/* =========================================================
 * 谐波画笔 · 样式 styles.css
 * ========================================================= */
:root {
  --bg: #040a15;
  --bg2: #071226;
  --stage-bg: #02060d;
  --panel: rgba(11, 24, 45, 0.66);
  --panel2: rgba(7, 16, 31, 0.92);
  --card: linear-gradient(165deg, rgba(14, 30, 55, 0.85), rgba(6, 14, 28, 0.7));
  --line: rgba(110, 180, 255, 0.14);
  --line2: rgba(110, 180, 255, 0.28);
  --text: #dfeeff;
  --muted: #93afcc;
  --dim: #6180a0;
  --accent: #54e6ff;
  --accent2: #ff5ed2;
  --gold: #ffd166;
  --ok: #5effb0;
  --warn: #ffb454;
  --danger: #ff6b7a;
  --modal-bg: linear-gradient(170deg, #0c1a2e, #060e1c);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --radius: 18px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Cascadia Mono", monospace;
}

[data-theme="neon"] {
  --bg: #080312;
  --bg2: #170a2b;
  --stage-bg: #060210;
  --panel: rgba(28, 10, 44, 0.66);
  --panel2: rgba(17, 6, 30, 0.92);
  --card: linear-gradient(165deg, rgba(40, 14, 60, 0.85), rgba(12, 4, 24, 0.75));
  --line: rgba(255, 120, 220, 0.16);
  --line2: rgba(255, 120, 220, 0.3);
  --text: #ffe9fb;
  --muted: #c39bc2;
  --dim: #8b6a91;
  --accent: #ff6ad5;
  --accent2: #7de9ff;
  --modal-bg: linear-gradient(170deg, #1e0a32, #0b0318);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="paper"] {
  --bg: #f5efe2;
  --bg2: #ece3d1;
  --stage-bg: #efe7d6;
  --panel: rgba(255, 252, 245, 0.72);
  --panel2: rgba(250, 245, 234, 0.94);
  --card: linear-gradient(165deg, rgba(255, 253, 247, 0.95), rgba(240, 232, 217, 0.85));
  --line: rgba(78, 60, 40, 0.14);
  --line2: rgba(78, 60, 40, 0.26);
  --text: #2b2620;
  --muted: #6d6152;
  --dim: #988a77;
  --accent: #b23a48;
  --accent2: #2d6a7a;
  --gold: #b8860b;
  --ok: #2f7a4f;
  --warn: #b06a12;
  --danger: #b23a48;
  --modal-bg: linear-gradient(170deg, #fffdf7, #f0e8d9);
  --shadow: 0 24px 60px rgba(90, 70, 40, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 700px at 18% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 65%),
    radial-gradient(900px 600px at 90% 10%, color-mix(in srgb, var(--accent2) 8%, transparent), transparent 60%),
    radial-gradient(1200px 800px at 50% 110%, var(--bg2), transparent 70%),
    var(--bg);
  pointer-events: none;
}
[data-theme="paper"] body::before {
  background:
    radial-gradient(900px 600px at 20% 0%, rgba(178, 58, 72, 0.06), transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(45, 106, 122, 0.05), transparent 60%),
    var(--bg);
}
button { font-family: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.s { color: var(--gold); }

/* ---------------- 启动画面 ---------------- */
.boot-splash { position: fixed; inset: 0; display: grid; place-items: center; background: #040a15; z-index: 50; color: #dfeeff; font-family: var(--font); }
.boot-inner { text-align: center; }
.boot-orbit { width: 96px; height: 96px; margin: 0 auto 18px; position: relative; }
.boot-orbit i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(84, 230, 255, .25); }
.boot-orbit i:nth-child(2) { inset: 14px; border-color: rgba(84, 230, 255, .45); animation: spin 2.6s linear infinite; border-top-color: #54e6ff; }
.boot-orbit i:nth-child(3) { inset: 30px; border-color: rgba(255, 94, 210, .5); animation: spin 1.8s linear infinite reverse; border-bottom-color: #ff5ed2; }
.boot-orbit b { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #ffd166; box-shadow: 0 0 18px #ffd166; }
.boot-title { font-size: 20px; letter-spacing: .18em; font-weight: 800; }
.boot-sub { margin-top: 6px; font-size: 11px; color: #6f8cab; letter-spacing: .12em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 基础控件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line2);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s, box-shadow .16s, background .16s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #041018;
  border: none;
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 30%, transparent);
}
[data-theme="paper"] .btn.primary { color: #fffaf0; background: linear-gradient(135deg, #b23a48, #8a4a2c); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: transparent; }
.btn.lg { padding: 14px 28px; font-size: 16px; }
.btn.small { padding: 8px 14px; font-size: 12px; }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }

.icon-btn {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  font-size: 15px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: .16s;
  padding: 0;
}
.icon-btn:hover { border-color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 24%, transparent); }
.icon-btn.active { background: var(--accent); color: #041018; }

.text-btn { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 8px 6px; }
.text-btn:hover { color: var(--accent); }

.chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.chip.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800; letter-spacing: .08em; color: var(--text); }
.logo-mark { color: var(--accent); display: inline-flex; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.topbar-space { flex: 1; }
.star-total { display: flex; align-items: center; gap: 4px; font: 700 13px var(--mono); color: var(--muted); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.star-total .s { font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 4px; }

/* ---------------- 页面容器 ---------------- */
#screen { min-height: 100vh; }
.screen { max-width: 1240px; margin: 0 auto; padding: 0 28px 80px; }
.eyebrow { font-size: 10px; letter-spacing: .22em; color: var(--dim); font-weight: 700; }
.muted { color: var(--dim); }

/* ---------------- 首页 ---------------- */
.hero {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 30px;
  align-items: center;
  padding: 26px 0 36px;
}
.hero-title {
  font-size: clamp(46px, 6.6vw, 82px);
  line-height: 1.02;
  margin: 12px 0 14px;
  letter-spacing: .04em;
  font-weight: 800;
}
.hero-title span {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-tagline { font-size: clamp(16px, 2vw, 21px); color: var(--text); margin: 0 0 8px; font-weight: 600; line-height: 1.5; }
.hero-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; align-items: center; gap: 14px; margin-top: 24px; color: var(--dim); font-size: 12px; flex-wrap: wrap; }
.hero-stats b { color: var(--text); font-size: 14px; }
.hero-stats i { width: 1px; height: 12px; background: var(--line); }
.hero-art {
  position: relative;
  width: 100%;
  max-width: 470px;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 66%);
}
.hero-canvas { width: 100%; height: 100%; display: block; }
.hero-caption { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; font: 10px var(--mono); color: var(--dim); }
.hero-caption span { padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: .2s ease;
}
.mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 10% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  opacity: 0;
  transition: .25s;
  pointer-events: none;
}
.mode-card:hover { transform: translateY(-2px); border-color: var(--line2); box-shadow: 0 18px 42px rgba(0, 0, 0, .35); }
.mode-card:hover::after { opacity: 1; }
.mode-card.campaign { grid-column: span 2; }
.mode-card.disabled { opacity: .55; cursor: not-allowed; }
.mode-card.disabled:hover { transform: none; }
.mode-icon {
  width: 50px; height: 50px; flex: 0 0 50px;
  border-radius: 15px;
  display: grid; place-items: center;
  font-size: 24px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid var(--line);
}
.mode-body { min-width: 0; flex: 1; }
.mode-kicker { font: 700 9px var(--mono); letter-spacing: .2em; color: var(--dim); }
.mode-card h3 { margin: 3px 0 4px; font-size: 17px; letter-spacing: .02em; }
.mode-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.mode-bar { height: 4px; border-radius: 2px; background: rgba(128, 160, 200, .14); margin: 12px 0 7px; max-width: 340px; overflow: hidden; }
.mode-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.mode-foot { display: flex; gap: 14px; font-size: 11px; color: var(--dim); }
.mode-arrow { margin-left: auto; color: var(--accent); font-size: 20px; opacity: .55; }
.tag { color: var(--accent2); }
.home-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }

/* ---------------- 地图 ---------------- */
.map-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 22px 0 26px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.map-hero h1 { font-size: clamp(30px, 4vw, 42px); margin: 6px 0 8px; letter-spacing: .04em; }
.map-hero p { margin: 0; color: var(--muted); max-width: 560px; }
.map-progress { width: 300px; max-width: 100%; }
.big-star { font: 800 32px var(--mono); display: flex; align-items: baseline; gap: 6px; }
.big-star .s { font-size: 26px; margin-right: 2px; }
.big-star em { font-style: normal; font-size: 13px; color: var(--dim); font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: rgba(128, 160, 200, .14); margin: 10px 0 7px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.sub { font-size: 11px; color: var(--dim); }

.chapter {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 22px 16px;
  background: var(--card);
  position: relative;
  overflow: hidden;
}
.chapter::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(var(--ch), transparent);
  opacity: .85;
}
.chapter.locked { opacity: .55; }
.chapter-head { display: flex; align-items: center; gap: 16px; }
.chapter-no { font: 800 30px var(--mono); color: var(--ch); opacity: .75; letter-spacing: -.02em; }
.chapter-titles h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.chapter-titles p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.cleared-tag { font: 700 9px var(--mono); letter-spacing: .12em; color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); border-radius: 999px; padding: 2px 8px; }
.chapter-stars { margin-left: auto; color: var(--gold); font: 700 13px var(--mono); }
.chapter-lock { font-size: 10px; color: var(--dim); border: 1px dashed var(--line2); padding: 3px 9px; border-radius: 999px; }
.chapter-desc { margin: 14px 0 0; font-size: 11.5px; color: var(--dim); }
.level-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.level-node {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .12);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: .17s;
  min-width: 0;
}
[data-theme="paper"] .level-node { background: rgba(255, 255, 255, .4); }
.level-node:hover { border-color: var(--ch); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .25); }
.level-node.locked { opacity: .42; cursor: not-allowed; transform: none; }
.level-node.boss { border-color: color-mix(in srgb, var(--gold) 32%, transparent); }
.node-thumb { position: relative; width: 62px; height: 62px; flex: 0 0 62px; border-radius: 12px; background: rgba(0, 0, 0, .18); display: grid; place-items: center; overflow: hidden; }
.node-canvas { width: 100%; height: 100%; }
.boss-badge { position: absolute; top: 0; right: 0; background: var(--gold); color: #241a00; font: 800 8px var(--mono); padding: 2px 5px; border-bottom-left-radius: 6px; }
.lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; font-size: 20px; }
.node-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.node-id { font: 700 9px var(--mono); color: var(--dim); letter-spacing: .06em; }
.node-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-best { font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 星级 */
.stars { display: inline-flex; gap: 2px; font-size: 17px; line-height: 1; color: rgba(150, 170, 190, .22); }
.stars.small { font-size: 12px; }
.stars .star.on { color: var(--gold); text-shadow: 0 0 12px color-mix(in srgb, var(--gold) 55%, transparent); }

/* ---------------- 游戏界面 ---------------- */
body[data-screen="play"] { overflow: hidden; }
body[data-screen="play"] #screen { height: 100vh; }
.play { position: fixed; inset: 0; z-index: 1; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.play-head {
  width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel2);
  flex: 0 0 auto;
  flex-wrap: wrap;
  z-index: 4;
}
.play-id { min-width: 170px; }
.chapter-tag { font: 700 10px var(--mono); letter-spacing: .14em; color: var(--accent); text-transform: uppercase; }
.play-name { font-size: 19px; margin: 2px 0; letter-spacing: .01em; }
.play-teach { margin: 0; font-size: 11px; color: var(--dim); }
.target-chip { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0, 0, 0, .16); }
[data-theme="paper"] .target-chip { background: rgba(255, 255, 255, .4); }
.target-cv { width: 48px; height: 48px; border-radius: 9px; background: rgba(0, 0, 0, .16); }
.target-meta { display: flex; flex-direction: column; font-size: 9px; color: var(--dim); }
.target-meta b { font-size: 12.5px; color: var(--text); font-weight: 600; }
.score-box { display: flex; flex-direction: column; gap: 6px; min-width: 168px; }
.err-row { display: flex; align-items: center; gap: 8px; }
.err-bar { width: 108px; height: 6px; border-radius: 3px; background: rgba(128, 160, 200, .16); overflow: hidden; }
.err-bar i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .18s ease, background .2s; }
.err-bar i[data-level="3"] { background: var(--ok); }
.err-bar i[data-level="2"] { background: var(--gold); }
.err-bar i[data-level="1"] { background: var(--warn); }
.pct { font: 700 12px var(--mono); color: var(--muted); }
.pct[data-level="3"] { color: var(--ok); }
.pct[data-level="2"] { color: var(--gold); }
.pct[data-level="1"] { color: var(--warn); }
.pct[data-level="0"] { color: var(--danger); }
.clock { font-size: 10px; color: var(--dim); white-space: nowrap; }
.clock b { font-family: var(--mono); color: var(--muted); font-weight: 600; }
.timer { display: flex; align-items: center; gap: 5px; font: 700 14px var(--mono); color: var(--gold); padding: 4px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.timer-icon { font-size: 11px; }
.timer.urgent { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); animation: pulse 1.1s infinite; }

.play-body { flex: 1; min-height: 0; min-width: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.stage-wrap { position: relative; min-height: 0; min-width: 0; overflow: hidden; background: var(--stage-bg); }
.stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.play.panning .stage { cursor: grabbing; }
.stage-hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  padding: 7px 15px; border-radius: 999px;
  background: rgba(4, 10, 20, .72); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px;
  opacity: 0; transition: opacity .25s; pointer-events: none;
  white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
  backdrop-filter: blur(8px);
}
[data-theme="paper"] .stage-hint { background: rgba(255, 252, 245, .86); }
.stage-hint.show { opacity: 1; }
.view-ctrl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.view-ctrl .icon-btn { width: 30px; height: 30px; font-size: 13px; background: rgba(4, 10, 20, .62); }
[data-theme="paper"] .view-ctrl .icon-btn { background: rgba(255, 252, 245, .86); }

.side-panel {
  display: flex; flex-direction: column; gap: 7px;
  min-height: 0;
  min-width: 0;
  padding: 12px 14px 10px;
  border-left: 1px solid var(--line);
  background: var(--panel2);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.panel-head .count { font: 700 11px var(--mono); color: var(--accent); }
.panel-head .count.over { color: var(--danger); }
.spectrum { width: 100%; max-width: 100%; height: 118px; display: block; }
.harm-head { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); border-top: 1px solid var(--line); padding-top: 7px; }
.harm-head em { font-style: normal; }
.harm-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-right: 3px; scrollbar-width: thin; }
.harm-list::-webkit-scrollbar { width: 4px; }
.harm-list::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 2px; }
.harm-row { display: grid; grid-template-columns: 32px 1fr 30px 28px; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; cursor: pointer; font-size: 11px; }
.harm-row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.harm-row.hl { background: color-mix(in srgb, var(--accent2) 13%, transparent); }
.harm-row:not(.on) { opacity: .45; }
.hk { font: 600 10.5px var(--mono); color: var(--muted); }
.harm-row.on .hk { color: var(--accent); }
.hbar { height: 4px; border-radius: 2px; background: rgba(128, 160, 200, .14); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.harm-row:not(.on) .hbar i { background: var(--dim); }
.hmag { font: 9.5px var(--mono); color: var(--dim); text-align: right; }
.switch { width: 26px; height: 15px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; padding: 0; position: relative; cursor: pointer; }
.switch span { position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); transition: .15s; }
.switch.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.switch.on span { left: 13px; background: var(--accent); }
.panel-tip { font-size: 9.5px; line-height: 1.55; color: var(--dim); }
.harm-empty { padding: 26px 8px; color: var(--dim); font-size: 11.5px; text-align: center; }

.play-foot {
  width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 18px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel2);
  flex: 0 0 auto; flex-wrap: wrap;
}
.slider-group { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); }
.slider-group input[type="range"] { width: 118px; accent-color: var(--accent); height: 18px; cursor: pointer; }
.kval { font: 700 11.5px var(--mono); color: var(--text); min-width: 32px; }
.foot-actions { display: flex; gap: 5px; margin-left: auto; }
.settle-btn { min-width: 104px; }

.play.sandbox .score-box, .play.sandbox .timer, .play.sandbox .clock { display: none; }

/* ---------------- 弹层 ---------------- */
.overlay { position: fixed; inset: 0; display: none; z-index: 100; }
.overlay.open { display: block; }
.scrim { position: absolute; inset: 0; background: rgba(2, 6, 14, .72); backdrop-filter: blur(7px); }
[data-theme="paper"] .scrim { background: rgba(60, 45, 28, .35); }
.modal-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 18px; overflow: auto; pointer-events: none; }
.modal { pointer-events: auto; }
.modal {
  width: min(580px, 100%);
  background: var(--modal-bg);
  border: 1px solid var(--line2);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  color: var(--text);
  transform: translateY(16px) scale(.98);
  opacity: 0;
  transition: transform .24s cubic-bezier(.2, .9, .3, 1.15), opacity .2s;
  position: relative;
  margin: auto;
}
.modal.in { transform: none; opacity: 1; }
.modal-kicker { font-size: 10px; letter-spacing: .18em; color: var(--dim); font-weight: 700; }
.modal h2 { margin: 6px 0 8px; font-size: 26px; letter-spacing: .02em; }
.modal p { color: var(--muted); line-height: 1.75; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
.modal .tips { color: var(--muted); font-size: 12.5px; line-height: 1.9; padding-left: 18px; margin: 10px 0; }
.intro-top { display: flex; gap: 18px; align-items: center; }
.intro-shape { width: 132px; height: 132px; flex: 0 0 132px; border-radius: 18px; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); }
[data-theme="paper"] .intro-shape { background: rgba(255, 255, 255, .4); }
.intro-meta h2 { margin: 4px 0; font-size: 25px; }
.intro-meta .chapter-tag { font-size: 10px; letter-spacing: .04em; }
.intro-teach { color: var(--accent); font-size: 12.5px; margin: 0 0 9px; }
.criteria { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--dim); }
.criteria b { color: var(--text); font-family: var(--mono); }
.intro-text { color: var(--muted); line-height: 1.8; font-size: 13.5px; margin: 18px 0 14px; }
.star-legend { display: grid; gap: 5px; font-size: 11.5px; color: var(--muted); }
.star-legend > div { display: flex; align-items: center; gap: 10px; }
.hint-line { display: flex; gap: 10px; margin-top: 16px; padding: 11px 13px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 6%, transparent); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.hint-icon { color: var(--accent); }

/* 结算 */
.result-card { text-align: center; overflow: hidden; }
.result-card.three { border-color: color-mix(in srgb, var(--gold) 40%, transparent); box-shadow: 0 0 70px color-mix(in srgb, var(--gold) 14%, transparent), var(--shadow); }
.result-kicker { font-size: 10px; letter-spacing: .2em; color: var(--dim); font-weight: 700; text-transform: uppercase; }
.result-stars { display: flex; justify-content: center; gap: 12px; margin: 14px 0 4px; }
.big-star { font-size: 46px; line-height: 1; color: rgba(150, 170, 190, .16); animation: pop .55s both; }
.big-star.on { color: var(--gold); text-shadow: 0 0 34px color-mix(in srgb, var(--gold) 62%, transparent); }
.result-card h2 { font-size: 30px; margin: 6px 0; }
.result-sub { color: var(--muted); font-size: 13px; }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0 16px; }
.result-grid > div { padding: 12px 6px; border-radius: 12px; background: rgba(128, 160, 200, .06); border: 1px solid var(--line); }
.result-grid span { display: block; font-size: 9.5px; color: var(--dim); margin-bottom: 4px; }
.result-grid b { font: 700 16px var(--mono); }
.grade.S { color: var(--gold); }
.grade.A { color: var(--ok); }
.grade.B { color: var(--accent); }
.grade.C { color: var(--muted); }
.result-teach { text-align: left; font-size: 12px; color: var(--muted); line-height: 1.75; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, transparent); border: 1px solid var(--line); }
.teach-icon { color: var(--accent); margin-right: 6px; }
.new-record { position: absolute; top: 18px; right: 18px; font: 700 9px var(--mono); letter-spacing: .16em; color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); padding: 4px 9px; border-radius: 999px; }
.unlock-line { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 11.5px; color: var(--gold); margin-top: 8px; }
.unlock-line.ach { color: var(--accent2); }
.unlock-icon { font-size: 12px; }

/* ---------------- 读谱师 ---------------- */
.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 22px; }
.reading-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 17px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; transition: .18s;
}
.reading-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.reading-no { font: 800 20px var(--mono); color: var(--dim); }
.reading-body { flex: 1; min-width: 0; }
.reading-body h3 { margin: 0; font-size: 15px; }
.reading-body p { margin: 2px 0 6px; font-size: 10.5px; color: var(--dim); }
.reading-mini { width: 100%; height: 62px; display: block; }
.reading-mark { margin-left: auto; color: var(--accent); font-size: 18px; }
.reading-card.done { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.reading-card.done .reading-mark { color: var(--ok); }
.puzzle-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-top: 18px; flex-wrap: wrap; }
.puzzle-head h1 { margin: 6px 0; font-size: clamp(26px, 3.6vw, 36px); }
.puzzle-head p { margin: 0; color: var(--muted); max-width: 620px; }
.puzzle-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10.5px; color: var(--dim); }
.puzzle-legend span { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.puzzle-legend b { color: var(--accent); font-family: var(--mono); }
.spectrum-board { margin: 20px 0 16px; padding: 16px 18px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); }
.big-spectrum { width: 100%; height: 180px; display: block; }
.board-axis { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--dim); padding: 2px 8px; }
.puzzle-q { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.candidate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.candidate {
  position: relative; padding: 10px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; transition: .18s;
}
.candidate:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 34px rgba(0, 0, 0, .3); }
.candidate-cv { width: 100%; aspect-ratio: 1; display: block; border-radius: 12px; background: rgba(0, 0, 0, .12); }
.candidate-letter { position: absolute; top: 14px; left: 18px; font: 800 13px var(--mono); color: var(--dim); }
.candidate-foot { font-size: 10.5px; color: var(--dim); text-align: center; padding-top: 8px; }
.candidate.correct { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 24%, transparent), 0 0 40px color-mix(in srgb, var(--ok) 12%, transparent); }
.candidate.correct .candidate-foot { color: var(--ok); }
.candidate.wrong { border-color: var(--danger); opacity: .45; }
.candidate.dim { opacity: .3; }
.candidate.shake { animation: shake .4s; }
.reading-explain { display: none; margin-top: 18px; padding: 14px 18px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.reading-explain.show { display: flex; align-items: center; gap: 12px; animation: fadeUp .35s both; }
.reading-explain p { margin: 0; color: var(--text); line-height: 1.75; font-size: 12.5px; flex: 1; }
.reading-explain .reading-next { flex: 0 0 auto; padding: 8px 16px; font-size: 12px; }
.explain-icon { color: var(--ok); font-size: 18px; }
.reading-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.reading-kicker { font: 600 9px var(--mono); letter-spacing: .12em; color: var(--accent); margin-bottom: 2px; }
.reading-body h3 { margin: 1px 0 0; }
.reading-shape-board { margin: 20px 0 16px; padding: 16px 18px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); }
.big-shape { width: 100%; height: 330px; display: block; }
.reading-compare { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 14px; margin: 20px 0 16px; }
.reading-panel { padding: 14px 16px 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.reading-panel-label { font: 600 9px var(--mono); letter-spacing: .12em; color: var(--dim); margin-bottom: 6px; }
.reading-panel .big-shape, .reading-panel .big-spectrum { height: 220px; }
.match-spectrum { width: 100%; height: 64px; display: block; border-radius: 10px; background: rgba(0, 0, 0, .12); }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.choice-btn { position: relative; padding: 24px 12px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; transition: .18s; text-align: center; }
.choice-btn b { display: block; font: 800 22px var(--mono); color: var(--accent); }
.choice-btn span { display: block; font-size: 10px; color: var(--dim); margin-top: 4px; }
.choice-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.choice-btn.correct { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 24%, transparent), 0 0 40px color-mix(in srgb, var(--ok) 12%, transparent); }
.choice-btn.correct b { color: var(--ok); }
.choice-btn.wrong { border-color: var(--danger); opacity: .45; }
.choice-btn.dim { opacity: .3; }
.choice-btn.shake { animation: shake .4s; }

/* ---------------- 每日 ---------------- */
.daily-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 30px; align-items: center; margin-top: 26px; }
.daily-art { position: relative; aspect-ratio: 1; max-width: 420px; width: 100%; justify-self: center; border-radius: 26px; border: 1px solid var(--line); background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 65%), var(--panel); padding: 14px; }
.daily-shape { width: 100%; height: 100%; display: block; }
.daily-tag { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font: 700 10px var(--mono); letter-spacing: .12em; color: var(--gold); padding: 4px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); background: rgba(0, 0, 0, .3); }
.daily-info h1 { font-size: clamp(30px, 4vw, 44px); margin: 8px 0 10px; }
.daily-info p { color: var(--muted); line-height: 1.8; }
.daily-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.daily-stats > div { padding: 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel); }
.daily-stats span { display: block; font-size: 10px; color: var(--dim); margin-bottom: 4px; }
.daily-stats b { font-size: 16px; font-family: var(--mono); }
.daily-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.daily-note { font-size: 11px; color: var(--dim); margin-top: 16px; }
.daily-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.daily-step { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
.daily-step b { font: 800 22px var(--mono); color: var(--gold); opacity: .7; }
.daily-step h4 { margin: 6px 0 4px; font-size: 15px; }
.daily-step p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

/* ---------------- 图库 ---------------- */
.map-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.gallery-ws .ws-section-head { margin-top: 30px; }
.gallery-ws .ws-section-head:first-child { margin-top: 20px; }
.gallery-ws .workshop-grid { margin-top: 16px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 22px; }
.gallery-card {
  text-align: left; padding: 10px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; transition: .18s;
  position: relative;
}
.gallery-lock { position: absolute; top: 16px; right: 16px; font: 700 9px var(--mono); color: var(--muted); background: rgba(4, 10, 20, .62); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); }
[data-theme="paper"] .gallery-lock { background: rgba(255, 252, 245, .8); }
.gallery-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.gallery-canvas { width: 100%; height: 140px; display: block; border-radius: 11px; background: rgba(0, 0, 0, .14); }
.gallery-meta { padding: 9px 3px 3px; display: flex; flex-direction: column; gap: 3px; }
.gallery-line { display: flex; align-items: baseline; gap: 7px; }
.gallery-line b { font: 700 10px var(--mono); color: var(--dim); }
.gallery-line span { font-size: 14px; font-weight: 600; }
.gallery-best { font-size: 10px; color: var(--dim); }
.gallery-card.locked { opacity: .4; }
.gallery-card.locked .gallery-canvas { background: rgba(0, 0, 0, .3); }

/* ---------------- 成就 ---------------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 22px; }
.ach-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); opacity: .48; }
.ach-card.on { opacity: 1; border-color: color-mix(in srgb, var(--gold) 32%, transparent); box-shadow: inset 0 0 30px color-mix(in srgb, var(--gold) 5%, transparent); }
.ach-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid var(--line); }
.ach-card.on .ach-icon { color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, transparent); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.ach-body h3 { margin: 0 0 3px; font-size: 15px; }
.ach-body p { margin: 0; font-size: 11px; color: var(--muted); }
.ach-state { margin-left: auto; font: 700 9px var(--mono); letter-spacing: .1em; color: var(--dim); }
.ach-card.on .ach-state { color: var(--gold); }

/* ---------------- 设置 ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; margin-top: 24px; align-items: start; }
.set-card { padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); }
.set-card h2 { margin: 0 0 14px; font-size: 18px; }
.set-card h3 { margin: 16px 0 8px; font-size: 11px; color: var(--dim); font-weight: 700; letter-spacing: .1em; }
.picks { display: grid; gap: 7px; }
.pick { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .12); color: var(--text); cursor: pointer; text-align: left; transition: .15s; }
[data-theme="paper"] .pick { background: rgba(255, 255, 255, .4); }
.pick:hover { border-color: var(--line2); }
.pick.active { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.pick.locked { opacity: .45; }
.pick-swatch { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--dim); }
.pick-swatch[data-id="scope"] { background: radial-gradient(circle at 40% 35%, #54e6ff55, #040a15); }
.pick-swatch[data-id="neon"] { background: radial-gradient(circle at 40% 35%, #ff6ad577, #0a0418); }
.pick-swatch[data-id="paper"] { background: radial-gradient(circle at 40% 35%, #fffdf7, #d9cdb6); }
.pick-swatch[data-kind="brushes"] { background: linear-gradient(90deg, #54e6ff, #b6f6ff, transparent); }
.pick-swatch[data-kind="brushes"][data-id="neon"] { background: linear-gradient(90deg, #ff6ad5, #7de9ff); }
.pick-swatch[data-kind="brushes"][data-id="ink"] { background: linear-gradient(90deg, #2b2620, #8a7a66); }
.pick-swatch[data-kind="trails"] { background: radial-gradient(circle at 30% 40%, #fff, #54e6ff 40%, transparent 70%); }
.pick-meta { display: flex; flex-direction: column; gap: 1px; }
.pick-meta b { font-size: 12.5px; }
.pick-meta span { font-size: 10px; color: var(--dim); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.toggle { width: 40px; height: 22px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; padding: 0; position: relative; cursor: pointer; flex: 0 0 auto; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--dim); transition: .18s; }
.toggle.on { background: color-mix(in srgb, var(--accent) 24%, transparent); border-color: var(--accent); }
.toggle.on i { left: 21px; background: var(--accent); }
.set-note { font-size: 10.5px; color: var(--dim); line-height: 1.6; margin: 12px 0 0; }
.stat-list { display: grid; gap: 2px; margin-bottom: 16px; }
.stat-list > div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.stat-list b { color: var(--text); font-family: var(--mono); font-size: 12px; }
.set-card.about p { font-size: 11.5px; color: var(--muted); line-height: 1.8; }

.fatal { padding: 60px 0; text-align: center; }

.toasts { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line2);
  color: var(--text); font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(10px);
  transition: .25s;
  backdrop-filter: blur(10px);
  max-width: 90vw;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast.ach { border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); }
.toast-icon { font-size: 14px; }

/* ---------------- 动画 ---------------- */
@keyframes pop { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 65% { transform: scale(1.12) rotate(2deg); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 频谱工坊 ---------------- */
.play.workshop .play-body { grid-template-columns: minmax(0, 1fr) 372px; }
.play.workshop .side-panel { gap: 6px; }
.panel-tools { display: flex; align-items: center; gap: 8px; }
.mini-toggle { font-size: 9px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--dim); cursor: pointer; transition: .15s; }
.mini-toggle.on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.coeff-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.coeff-row { padding: 7px 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .12); cursor: pointer; }
[data-theme="paper"] .coeff-row { background: rgba(255, 255, 255, .4); }
.coeff-row.hl { border-color: var(--accent2); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 30%, transparent); }
.coeff-head { display: flex; justify-content: space-between; align-items: center; }
.coeff-k { font: 700 11px var(--mono); color: var(--accent); }
.coeff-del { width: 18px; height: 18px; border-radius: 50%; border: none; background: transparent; color: var(--dim); cursor: pointer; font-size: 13px; line-height: 1; }
.coeff-del:hover { color: var(--danger); }
.coeff-slider { display: grid; grid-template-columns: 26px 1fr 42px; align-items: center; gap: 6px; font-size: 9px; color: var(--dim); margin-top: 3px; }
.coeff-slider input[type="range"] { width: 100%; accent-color: var(--accent); height: 16px; }
.coeff-slider b { font: 600 9.5px var(--mono); color: var(--text); text-align: right; }
.coeff-target { font: 600 9px var(--mono); color: var(--gold); margin-top: 4px; }
.add-harm { border-top: 1px solid var(--line); padding-top: 7px; }
.add-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.add-head em { font-style: normal; color: var(--dim); font-size: 9px; }
.k-palette { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 6px; }
.k-btn { padding: 4px 0; font: 600 9.5px var(--mono); border-radius: 5px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: .12s; }
.k-btn:hover { border-color: var(--accent); color: var(--accent); }
.k-btn.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent); }
.foot-note { flex: 1 1 auto; font-size: 10px; color: var(--dim); margin-left: 14px; }
.workshop-page .map-hero h1, .lessons-page .map-hero h1 { font-size: clamp(32px, 4.4vw, 46px); }
.workshop-tips { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 16px; margin-top: 18px; border-radius: 12px; border: 1px dashed var(--line2); color: var(--dim); font-size: 11.5px; }
.workshop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 18px; }
.workshop-card { position: relative; text-align: left; padding: 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; transition: .18s; }
.workshop-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.workshop-card.locked { opacity: .5; cursor: not-allowed; }
.workshop-canvas { width: 100%; height: 150px; display: block; border-radius: 11px; background: rgba(0, 0, 0, .14); }
.workshop-meta { padding: 9px 3px 3px; display: flex; flex-direction: column; gap: 3px; }
.workshop-line { display: flex; align-items: baseline; gap: 8px; }
.workshop-line b { font: 700 10px var(--mono); color: var(--dim); }
.workshop-line span { font-size: 15px; font-weight: 600; }
.workshop-kicker { margin: 0; font-size: 10px; color: var(--dim); }
.workshop-best { font-size: 10px; color: var(--dim); }
.workshop-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11.5px; }
.workshop-foot p { margin: 0; max-width: 680px; line-height: 1.7; }
.foot-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.ws-tabs { display: flex; gap: 8px; margin-top: 22px; border-bottom: 1px solid var(--line); padding-bottom: 12px; flex-wrap: wrap; }
.ws-tab { display: inline-flex; align-items: baseline; gap: 7px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: .15s; }
.ws-tab b { font-size: 12px; font-weight: 600; }
.ws-tab em { font: 500 9.5px var(--mono); color: var(--dim); font-style: normal; }
.ws-tab:hover { border-color: var(--accent); color: var(--accent); }
.ws-tab.on { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: var(--accent); color: var(--accent); }
.ws-tab.on em { color: var(--accent); }
.ws-tab.super.on { background: color-mix(in srgb, var(--accent2) 14%, transparent); border-color: var(--accent2); color: var(--accent2); }
.ws-chapters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ws-chapter { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: .15s; text-align: left; }
.ws-chapter b { font: 600 9px var(--mono); letter-spacing: .1em; color: var(--dim); }
.ws-chapter span { font-size: 11.5px; }
.ws-chapter:hover { border-color: var(--accent); color: var(--accent); }
.ws-chapter.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); }
.ws-chapter.on b { color: var(--accent); }
.ws-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-top: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ws-section-head h2 { margin: 0; font-size: 20px; letter-spacing: .03em; }
.ws-section-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--dim); }
.ws-section-prog { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.ws-section-prog b { font: 700 14px var(--mono); color: var(--accent); }
.ws-section-prog span { font-size: 10px; color: var(--dim); }
.workshop-card .ws-type { position: absolute; left: 10px; top: 10px; padding: 2px 8px; border-radius: 999px; font-size: 9px; letter-spacing: .08em; background: rgba(5, 15, 28, .72); border: 1px solid var(--line); color: var(--gold); }
.workshop-card .ws-type.super { color: var(--accent2); }
.workshop-card.super { border-color: color-mix(in srgb, var(--accent2) 34%, var(--line)); }
.workshop-card.super:hover { border-color: var(--accent2); }

/* ---------------- 傅里叶讲义 ---------------- */
.mode-card.lessons { grid-column: span 2; }
.lesson-grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin-top: 22px; }
.lesson-card { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; transition: .18s; }
.lesson-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.lesson-no { font: 800 24px var(--mono); color: var(--accent); opacity: .7; }
.lesson-card-body { flex: 1; min-width: 0; }
.lesson-card-kicker { font: 700 9px var(--mono); letter-spacing: .12em; color: var(--dim); }
.lesson-card h3 { margin: 3px 0 2px; font-size: 16px; }
.lesson-card p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.55; }
.lesson-card-state { font-size: 11px; color: var(--accent); }
.lesson-card.read .lesson-card-state { color: var(--ok); }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); gap: 30px; align-items: start; padding-top: 18px; }
.lesson-text { max-width: 640px; }
.lesson-text h1 { font-size: clamp(30px, 4vw, 44px); margin: 8px 0 6px; letter-spacing: .02em; }
.lesson-summary { color: var(--muted); font-size: 15px; line-height: 1.7; }
.lesson-section h3 { margin: 22px 0 6px; font-size: 15px; }
.lesson-section p { color: var(--muted); line-height: 1.9; font-size: 13.5px; margin: 0; }
.formula { margin: 12px 0; padding: 13px 16px; border-radius: 12px; border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); font-family: "Cambria Math", "Times New Roman", "Songti SC", serif; font-size: 17px; color: var(--text); overflow-x: auto; line-height: 1.7; }
.formula.mini { font-size: 13px; margin: 14px 0; line-height: 1.7; }
.formula sub, .formula sup { font-size: .68em; }
.formula svg { display: block; }
.intro-note { font-size: 12.5px; color: var(--muted); line-height: 1.75; margin: 10px 0 14px; }
.lesson-points-wrap { margin-top: 24px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.lesson-points-wrap h3 { margin: 0 0 8px; font-size: 12px; color: var(--accent); letter-spacing: .08em; }
.lesson-points { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.lesson-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.lesson-demo { position: sticky; top: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); padding: 14px; }
.demo-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; color: var(--dim); margin-bottom: 8px; }
.demo-head b { font-size: 12px; color: var(--text); }
.lesson-canvas { width: 100%; height: 400px; display: block; border-radius: 14px; background: var(--stage-bg); }
.lesson-controls { display: flex; align-items: center; gap: 14px; padding-top: 12px; flex-wrap: wrap; }
.lesson-control { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); flex: 1 1 200px; }
.lesson-control input[type="range"] { flex: 1; accent-color: var(--accent); }
.lesson-control input[type="range"], .coeff-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line2);
  outline: none;
}
.lesson-control input[type="range"]::-webkit-slider-thumb,
.coeff-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px color-mix(in srgb, var(--accent) 60%, transparent);
  cursor: pointer;
}
.lesson-control input[type="range"]::-moz-range-thumb,
.coeff-slider input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
.lesson-readout { font: 700 10.5px var(--mono); color: var(--accent); white-space: nowrap; }
.lesson-caption { font-size: 10.5px; color: var(--dim); margin: 8px 0 0; line-height: 1.6; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .level-row { grid-template-columns: repeat(2, 1fr); }
  .modes { grid-template-columns: repeat(2, 1fr); }
  .mode-card.campaign { grid-column: span 2; }
  .play-body { grid-template-columns: minmax(0, 1fr) 280px; }
  .slider-group input[type="range"] { width: 90px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .hero-art { max-width: 320px; order: -1; }
  .hero-title { font-size: clamp(42px, 11vw, 64px); }
  .screen { padding: 0 18px 60px; }
  .modes { grid-template-columns: 1fr; }
  .mode-card.campaign { grid-column: span 1; }
  .play-head { gap: 10px; padding: 8px 12px; }
  .play-teach, .clock, .target-chip { display: none; }
  .play-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 38%; }
  .play.workshop .play-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 52%; }
  .play.workshop .side-panel { overflow-y: auto; }
  .play.workshop .coeff-list { flex: 0 0 auto; overflow: visible; }
  .play.workshop .spectrum { flex: 0 0 auto; }
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-demo { position: static; }
  .lesson-canvas { height: 300px; }
  .mode-card.lessons { grid-column: span 1; }
  .side-panel { border-left: none; border-top: 1px solid var(--line); padding: 8px 12px; }
  .spectrum { height: 82px; }
  .harmonic-list { max-height: 120px; }
  .play-foot { gap: 10px; padding: 8px 12px; }
  .slider-group input[type="range"] { width: 74px; }
  .candidate-grid { grid-template-columns: repeat(2, 1fr); }
  .daily-grid { grid-template-columns: 1fr; }
  .daily-art { max-width: 300px; }
  .map-progress { width: 100%; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px 16px; border-radius: 20px; width: 100%; max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
  .modal-wrap { padding: 10px; }
}
@media (max-width: 620px) {
  .play-name { font-size: 16px; }
  .play-head { gap: 8px; }
  .play-id { min-width: 0; flex: 1 1 auto; }
  .score-box { min-width: 92px; flex: 0 0 auto; gap: 4px; }
  .err-bar { width: 56px; }
  .stars { font-size: 15px; }
  .play-foot { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 10px; align-items: center; }
  .foot-settle { grid-column: 1; grid-row: 1; width: 100%; }
  .foot-actions { grid-column: 2; grid-row: 1; justify-content: flex-end; margin-left: 0; gap: 4px; }
  .foot-actions .icon-btn { width: 33px; height: 33px; font-size: 13px; }
  .foot-actions .icon-btn:last-child { display: none; }
  .foot-k { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .foot-k input[type="range"] { flex: 1 1 auto; width: auto; min-width: 0; }
  .foot-speed { display: none; }
  .foot-sandbox { display: none; }
  .level-row { grid-template-columns: 1fr; }
  .candidate-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .big-spectrum { height: 150px; }
  .hero-stats { gap: 8px; }
  .intro-top { flex-direction: column; align-items: flex-start; }
  .intro-shape { width: 100%; height: 150px; flex: none; }
  .foot-actions { margin-left: 0; }
  .play-foot { justify-content: space-between; }
  .settle-btn { flex: 1 1 auto; }
  .reading-grid { grid-template-columns: 1fr; }
  .reading-compare { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .big-shape { height: 260px; }
  .reading-panel .big-shape, .reading-panel .big-spectrum { height: 190px; }
  .daily-stats { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .workshop-grid, .lesson-grid-list { grid-template-columns: 1fr; }
  .lesson-canvas { height: 240px; }
  .ws-section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .ws-tabs { gap: 6px; }
  .ws-tab { padding: 6px 12px; }
  .ws-chapter { padding: 6px 10px; }
  .foot-links { width: 100%; }
  .workshop-foot { flex-direction: column; align-items: flex-start; }
  .foot-note { display: none; }
  .topbar { height: 58px; }
}
.topbar { padding-top: env(safe-area-inset-top, 0px); }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-foot { padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
@media (max-width: 620px) {
  .foot-sandbox.foot-important { display: inline-flex; grid-column: 1 / -1; grid-row: 3; justify-self: stretch; justify-content: center; }
}
@media (max-width: 430px) {
  .screen { padding: 0 14px 64px; }
  .topbar { height: 54px; padding-left: 12px; padding-right: 12px; gap: 8px; }
  .topbar-title { font-size: 12px; }
  .topbar .star-total { font-size: 11px; padding: 4px 8px; }
  .top-actions { gap: 8px; }
  .top-actions .text-btn { font-size: 11px; }
  .icon-btn { width: 32px; height: 32px; font-size: 14px; }
  .hero-art { max-width: 250px; }
  .hero-sub { font-size: 12px; }
  .hero-stats { flex-wrap: wrap; gap: 6px 10px; font-size: 10.5px; }
  .hero-actions { flex-wrap: wrap; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .mode-card { padding: 12px; gap: 10px; }
  .mode-icon { width: 42px; height: 42px; font-size: 18px; }
  .mode-body h3 { font-size: 16px; }
  .mode-body p { font-size: 11.5px; }
  .home-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .home-foot span { font-size: 10px; }
  .play-head { padding: 6px 10px; gap: 6px; }
  .play-name { font-size: 15px; }
  .play-sub { font-size: 9px; }
  .score-box { min-width: 74px; }
  .err-bar { width: 42px; }
  .stars { font-size: 13px; }
  .play-foot { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 8px 10px; }
  .foot-note { display: none; }
  .foot-settle { flex: 1 1 auto; width: auto; min-width: 0; }
  .foot-actions { flex: 0 0 auto; display: flex; justify-content: flex-end; margin-left: 0; gap: 6px; }
  .foot-actions .btn { padding: 9px 10px; font-size: 12px; white-space: nowrap; }
  .foot-actions .icon-btn { width: 31px; height: 31px; }
  .foot-k label, .foot-speed label { font-size: 10px; }
  .side-panel { padding: 8px 10px; }
  .spectrum { height: 72px; }
  .harmonic-list { max-height: 100px; }
  .coeff-slider { grid-template-columns: 22px 1fr 38px; }
  .k-palette { gap: 3px; }
  .k-btn { padding: 5px 0; font-size: 9px; }
  .daily-art { max-width: 250px; }
  .big-shape { height: 220px; }
  .reading-panel .big-shape, .reading-panel .big-spectrum { height: 170px; }
  .choice-btn { padding: 16px 8px 12px; }
  .choice-btn b { font-size: 19px; }
  .candidate-grid { gap: 8px; }
  .candidate-letter { top: 10px; left: 12px; }
  .lesson-grid { gap: 18px; }
  .lesson-text h1 { font-size: 30px; }
  .formula { padding: 10px 12px; }
  .modal { padding: 18px 14px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }
  .settings-grid { gap: 10px; }
}
@media (orientation: landscape) {
  .topbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .screen { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .play-head { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .play-foot { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
}
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { height: 48px; }
  .screen { padding: 0 16px 40px; }
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); padding-top: 4px; gap: 18px; }
  .hero-art { max-width: 240px; order: 0; justify-self: end; }
  .hero-title { font-size: clamp(34px, 6vw, 52px); }
  .hero-tagline { font-size: 17px; }
  .hero-sub { font-size: 12px; }
  .hero-actions { flex-wrap: nowrap; }
  .hero-stats { flex-wrap: wrap; gap: 6px 10px; font-size: 10.5px; }
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-card.campaign, .mode-card.lessons { grid-column: span 1; }
  .home-foot { flex-direction: row; }
  .play-head { padding: 4px 12px; gap: 8px; }
  .play-name { font-size: 15px; }
  .play-teach, .clock, .target-chip { display: none; }
  .play-body { grid-template-columns: minmax(0, 1fr) 250px; grid-template-rows: minmax(0, 1fr); }
  .play.workshop .play-body { grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); }
  .side-panel { border-left: 1px solid var(--line); border-top: none; padding: 6px 10px; overflow-y: auto; }
  .play.workshop .side-panel { overflow-y: auto; }
  .play.workshop .coeff-list { flex: 0 0 auto; overflow: visible; }
  .play.workshop .spectrum { flex: 0 0 auto; height: 64px; }
  .spectrum { height: 64px; }
  .harmonic-list { max-height: 82px; }
  .play-foot { display: flex; padding: 5px 12px; gap: 8px; padding-bottom: max(5px, env(safe-area-inset-bottom, 0px)); }
  .foot-settle { flex: 0 0 auto; width: auto; }
  .foot-actions { margin-left: auto; }
  .foot-actions .icon-btn:last-child { display: inline-flex; }
  .foot-sandbox { display: inline-flex; }
  .foot-speed { display: flex; }
  .foot-k input[type="range"] { width: 90px; }
  .reading-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .reading-compare { grid-template-columns: 1fr 1fr; }
  .big-shape { height: 200px; }
  .reading-panel .big-shape, .reading-panel .big-spectrum { height: 150px; }
  .big-spectrum { height: 110px; }
  .daily-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .daily-art { max-width: 220px; }
  .daily-stats { grid-template-columns: repeat(3, 1fr); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workshop-grid, .lesson-grid, .lesson-grid-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-canvas { height: 200px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { max-width: 560px; padding: 18px 20px; }
  .modal-wrap { padding: 10px; }
}
/* ============ 移动端重设计：底部导航 / 首页双列 / 工坊面板分页 ============ */
.dock {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.dock-btn {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; border: 0; border-radius: 12px;
  background: none; color: var(--dim); font: 600 10px var(--font); cursor: pointer;
}
.dock-icon { font-size: 18px; line-height: 1; }
.dock-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.panel-tabs { display: none; }
@media (max-width: 900px) {
  .dock { display: flex; }
  .screen { padding-bottom: 100px; }
  body.in-play .dock { display: none; }
  body.in-play .screen { padding-bottom: 60px; }
  .top-actions .icon-btn { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 4px; gap: 14px; }
  .hero-art { display: none; }
  .hero-title { font-size: clamp(32px, 9vw, 46px); }
  .hero-tagline { font-size: 16px; }
  .hero-sub { font-size: 12px; }
  .hero-actions { flex-wrap: nowrap; gap: 8px; }
  .hero-actions .btn { flex: 1 1 0; justify-content: center; padding: 10px 12px; }
  .hero-stats { font-size: 10.5px; }
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mode-card { padding: 12px; gap: 10px; min-height: 0; }
  .mode-card.campaign { grid-column: span 2; }
  .mode-card.lessons { grid-column: span 1; }
  .mode-icon { width: 40px; height: 40px; flex: 0 0 40px; font-size: 18px; border-radius: 12px; }
  .mode-card h3 { font-size: 15px; }
  .mode-card p { font-size: 11px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mode-kicker { font-size: 8.5px; }
  .mode-arrow { display: none; }
  .mode-bar { margin: 8px 0 5px; }
  .mode-foot { font-size: 10px; gap: 8px; }
  .home-foot { margin-top: 24px; }
  .panel-tabs { display: flex; gap: 4px; margin: 6px 0 8px; }
  .panel-tab { flex: 1 1 0; padding: 5px 0; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--dim); font: 700 11px var(--font); cursor: pointer; }
  .panel-tab.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .workshop-side .panel-sec { display: none; min-width: 0; }
  .workshop-side[data-mtab="spectrum"] .panel-sec[data-sec="spectrum"],
  .workshop-side[data-mtab="coeffs"] .panel-sec[data-sec="coeffs"],
  .workshop-side[data-mtab="add"] .panel-sec[data-sec="add"] { display: block; }
  .workshop-side { overflow-y: auto; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .home { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); column-gap: 18px; align-items: start; }
  .home > .topbar { grid-column: 1 / -1; grid-row: 1; }
  .home > .hero { grid-column: 1; grid-row: 2; padding-top: 0; }
  .home > .modes { grid-column: 2; grid-row: 2; }
  .home > .home-foot { grid-column: 1 / -1; grid-row: 3; }
  .home .hero-sub { display: none; }
  .home .hero-title { font-size: clamp(30px, 5vw, 40px); }
  .home .hero-tagline { font-size: 15px; }
  .home .hero-actions .btn { padding: 9px 10px; font-size: 13px; }
  .home .modes { gap: 8px; }
  .home .mode-card { padding: 10px; }
}
@media (max-width: 900px) and (orientation: portrait) {
  body[data-screen="play"] { overflow: hidden; }
  .play { position: fixed; inset: 0; }
  .play-body { display: flex; flex-direction: column; grid-template: none; }
  .play.workshop .play-body { display: flex; flex-direction: column; grid-template: none; }
  .stage-wrap { flex: 1 1 auto; min-height: 0; }
  .side-panel {
    flex: 0 0 auto;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
    min-width: 0;
    height: 42vh;
    max-height: 42vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    margin-top: -12px;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    padding: 18px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .35);
    z-index: 2;
  }
  .side-panel.collapsed { height: 74px; max-height: 74px; overflow: hidden; }
  .side-panel.collapsed .panel-tabs, .side-panel.collapsed .panel-sec { display: none; }
  .side-panel.collapsed .panel-head { margin-bottom: 0; }
  .panel-head, .panel-tabs, .panel-sec { width: 100%; min-width: 0; box-sizing: border-box; }
  .panel-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; overflow: hidden; }
  .panel-tab { min-width: 0; width: 100%; }
  .view-ctrl { top: 48px; bottom: auto; }
  .side-panel::before {
    content: "";
    position: absolute;
    top: 6px; left: 50%;
    width: 38px; height: 4px;
    margin-left: -19px;
    border-radius: 2px;
    background: var(--line2);
    opacity: .8;
  }
  .play.workshop .side-panel { padding-top: 18px; }
  .play.workshop .spectrum { height: 96px; }
  .play.workshop .coeff-list { flex: 0 0 auto; overflow: visible; }
  .play-head { padding-top: max(8px, env(safe-area-inset-top, 0px)); }
  .play-foot { padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
}
/* ============ 设置：存档 / 版本与更新 ============ */
.hidden-file { display: none; }
.save-actions, .update-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.save-actions .btn, .update-actions .btn { flex: 1 1 auto; justify-content: center; }
.field { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-size: 11px; color: var(--muted); }
.field span { flex: 0 0 auto; }
.field .inp {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .2); color: var(--text); font: 11px var(--font);
}
.field .inp:focus { outline: none; border-color: var(--accent); }
.update-modal .changelog { max-height: 52vh; overflow-y: auto; margin: 8px 0 4px; }
.update-modal .changelog section { padding: 8px 0; border-top: 1px solid var(--line); }
.update-modal .changelog section:first-child { border-top: none; }
.update-modal .changelog h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.update-modal .changelog ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
@media (max-width: 900px) {
  .save-actions .btn, .update-actions .btn { flex: 1 1 46%; }
}
/* ===== 动效：让游戏更像应用 ===== */
@keyframes screen-in { from { opacity: 0; transform: translateY(10px) scale(.994); } to { opacity: 1; transform: none; } }
.screen-enter { animation: screen-in .3s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.home .hero { animation: rise-in .42s cubic-bezier(.2,.7,.2,1) both; }
.home .modes .mode { animation: rise-in .38s cubic-bezier(.2,.7,.2,1) both; }
.home .modes .mode:nth-child(1) { animation-delay: .04s; }
.home .modes .mode:nth-child(2) { animation-delay: .08s; }
.home .modes .mode:nth-child(3) { animation-delay: .12s; }
.home .modes .mode:nth-child(4) { animation-delay: .16s; }
.home .modes .mode:nth-child(5) { animation-delay: .2s; }
.home .modes .mode:nth-child(6) { animation-delay: .24s; }
.home .modes .mode:nth-child(7) { animation-delay: .28s; }
.btn, .mode, .icon-btn, .dock-btn, .panel-tab, .mini-toggle { transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease; }
.btn:active, .icon-btn:active, .dock-btn:active, .panel-tab:active, .mini-toggle:active { transform: scale(.955); }
.mode:active { transform: scale(.985); }
.modal-wrap { animation: modal-in .26s cubic-bezier(.2,.8,.2,1) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.965); } to { opacity: 1; transform: none; } }
.scrim { animation: fade-in .2s both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.toast { animation: toast-in .26s cubic-bezier(.2,.8,.2,1) both; }
.toast.out { animation: toast-out .2s both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px) scale(.97); } }
.dock-btn.on .dock-icon { animation: dock-pop .3s cubic-bezier(.2,.8,.2,1); }
@keyframes dock-pop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes pop-star { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.big-star .s, .modal .star { animation: pop-star .34s .04s cubic-bezier(.2,.8,.2,1) both; }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.confetti-layer i { position: absolute; top: -12px; width: 7px; height: 11px; border-radius: 2px; animation: confetti-fall 1.4s cubic-bezier(.2,.6,.3,1) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--x, 0px), 110vh, 0) rotate(var(--r, 360deg)); opacity: .9; } }
.boot-orbit { animation: boot-spin 3.2s linear infinite; }
.boot-orbit i { animation: boot-pulse 1.4s ease-in-out infinite; }
.boot-title { animation: rise-in .7s .05s both; }
.boot-sub { animation: rise-in .7s .2s both; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (max-width: 900px) and (orientation: portrait) {
  .play .side-panel { animation: sheet-up .3s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes sheet-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after {
  animation-duration: .001ms !important;
  transition-duration: .001ms !important;
}
