/* 一个字节的距离 · 样式 */
/* 字体：Claude 的品牌字体是商业授权字体，不能打包；
   这里把它们排在最前面，电脑上装了就会用。没装的话，英文和数字用开源的 Source Serif 4（OFL），中文用系统自带的宋体。 */
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-display: swap; src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap; src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-display: swap; src: url("fonts/source-serif-4-latin-700-normal.woff2") format("woff2"); }
:root {
  --serif: "Anthropic Serif", "Copernicus", "Tiempos Text", "Source Serif 4", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Anthropic Sans", "Styrene B", "Styrene A", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "Anthropic Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #f2f1ec;
  --card: #ffffff;
  --soft: #f6f5f1;
  --ink: #161616;
  --muted: #66645e;
  --line: #d6d3cb;
  --hl: #ffe45c;          /* 荧光笔 */
  --hl-soft: #fff4b0;
  --red: #d92d20;         /* 改动 */
  --ok: #1a7f45;
  --ok-soft: #e7f3eb;
  --bad: #c8281e;
  --bad-soft: #fbeceb;
  --code-bg: #151515;
  --code-ink: #e8e8e8;
  --code-muted: #8c8c8c;
  --changed: #ff5f52;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--sans);
}
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #2f6feb; outline-offset: 2px; }
[hidden] { display: none !important; }
code {
  font-family: var(--mono);
  font-size: .9em;
  background: #ecebe5;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.mono { font-family: var(--mono); }
.small { font-size: 13.5px; }
.muted { color: var(--muted); }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
}
.brand { font-weight: 800; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-ic {
  font-family: var(--mono); font-size: 13px; font-weight: 700; line-height: 1;
  background: var(--ink); color: var(--hl); padding: 5px 5px; border-radius: 3px;
}
.dots { display: flex; gap: 2px; flex: 1; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.dots::-webkit-scrollbar { display: none; }
.dot {
  border: 0; background: transparent; padding: 4px 9px; border-radius: 3px;
  cursor: pointer; display: flex; gap: 6px; align-items: center; color: var(--muted);
  font-size: 14px; white-space: nowrap;
}
.dot:hover { background: #e6e4dd; }
.dot-n { display: none; font-family: var(--mono); font-size: 12px; font-weight: 700; color: #a9a69d; }
.dot.seen { color: var(--ink); }
.dot.seen .dot-n { color: var(--ink); }
.dot.on { background: var(--ink); color: #fff; }
.dot.on .dot-n { color: var(--hl); }
.lab-btn {
  border: 1px solid var(--ink); background: transparent; border-radius: 3px; padding: 5px 12px;
  cursor: pointer; font-size: 14px; white-space: nowrap;
}
.lab-btn:hover { background: #e6e4dd; }
.lab-btn.on { background: var(--ink); color: #fff; }
@media (max-width: 860px) {
  .top { padding: 8px 10px; gap: 6px; }
  .brand-name, .lab-btn span { display: none; }
  .lab-btn { padding: 5px 8px; }
  .dot-l { display: none; }
  .dot-n { display: inline; }
  .dot { padding: 4px 7px; }
  .dot.on .dot-n { display: none; }
  .dot.on .dot-l { display: inline; }
}

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 20px; padding: 20px; max-width: 1440px; margin: 0 auto; align-items: start;
}
.layout.solo { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.story {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 24px 24px 28px;
  min-width: 0;
}
@media (min-width: 901px) {
  .layout:not(.solo) .story { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 14px; }
  .story { padding: 18px 16px 20px; }
}
.bench { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; min-width: 0; }
@media (max-width: 1200px) { .bench { grid-template-columns: minmax(0, 1fr); } }
.work { min-width: 0; }

.foot { max-width: 1000px; margin: 10px auto 30px; padding: 0 20px; color: var(--muted); font-size: 12.5px; text-align: center; }
.foot p { margin: 4px 0; }

/* ---------- 故事面板 ---------- */
.story p { margin: 0 0 12px; }
.ch-kicker, .kicker { font-family: var(--mono); color: var(--muted); font-size: 12.5px; letter-spacing: .04em; }
.ch-head h2 { margin: 2px 0 12px; font-size: 26px; line-height: 1.3; }
.hero-title { font-size: 46px; line-height: 1.15; margin: 6px 0 12px; letter-spacing: .02em; }
.lead { font-size: 18px; }
@media (max-width: 420px) { .hero-title { font-size: 40px; } .lead { font-size: 17px; } }
.meta { color: var(--muted); font-size: 14px; }
.disclaimer { color: var(--muted); font-size: 13px; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 18px; }
.hero-art {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--code-bg); padding: 18px; border-radius: 6px; margin: 18px 0;
}
.hb { color: #cfcfcf; background: #222; border-radius: 3px; padding: 6px 10px; font-size: 20px; font-family: var(--mono); }
.hb.flip { color: var(--hl); outline: 2px solid var(--hl); transition: color .3s, outline-color .3s; }
.hb.flip.patched { color: #ff8a80; outline-color: var(--changed); }
.hero-lock {
  margin-left: auto; font-size: 13px; font-weight: 700; color: #9a9a9a;
  border: 1.5px solid currentColor; border-radius: 3px; padding: 2px 8px; transition: color .3s;
}
.hero-lock.open { color: #4abe78; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 4px; }

.tasks { list-style: none; padding: 0; margin: 16px 0; }
.tasks li {
  display: flex; gap: 10px; padding: 9px 12px; border-radius: 3px; background: var(--soft);
  margin-bottom: 6px; color: var(--muted); border: 1px solid transparent;
}
.tasks li.current { background: var(--hl-soft); border-color: #e6cf4a; color: var(--ink); }
.tasks li.done { color: var(--ink); background: var(--ok-soft); }
.tick {
  flex: 0 0 18px; height: 18px; border-radius: 3px; border: 2px solid #bdbab1;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 4px;
}
.tasks li.current .tick { border-color: var(--ink); }
.tasks li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }

.tip { background: var(--soft); border-left: 3px solid #a8a59c; border-radius: 0 3px 3px 0; padding: 9px 14px; margin: 12px 0; font-size: 15px; }
.tip.alert { background: var(--bad-soft); border-left-color: var(--red); }
.pick-hint { background: var(--hl-soft); color: var(--ink); border-radius: 3px; padding: 9px 14px 9px 17px; margin: 12px 0; font-weight: 700; animation: pulseBg 1.8s infinite; }
.disc, .win, .fb, .tip, .card-preview, .q { scroll-margin-top: 76px; }
.disc { border-left: 4px solid var(--ink); background: var(--soft); padding: 11px 16px; border-radius: 0 3px 3px 0; margin: 16px 0; }
.disc-t { font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: var(--muted); }
.hints { margin: 12px 0; }
.hint { background: var(--hl-soft); border-radius: 3px; padding: 9px 14px 9px 17px; margin-bottom: 8px; font-size: 15px; }

.q { margin: 14px 0; }
.q-title { font-weight: 700; margin-bottom: 8px; }
.opt {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 3px; padding: 9px 14px; margin-bottom: 6px; cursor: pointer; line-height: 1.5;
}
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt:disabled { cursor: default; }
.opt b { font-family: var(--mono); margin-right: 6px; }
.opt.picked { border-color: var(--ink); background: var(--hl-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.fb { padding: 9px 14px; border-radius: 3px; margin-top: 6px; font-size: 15px; }
.fb.ok { background: var(--ok-soft); }
.fb.no { background: var(--bad-soft); }

.win { background: var(--ok-soft); border-left: 4px solid var(--ok); border-radius: 0 3px 3px 0; padding: 12px 16px 12px 13px; margin: 14px 0; }
.win-title { font-weight: 800; font-size: 18px; margin-bottom: 2px; }
.win p { margin: 4px 0 0; }
.sub-k { font-weight: 700; font-size: 14px; color: var(--muted); margin-top: 8px; }
.chg-list { padding-left: 18px; margin: 4px 0 8px; font-size: 14px; }
.world { border: 1px solid var(--line); border-radius: 3px; padding: 12px 16px; margin: 14px 0; font-size: 14.5px; }
.world-title { font-weight: 800; }
.world ul { padding-left: 18px; margin: 6px 0 0; }
.world li { margin-bottom: 6px; }
.lab-count { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--muted); margin-left: 8px; }
.world ul.lab-list { list-style: none; padding: 0; margin: 8px 0; }
.lab-list li { display: flex; gap: 10px; }
.lab-list li.done { color: var(--muted); }
.lab-list li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.lab-list .after { display: block; color: var(--ink); font-size: 13.5px; margin-top: 2px; }
.alts { background: var(--soft); border-radius: 3px; padding: 9px 14px 9px 17px; margin: 10px 0; font-size: 14.5px; }
.alts summary { cursor: pointer; font-weight: 700; }
.alt-list { padding-left: 18px; margin: 8px 0 0; }
.alt-list li { margin-bottom: 4px; }
.alt-list li.mine { color: var(--red); font-weight: 700; }
.alt-list li.mine::after { content: " ← 你的"; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.seg-btn { border: 1px solid var(--line); background: #fff; border-radius: 3px; padding: 7px 12px; cursor: pointer; }
.seg-btn:hover { border-color: var(--ink); }
.seg-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* 发现卡 */
.records { list-style: none; padding: 0; margin: 0 0 16px; }
.records li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.records .k { flex: 0 0 74px; color: var(--muted); font-weight: 700; }
textarea.finding {
  width: 100%; border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px;
  font: inherit; font-size: 17px; resize: vertical; background: #fff; color: var(--ink);
}
textarea.finding:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  border: 1px solid var(--line); background: var(--soft); border-radius: 3px; padding: 4px 10px;
  font-size: 13.5px; cursor: pointer; line-height: 1.5;
}
.chip:hover { border-color: var(--ink); }
.chip b { font-family: var(--mono); }
.chip.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.card-preview { margin-top: 16px; }
.card-preview img { width: 100%; border: 1px solid var(--line); display: block; }
.warn-line { color: var(--bad); font-size: 14px; min-height: 1.5em; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--ink); background: #fff; border-radius: 3px; padding: 8px 16px;
  cursor: pointer; font-weight: 600; transition: background .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.4;
}
.btn:hover:not(:disabled) { background: #eeede8; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #333; }
.btn.big { padding: 12px 26px; font-size: 18px; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--ink); background: transparent; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.pulse { background: var(--hl); border-color: var(--ink); animation: pulse 1.6s infinite; }
.btn.pulse:hover:not(:disabled) { background: #fff07a; }

/* ---------- 设备：一台带液晶屏的保险箱 ---------- */
.device-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.device {
  width: 100%; max-width: 270px; background: #2b2b2b; border-radius: 6px; padding: 12px 12px 14px;
  border: 1px solid #000;
}
.dev-top { display: none; }
.dev-name { color: #b8b8b8; font-family: var(--mono); font-size: 12px; margin: 0 0 8px; letter-spacing: .04em; }
.screen {
  background: #c5d0b4; color: #1d2a14; border-radius: 3px; min-height: 196px;
  padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 2px; overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18);
}
.screen .ic {
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em;
  border: 1.5px solid currentColor; border-radius: 2px; padding: 1px 7px; margin-bottom: 8px;
}
.screen .tt { font-weight: 800; font-size: 22px; font-family: var(--mono); word-break: break-all; }
.screen .sb { font-size: 13px; opacity: .72; }
.screen.run { background: #ced3c0; }
.screen.open { background: #b4dc9c; color: #10300f; }
.screen.deny { background: #e3b3aa; color: #4a120c; animation: shake .45s; }
.screen.crash { background: #1b1b1b; color: #ff6b5e; }
.screen.stuck { background: #c3c8cf; color: #1f2530; }
.screen.halted { background: #d2d2c8; }
.box { margin-top: 8px; width: 100%; background: rgba(255, 255, 255, .45); border-radius: 2px; padding: 8px; }
.box-label { font-size: 12px; opacity: .72; }
.box-text { font-family: var(--mono); font-size: 15px; word-break: break-all; letter-spacing: .06em; font-weight: 700; }
.box-verdict { font-size: 13px; margin-top: 2px; font-weight: 700; }
.dev-form { display: flex; gap: 8px; margin-top: 12px; }
.pw {
  flex: 1; min-width: 0; border: 0; border-radius: 3px; padding: 9px 12px; font-size: 16px;
  background: #fff; color: var(--ink); font-family: var(--mono);
}
.pw:focus { outline: 2px solid var(--hl); }
.device .btn.primary { background: var(--hl); border-color: var(--hl); color: var(--ink); }
.device .btn.primary:hover:not(:disabled) { background: #fff07a; }
.pw-warn { color: #ff9a90; font-size: 12px; text-align: center; min-height: 18px; margin-top: 4px; }
.sticky {
  background: #fff38a; color: #5a4a00; padding: 14px 18px; transform: rotate(-3deg);
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .4); max-width: 230px; line-height: 1.5;
  font-family: "Chalkboard SE", "Kaiti SC", "KaiTi", "Comic Sans MS", cursive; font-size: 16px;
}
.sticky b { font-family: var(--mono); font-size: 22px; letter-spacing: .08em; }

.stage { display: none; }

/* ---------- 代码面板 ---------- */
.code-panel {
  background: var(--code-bg); color: var(--code-ink); border-radius: 6px; padding: 12px;
  border: 1px solid #000;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: flex; gap: 0; border: 1px solid #3a3a3a; border-radius: 3px; overflow: hidden; }
.tab { border: 0; background: transparent; color: var(--code-muted); padding: 5px 12px; cursor: pointer; font-size: 14px; }
.tab + .tab { border-left: 1px solid #3a3a3a; }
.tab.on { background: #e8e8e8; color: #111; }
.tab.locked { opacity: .45; }
.changes { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.chg-count { color: var(--code-muted); }
.chg-count.has { color: var(--changed); font-weight: 700; }
.btn.tiny { padding: 3px 10px; font-size: 13px; border-radius: 3px; background: transparent; color: #ddd; border: 1px solid #555; }
.btn.tiny:hover:not(:disabled) { background: #2a2a2a; }

.listing { position: relative; padding-left: 34px; }
.listing .arrows { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.row {
  display: grid; grid-template-columns: 22px 26px 76px minmax(0, 1fr); align-items: center; gap: 6px;
  min-height: 52px; padding: 4px 8px 4px 2px; border-radius: 3px; border-left: 3px solid transparent;
  transition: background .2s;
}
.row + .row { margin-top: 2px; }
.row.visited { background: rgba(255, 255, 255, .05); }
.row.pc { background: rgba(255, 228, 92, .14); border-left-color: var(--hl); }
.row.end-halted { border-left-color: #4abe78; }
.row.end-crashed, .row.end-stuck { border-left-color: var(--changed); background: rgba(255, 95, 82, .12); }
.row.pickable { cursor: pointer; }
.row.pickable:hover { background: rgba(124, 183, 255, .14); outline: 1px dashed #7cb7ff; }
.row.pick-ok { background: rgba(74, 190, 120, .2); outline: 2px solid #4abe78; }
.row.pick-bad { outline: 2px solid var(--changed); }
.mk { color: var(--hl); font-size: 14px; text-align: center; white-space: nowrap; }
.ad { color: var(--code-muted); font-size: 13px; font-family: var(--mono); }
.bytes { display: flex; gap: 4px; }
.byte {
  border: 1px solid #383838; background: #1f1f1f; color: #e8e8e8; border-radius: 3px;
  width: 35px; height: 34px; cursor: pointer; font-family: var(--mono); font-size: 14px; padding: 0;
}
.byte:hover { border-color: #8c8c8c; background: #2a2a2a; }
.byte.changed { border-color: var(--changed); color: #ff8a80; background: #2a1513; }
.zh { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.zh-main { font-size: 15px; }
.asm { font-family: var(--mono); font-size: 12px; color: var(--code-muted); }
.warn { font-size: 12px; color: #e8c547; }
.kind-jcc .zh-main { color: #e8c547; }
.kind-jmp .zh-main { color: #7cb7ff; }
.kind-call .zh-main { color: #e8e8e8; }
.kind-bad .zh-main { color: #ff8a80; }
.kind-nop .zh-main, .kind-hlt .zh-main { color: #8c8c8c; }
.odd-note { margin-top: 8px; font-size: 13px; color: #e8c547; border: 1px dashed #6b5d1f; border-radius: 3px; padding: 8px 10px; font-family: var(--sans); }
.listing-foot { margin-top: 10px; font-size: 12.5px; color: var(--code-muted); font-family: var(--sans); display: flex; gap: 14px; flex-wrap: wrap; }
.listing-foot i { display: inline-block; width: 18px; height: 0; border-top: 2px dashed #e8c547; vertical-align: middle; margin-right: 4px; }
.listing-foot i.jmp { border-top-style: solid; border-top-color: #7cb7ff; }
.listing-foot i.tk { border-top: 3px solid var(--changed); }

.hex-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.hexgrid { display: grid; grid-template-columns: 24px repeat(8, minmax(0, 1fr)); gap: 4px; }
.hx-col, .hx-row, .hx-corner { font-size: 11px; color: var(--code-muted); display: grid; place-items: center; font-family: var(--mono); }
.cell {
  border: 1.5px solid transparent; border-radius: 3px; min-height: 40px; padding: 2px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 14px; color: #fff; background: #1f1f1f; min-width: 0;
}
.cell:hover { border-color: rgba(255, 255, 255, .45); }
.cell.r-code { background: #2c2c2c; }
.cell.r-text { background: rgba(74, 190, 120, .22); }
.cell.r-secret { background: rgba(240, 140, 40, .32); }
.cell.r-input { background: rgba(80, 150, 230, .26); }
.cell.r-box { background: rgba(230, 110, 170, .26); }
.hexgrid.ascii .cell { min-height: 48px; }
.hexgrid.ascii .cell .h { font-size: 10px; opacity: .55; }
.cell .c { font-size: 18px; font-weight: 700; line-height: 1.1; }
.cell .c.np { opacity: .3; font-weight: 400; }
.cell.changed { border-color: var(--changed); }
.cell.pc { outline: 2px solid var(--hl); outline-offset: 1px; }
.cell.flash { animation: flash 1.2s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--code-muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .l-code::before { background: #5a5a5a; }
.legend .l-text::before { background: #4abe78; }
.legend .l-secret::before { background: #f08c28; }
.legend .l-input::before { background: #5096e6; }
.legend .l-box::before { background: #e66eaa; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 36px; height: 20px; border-radius: 3px; background: #3a3a3a; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch .slider::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 2px; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: #4abe78; }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--hl); }
.switch.pulse .slider { animation: pulse 1.6s infinite; }

/* ---------- CPU 面板 ---------- */
.cpu { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.cpu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cpu-title { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--soft); border-radius: 3px; padding: 6px 10px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--mono); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.lamp { width: 13px; height: 13px; border-radius: 50%; background: #cfccc4; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); flex: 0 0 auto; }
.lamp.on { background: #3ccf6e; box-shadow: 0 0 8px #3ccf6e; }
.last { margin: 10px 0 0; font-size: 14px; background: var(--soft); border-radius: 3px; padding: 8px 10px; min-height: 64px; }
.last .k { color: var(--muted); font-weight: 700; }
.cpu-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 对话框 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.dialog {
  background: #fff; border-radius: 6px; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  padding: 18px 18px 16px; border: 1px solid var(--ink);
}
@media (max-width: 560px) {
  .overlay { place-items: end center; padding: 0; }
  .dialog { border-radius: 6px 6px 0 0; width: 100%; max-height: 88vh; border-width: 1px 0 0; }
}
.dlg-title { font-family: var(--mono); font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-family: var(--sans); font-size: 12px; font-weight: 700; border-radius: 2px; padding: 1px 8px; color: var(--ink); }
.badge.r-code { background: #e6e6e6; } .badge.r-text { background: #d5f0de; } .badge.r-secret { background: #fde2c4; }
.badge.r-input { background: #d6e6fa; } .badge.r-box { background: #f9d9e9; }
.dlg-row { margin: 10px 0; font-size: 15px; }
.dlg-ctx { background: var(--code-bg); color: var(--code-ink); border-radius: 3px; padding: 8px 12px; font-family: var(--mono); font-size: 14px; }
.dlg-ctx b { color: var(--hl); }
.dlg-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hexin, .charin { font-family: var(--mono); font-size: 22px; text-align: center; border: 1px solid var(--ink); border-radius: 3px; padding: 6px; color: var(--ink); background: #fff; }
.hexin:focus, .charin:focus { outline: none; box-shadow: 0 0 0 3px var(--hl); }
.hexin { width: 86px; text-transform: uppercase; }
.charin { width: 60px; }
.hexin.bad { border-color: var(--bad); }
.preview { background: var(--soft); border-radius: 3px; padding: 8px 12px; margin: 10px 0; font-size: 14.5px; }
.preview code { background: #e8e6df; }
.dlg-lock { background: var(--soft); border-radius: 3px; padding: 8px 12px; font-size: 14.5px; }
.dlg-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 3px; z-index: 60; font-size: 14px; line-height: 1.6; animation: fade .2s; width: max-content; max-width: min(560px, calc(100vw - 32px)); }

/* ---------- 动画 ---------- */
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px #fff, 0 0 14px var(--hl); } 100% { box-shadow: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--hl-rgb, 240, 200, 0), .7); } 50% { box-shadow: 0 0 0 6px rgba(var(--hl-rgb, 240, 200, 0), 0); } }
@keyframes pulseBg { 0%, 100% { background: var(--hl-soft); } 50% { background: var(--hl); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ==========================================================================
   3D 世界 + 暗色 HUD（只在有 WebGL 时生效；没有的话上面的浅色 2D 版照常工作）
   ========================================================================== */
.world3d { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #050507; }
body.has3d {
  --bg: #050507;
  --card: rgba(16, 16, 19, .7);
  --soft: rgba(255, 255, 255, .065);
  --ink: #f2efe7;
  --muted: #a5a197;
  --line: rgba(255, 255, 255, .15);
  --hl: #F08A60; --hl-rgb: 240, 138, 96;      /* 和夜色线稿同一个陶土橙 */
  --hl-soft: rgba(240, 138, 96, .17);
  --arr-jcc: #a5a197;
  --red: #ff5f52;
  --ok: #4fd487;
  --ok-soft: rgba(60, 207, 110, .15);
  --bad: #ff6b5e;
  --bad-soft: rgba(255, 90, 75, .16);
  --code-bg: rgba(12, 12, 14, .76);
  background: #050507; color-scheme: dark;
}
.has3d main, .has3d .foot { position: relative; z-index: 1; }
.has3d .top { background: rgba(5, 5, 7, .55); border-bottom-color: var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.has3d .brand-ic { background: var(--hl); color: #111; }
.has3d .row.pc { background: rgba(var(--hl-rgb), .16); }
.has3d .warn, .has3d .kind-jcc .zh-main { color: var(--hl); }
.has3d .odd-note { color: var(--hl); border-color: rgba(var(--hl-rgb), .5); }
.has3d .listing-foot i { border-top-color: var(--arr-jcc); }
.has3d .listing-foot i.jmp { border-top-color: #7cb7ff; }
.has3d .listing-foot i.tk { border-top-color: var(--changed); }
.has3d .story, .has3d .cpu, .has3d .code-panel { -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); }
.has3d .story, .has3d .cpu { box-shadow: 0 20px 60px -30px rgba(0, 0, 0, .9); }
.has3d code, .has3d .preview code { background: rgba(255, 255, 255, .11); }
.has3d .dot:hover, .has3d .lab-btn:hover { background: rgba(255, 255, 255, .1); }
.has3d .dot.on, .has3d .lab-btn.on, .has3d .seg-btn.on, .has3d .chip.sel, .has3d .btn.primary, .has3d .toast { color: #111; }
.has3d .tasks li.done .tick, .has3d .lab-list li.done .tick { color: #08130c; }
.has3d .tasks li.current { border-color: rgba(var(--hl-rgb), .55); }
.has3d .opt, .has3d .seg-btn, .has3d textarea.finding, .has3d .btn, .has3d .pw, .has3d .hexin, .has3d .charin { background: rgba(255, 255, 255, .07); color: var(--ink); }
.has3d .seg-btn.on { background: var(--ink); border-color: var(--ink); color: #111; }
.has3d .btn { border-color: rgba(255, 255, 255, .4); }
.has3d .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.has3d .btn.primary { background: var(--ink); border-color: var(--ink); }
.has3d .btn.primary:hover:not(:disabled) { background: #fff; }
.has3d .btn.pulse, .has3d .device .btn.primary { background: var(--hl); border-color: var(--hl); color: #111; }
.has3d .btn.pulse:hover:not(:disabled), .has3d .device .btn.primary:hover:not(:disabled) { background: #FF9D75; }
.has3d .badge { color: #111; }
.has3d .dialog { background: #17171a; border-color: var(--line); box-shadow: 0 30px 80px -20px #000; }
.has3d .toast { background: var(--ink); }
.has3d .foot { color: #77746c; }
.has3d .snd-btn { font-size: 13px; }

/* 取景框：一块透明的空白，镜头会把保险箱和键帽对准它 */
.has3d .stage {
  display: block; width: 100%; height: min(54vh, 500px); position: relative;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.has3d .stage:active { cursor: grabbing; }
.has3d .device-wrap { align-items: stretch; gap: 10px; }
.has3d .device { width: 100%; max-width: 440px; align-self: center; background: none; border: 0; padding: 0; }
.has3d .dev-name { display: none; }
/* 便利贴：贴在密码框的右上方，不占位置，也不会被挤到屏幕外面 */
.has3d .device-wrap .stage { order: 1; }
.has3d .dev-extra { order: 2; height: 0; margin-top: -10px; position: relative; z-index: 4; }
.has3d .device { order: 3; }
.has3d .dev-extra .sticky { position: absolute; right: 0; bottom: 4px; font-size: 17px; }
.has3d .screen {
  min-height: 0; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: baseline;
  text-align: left; gap: 2px 10px; padding: 9px 12px; box-shadow: none; border: 1px solid var(--line); border-left-width: 3px;
  background: rgba(12, 12, 14, .7); color: var(--ink); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.has3d .screen.run, .has3d .screen.stuck { border-left-color: #F2DFA7; background: rgba(12, 12, 14, .7); color: var(--ink); }
.has3d .screen.stuck { border-left-color: #E0A56E; }
.has3d .screen.halted { background: rgba(12, 12, 14, .7); color: var(--ink); }
.has3d .screen.open { border-left-color: #3ccf6e; background: rgba(20, 60, 36, .72); color: #dcffe9; }
.has3d .screen.deny, .has3d .screen.crash { border-left-color: #ff4a3d; background: rgba(70, 18, 14, .72); color: #ffe3df; }
.has3d .screen .ic { margin: 0; font-size: 11px; }
.has3d .screen .tt { font-size: 17px; }
.has3d .screen .box { flex-basis: 100%; background: rgba(255, 255, 255, .1); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 6px; padding: 6px 10px; }
.has3d .screen .box > * { margin: 0; }
.has3d .dev-form { margin-top: 8px; }
.has3d .pw { border: 1px solid rgba(255, 255, 255, .4); background: rgba(12, 12, 14, .7); }
.has3d .pw-warn { color: #ff9a90; text-align: left; }
.has3d .sticky { align-self: center; background: #EBDBBC; color: #141413; }
.has3d .layout { max-width: 1680px; }
.has3d .layout.solo:not(.title) { max-width: 760px; }
@media (min-width: 1201px) {
  .has3d .layout:not(.solo) { grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); }
  .has3d .bench { grid-template-columns: minmax(0, 1fr) minmax(400px, 500px); }
  .has3d .device-wrap { position: sticky; top: 72px; }
  .has3d .device-wrap .stage { height: calc(100vh - 256px); min-height: 320px; }
}

/* 标题画面 */
.has3d .layout.title { max-width: none; padding: 0; }
.has3d .story.intro-story {
  background: none;
  border: 0; border-radius: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  position: static; max-height: none; overflow: visible;
  min-height: calc(100vh - 52px); padding: 32px clamp(20px, 6vw, 96px);
  display: grid; grid-template-columns: minmax(0, 620px) minmax(0, 1fr); column-gap: 24px; align-content: center;
}
.has3d .layout.title::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, rgba(5, 5, 7, .8) 0%, rgba(5, 5, 7, .45) 36%, rgba(5, 5, 7, 0) 60%); }
.has3d .intro-story > p { max-width: 540px; }
.has3d .intro-story > * { grid-column: 1; }
.has3d .intro-story > .hero-stage { grid-column: 2; grid-row: 1 / span 6; height: 100%; min-height: 62vh; }
.has3d .hero-title { font-size: clamp(40px, 5.3vw, 80px); letter-spacing: .04em; white-space: nowrap; margin: 10px 0 18px; text-shadow: 0 4px 40px rgba(0, 0, 0, .7); }
.has3d .intro-story .lead { font-size: clamp(17px, 1.5vw, 21px); }
.has3d .intro-story .btn.big { background: var(--hl); border-color: var(--hl); padding: 12px 34px; }
.has3d .intro-story .btn.big:hover { background: #FF9D75; }
@media (max-width: 900px) {
  .has3d .story.intro-story { grid-template-columns: minmax(0, 1fr); align-content: start; padding-top: 0; }
  .has3d .layout.title::before { background: linear-gradient(180deg, rgba(5, 5, 7, 0) 34%, rgba(5, 5, 7, .8) 56%); }
  .has3d .intro-story > .hero-stage { grid-column: 1; grid-row: 1; height: 44vh; min-height: 0; }
}

/* 标题和正文用衬线体，按钮、标签这些界面元素用无衬线体 */
.hero-title, .ch-head h2, .brand-name, .world-title, .cpu-title { font-family: var(--serif); }
.story p, .story li, .disc, .win, .tip, .fb, .hint, .opt { font-family: var(--serif); }
.story .meta, .story .kicker, .story .ch-kicker { font-family: var(--sans); }
.hero-title, .ch-head h2 { font-weight: 700; }
/* 猜一猜、我的发现：世界退到后面当背景，压暗一点让文字好读 */
.has3d .layout.solo:not(.title)::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: rgba(5, 5, 7, .5); }

/* ---------- 游戏 HUD：去掉卡片感，面板贴边，开门时拉电影黑边 ---------- */
.cine-bar { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 45; pointer-events: none; transition: height .6s cubic-bezier(.2, .7, .2, 1); }
.cine-bar.up { top: 0; } .cine-bar.down { bottom: 0; }
body.cine .cine-bar { height: 10vh; }
.has3d .top, .has3d .story, .has3d .work, .has3d .foot { transition: opacity .5s; }
body.cine .top, body.cine .story, body.cine .work, body.cine .foot { opacity: .05; }
.has3d .top { background: linear-gradient(180deg, rgba(5, 5, 7, .88), rgba(5, 5, 7, 0)); border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.has3d .code-panel, .has3d .cpu { border-radius: 2px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(8, 8, 10, .62); box-shadow: none; }
.has3d .btn, .has3d .tab, .has3d .seg-btn, .has3d .opt, .has3d .chip, .has3d .pw, .has3d .screen, .has3d .lab-btn, .has3d .dot { border-radius: 2px; }
.has3d .layout:not(.solo) ~ .foot { display: none; }
@media (min-width: 1201px) {
  .has3d .layout:not(.solo) .story {
    background: linear-gradient(90deg, rgba(5, 5, 7, .82), rgba(5, 5, 7, .6) 72%, rgba(5, 5, 7, 0));
    border: 0; border-left: 2px solid rgba(var(--hl-rgb), .75); border-radius: 0; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

/* ---------- 3D HUD 对齐（只管 3D，线稿版的尺寸在下面它自己的块里） ---------- */
/* CPU 面板和代码面板内边距一致；四个状态格一样高：「下一条指令的地址」放得下一行（8 个字 96px，格内留 98.5px），万一换行，数值也照样落在格子底部同一条线上 */
body.has3d:not(.ink) .cpu { padding: 12px; }
body.has3d:not(.ink) .stat { padding-right: 4px; display: flex; flex-direction: column; justify-content: space-between; }
body.has3d:not(.ink) .cpu-head { align-items: baseline; }                     /* 「CPU」和按钮上的字同一条基线 */
/* 「声音」按钮字号小一号，高度跟「自由实验室」拉齐 */
body.has3d:not(.ink) .snd-btn { align-self: stretch; }
/* 对话框：输入行和下面那行说明之间也留 10px，跟其他段落一样 */
body.has3d:not(.ink) .dlg-edit { margin-bottom: 10px; }
/* 开门那几秒：屏幕条和密码框跟着其他界面一起淡下去，不被下面那条黑边切掉半行 */
body.has3d:not(.ink) .device-wrap { transition: opacity .5s; }
body.has3d.cine:not(.ink) .device-wrap { opacity: .05; }
/* 标题页的「开始」按钮不被网格行高拉长 */
body.has3d:not(.ink) .intro-story .actions { align-items: flex-start; }
/* 键盘焦点框用陶土橙，和输入框的焦点一致（原来是浅色版的蓝） */
body.has3d:not(.ink) :is(button, a, summary):focus-visible { outline-color: var(--hl); }
/* 会整页滚动的地方（猜一猜、我的发现，以及窄屏），顶栏底色铺到按钮下沿，滚上去的正文不会从导航后面透出来 */
body.has3d:not(.ink):has(.layout.solo:not(.title)) .top { background: linear-gradient(180deg, rgba(5, 5, 7, .97) calc(100% - 8px), rgba(5, 5, 7, 0)); }
@media (max-width: 1200px) {
  body.has3d:not(.ink) .top { background: linear-gradient(180deg, rgba(5, 5, 7, .97) calc(100% - 8px), rgba(5, 5, 7, 0)); }
}
/* 手机上关卡点放不下时从左边排起（居中会把第一个点挤到左边外面、滚也滚不到）；放得下时仍然居中。和线稿版同一个做法 */
@media (max-width: 860px) {
  body.has3d:not(.ink) .dots { justify-content: flex-start; }
  body.has3d:not(.ink) .dot:first-child { margin-left: auto; }
  body.has3d:not(.ink) .dot:last-child { margin-right: auto; }
}
@media (min-width: 1201px) {
  /* 密码框下面那行提示平时是空的，不再占 22px 高度：开门后屏幕变高时，整页不会多出一截滚动 */
  body.has3d:not(.ink) .device { position: relative; }
  body.has3d:not(.ink) .pw-warn { position: absolute; left: 0; right: 0; top: 100%; }
  /* 中间一栏左右留白一样（和故事栏之间也是 20px），屏幕条正好在两块面板正中 */
  body.has3d:not(.ink) .bench { column-gap: 20px; }
  /* 提示条对准中间那一栏（=视口中线往左 55px），落在密码框正下方，而不是偏到右边 */
  body.has3d:not(.ink):has(.bench:not([hidden])) .toast { left: calc(50% - 55px); }
}


/* ==========================================================================
   手绘线稿版（body.has3d.ink）：米白纸面、墨色描线、陶土橙强调。
   布局沿用上面 has3d 的规则，这里只换颜色。面板的边框不是 CSS 画的，是 ink.js 在画布上描的抖动线。
   ========================================================================== */
/* Claude 的字体不能打包。电脑上装了 Claude 桌面版的话，直接用它自带的那份；没有就退回 Source Serif 4 和系统字体。 */
@font-face { font-family: "Anthropic Serif"; font-weight: 300 800; font-display: swap; src: local("Anthropic Serif"); }
@font-face { font-family: "Anthropic Sans"; font-weight: 300 800; font-display: swap; src: local("Anthropic Sans"); }
.world-ink { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
/* 两套场景的画布都在页面里，只露出当前这一套；换的时候有一块幕布先盖住（见 stage.js） */
.ink .world3d { visibility: hidden; }
body:not(.ink) .world-ink { visibility: hidden; }
.tone-veil { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 90; pointer-events: none; opacity: 0; visibility: hidden; background: #000; }
:root { --arr-jcc: #e8c547; --arr-jmp: #7cb7ff; --arr-taken: #ff5f52; }
body.has3d.ink {
  --bg: #F0EEE6; --bg-rgb: 240, 238, 230; --paper: #FAF9F5; --paper-hi: #fff; --ink: #141413; --ink-rgb: 20, 20, 19; --ink-2: #3D3D3A; --on-ink: #FAF9F5; --on-hl: #FAF9F5;
  --muted: #6B6A63; --gray: #87867F; --hl: #D97757; --hl-2: #C4633F; --hl-rgb: 217, 119, 87; --red: #B5532F; --red-ink: #7A2E14;
  --ok: #5E7345; --olive: #788C5D; --olive-rgb: 120, 140, 93; --ok-ink: #2F3D20; --blue: #3F6E9E; --blue-rgb: 106, 155, 204;
  --r-code: #FAF9F5; --r-text: #D9E5DF; --r-secret: #EFE1C6; --r-input: #DCDBE8; --r-box: #F1DADA;
  --sw-off: #CFCCC0; --lamp-off: #E3DACC; --drop: rgba(20, 20, 19, .1);
  --card: transparent; --soft: rgba(var(--ink-rgb), .05); --line: rgba(var(--ink-rgb), .2); --hl-soft: rgba(var(--hl-rgb), .15);
  --ok-soft: rgba(var(--olive-rgb), .18); --bad: var(--red); --bad-soft: rgba(var(--hl-rgb), .15);
  --code-bg: transparent; --code-ink: var(--ink); --code-muted: var(--muted); --changed: var(--hl);
  --arr-jcc: var(--gray); --arr-jmp: var(--blue); --arr-taken: var(--hl);
  background: var(--bg); color-scheme: light;
}
/* 夜色线稿：同一套版式，纸换成黑的，线换成浅的，陶土橙的地方带一点光 */
body.has3d.ink.night {
  --bg: #0D0D0C; --bg-rgb: 13, 13, 12; --paper: #1C1B19; --paper-hi: #2A2826; --ink: #EDEAE0; --ink-rgb: 237, 234, 224; --ink-2: #CFCCC0; --on-ink: #141413; --on-hl: #141413;
  --muted: #A8A69C; --gray: #8E8C84; --hl: #F08A60; --hl-2: #FF9D75; --hl-rgb: 240, 138, 96; --red: #FF7A57; --red-ink: #FFC2AD;
  --ok: #A9C283; --olive: #A9C283; --olive-rgb: 169, 194, 131; --ok-ink: #D5E6BC; --blue: #8FB8E0; --blue-rgb: 143, 184, 224;
  --r-code: #1C1B19; --r-text: #1B2B26; --r-secret: #352C1C; --r-input: #262538; --r-box: #3A2424;
  --sw-off: #45433F; --lamp-off: #33312E; --drop: rgba(0, 0, 0, .55);
  --code-muted: var(--gray);
  color-scheme: dark;
}
.ink .top { background: linear-gradient(180deg, rgba(var(--bg-rgb), .97) 55%, rgba(var(--bg-rgb), 0)); border-bottom: 0; }
.ink .brand-ic { background: var(--hl); color: var(--on-hl); }
.ink .story, .ink .cpu, .ink .code-panel { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
.ink code, .ink .preview code { background: rgba(var(--ink-rgb), .07); }
.ink .dot:hover, .ink .lab-btn:hover { background: rgba(var(--ink-rgb), .07); }
.ink .dot.on, .ink .lab-btn.on, .ink .seg-btn.on, .ink .chip.sel, .ink .btn.primary, .ink .toast, .ink .badge { color: var(--on-ink); }
.ink .badge.r-code, .ink .badge.r-text, .ink .badge.r-secret, .ink .badge.r-input, .ink .badge.r-box { color: var(--ink); }
.ink .tasks li.done .tick, .ink .lab-list li.done .tick { color: var(--on-ink); }
.ink .tasks li.current { border-color: rgba(var(--hl-rgb), .6); }
.ink .opt, .ink .seg-btn, .ink textarea.finding, .ink .btn, .ink .pw, .ink .hexin, .ink .charin { background: var(--paper); color: var(--ink); }
.ink .seg-btn.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.ink .btn { border-color: var(--ink); }
.ink .btn:hover:not(:disabled) { background: var(--paper-hi); }
.ink .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.ink .btn.primary:hover:not(:disabled) { background: var(--ink-2); }
.ink .btn.pulse, .ink .device .btn.primary { background: var(--hl); border-color: var(--hl); color: var(--on-hl); }
.ink .btn.pulse:hover:not(:disabled), .ink .device .btn.primary:hover:not(:disabled) { background: var(--hl-2); }
.ink .dialog { background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 5px 6px 0 var(--drop); }
.ink .overlay { background: rgba(var(--bg-rgb), .8); }
.ink .foot { color: var(--code-muted); }
.ink .stage, .ink .stage:active { cursor: default; }
.ink .screen, .ink .screen.run, .ink .screen.stuck, .ink .screen.halted { background: transparent; border: 0; color: var(--ink); -webkit-backdrop-filter: none; backdrop-filter: none; }
.ink .screen.open { background: rgba(var(--olive-rgb), .17); color: var(--ok-ink); border: 0; }
.ink .screen.deny, .ink .screen.crash { background: rgba(var(--hl-rgb), .17); color: var(--red-ink); border: 0; }
.ink .screen .box { background: rgba(var(--ink-rgb), .06); }
.ink .screen { border-radius: 7px; }   /* 和画布描的圆角（7px）一样，开门/报错的底色不从描线的角上露出来 */
.ink .pw { border: 0; background: var(--paper); }
/* 密码框的边框是画布在元素边上描的线；底色往里收 2px，不把这条线的内侧一半盖掉（外框尺寸和文字位置不变） */
.ink .pw { border: 2px solid transparent; padding: 7px 10px; background-clip: padding-box; }
.ink .pw:focus { background-clip: border-box; }   /* 聚焦时还是原来那样：橙色框整圈盖住描线 */
.ink .pw-warn { color: var(--red); }
.ink .sticky { background: #EBDBBC; color: #141413; border: 1.5px solid #141413; box-shadow: 3px 4px 0 var(--drop); }
/* 便利贴贴在保险箱右边的空白处，不压键帽，也不压两边的面板 */
.ink .device-wrap { position: relative; }
.ink .dev-extra { position: static; height: 0; margin: 0; }
.ink .dev-extra .sticky { position: absolute; right: 4px; top: 46px; bottom: auto; font-size: 14.5px; padding: 9px 12px; max-width: 150px; line-height: 1.45; z-index: 4; }
.ink .dev-extra .sticky b { font-size: 19px; }
.ink .tip { border-left-color: var(--ink); }
.ink .layout.title::before, .ink .layout.solo:not(.title)::before, .ink .cine-bar { display: none; }
.ink .hero-title { text-shadow: none; letter-spacing: .02em; }
.ink .hero-title, .ink .ch-head h2 { font-weight: 600; }
.ink .ch-kicker, .ink .kicker { color: var(--hl); letter-spacing: .14em; font-weight: 700; }
.ink .intro-story .btn.big { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.ink .intro-story .btn.big:hover { background: var(--ink-2); }
body.ink.cine .top, body.ink.cine .story, body.ink.cine .work, body.ink.cine .foot { opacity: .1; }
.ink .code-panel, .ink .cpu { border: 0; background: transparent; }
.ink .tabs { border-color: var(--ink); }
.ink .tab + .tab { border-left-color: var(--ink); }
.ink .tab.on { background: var(--ink); color: var(--on-ink); }
.ink .btn.tiny { color: var(--ink); border-color: rgba(var(--ink-rgb), .45); background: transparent; }
.ink .btn.tiny:hover:not(:disabled) { background: rgba(var(--ink-rgb), .07); }
.ink .row.visited { background: rgba(var(--ink-rgb), .04); }
.ink .row.pc { background: rgba(var(--hl-rgb), .16); border-left-color: var(--hl); }
.ink .row.end-halted { border-left-color: var(--olive); }
.ink .row.end-crashed, .ink .row.end-stuck { border-left-color: var(--red); background: rgba(var(--hl-rgb), .14); }
.ink .row.pickable:hover { background: rgba(var(--blue-rgb), .16); outline: 1px dashed rgb(var(--blue-rgb)); }
.ink .row.pick-ok { background: rgba(var(--olive-rgb), .22); outline: 2px solid var(--olive); }
.ink .byte { border-color: rgba(var(--ink-rgb), .35); background: var(--paper); color: var(--ink); }
.ink .byte:hover { border-color: var(--ink); background: var(--paper-hi); }
.ink .byte.changed { border-color: var(--red); color: var(--on-hl); background: var(--hl); }
.ink .warn { color: var(--red); }
.ink .kind-jcc .zh-main, .ink .kind-bad .zh-main { color: var(--red); }
.ink .kind-jmp .zh-main { color: var(--blue); }
.ink .kind-call .zh-main { color: var(--ink); }
.ink .kind-nop .zh-main, .ink .kind-hlt .zh-main { color: var(--gray); }
.ink .odd-note { color: var(--red-ink); border-color: rgba(var(--hl-rgb), .5); }
.ink .cell { color: var(--ink); background: var(--paper); border-color: rgba(var(--ink-rgb), .22); }
.ink .cell:hover { border-color: var(--ink); }
.ink .cell.r-code { background: var(--r-code); }
.ink .cell.r-text { background: var(--r-text); }
.ink .cell.r-secret { background: var(--r-secret); }
.ink .cell.r-input { background: var(--r-input); }
.ink .cell.r-box { background: var(--r-box); }
.ink .cell.changed { background: var(--hl); color: var(--on-hl); border-color: var(--red); }
.ink .legend .l-code::before { background: var(--paper); box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), .4); }
.ink .legend .l-text::before { background: #BCD1CA; }
.ink .legend .l-secret::before { background: #D4A27F; }
.ink .legend .l-input::before { background: #CBCADB; }
.ink .legend .l-box::before { background: #EBCECE; }
.ink .switch .slider { background: var(--sw-off); }
.ink .switch .slider::after { background: var(--paper); }
.ink .switch input:checked + .slider { background: var(--olive); }
.ink .lamp { background: var(--lamp-off); }
.ink .lamp.on { background: var(--olive); box-shadow: none; }
/* 夜里：亮着的东西带一圈光 */
.night .btn.pulse, .night .device .btn.primary { box-shadow: 0 0 22px rgba(var(--hl-rgb), .45); }
.night .byte.changed, .night .cell.changed { box-shadow: 0 0 14px rgba(var(--hl-rgb), .55); }
.night .row.pc { box-shadow: inset 0 0 26px rgba(var(--hl-rgb), .12); }
.night .lamp.on { box-shadow: 0 0 10px rgba(var(--olive-rgb), .8); }
.night .switch .slider::after { background: #EDEAE0; }
.night .ch-kicker { text-shadow: 0 0 14px rgba(var(--hl-rgb), .55); }
.night .dialog { box-shadow: 0 0 0 1px rgba(var(--ink-rgb), .08), 0 24px 70px rgba(0, 0, 0, .7); }
/* 对话框标题旁的区域标签是浅底色，夜里字要用深色，不然浅字压在浅底上看不见 */
.night .badge.r-code, .night .badge.r-text, .night .badge.r-secret, .night .badge.r-input, .night .badge.r-box { color: var(--on-ink); }
@media (min-width: 1201px) {
  .ink .layout:not(.solo) .story { background: none; border: 0; padding-left: 22px; }
  .ink .device-wrap { position: sticky; }
  .ink .device-wrap .stage { height: calc(100vh - 262px); }
}
/* ---------- 线稿版的对齐 ---------- */
/* CPU 面板的内边距和代码面板一样是 12px，两块面板里的内容左右对齐；四格状态等宽，标签放得下一行，数值都落在格子底部同一条线上 */
.ink .cpu { padding: 12px; }
.ink .stat { padding: 6px 4px 6px 10px; display: flex; flex-direction: column; justify-content: space-between; }   /* 和 3D 版同一组数，换画风时字不跳 */
/* 会整页滚动的地方（猜一猜、我的发现、标题页，以及窄屏），顶栏底色铺到按钮下沿，滚上去的正文不会从导航后面透出来；关卡页不滚，保持原来的长渐隐 */
body.has3d.ink:has(.layout.solo) .top { background: linear-gradient(180deg, rgba(var(--bg-rgb), .97) calc(100% - 8px), rgba(var(--bg-rgb), 0)); }
@media (max-width: 1200px) {
  body.has3d.ink .top { background: linear-gradient(180deg, rgba(var(--bg-rgb), .97) calc(100% - 8px), rgba(var(--bg-rgb), 0)); }
}
/* 「CPU」和右边三个按钮的字落在同一条基线上 */
.ink .cpu-head { align-items: baseline; }
/* 字节对话框：输入框下面那行小字原来紧贴着输入框，和别的段落一样空 10px */
.ink .dlg-edit { margin-bottom: 10px; }
/* 标题页：左栏的格子被右边的保险箱撑高了，「开始」按钮不跟着被拉高 */
.ink .intro-story .actions { align-items: flex-start; }
/* 顶栏：「声音」按钮的字小一号，框的高度和「自由实验室」一样 */
.ink .snd-btn { align-self: stretch; }
/* 键盘焦点框用陶土橙，和 3D 版一致（原来是浅色版的蓝） */
.ink :is(button, a, summary):focus-visible { outline-color: var(--hl); }
/* 手机上关卡按钮放不下时，从左边开始排（居中会把第一个按钮切掉一半，而且滑不回去）；放得下时仍然居中 */
@media (max-width: 860px) {
  .ink .dots { justify-content: flex-start; }
  .ink .dot:first-child { margin-left: auto; }
  .ink .dot:last-child { margin-right: auto; }
}
/* 宽屏：中间一栏、密码框下的提示行、提示条的位置和 3D 版一样（见上面 3D HUD 对齐那段），换画风时保险箱和屏幕条不挪动 */
@media (min-width: 1201px) {
  .ink .bench { column-gap: 20px; }
  .ink .device { position: relative; }
  .ink .pw-warn { position: absolute; left: 0; right: 0; top: 100%; }
  body.has3d.ink:has(.bench:not([hidden])) .toast { left: calc(50% - 55px); }
}
/* 手机上保险箱右边没有空地，便利贴不再浮在画面上（会盖住门里的字），改成排在键帽和屏幕之间，靠右 */
@media (max-width: 560px) {
  .ink .dev-extra { height: auto; display: flex; justify-content: flex-end; padding-right: 4px; }
  .ink .dev-extra .sticky { position: static; }
}

/* ---------- 逐帧检查后补的几处 ---------- */
/* 选中文字的底色：跟着各画风的强调色走，不用浏览器默认的蓝 */
::selection { background: rgba(var(--hl-rgb, 217, 119, 87), .38); color: inherit; }
/* 弹窗关掉时淡出去 */
.overlay.closing { animation: fadeOut .14s ease-in forwards; pointer-events: none; }
@keyframes fadeOut { to { opacity: 0; } }
/* 便利贴第一次出现时浮上来（translate 和它本身歪着的 transform 互不影响） */
.sticky { animation: stickyIn .34s ease-out both; }
@keyframes stickyIn { from { opacity: 0; translate: 0 8px; } }
/* 左栏滚动以后，滚走的那一头渐隐（宽屏下左栏没有外框，只有一条竖线，竖线跟着一起淡掉） */
@media (min-width: 1201px) {
  body.has3d .layout:not(.solo) .story.cut {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--cut-t, 0px), #000 calc(100% - var(--cut-b, 0px)), transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 var(--cut-t, 0px), #000 calc(100% - var(--cut-b, 0px)), transparent 100%);
  }
}
