/* 水循环三维沙盘 · 纸面地理课件风格 */
@font-face { font-family: "Mono"; src: url("fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #f6f1e6;
  --paper-2: #fbf7ee;
  --card: #fffdf8;
  --line: #e3d9c6;
  --line-strong: #cfc2a8;
  --ink: #2c2a25;
  --ink-2: #5c574c;
  --faint: #9a917f;
  --accent: #c96a2e;
  --water: #2f7fb8;
  --teal: #2fa39b;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Mono", ui-monospace, monospace;
  --rail: 236px;
  --panel: 384px;
  --shadow: 0 12px 30px -22px rgba(80, 62, 34, .55), 0 2px 6px rgba(80, 62, 34, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 14px; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.top {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
}
.top__brand { display: flex; align-items: center; gap: 12px; }
.top__mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; background: var(--water); color: #fff; font-size: 18px;
}
.top__name { font-family: var(--serif); font-size: 19px; letter-spacing: .02em; }
.top__name em { font-family: var(--mono); font-style: normal; font-size: 12px; letter-spacing: .18em; color: var(--accent); margin-right: 8px; }
.top__sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.top__right { display: flex; align-items: center; gap: 10px; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--card); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 三栏 ---------- */
.shell { position: fixed; inset: 62px 0 0 0; display: grid; grid-template-columns: var(--rail) minmax(0,1fr) var(--panel); }

.rail { border-right: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; overflow: auto; }
.rail__head { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--faint); padding: 16px 18px 10px; }
.rail ol { list-style: none; margin: 0; padding: 0 10px; }
.rail li button {
  width: 100%; text-align: left; display: flex; gap: 10px; align-items: flex-start;
  border: 0; background: none; padding: 11px 10px; border-radius: 9px; border-left: 3px solid transparent;
}
.rail li button:hover { background: rgba(201,106,46,.06); }
.rail li button.is-on { background: var(--card); border-left-color: var(--accent); box-shadow: var(--shadow); }
.rail__no { font-family: var(--mono); font-size: 11px; color: var(--faint); padding-top: 2px; }
.rail li button.is-on .rail__no { color: var(--accent); }
.rail__cn { font-family: var(--serif); font-size: 14.5px; line-height: 1.3; }
.rail__en { font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.rail__foot { margin-top: auto; padding: 14px 18px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); }
.rail__foot b { color: var(--ink-2); font-weight: 500; }

/* ---------- 舞台 ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px 12px; }
.stage__tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.stage__tabs button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 7px 16px; font-size: 13px; color: var(--ink-2);
}
.stage__tabs button.is-on { background: var(--water); border-color: var(--water); color: #fff; }
.stage__card {
  position: relative; flex: 1; min-height: 0; border: 1px solid var(--line);
  border-radius: 16px; background:
    linear-gradient(rgba(207,194,168,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(207,194,168,.14) 1px, transparent 1px),
    var(--card);
  background-size: 26px 26px, 26px 26px, auto;
  box-shadow: var(--shadow); overflow: hidden;
}
.stage__card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__hint { position: absolute; left: 14px; top: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint); }
.stage__tools { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 8px; }
.chipbtn { border: 1px solid var(--line-strong); background: rgba(255,253,248,.92); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--ink-2); }
.chipbtn.is-on { border-color: var(--teal); color: var(--teal); }
.chipbtn kbd { font-family: var(--mono); font-size: 9.5px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; margin-left: 5px; color: var(--faint); }

/* 标注 */
.labels { position: absolute; inset: 0; pointer-events: none; }
.lab { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; }
.lab__dot { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(201,106,46,.18); }
.lab-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.lab-line { stroke: #8a8272; stroke-width: 1; opacity: .7; }
.lab__txt {
  position: absolute; left: 0; top: 0; margin: -11px 0 0 -0px; padding: 3px 9px; border-radius: 6px;
  background: rgba(255,253,248,.94); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink); box-shadow: var(--shadow);
}
.lab__txt b { color: var(--accent); font-weight: 600; margin-right: 3px; }
.lab.is-dim { opacity: .28; }

/* 时间条 */
.timebar { display: flex; align-items: center; gap: 14px; padding: 10px 4px 0; }
.timebar__day { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.timebar__day b { color: var(--accent); font-size: 14px; }
.timebar__season { font-size: 12px; color: var(--faint); }
.speeds { display: flex; gap: 4px; }
.speeds button { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 4px 10px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.speeds button.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.timebar__note { margin-left: auto; font-size: 11.5px; color: var(--faint); max-width: 46%; text-align: right; }

/* ---------- 右栏 ---------- */
.panel { border-left: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; min-height: 0; }
.panel__head { display: flex; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.panel__no { font-family: var(--mono); font-size: 22px; color: var(--accent); line-height: 1; }
.panel__head h2 { margin: 0; font-family: var(--serif); font-size: 20px; }
.panel__en { font-size: 11px; color: var(--faint); margin-top: 3px; }
.panel__body { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.panel__body p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }

.goals { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 10px 12px; margin: 4px 0 16px; }
.goals__t { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--faint); margin-bottom: 7px; }
.goal { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); padding: 4px 0; }
.goal__box { width: 15px; height: 15px; border: 1.5px solid var(--line-strong); border-radius: 4px; flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; font-size: 10px; color: transparent; }
.goal.is-done .goal__box { background: var(--teal); border-color: var(--teal); color: #fff; }
.goal.is-done { color: var(--faint); }

.steps__title { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--faint); margin: 6px 0 8px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.steps button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.steps button.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-play { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; padding: 7px 14px; font-size: 12.5px; margin-bottom: 16px; }
.btn-play.is-stop { background: var(--ink); border-color: var(--ink); }

.tablebox { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.tablebox__t { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--faint); padding: 9px 12px; border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 6px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--faint); font-weight: 400; }
td:last-child, th:last-child { text-align: right; font-family: var(--mono); }
tr:last-child td { border-bottom: 0; }
td.num { color: var(--water); }
.bar { height: 5px; border-radius: 3px; background: var(--water); display: inline-block; vertical-align: middle; }
.note { font-size: 11px; color: var(--faint); padding: 8px 12px; line-height: 1.6; }

@media (max-width: 1180px) { :root { --rail: 190px; --panel: 320px; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .rail { display: none; }
  .panel { border-left: 0; border-top: 1px solid var(--line); max-height: 42vh; }
}