:root {
  --bg: #0f0d0b; --bg2: #17130f; --panel: #1e1813; --line: #3a2e24; --ink: #e6dccb; --muted: #9a8b76; --accent: #d9a441; --accent2: #7fb2d1;
  --say: #f1e9d8; --pose: #d8c9a8; --ooc: #8fb7d6; --sys: #c7b58f; --err: #e07b6b; --enc: #f0c56b; --npc: #c9a8e8; --notice: #9ad19a; --announce: #ffd37a; --room: #e8c77a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, Segoe UI, Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--err); min-height: 1.2em; margin-top: 6px; }
button, input, select, textarea { font: inherit; }
input, select, textarea { background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); }
button { background: #2a221b; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1a1408; font-weight: 600; border-color: transparent; }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 4px; }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }

.panel.center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.panel h1 { font-family: Georgia, serif; color: var(--accent); letter-spacing: 1px; margin: 0 0 6px; }
.panel .tag { color: var(--muted); margin: 0 0 20px; text-align: center; max-width: 480px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.box .primary { width: 100%; margin-top: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button { flex: 1; background: transparent; border: 1px solid transparent; border-bottom: 2px solid var(--line); border-radius: 0; color: var(--muted); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
#char_list .charbtn { display: flex; justify-content: space-between; width: 100%; margin: 6px 0; text-align: left; }
#char_list .charbtn small { color: var(--muted); }
details summary { cursor: pointer; color: var(--accent); margin: 12px 0 4px; }

#game { height: 100vh; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header .brand { font-family: Georgia, serif; color: var(--accent); font-weight: bold; letter-spacing: .5px; }
header .loc { color: var(--room); }
header .time { color: var(--muted); font-size: 13px; }
header .spacer { flex: 1; }
.pill { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; font-size: 13px; }
.hbtn { padding: 4px 10px; font-size: 13px; text-decoration: none; color: var(--ink); }
main { flex: 1; display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
#logwrap { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
#log { flex: 1; overflow-y: auto; padding: 12px 16px; font-family: Georgia, 'Times New Roman', serif; font-size: 16px; line-height: 1.5; }
#log > div { margin: 0 0 6px; white-space: pre-wrap; word-wrap: break-word; }
#log .t-echo { color: #6d6154; font-family: system-ui, sans-serif; font-size: 13px; margin-top: 8px; }
#log .t-say { color: var(--say); } #log .t-pose { color: var(--pose); font-style: italic; }
#log .t-ooc { color: var(--ooc); font-family: system-ui, sans-serif; font-size: 14px; }
#log .t-sys, #log .t-help { color: var(--sys); } #log .t-help { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; }
#log .t-err { color: var(--err); } #log .t-whisper, #log .t-page { color: #e6b3d6; font-style: italic; }
#log .t-spoof { color: #b8c9a5; }
#log .t-room { color: var(--ink); } #log .t-room .rname { color: var(--room); font-weight: bold; font-size: 18px; display: block; margin-bottom: 2px; }
#log .t-room .rexits { color: var(--muted); font-style: italic; }
#log .t-enc { color: var(--enc); border-left: 3px solid var(--enc); padding-left: 10px; background: rgba(240,197,107,.05); }
#log .t-flight { color: var(--accent2); border-left: 3px solid var(--accent2); padding-left: 10px; }
#log .t-npc { color: var(--npc); } #log .t-event { color: #d1c39a; font-style: italic; }
#log .t-notice { color: var(--notice); } #log .t-announce { color: var(--announce); font-weight: bold; text-align: center; padding: 4px; border-top: 1px dotted var(--line); border-bottom: 1px dotted var(--line); }
#log .t-welcome { color: var(--accent); font-family: Georgia, serif; }
#log .t-dragon { color: var(--ink); }
#log .t-trade { color: #a9d9c0; }
#log .dcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 4px 0; font-family: system-ui, sans-serif; font-size: 14px; }
#log .dcard .sw { display: inline-flex; align-items: center; gap: 6px; margin: 4px 12px 2px 0; }
#log .dcard .chip { width: 22px; height: 22px; border-radius: 5px; border: 1px solid #000; display: inline-block; }
#log .dcard code { color: var(--accent); cursor: pointer; }
#log .dcard a { color: var(--accent2); }
#log .dcard .stats { color: var(--muted); font-size: 13px; }
#encbar { padding: 6px 16px; background: #2a1f12; border-top: 1px solid var(--line); color: var(--enc); font-size: 13px; display: flex; gap: 16px; align-items: center; }
#encbar .hp { height: 8px; width: 120px; background: #3a2b1a; border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; }
#encbar .hp i { display: block; height: 100%; background: #c0553f; }
#encbar .hp.me i { background: #7fb27f; }
#inputrow { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line); }
#inputrow .prompt { color: var(--accent); font-family: monospace; }
#cmd { font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
aside#side { display: flex; flex-direction: column; min-height: 0; background: var(--bg2); }
.side-tabs { padding: 6px 8px 0; }
.side-tabs button { font-size: 13px; padding: 6px 4px; }
.side-pane { flex: 1; overflow-y: auto; padding: 10px 12px; font-size: 13.5px; }
.side-pane h4 { margin: 10px 0 4px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.side-pane .row { padding: 3px 0; border-bottom: 1px dotted #2a221b; cursor: pointer; }
.side-pane .row:hover { color: var(--accent); }
.side-pane .exits button { margin: 2px 4px 2px 0; padding: 3px 9px; font-size: 12px; }
.side-pane .chip { width: 14px; height: 14px; border-radius: 4px; border: 1px solid #000; display: inline-block; vertical-align: middle; margin-right: 6px; }
.side-pane .meter { height: 4px; background: #2a221b; border-radius: 2px; overflow: hidden; margin: 2px 0 4px; }
.side-pane .meter i { display: block; height: 100%; background: var(--accent); }
.badge { background: var(--accent); color: #1a1408; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
#side_ooc { display: flex; flex-direction: column; }
#side_ooc.hidden { display: none; }
#ooclog { flex: 1; overflow-y: auto; font-size: 13px; }
#ooclog div { margin-bottom: 4px; color: var(--ooc); white-space: pre-wrap; }
#ooclog div.system { color: var(--muted); font-style: italic; }
.oocrow { padding-top: 6px; }
#mapc { width: 100%; background: #0b1a24; border: 1px solid var(--line); border-radius: 8px; }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 10; }
#modal_body { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; max-width: 700px; width: 92%; max-height: 90vh; overflow-y: auto; }
#modal_body h2 { margin: 0 0 4px; color: var(--accent); font-family: Georgia, serif; }
#modal_body .chip { width: 40px; height: 40px; border-radius: 8px; border: 2px solid #000; display: inline-block; vertical-align: middle; margin-right: 8px; }
#modal_body .sw { display: inline-block; margin: 6px 16px 6px 0; }
#modal_body code { color: var(--accent); cursor: pointer; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  aside#side { max-height: 40vh; border-top: 1px solid var(--line); }
  #logwrap { border-right: none; }
}
