:root {
  color-scheme: light;
  --bg: #f5f2eb;
  --ink: #171717;
  --muted: #746f66;
  --line: #ded8cc;
  --panel: #fffaf1;
  --panel-strong: #ffffff;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #ffead5;
  --correct: #15803d;
  --correct-soft: #dcfce7;
  --wrong: #b42318;
  --wrong-soft: #fde4df;
  --mark: #8b5a00;
  --mark-soft: #ffe7b8;
  --shadow: 0 18px 50px rgba(33, 29, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  border-radius: 7px;
  cursor: pointer;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover {
  border-color: #bdb5a6;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  border: 1px solid #cfc6b8;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  background: #f7f1e7;
  color: #3f3a32;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

button:hover kbd {
  border-color: #aca292;
}

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  border-right: 1px solid var(--line);
  padding: 24px;
  background: #ece6da;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f97316, var(--accent-strong));
  color: white;
  font-weight: 800;
}

.brand strong {
  font-size: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-grid div,
.progress-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 250, 241, 0.75);
}

.metric-grid span,
.progress-head span,
.question-meta,
.answer-panel span {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.progress-block {
  margin-top: 14px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar {
  position: relative;
  height: 10px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(12.5% - 2px),
      rgba(255, 250, 241, 0.75) calc(12.5% - 2px),
      rgba(255, 250, 241, 0.75) 12.5%
    ),
    #d8d0c2;
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.mode-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.mode-list button {
  justify-content: flex-start;
  text-align: left;
  padding: 0 12px;
}

.mode-list button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #7c2d12;
  font-weight: 700;
}

.search-box {
  margin-top: 16px;
}

.search-box input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel-strong);
}

.data-actions {
  margin-top: 12px;
}

.data-actions button {
  width: 100%;
  justify-content: center;
  padding: 0 12px;
  color: #5a3400;
  background: #fff7ed;
  border-color: #d8c7ad;
  font-weight: 700;
}

.data-actions button:hover {
  border-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: 28px;
}

.topbar,
.answer-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 20px;
}

.topbar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.topbar strong {
  font-size: 22px;
}

.top-actions,
.answer-actions {
  display: flex;
  gap: 8px;
}

.top-actions button,
.answer-actions button {
  padding: 0 14px;
}

.question-panel {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.question-meta span {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--panel-strong);
}

h1 {
  margin: 0;
  max-width: 980px;
  font-size: 25px;
  font-weight: 650;
  line-height: 1.62;
  letter-spacing: 0;
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  background: var(--panel-strong);
}

.option span {
  align-self: center;
  font-size: 18px;
  font-weight: 520;
  line-height: 1.45;
}

.option kbd {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: #eee7da;
  font-size: 14px;
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option.correct {
  border-color: var(--correct);
  background: var(--correct-soft);
}

.option.correct kbd {
  border-color: rgba(21, 128, 61, 0.35);
  background: #bbf7d0;
  color: #14532d;
}

.option.wrong {
  border-color: var(--wrong);
  background: var(--wrong-soft);
}

.option.wrong kbd {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fecaca;
  color: #7f1d1d;
}

.answer-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 250, 241, 0.9);
}

.answer-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

#submitBtn {
  border-color: var(--accent);
  background: var(--accent-strong);
  color: white;
  font-weight: 800;
}

#submitBtn span {
  color: white;
  font-size: 15px;
}

#submitBtn kbd {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.is-marked #markBtn,
.is-uncertain #unsureBtn,
.is-auto-next #autoNextBtn {
  border-color: var(--mark);
  background: var(--mark-soft);
  color: #5a3400;
  font-weight: 700;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .answer-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .answer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .answer-actions {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 20px;
  }
}
