/* Rainhaven 1947 — modern dark UI with pixel-art illustration (Codédex-inspired). */
:root {
  --bg: #0a0e1c;
  --bg2: #0f1427;
  --panel: #121a33;
  --panel2: #18213f;
  --line: #2a3561;
  --line2: #3a4780;
  --text: #e8ebf7;
  --muted: #9aa4cc;
  --dim: #6b76a3;
  --yellow: #ffd23f;
  --yellow-d: #c9960b;
  --pink: #ff4f8b;
  --teal: #3ee6c1;
  --red: #ff5d5d;
  --blue: #5aa8ff;
  --purple: #a78bfa;
  --pixel: 'Jersey 10', 'Courier New', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: Menlo, Consolas, 'SF Mono', Monaco, 'Liberation Mono', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
body { overflow-x: hidden; }
button { font: inherit; color: inherit; }
canvas.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
:not(pre) > code { background: #0b1022; border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: #ffe38a; }
a { color: var(--yellow); }
h1, h2, h3, .pxf { font-family: var(--pixel); font-weight: 700; letter-spacing: 0.5px; }
h1 { font-size: 34px; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.boot-title { font-family: var(--pixel); font-size: 42px; color: var(--yellow); text-shadow: 3px 3px 0 #7a1f3d; }
.boot-sub { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { font-family: var(--pixel); font-weight: 700; font-size: 16px; cursor: pointer; border: 2px solid #000; border-radius: 6px;
  padding: 9px 18px; background: var(--yellow); color: #1a1405; box-shadow: 0 4px 0 var(--yellow-d), 0 4px 0 2px #000;
  transition: transform .06s, box-shadow .06s; user-select: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--yellow-d), 0 1px 0 2px #000; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line2); box-shadow: 0 4px 0 #070a16; }
.btn.ghost:hover { border-color: var(--muted); }
.btn.teal { background: var(--teal); box-shadow: 0 4px 0 #1a9c80, 0 4px 0 2px #000; }
.btn.pink { background: var(--pink); color: #fff; box-shadow: 0 4px 0 #a92a58, 0 4px 0 2px #000; }
.btn.small { font-size: 13px; padding: 5px 11px; }
.btn.big { font-size: 20px; padding: 12px 28px; }
.iconbtn { background: transparent; border: 2px solid transparent; border-radius: 8px; padding: 4px 8px; cursor: pointer; color: var(--muted);
  font-family: var(--pixel); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.iconbtn:hover { color: var(--text); border-color: var(--line); background: var(--panel); }
.iconbtn .ico { font-size: 17px; line-height: 1; }
.iconbtn.on { color: var(--yellow); }
.info-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--yellow); color: var(--yellow); background: transparent;
  font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 18px; cursor: pointer; }
.info-btn:hover, .info-btn.on { background: var(--yellow); color: #111; }

.tag { display: inline-block; border: 1.5px solid var(--line2); border-radius: 999px; padding: 2px 11px; font-size: 12px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tag.y { border-color: var(--yellow); color: var(--yellow); }
.tag.p { border-color: var(--pink); color: var(--pink); }
.tag.t { border-color: var(--teal); color: var(--teal); }
.tag.r { border-color: var(--red); color: var(--red); }

.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 10px; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 18px 20px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(8, 11, 24, 0.96); border-bottom: 2px solid var(--line); backdrop-filter: blur(4px); }
.logo { font-family: var(--pixel); font-weight: 700; font-size: 20px; color: var(--text); display: flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.logo .coin { width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); border: 2px solid #000; box-shadow: inset -3px -3px 0 var(--yellow-d); }
.logo small { color: var(--pink); font-size: 14px; }
.topbar .spacer { flex: 1; }
.topbar .chap { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-card { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 4px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.avatar-card:hover { border-color: var(--line2); }
.avatar-card canvas { width: 36px; height: 36px; border-radius: 6px; background: #1d2750; }
.avatar-card .nm { font-weight: 700; font-size: 13px; line-height: 1.1; }
.avatar-card .rk { font-size: 11px; color: var(--yellow); font-family: var(--pixel); }
.badge-tally { font-family: var(--pixel); color: var(--yellow); font-size: 15px; white-space: nowrap; }

/* ---------- banner ---------- */
.banner { position: relative; width: 100%; background: #070a15; border-bottom: 2px solid var(--line); overflow: hidden; }
.banner canvas { width: 100%; height: auto; }
.banner.short canvas { height: clamp(150px, 24vh, 230px); object-fit: cover; object-position: 50% 80%; }
.banner .banner-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 6%; pointer-events: none; }
.banner .banner-overlay > * { pointer-events: auto; }
.banner h1 { font-size: clamp(28px, 4.2vw, 56px); text-shadow: 4px 4px 0 #000, 0 0 24px rgba(0, 0, 0, .7); margin: 8px 0; }
.banner p { max-width: 640px; text-shadow: 2px 2px 0 #000; font-size: 16px; margin: 0 0 14px; }

/* ---------- title screen ---------- */
.title-screen { min-height: 100vh; display: flex; flex-direction: column; }
.title-screen .banner { flex: 1; display: flex; }
.title-screen .banner canvas { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; position: absolute; inset: 0; }
.title-screen .banner-overlay { background: linear-gradient(90deg, rgba(5,7,16,.88) 0%, rgba(5,7,16,.6) 42%, rgba(5,7,16,0) 68%); }
.title-logo { font-family: var(--pixel); font-weight: 700; font-size: clamp(44px, 8vw, 104px); line-height: .95; color: var(--yellow);
  text-shadow: 5px 5px 0 #7a1f3d, 10px 10px 0 #000; margin: 0; }
.title-sub { font-family: var(--sans); font-weight: 600; font-size: clamp(16px, 1.6vw, 21px); color: #fff; text-shadow: 2px 2px 0 #000; margin: 10px 0 24px; max-width: 560px; }
.title-menu { display: flex; gap: 14px; flex-wrap: wrap; }
.title-foot { padding: 10px 18px; color: var(--dim); font-size: 12px; display: flex; justify-content: space-between; background: #070a15; border-top: 2px solid var(--line); }

/* ---------- generic page ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.center-page { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 30px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

input.txt { font: inherit; background: #0b1022; border: 2px solid var(--line2); color: var(--text); border-radius: 8px; padding: 10px 12px; width: 100%; font-size: 17px; }
input.txt:focus { outline: none; border-color: var(--yellow); }

/* ---------- character creator ---------- */
.creator { display: grid; grid-template-columns: 300px 1fr; gap: 22px; max-width: 980px; width: 100%; }
@media (max-width: 860px) { .creator { grid-template-columns: 1fr; } }
.creator .stage { background: radial-gradient(circle at 50% 70%, #26335f, #0c1124 70%); border: 2px solid var(--line); border-radius: 10px; display: flex;
  flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 10px; }
.creator .stage canvas { width: 192px; height: 288px; }
.preset-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.preset { background: #0e1430; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; padding: 4px; display: flex; flex-direction: column; align-items: center; }
.preset canvas { width: 64px; height: 64px; }
.preset.sel { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(255, 210, 63, .25); }
.preset span { font-size: 11px; color: var(--muted); }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.swatch { width: 30px; height: 30px; border-radius: 6px; border: 2px solid #000; cursor: pointer; box-shadow: 0 0 0 2px var(--line); }
.swatch.sel { box-shadow: 0 0 0 3px var(--yellow); }
.label { font-family: var(--pixel); font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ---------- dialogue / cutscene ---------- */
.dialogue { display: flex; gap: 14px; align-items: flex-start; }
.dialogue .portrait { flex: 0 0 auto; width: 96px; height: 96px; border-radius: 8px; border: 2px solid var(--line2); background: #1b2447; }
.dialogue .speech { flex: 1; }
.dialogue .who { font-family: var(--pixel); color: var(--yellow); font-size: 15px; }
.dialogue .said { font-size: 16px; min-height: 3em; white-space: pre-wrap; }
.cutscene { max-width: 900px; width: 100%; }
.cutscene .banner { border: 2px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.cutscene .card { min-height: 170px; }
.cut-actions { display: flex; justify-content: space-between; margin-top: 12px; align-items: center; }
.caret::after { content: '▋'; animation: blink 1s steps(2) infinite; color: var(--yellow); margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- briefing / roadmap ---------- */
.roadmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.road { border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel2); position: relative; }
.road .n { font-family: var(--pixel); color: var(--dim); font-size: 12px; }
.road .t { font-family: var(--pixel); font-size: 15px; }
.road .c { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.road.done { border-color: var(--teal); }
.road.done::after { content: '✔'; position: absolute; top: 8px; right: 10px; color: var(--teal); font-weight: 700; }
.road.cert { background: linear-gradient(135deg, #3b2a05, #1c1606); border-color: var(--yellow); }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rule { border: 2px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--panel2); }
.rule .h { font-family: var(--pixel); font-size: 15px; margin-bottom: 4px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 18px; }
.stat { border: 2px solid var(--line); border-radius: 8px; padding: 8px 14px; background: var(--panel2); }
.stat b { font-family: var(--pixel); font-size: 22px; color: var(--yellow); display: block; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- map ---------- */
.map-wrap { position: relative; }
.map-canvas { width: 100%; height: auto; cursor: pointer; border-bottom: 2px solid var(--line); }
.map-hud { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 12px 18px; background: var(--bg2); border-bottom: 2px solid var(--line); }
.map-tip { position: absolute; pointer-events: none; background: rgba(8, 11, 24, .96); border: 2px solid var(--line2); border-radius: 8px; padding: 8px 12px;
  font-size: 13px; max-width: 260px; z-index: 5; }
.map-tip .t { font-family: var(--pixel); font-size: 15px; }
.chapter-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.chap-card { padding: 14px 16px; }
.chap-card.locked { opacity: .5; }
.chap-card .missions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mnode { font-family: var(--pixel); font-size: 12px; border: 2px solid var(--line2); border-radius: 6px; padding: 3px 8px; cursor: pointer; background: var(--panel2); }
.mnode:hover { border-color: var(--yellow); }
.mnode.done { border-color: var(--teal); color: var(--teal); }
.mnode.boss { border-color: var(--pink); }
.mnode.locked { cursor: not-allowed; opacity: .45; }
.mnode.int { border-style: dashed; border-color: var(--purple); color: var(--purple); }
.mnode.next { background: var(--yellow); color: #111; border-color: #000; }

/* ---------- mission screen ---------- */
.mission { display: grid; grid-template-columns: minmax(330px, 420px) 1fr; gap: 18px; padding: 18px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 1000px) { .mission { grid-template-columns: 1fr; } }
.mission .left, .mission .right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.story-card .said { font-size: 15.5px; }
.task-card { border-color: var(--yellow); background: linear-gradient(180deg, #1c1a10, var(--panel) 60%); }
.task-card .h { font-family: var(--pixel); color: var(--yellow); font-size: 15px; margin-bottom: 4px; }
.task-card .task { font-size: 15.5px; }
.trap-card { border-color: var(--pink); background: linear-gradient(180deg, #2a0f1c, var(--panel) 70%); }
.trap-card .h { color: var(--pink); font-family: var(--pixel); }
.clue-log { max-height: 190px; overflow: auto; font-size: 13.5px; }
.clue-log li { margin-bottom: 4px; }
.editor-card { padding: 0; overflow: hidden; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 2px solid var(--line); background: var(--panel2); gap: 10px; flex-wrap: wrap; }
.editor-head .t { font-family: var(--pixel); font-size: 14px; color: var(--muted); }
.editor-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); }
.CodeMirror { height: 190px; font-family: var(--mono); font-size: 14.5px; background: #0a0f22; color: #e8ebf7; }
.CodeMirror-gutters { background: #0a0f22; border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: #4b5687; }
.CodeMirror-cursor { border-left: 2px solid var(--yellow); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: #2a3a78 !important; }
.CodeMirror-matchingbracket { color: var(--teal) !important; text-decoration: underline; }
.cm-s-default .cm-keyword { color: #ff7ab0; font-weight: 600; }
.cm-s-default .cm-builtin, .cm-s-default .cm-type { color: #7cc4ff; }
.cm-s-default .cm-string { color: #b9f18c; }
.cm-s-default .cm-number { color: #ffb86b; }
.cm-s-default .cm-comment { color: #6b76a3; font-style: italic; }
.cm-s-default .cm-operator { color: #ffd23f; }
.cm-s-default .cm-variable-2 { color: #c7b8ff; }
.CodeMirror-placeholder { color: #4b5687 !important; }
.CodeMirror-hints { background: #121a33; border: 2px solid var(--line2); font-family: var(--mono); font-size: 13px; z-index: 100; }
.CodeMirror-hint { color: var(--text); }
li.CodeMirror-hint-active { background: var(--yellow); color: #111; }
.feedback { padding: 12px 16px; border-radius: 10px; border: 2px solid; display: flex; gap: 12px; align-items: center; font-size: 15px; }
.feedback .fx { font-family: var(--pixel); font-size: 17px; white-space: nowrap; }
.feedback.ok { border-color: var(--teal); background: #0c2a26; }
.feedback.ok .fx { color: var(--teal); }
.feedback.bad { border-color: var(--red); background: #2a1016; }
.feedback.bad .fx { color: var(--red); }
.feedback.err { border-color: #b98a2b; background: #2a200c; }
.feedback.err .fx { color: var(--yellow); }
.feedback.err .msg { font-family: var(--mono); font-size: 13px; }
.attempts { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.badges { color: var(--yellow); letter-spacing: 2px; font-size: 16px; }
.badges .off { color: #333a5c; }
.results { overflow: auto; max-height: 360px; border-radius: 0 0 10px 10px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.grid th { position: sticky; top: 0; background: #1b2550; color: #cdd5ff; text-align: left; padding: 7px 10px; font-weight: 700; border-bottom: 2px solid var(--line2); white-space: nowrap; }
table.grid td { padding: 6px 10px; border-bottom: 1px solid #1e2748; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
table.grid tr:nth-child(even) td { background: #0f1630; }
table.grid td.null { color: #69739f; font-style: italic; }
.result-meta { padding: 6px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.timer { font-family: var(--pixel); font-size: 26px; color: var(--pink); text-shadow: 0 0 12px rgba(255, 79, 139, .6); }
.timer.low { animation: pulse .5s infinite alternate; color: var(--red); }
@keyframes pulse { to { transform: scale(1.08); } }
.boss-steps { display: flex; gap: 6px; margin-top: 6px; }
.boss-steps span { width: 26px; height: 8px; border-radius: 3px; background: var(--line); }
.boss-steps span.done { background: var(--teal); }
.boss-steps span.cur { background: var(--pink); }

/* ---------- drawers ---------- */
.drawer { position: fixed; top: 60px; right: 0; bottom: 0; width: min(430px, 96vw); background: #0d1328; border-left: 2px solid var(--line2);
  z-index: 40; transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .5); }
.drawer.open { transform: translateX(0); }
.drawer .dh { padding: 14px 16px; border-bottom: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer .db { padding: 14px 16px; overflow: auto; flex: 1; }
.drawer.left { right: auto; left: 0; border-left: none; border-right: 2px solid var(--line2); transform: translateX(-105%); }
.drawer.left.open { transform: translateX(0); }
.cheat { border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel); }
.cheat .h { font-family: var(--pixel); font-size: 14.5px; color: var(--yellow); display: flex; justify-content: space-between; }
.cheat pre { margin: 6px 0 2px; font-family: var(--mono); font-size: 12.5px; background: #080c1c; border-radius: 6px; padding: 8px; white-space: pre-wrap; color: #cfe3ff; }
.cheat p { margin: 4px 0; font-size: 13.5px; color: var(--muted); }
.cheat-section { font-family: var(--pixel); color: var(--muted); font-size: 13px; letter-spacing: 1.5px; margin: 16px 0 8px; text-transform: uppercase; }
.cheat.locked { opacity: .35; }
.tbl-card { border: 1.5px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--panel); overflow: hidden; }
.tbl-card .th { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: var(--panel2); }
.tbl-card .th b { font-family: var(--mono); color: var(--yellow); }
.tbl-card table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl-card td { padding: 3px 10px; border-top: 1px solid #1e2748; font-family: var(--mono); }
.tbl-card td.ty { color: #7cc4ff; }
.tbl-card td.k { color: var(--pink); white-space: nowrap; }
.tbl-card td.note { color: var(--dim); font-family: var(--sans); font-size: 11.5px; }
.peek { overflow: auto; max-height: 220px; border-top: 1px solid var(--line); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(3, 5, 12, .78); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 2px solid var(--line2); border-radius: 12px; max-width: 820px; width: 100%; max-height: 92vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: pop .18s; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal .mh { padding: 16px 22px 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal .mb { padding: 4px 22px 18px; }
.modal .mf { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 2px solid var(--line); flex-wrap: wrap; }
.modal.wide { max-width: 1100px; }
.xbtn { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.xbtn:hover { color: var(--text); }
.lesson .syntax { background: #080c1c; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; color: #cfe3ff; }
.lesson .try { margin-top: 12px; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.lesson .try .CodeMirror { height: auto; min-height: 70px; max-height: 200px; }
.lesson p { margin: 8px 0; }
.lesson ul { margin: 6px 0; padding-left: 20px; }
.trap-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .trap-vs { grid-template-columns: 1fr; } }
.trap-vs .bad { border-color: var(--red); }
.trap-vs .good { border-color: var(--teal); }
.trap-vs .lbl { font-family: var(--pixel); font-size: 13px; padding: 6px 10px; }
.trap-vs .bad .lbl { color: var(--red); }
.trap-vs .good .lbl { color: var(--teal); }
.notebook { display: grid; grid-template-columns: 240px 1fr; gap: 16px; min-height: 420px; }
@media (max-width: 760px) { .notebook { grid-template-columns: 1fr; } }
.nb-list { border-right: 2px solid var(--line); padding-right: 10px; max-height: 64vh; overflow: auto; }
.nb-item { padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.nb-item:hover { background: var(--panel2); }
.nb-item.sel { background: var(--yellow); color: #111; }
.nb-item.trap::before { content: '⚠ '; color: var(--pink); }
.nb-item.sel.trap::before { color: #111; }

/* ---------- win / fail ---------- */
.win-badges { font-size: 44px; letter-spacing: 8px; color: var(--yellow); text-shadow: 3px 3px 0 #000; text-align: center; }
.win-badges .off { color: #333a5c; }
.reward-box { border: 2px dashed var(--yellow); border-radius: 8px; padding: 10px 14px; background: #1c1a10; margin-top: 10px; }
.reward-box .h { font-family: var(--pixel); color: var(--yellow); font-size: 14px; }

/* ---------- tour ---------- */
.tour-back { position: fixed; inset: 0; z-index: 80; pointer-events: auto; }
.tour-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(3, 5, 12, .8); border: 3px solid var(--yellow); transition: all .25s; pointer-events: none; }
.tour-tip { position: fixed; z-index: 81; max-width: 340px; background: var(--panel); border: 2px solid var(--yellow); border-radius: 10px; padding: 14px 16px; }
.tour-tip .h { font-family: var(--pixel); color: var(--yellow); font-size: 16px; }
.tour-tip .f { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #111831; border: 2px solid var(--yellow); border-radius: 10px; padding: 10px 16px; font-family: var(--pixel); font-size: 15px; animation: pop .2s; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }

/* ---------- wardrobe ---------- */
.wardrobe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cos { border: 2px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; text-align: center; background: var(--panel2); }
.cos.on { border-color: var(--yellow); }
.cos.locked { opacity: .45; cursor: not-allowed; }
.cos .n { font-family: var(--pixel); font-size: 14px; }
.cos .u { font-size: 11.5px; color: var(--muted); }

/* ---------- certificate ---------- */
.cert-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cert-wrap canvas { width: min(1000px, 100%); height: auto; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }

@media print {
  body * { visibility: hidden; }
  .print-me, .print-me * { visibility: visible; }
  .print-me { position: fixed; left: 0; top: 0; width: 100% !important; }
}
