:root {
  --bg-color: #0d1117;
  --panel-bg: #161b22;
  --text-main: #c9d1d9;
  --accent-green: #2ea043;
  --accent-cyan: #58a6ff;
  --mono-font: "Fira Code", "Consolas", monospace;
}
body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: "Noto Sans TC", sans-serif;
  margin: 0;
  display: flex;
  height: 100vh;
}
.container {
  display: flex;
  width: 100%;
  padding: 20px;
  gap: 20px;
}

a {
  color: var(--text-main);
}
.input-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}
h1 {
  font-family: var(--mono-font);
  font-size: 1.2rem;
  color: var(--accent-cyan);
  border-bottom: 1px solid #30363d;
  padding-bottom: 10px;
}
.editor {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 20px;
  font-size: 1.2rem;
  outline: none;
}
.editor:focus {
  border-color: var(--accent-cyan);
}

.candidate-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--accent-green);
  background: rgba(46, 160, 67, 0.1);
  border-radius: 4px;
  display: inline-block;
  min-height: 4em;
}
.bopomofo {
  color: var(--accent-green);
  font-family: var(--mono-font);
  margin-bottom: 5px;
  font-size: 0.9rem;
}
.preedit {
  display: flex;
  flex-wrap: wrap;
  position: relative;
  .interval {
    display: flex;
    flex-direction: column;
    position: relative;
    .underline {
      border-bottom: var(--accent-green) solid 2px;
      width: calc(100% - 0.2em);
    }
  }
}
.cursor-box {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: row;
  .cursor-pad {
    visibility: hidden;
  }
  .cursor-anchor {
    position: relative;
    .cursor {
      background: var(--accent-green);
      position: absolute;
      bottom: 0.1em;
      z-index: -1;
      width: 1em;
      height: 0.5em;
    }
  }
}
.candidates>span {
  margin-right: 15px;
}
.candidates span.active {
  background: var(--accent-green);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
}
.num {
  color: var(--accent-cyan);
  margin-right: 0.5em;
}

.keyboard-area {
  margin-top: 10px;
  padding: 10px;
  display: inline-block;
  min-height: 4em;
}
.keyboard {
  display: flex;
  flex-direction: column;
  .kb-row {
    display: flex;
    flex-direction: row;
  }
  .key {
    border: 1px solid var(--accent-green);
    border-radius: 4px;
    padding: 10px;
    margin: 0.05em;
    flex: 1;
    display: flex;
    flex-direction: column;
    &.keydown {
      background: rgba(46, 160, 67, 0.7);
    }
    &.sp1 {
    }
    &.sp1h {
      flex: 2;
    }
    &.sp2 {
      flex: 3;
    }
    &.sp4 {
      flex: 5;
    }
    &.sp10 {
      flex: 10;
    }
    .print-right {
      align-self: end;
    }
  }
}

.state-section {
  width: 600px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-family: var(--mono-font);
}
.state-panel {
  background: var(--panel-bg);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 15px;
  font-size: 0.85rem;
}
.panel-title {
  color: #8b949e;
  margin-bottom: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.data-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.data-key {
  color: var(--accent-cyan);
}
