/* Ring Zero — 日式動漫・熱血（shonen）風：集中線・網点・粗黑框・爆裂標題 */

@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&family=RocknRoll+One&family=Zen+Kaku+Gothic+New:wght@500;700;900&family=Noto+Sans+TC:wght@500;700;900&family=Press+Start+2P&family=DotGothic16&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg: #16100c;          /* 焦土黑 */
  --bg2: #1f1611;
  --ink: #140d08;         /* 描線黑 */
  --paper: #f7efe2;       /* 漫畫紙白 */
  --surface: rgba(247, 239, 226, .04);
  --surface2: rgba(247, 239, 226, .08);
  --border: rgba(247, 239, 226, .16);
  --fg: #f4ece0;
  --dim: #b6aa97;
  --hi: #e8331d;          /* 熱血緋紅 — 主調 */
  --hi-deep: #b71f10;
  --orange: #ff7a18;      /* 橙 — 火焰 */
  --kin: #ffce1f;         /* 黄 — 閃光／勝利 */
  --ai: #34a0d8;          /* 必殺青 */
  --take: #7fc23a;        /* 通過綠 */
  /* 相容舊變數名 */
  --shu: var(--hi);
  --shu-deep: var(--hi-deep);
  --cyan: var(--ai);
  --amber: var(--kin);
  --violet: var(--hi);
  --green: var(--take);
  --red: var(--hi);
  --grad: var(--hi);
  --radius: 2px;
  --display: 'Dela Gothic One', 'Noto Sans TC', sans-serif;
  --impact: 'RocknRoll One', 'Noto Sans TC', sans-serif;
  --gothic: 'Zen Kaku Gothic New', 'Noto Sans TC', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --pixel: 'DotGothic16', monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--gothic); font-weight: 500;
  font-size: 15.5px; line-height: 1.85; -webkit-font-smoothing: antialiased;
}
canvas { image-rendering: pixelated; }

/* 網点（halftone）+ 火光 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1000px 460px at 50% -12%, rgba(232, 51, 29, .16), transparent 70%),
    radial-gradient(760px 520px at 100% 112%, rgba(255, 122, 24, .08), transparent 72%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(247, 239, 226, .05) 1px, transparent 1.4px);
  background-size: 6px 6px;
}

/* ── 頂欄 ── */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 22px;
  padding: 13px 28px; background: var(--ink);
  border-bottom: 3px solid var(--hi);
}
header h1 {
  margin: 0; font-family: 'Press Start 2P', monospace; font-size: 13px;
  color: var(--kin); letter-spacing: 1px;
  text-shadow: 2px 2px 0 var(--hi), 3px 3px 0 var(--ink);
  transform: skewX(-5deg);
}
header .boot { color: var(--dim); font-size: 12.5px; margin-left: auto; font-family: var(--mono); }
#crumbs { display: flex; gap: 6px; }
#crumbs .crumb {
  color: var(--fg); padding: 5px 16px; cursor: pointer;
  font-family: var(--impact); font-size: 14px; transition: all .12s;
  border: 2px solid transparent; transform: skewX(-6deg);
}
#crumbs .crumb:hover { color: var(--kin); }
#crumbs .crumb.on {
  color: var(--ink); background: var(--kin); border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--hi);
}

/* ── 場景 ── */
.scene { display: none; padding: 32px; max-width: 1280px; margin: 0 auto; }
.scene.on { display: block; animation: burst .3s cubic-bezier(.2, 1.2, .3, 1); }
@keyframes burst { from { opacity: 0; transform: scale(.97) translateY(10px) } to { opacity: 1 } }

/* 漫畫格（panel）：粗框＋硬陰影 */
.card {
  background: var(--bg2); border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink); border-radius: var(--radius); padding: 22px 24px;
}
h2.label {
  font-family: var(--gothic); font-weight: 900; font-size: 13px; color: var(--kin);
  letter-spacing: .18em; margin: 2px 0 16px;
}
h2.label::before { content: "▍"; color: var(--hi); margin-right: 6px; }

/* ── 場景1：地圖 ── */
#world { display: grid; grid-template-columns: 1fr 320px; gap: 26px; }
.chapter { margin-bottom: 30px; }
.chapter-name {
  font-family: var(--impact); font-size: 20px; margin: 0 0 16px;
  letter-spacing: .04em; display: inline-block;
  padding: 5px 18px; background: var(--hi); color: var(--paper);
  box-shadow: 4px 4px 0 var(--ink); border: 2px solid var(--ink);
}
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.room {
  position: relative; cursor: pointer; padding: 18px 20px;
  background: var(--bg2); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  transition: all .14s cubic-bezier(.2, 1.4, .3, 1);
}
.room:hover {
  transform: translate(-3px, -3px) rotate(-.6deg); border-color: var(--hi);
  box-shadow: 8px 8px 0 var(--hi);
}
.room.sel { border-color: var(--kin); box-shadow: 6px 6px 0 var(--kin); }
.room.sel::after {
  content: "！"; position: absolute; right: 8px; bottom: 4px;
  font-family: var(--display); color: var(--hi); font-size: 26px;
  text-shadow: 1px 1px 0 var(--ink);
}
.room .rt { font-family: var(--impact); font-weight: 700; font-size: 17px; }
.room .rm { color: var(--dim); font-size: 12.5px; margin-top: 5px; font-family: var(--mono); }
.room .dep-hint { color: var(--dim); font-size: 12px; margin-top: 6px; }
.room .dep-hint b { color: var(--ai); font-weight: 700; }
.room .torch-slot { position: absolute; right: 14px; top: 12px; }

#party { text-align: center; }
#party .hero-stand { margin: 6px auto 12px; width: fit-content; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
#party .hint { color: var(--dim); font-size: 13px; text-align: left; line-height: 1.95; }
#party .hint b { color: var(--kin); font-weight: 700; }

/* ── 場景2：任務簡報 ── */
#prep { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; }
#brief .title {
  font-family: var(--impact); font-size: 26px; margin: 0 0 8px; letter-spacing: .02em;
  color: var(--fg); line-height: 1.4; text-shadow: 2px 2px 0 var(--hi);
}
#brief .sub { color: var(--dim); font-size: 13px; margin-bottom: 16px; font-family: var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chip {
  font-size: 12px; font-family: var(--mono); font-weight: 700; padding: 3px 13px;
  border: 2px solid var(--ink); color: var(--ink); background: var(--ai);
  box-shadow: 2px 2px 0 var(--ink);
}
.objective { font-size: 14.5px; color: var(--fg); white-space: pre-wrap; line-height: 1.95; }
.checks-list { margin-top: 16px; }
.checks-list .ck {
  display: flex; gap: 10px; padding: 9px 0; border-top: 2px dotted var(--border); font-size: 13.5px;
}
.checks-list .ck .ico { color: var(--hi); font-weight: 700; }
.checks-list .ck .why { color: var(--dim); font-size: 12.5px; }

/* ── 書庫（原理教學・獨立閱讀） ── */
#library { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
#lib-list {
  position: sticky; top: 78px;
  background: var(--bg2); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); padding: 20px;
}
.lib-intro { color: var(--dim); font-size: 12.5px; line-height: 1.7; margin: 0 0 14px; }
.lib-section {
  font-family: var(--display); font-size: 13px; color: var(--hi);
  margin: 18px 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--ink);
}
.lib-section:first-child { margin-top: 0; }
.lib-sources {
  margin-top: 28px; padding-top: 16px; border-top: 2px dotted var(--border);
  font-size: 13px; color: var(--dim);
}
.lib-sources ul { margin: 8px 0 0; padding-left: 20px; }
.lib-sources li { margin: 4px 0; word-break: break-all; }
.lib-sources a { color: var(--ai); }
.lib-ch { margin-bottom: 16px; }
.lib-ch-name { font-family: var(--impact); font-size: 13px; color: var(--ai); margin-bottom: 6px; letter-spacing: .05em; }
.lib-item {
  padding: 8px 12px; cursor: pointer; color: var(--fg); font-size: 14px;
  border-left: 3px solid transparent; transition: all .12s;
}
.lib-item:hover { background: var(--surface2); border-left-color: var(--hi); }
.lib-item.on { background: var(--surface2); border-left-color: var(--kin); color: var(--kin); font-weight: 700; }

#lib-reader {
  background: var(--bg2); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  padding: 36px 44px; min-height: 70vh;
}
#lib-empty { color: var(--dim); padding: 60px 0; text-align: center; font-size: 15px; }
#lib-content { max-width: 760px; margin: 0 auto; }
.lib-crumb { font-family: var(--mono); font-size: 12px; color: var(--dim); margin-bottom: 8px; }
#lib-title {
  font-family: var(--impact); font-size: 30px; line-height: 1.35; margin: 0 0 24px;
  color: var(--fg); text-shadow: 2px 2px 0 var(--hi); padding-bottom: 16px;
  border-bottom: 3px solid var(--ink);
}
.lib-foot { margin-top: 36px; padding-top: 20px; border-top: 2px dotted var(--border); }

/* lesson markdown（書庫內文・大字距好讀） */
.md-h { font-family: var(--impact); color: var(--kin); margin: 30px 0 12px; line-height: 1.45; }
h1.md-h { font-size: 22px; color: var(--hi); }
h2.md-h { font-size: 19px; }
h3.md-h { font-size: 16px; color: var(--fg); }
.md-p { margin: 14px 0; font-size: 15.5px; line-height: 2; color: var(--fg); }
.md-list { margin: 12px 0 12px 4px; padding-left: 22px; }
.md-list li { margin: 8px 0; font-size: 15px; line-height: 1.9; }
.md-q {
  margin: 16px 0; padding: 12px 18px; border-left: 4px solid var(--ai);
  background: var(--surface); color: var(--dim); font-size: 14px; line-height: 1.85;
}
.md-pre {
  background: var(--ink); border: 2px solid var(--border); border-left: 4px solid var(--hi);
  padding: 14px 16px; overflow-x: auto; margin: 16px 0;
  font-family: var(--mono); font-size: 12.5px; color: var(--kin); line-height: 1.7;
}
#lib-body code {
  font-family: var(--mono); font-size: 13px; color: var(--ai);
  background: var(--surface2); padding: 1px 6px;
}
.md-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.md-table th { background: var(--surface2); color: var(--kin); font-family: var(--impact); }
.md-table td { color: var(--fg); line-height: 1.7; }
.md-hr { border: 0; border-top: 2px dotted var(--border); margin: 22px 0; }

/* 對話框（漫畫吹き出し風） */
#dialog {
  grid-column: 1 / -1; display: flex; gap: 18px; align-items: flex-start; cursor: pointer;
  border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 18px 22px; min-height: 92px;
}
#dialog .portrait { border: 2px solid var(--ink); background: var(--bg2); flex-shrink: 0; }
#dialog .name { font-family: var(--impact); font-size: 16px; color: var(--hi-deep); margin-bottom: 5px; }
#dialog .text { font-size: 16px; min-height: 40px; line-height: 1.8; font-weight: 700; color: var(--ink); }
#dialog .adv { color: var(--hi); animation: blink .8s steps(2) infinite; float: right; }
@keyframes blink { 50% { opacity: 0 } }

.steps { counter-reset: st; }
.step {
  display: flex; gap: 16px; padding: 14px 18px; margin-bottom: 12px;
  background: var(--bg2); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}
.step::before {
  counter-increment: st; content: counter(st);
  font-family: var(--display); font-size: 17px;
  color: var(--paper); background: var(--hi); border: 2px solid var(--ink);
  min-width: 34px; height: 34px; transform: skewX(-6deg);
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.step .what { font-family: var(--impact); font-size: 16px; }
.step .why { color: var(--dim); font-size: 13px; }

details.cli-alt { margin-top: 12px; color: var(--dim); font-size: 13px; }
details.cli-alt summary { cursor: pointer; }
.cmdline {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  background: var(--ink); border: 2px solid var(--border);
  padding: 8px 13px; font-family: var(--mono); font-size: 12.5px; color: var(--kin);
  overflow-x: auto; white-space: nowrap;
}
.cmdline button { margin-left: auto; flex-shrink: 0; padding: 4px 13px; font-size: 12px; }

/* ── 場景3：工作台 ── */
#bench { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; }
#editor-pane { display: flex; flex-direction: column; min-height: 560px; }
#file-tabs { display: flex; gap: 5px; }
.ftab {
  font-family: var(--mono); font-weight: 700; font-size: 12.5px; padding: 7px 16px;
  cursor: pointer; color: var(--dim);
  border: 2px solid var(--ink); border-bottom: none; background: var(--bg2);
}
.ftab.on { color: var(--ink); background: var(--kin); }
.ftab .ro { font-size: 10px; opacity: .65; margin-left: 5px; }
#editor-host {
  flex: 1; border: 3px solid var(--ink); overflow: hidden; background: #0f0a07; min-height: 460px;
}
#editor-host .cm-editor { height: 100%; font-size: 13.5px; }
#editor-host .cm-scroller { font-family: var(--mono); }
#editor-host textarea.fallback {
  width: 100%; height: 100%; min-height: 460px; background: #0f0a07; color: var(--fg);
  border: 0; padding: 14px; font-family: var(--mono); font-size: 13.5px; resize: none;
}
#editor-actions { display: flex; gap: 12px; margin-top: 14px; align-items: center; }
#save-state { color: var(--dim); font-size: 12.5px; font-family: var(--mono); }

/* 戰鬥舞台 — 集中線＋満月 */
#battle-stage {
  position: relative; height: 200px; overflow: hidden; border-radius: var(--radius);
  background: #0f0a07; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); margin-bottom: 16px;
}
#battle-stage::before {  /* 集中線 */
  content: ""; position: absolute; inset: -40%;
  background: repeating-conic-gradient(from 0deg at 50% 60%,
    rgba(255, 122, 24, .14) 0deg 1.4deg, transparent 1.4deg 5deg);
  animation: spin 26s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
#battle-stage::after {  /* 満月 */
  content: ""; position: absolute; right: 16%; top: 14%; width: 40px; height: 40px;
  border-radius: 50%; background: var(--kin); box-shadow: 0 0 26px rgba(255, 206, 31, .5);
}
#monster-spot { position: absolute; right: 12%; bottom: 26%; text-align: center; z-index: 2; }
#monster-spot canvas { animation: squish 1.6s ease-in-out infinite; }
@keyframes squish { 0%, 100% { transform: scaleY(1) } 50% { transform: scaleY(.86) translateY(5px) } }
#monster-spot.hit canvas { animation: hitflash .35s steps(2); }
@keyframes hitflash { 50% { filter: brightness(9) saturate(2); transform: translateX(10px) rotate(6deg) } }
#monster-spot.dead canvas { transition: all .8s; transform: rotate(220deg) scale(.05); opacity: 0; }
#hero-spot { position: absolute; left: 12%; bottom: 24%; z-index: 2; }
#hero-spot canvas { animation: bob 1.7s ease-in-out infinite; }
#monster-name {
  font-family: var(--display); font-size: 14px; color: var(--paper);
  text-shadow: 2px 2px 0 var(--hi), 3px 3px 0 var(--ink); margin-bottom: 6px;
}

#hp-row { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; }
.hp-seg {
  width: 17px; height: 11px; background: var(--take); border: 2px solid var(--ink);
  transition: all .2s;
}
.hp-seg.off { background: #2c2620; }
.hp-seg.crack { background: var(--hi); animation: crack .35s steps(3); }
@keyframes crack { 50% { transform: scale(1.6) rotate(20deg) } }

#side-pane .row { display: flex; gap: 10px; margin: 10px 0; }
#status { color: var(--dim); font-size: 13px; min-height: 20px; }

.check {
  display: flex; align-items: center; gap: 10px; margin: 7px 0; padding: 9px 15px;
  background: var(--bg2); border: 2px solid var(--ink); border-left: 5px solid var(--dim);
  opacity: 0; transform: translateX(-12px); transition: all .25s; font-size: 13.5px;
}
.check.show { opacity: 1; transform: none; }
.check.pass { border-left-color: var(--take); }
.check.fail { border-left-color: var(--hi); }
.check.pass .mark { color: var(--take); font-weight: 700; }
.check.fail .mark { color: var(--hi); font-weight: 700; }
.check .det { color: var(--dim); font-size: 12px; }

/* serial / 診斷 / 戰報 */
#below { margin-top: 20px; }
details.console { margin-bottom: 14px; }
details.console summary { cursor: pointer; color: var(--dim); font-size: 13px; user-select: none; font-family: var(--mono); }
#serial {
  background: #0f0a07; border: 2px solid var(--ink);
  height: 220px; overflow-y: auto; padding: 12px 16px; white-space: pre-wrap;
  font-family: var(--mono); font-size: 12px; color: #a89a86; margin-top: 8px;
}
#serial .marker { color: var(--take); font-weight: 700; }
#serial .bad { color: var(--hi); font-weight: 700; }

.diag {
  border: 2px solid var(--ink); border-left: 5px solid var(--hi);
  background: var(--bg2); padding: 10px 15px; margin: 9px 0; font-size: 13.5px; font-family: var(--mono);
}
.diag.warning { border-left-color: var(--kin); }
.diag .note { color: var(--dim); font-size: 12px; }
.diag .fixhint { color: var(--kin); font-size: 12.5px; font-weight: 700; }

#splat { display: none; margin-top: 16px; }
#splat .scroll {
  background: #0f0a07; border: 3px solid var(--hi); box-shadow: 5px 5px 0 var(--ink);
  padding: 16px; max-height: 440px; overflow-y: auto;
}
#splat pre { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
#splat .line { display: block; }
#splat .line.hl {
  background: rgba(232, 51, 29, .14); color: #ffd9d2;
  border-left: 4px solid var(--hi); padding-left: 8px; cursor: pointer;
}
#splat .line.hl::after { content: " ＋註解"; opacity: .55; font-size: 10.5px; }
#splat .note {
  display: block; margin: 6px 0 10px 20px; padding: 11px 15px;
  background: var(--bg2); border: 2px solid var(--ink); border-left: 5px solid var(--kin);
  color: var(--fg); font-size: 13.5px; font-family: var(--gothic); white-space: pre-wrap;
}
#splat .srcline { color: var(--ai); font-weight: 700; }

/* 提示 modal */
#hint-modal {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 5, 3, .8); align-items: center; justify-content: center;
}
#hint-modal.on { display: flex; }
#hint-modal .inner {
  max-width: 560px; width: 92%; display: flex; gap: 18px;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--hi); padding: 24px;
}
#hint-modal .name { font-family: var(--impact); font-size: 17px; color: var(--hi-deep); }
#hint-modal .tiertag { color: #7a6f5e; font-size: 12px; font-family: var(--mono); }
#hint-modal .text { white-space: pre-wrap; font-size: 15px; margin-top: 6px; font-weight: 700; }

/* cut-in（決め台詞・必殺演出） */
.cutin {
  position: fixed; left: 0; right: 0; top: 34%; z-index: 95; display: none;
  padding: 38px 0; text-align: center; transform: skewY(-3deg);
  font-family: var(--display); letter-spacing: .2em;
}
.cutin .big { font-size: 56px; -webkit-text-stroke: 2px var(--ink); }
.cutin .small { font-size: 13px; margin-top: 16px; opacity: .95; font-family: var(--impact); letter-spacing: .08em; -webkit-text-stroke: 0; }
#cutin-death {
  background: linear-gradient(90deg, transparent, var(--hi-deep) 14%, #7a140a 86%, transparent);
  color: var(--kin); text-shadow: 0 0 18px rgba(232, 51, 29, .9);
}
#cutin-victory {
  background: linear-gradient(90deg, transparent, var(--orange) 14%, var(--hi) 86%, transparent);
  color: var(--paper); text-shadow: 0 0 18px rgba(255, 206, 31, .9);
}
.cutin::before {  /* 集中線 */
  content: ""; position: absolute; inset: -50% 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(255, 255, 255, .22) 0deg 1deg, transparent 1deg 4deg);
}
.cutin.show { display: block; animation: cutin 2.4s ease forwards; }
@keyframes cutin {
  0% { transform: skewY(-3deg) scale(.5); opacity: 0 }
  12% { transform: skewY(-3deg) scale(1); opacity: 1 }
  82% { transform: skewY(-3deg) scale(1); opacity: 1 }
  100% { transform: skewY(-3deg) scale(1.15); opacity: 0 }
}
body.shake { animation: shake .45s steps(6); }
@keyframes shake {
  25% { transform: translate(7px, -5px) } 50% { transform: translate(-7px, 5px) }
  75% { transform: translate(5px, 3px) }
}

/* ── 漫畫動作按鈕（無漸層・無玻璃） ── */
button {
  font-family: var(--display); font-size: 14px; cursor: pointer;
  color: var(--paper); background: var(--hi);
  border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 10px 24px; letter-spacing: .04em;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .1s;
}
button:hover { background: var(--orange); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button:disabled { opacity: .45; cursor: wait; box-shadow: 2px 2px 0 var(--ink); transform: none; }
button.ghost { background: var(--bg2); color: var(--fg); }
button.ghost:hover { background: var(--surface2); color: var(--kin); }
button.warn { background: var(--kin); color: var(--ink); }
button.warn:hover { background: var(--orange); color: var(--paper); }
input[type=text] {
  background: #0f0a07; color: var(--fg); border: 2px solid var(--ink);
  border-radius: var(--radius); padding: 9px 14px; font-family: var(--mono); font-size: 13px; flex: 1;
}
input[type=text]:focus { outline: none; border-color: var(--hi); }

/* ════════ 淺色主題（漫畫紙白）════════ */
:root[data-theme="light"] {
  --bg: #f3ead9;
  --bg2: #fffdf6;
  --paper: #fffdf6;
  --surface: rgba(22, 16, 10, .035);
  --surface2: rgba(22, 16, 10, .09);
  --border: rgba(22, 16, 10, .22);
  --fg: #1d150d;
  --dim: #6a5d4b;
  --hi: #d8341d;
  --hi-deep: #a81f10;
  --orange: #e8600a;
  --kin: #b07d00;       /* 深金茶：白底可讀的文字色 */
  --ai: #1f6f9e;        /* 深青：白底連結 */
  --take: #4f7d22;      /* 深綠 */
}
/* 網点改墨點 */
:root[data-theme="light"] body::after {
  background-image: radial-gradient(rgba(22, 16, 10, .06) 1px, transparent 1.4px);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(900px 360px at 50% -12%, rgba(216, 52, 29, .08), transparent 72%),
    radial-gradient(700px 480px at 100% 112%, rgba(31, 111, 158, .05), transparent 74%);
}
/* 永遠暗底的表面（終端／程式碼／戰場）— 內部色固定亮，不隨主題反白 */
:root[data-theme="light"] #serial .marker { color: #7fc23a; }
:root[data-theme="light"] #serial .bad { color: #ff6a5a; }
:root[data-theme="light"] #serial { color: #b3a794; }
:root[data-theme="light"] .md-pre { color: #ffce1f; }
:root[data-theme="light"] .cmdline { color: #ffce1f; }
:root[data-theme="light"] .install pre { color: #ffce1f; }
:root[data-theme="light"] #editor-host textarea.fallback { color: #ece6da; }
:root[data-theme="light"] #monster-name { color: #fffdf6; }
/* 頭部維持暗條 → 內部字色固定亮色（否則跟著翻深、暗底深字看不清） */
:root[data-theme="light"] header { background: var(--ink); }
:root[data-theme="light"] header h1 { color: #ffce1f; }
:root[data-theme="light"] header .boot { color: #b6aa97; }
:root[data-theme="light"] #crumbs .crumb { color: #f4ece0; }
:root[data-theme="light"] #crumbs .crumb:hover { color: #ffce1f; }
:root[data-theme="light"] #crumbs .crumb.on { color: #16100c; background: #ffce1f; border-color: #16100c; }
:root[data-theme="light"] .theme-btn { color: #ffce1f; border-color: rgba(247, 239, 226, .22); }
:root[data-theme="light"] .theme-btn:hover { color: #ff7a18; }

/* 主題切換鈕（小、低調，覆寫動作按鈕樣式） */
.theme-btn {
  font-family: var(--gothic); font-size: 16px; line-height: 1;
  background: transparent; color: var(--kin); border: 2px solid var(--border);
  box-shadow: none; padding: 6px 11px; transform: none;
}
.theme-btn:hover { background: transparent; color: var(--hi); transform: none; box-shadow: none; }
.theme-btn:active { transform: none; box-shadow: none; }
