:root {
  --bg: #101614;
  --bg-raise: rgba(255, 255, 255, 0.035);
  --bg-inset: #0c1210;
  --line: rgba(243, 238, 228, 0.12);
  --line-strong: rgba(243, 238, 228, 0.22);
  --text: #f4efe6;
  --muted: #c9c2b4;
  --faint: #9a9386;
  --brass: #e0b15d;
  --brass-2: #f0d7a2;
  --ink: #1b1408;
  --teal: #8fd0b8;
  --blue: #9ec4e0;
  --lilac: #d5c6ef;
  --coral: #f0b2a2;
  --good: #8ed0a4;
  --bad: #f0a394;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
  --sans: "Outfit", "DengXian", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --serif: "Fraunces", "Palatino Linotype", "Songti SC", serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(880px 420px at -8% -20%, rgba(224, 177, 93, 0.16), transparent 55%),
    radial-gradient(760px 460px at 110% -12%, rgba(143, 208, 184, 0.1), transparent 48%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

::selection { background: rgba(224, 177, 93, 0.32); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 22, 20, 0.8);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand svg { width: 36px; height: 36px; color: var(--brass); flex: none; }

.brand strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand small {
  display: block;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.top-side { display: flex; gap: 8px; align-items: center; }

.chip {
  border: 1px solid rgba(224, 177, 93, 0.4);
  color: var(--brass-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.chip.ghost {
  border-color: var(--line-strong);
  color: var(--muted);
}

.shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

.nav {
  width: 232px;
  flex: none;
  padding: 14px 12px 24px;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.nav-label {
  margin: 14px 10px 6px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.nav-item {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
}

.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; display: block; }

.nav-item span { display: block; min-width: 0; }

.nav-item .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.nav-item .sit {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.04); }

.nav-item.active {
  background: rgba(224, 177, 93, 0.12);
  color: var(--brass-2);
}

.nav-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  flex: none;
}

.nav-item.seen .dot { background: var(--teal); box-shadow: none; }

.stage {
  flex: 1;
  overflow: auto;
  padding: 28px 28px 64px;
  scroll-behavior: smooth;
}

.stage-inner { max-width: 1080px; margin: 0 auto; }

.stage::-webkit-scrollbar { width: 10px; }
.stage::-webkit-scrollbar-thumb { background: #2a3832; border-radius: 99px; }

.kicker {
  margin: 0 0 8px;
  color: var(--brass);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }

.lead { margin: 12px 0 0; color: var(--muted); max-width: 68ch; }

.view-head { margin-bottom: 22px; position: relative; }

.watermark {
  position: absolute;
  right: 0;
  top: -18px;
  margin: 0;
  font-family: var(--serif);
  font-size: 92px;
  line-height: 1;
  color: rgba(224, 177, 93, 0.07);
  pointer-events: none;
  user-select: none;
}

.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }

.topics li, .mini-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.sit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.sit {
  --accent: var(--brass);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 196px;
  text-align: left;
  padding: 18px 16px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 2px 0 var(--accent);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.sit:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.sit-kicker { color: var(--accent); font-size: 12px; letter-spacing: 0.12em; font-weight: 600; }
.sit-title { font-size: 20px; font-weight: 600; line-height: 1.35; }
.sit-text { color: var(--muted); font-size: 14px; }
.sit-go { margin-top: auto; color: var(--brass-2); font-size: 13px; letter-spacing: 0.08em; }

.panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-raise);
}

.panel.split {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 18px;
  align-items: center;
}

.banner {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(143, 208, 184, 0.1);
  border: 1px solid rgba(143, 208, 184, 0.28);
  color: #dff6ec;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  background: transparent;
}

.btn.primary { background: var(--brass); color: var(--ink); }
.btn.primary:hover { background: #ebc278; }
.btn.ghost { border: 1px solid var(--line-strong); color: var(--text); background: transparent; }
.btn.ghost:hover { border-color: var(--brass); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 13px; font-weight: 500; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.tabs button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
}

.tabs button[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.feedback.ok { border-color: rgba(142, 208, 164, 0.45); background: rgba(142, 208, 164, 0.1); color: #e5f8ec; }
.feedback.bad { border-color: rgba(240, 163, 148, 0.5); background: rgba(240, 163, 148, 0.1); color: #ffe4de; }
.feedback.note { border-color: rgba(224, 177, 93, 0.4); background: rgba(224, 177, 93, 0.08); color: #f8ecd4; }
.feedback p { margin: 0; }
.feedback p + p { margin-top: 8px; }

.field, .slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.field span, .slider span, .label {
  color: var(--muted);
  font-size: 13px;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  max-width: 280px;
  background: var(--bg-inset);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--mono);
}

input.bad-input, select.bad-input { border-color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brass) var(--p, 40%), #2a3832 var(--p, 40%));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brass);
  border: 2px solid #1b1408;
  box-shadow: 0 0 0 4px rgba(224, 177, 93, 0.16);
}

.forces { display: flex; flex-wrap: wrap; gap: 8px; }

.force {
  border: 1px solid var(--line-strong);
  background: var(--bg-inset);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
}

.force[aria-pressed="true"] {
  color: var(--ink);
  background: var(--accent, var(--brass));
  border-color: transparent;
}

.diagram {
  width: 100%;
  height: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 30%),
    var(--bg-inset);
  border-radius: 16px;
  border: 1px solid var(--line);
}

.plots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.plot-card { padding: 8px 8px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-inset); }
.plot-card p { margin: 4px 6px 8px; color: var(--faint); font-size: 12px; }
.plot-card svg { width: 100%; height: auto; display: block; }

.pair-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

.pair-col {
  min-height: 180px;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: rgba(0, 0, 0, 0.12);
}

.pair-col h3 { display: flex; justify-content: space-between; }

.card {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1a2420;
  border: 1px solid var(--line);
}

.card p { margin: 0 0 8px; }

.pool { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.phases { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.phases button {
  flex: 1;
  min-width: 140px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 10px 12px;
  color: var(--muted);
}

.phases button strong { display: block; color: var(--text); font-size: 14px; }
.phases button small { color: var(--faint); }
.phases button[aria-current="step"] { border-color: var(--brass); background: rgba(224, 177, 93, 0.08); }
.phases button:disabled { opacity: 0.45; cursor: not-allowed; }

.reveal { margin: 0; padding: 0; list-style: none; }

.reveal li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.reveal .idx {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--brass);
}

.blank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.16);
  padding: 12px 14px;
  margin-top: 8px;
}

.choice:hover:not(:disabled) { border-color: var(--brass); }
.choice.is-good { border-color: var(--good); background: rgba(142, 208, 164, 0.12); }
.choice.is-bad { border-color: var(--bad); background: rgba(240, 163, 148, 0.08); }
.choice b { font-family: var(--mono); font-weight: 560; margin-right: 8px; color: var(--brass-2); }

.q-progress { display: flex; gap: 6px; margin: 8px 0 12px; }
.q-progress i {
  width: 28px;
  height: 4px;
  border-radius: 99px;
  background: #2a3832;
  display: block;
}
.q-progress i.on { background: var(--brass); }
.q-progress i.done { background: var(--teal); }

.hint-stack { display: flex; flex-direction: column; gap: 8px; }

.slip {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #17211c;
}

.slip .tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--brass);
  margin-bottom: 4px;
}

.slip.locked { color: var(--faint); border-style: dashed; background: transparent; }

.guide {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.rail { list-style: none; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0, 0, 0, 0.15); }

.rail button {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--faint);
  border-radius: 10px;
  padding: 7px;
}

.rail button.current { background: rgba(224, 177, 93, 0.12); color: var(--text); }
.rail button.done { color: var(--good); }
.rail button:disabled { cursor: default; }

.rail .n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 12px;
  flex: none;
}

.problem {
  padding: 14px 16px;
  border-left: 3px solid var(--brass);
  background: rgba(224, 177, 93, 0.06);
  border-radius: 0 14px 14px 0;
  margin-bottom: 12px;
}

.problem p { margin: 0; }

.read-list { display: flex; flex-direction: column; gap: 8px; }

.read-item {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.read-item select { max-width: none; }

.ticks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ticks label, .radios label { display: flex; gap: 8px; align-items: flex-start; }

.tool-layout { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: 14px; }

.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.readout div, .big-read {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}

.readout .num, .big-read .num {
  display: block;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.1;
  color: var(--brass-2);
}

.readout .num small, .unit { font-family: var(--sans); font-size: 12px; color: var(--faint); margin-left: 4px; }

.hidden-num { color: var(--faint) !important; }

.scores { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.score { display: grid; grid-template-columns: 52px 1fr 28px; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: #24302b; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brass); border-radius: inherit; }

.switch { margin-top: 22px; padding-top: 8px; color: var(--faint); font-size: 14px; }
.fine { color: var(--faint); font-size: 13px; }
.mono { font-family: var(--mono); }

.done-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(142, 208, 164, 0.15);
  color: var(--good);
  font-family: var(--serif);
  font-size: 28px;
}

.chain { margin: 8px 0 0; padding-left: 18px; }
.chain li { margin: 6px 0; }

.noscript {
  position: fixed;
  inset: auto 16px 16px 16px;
  padding: 12px 14px;
  background: #3a2420;
  border-radius: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 980px) {
  .sit-grid, .plots, .tool-layout, .panel.split, .guide, .pair-board { grid-template-columns: 1fr; }
  .blank-grid, .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 30px; }
  .watermark { font-size: 64px; }
}

@media (max-width: 800px) {
  .watermark { display: none; }
  .brand small { display: none; }
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .shell { flex-direction: column; }
  .nav {
    width: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .nav-label { display: none; }
  .nav-item { width: auto; min-width: 0; flex: 0 0 auto; padding: 8px 10px; }
  .nav-item .sit { display: none; }
  .stage { overflow: visible; padding: 18px 14px 48px; }
  .top { padding: 12px 14px; }
  .read-item, .grid-2, .blank-grid, .grid-4, .grid-3, .pool { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
