:root { --bg: #0b0e0a; --panel: rgba(10,13,10,0.86); --line: #2b3427; --text: #dcd6c4; --muted: #8f978a; --gold: #d9b45a; --gold2: #f0d68a; --ok: #8ff0c0; --warn: #ffb86b; --bad: #ff7a7a; --serif: 'Crimson Pro', Georgia, serif; --display: 'Cinzel', Georgia, serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--serif); overflow: hidden; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }
#top { position: fixed; top: 0; left: 0; right: 0; height: 40px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: linear-gradient(180deg, rgba(6,9,6,0.85), rgba(6,9,6,0)); pointer-events: none; z-index: 5; }
#top .title { font: 800 18px var(--display); letter-spacing: 0.22em; color: var(--gold2); }
#top .sub { color: var(--muted); font-style: italic; }
button { font: 600 12px var(--display); letter-spacing: 0.06em; color: var(--text); background: #1d2519; border: 1px solid #3a4a34; border-radius: 4px; padding: 7px 12px; cursor: pointer; }
button:hover { background: #26301f; }
button.primary { background: #3a4d28; border-color: #6a8a3a; color: #f0f0d8; }
button.mini { padding: 3px 8px; font-size: 11px; }
select, input[type=range] { font: 14px var(--serif); background: #0d110c; color: var(--text); border: 1px solid #2b3427; border-radius: 3px; padding: 3px 6px; max-width: 170px; }
input[type=range] { padding: 0; width: 120px; vertical-align: middle; }

/* bench */
#bench { position: fixed; top: 44px; right: 12px; bottom: 12px; width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; z-index: 6; backdrop-filter: blur(3px); }
body[data-mode="arena"] #bench, body[data-mode="sheet"] #bench { display: none; }
#bench .tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
#bench .tab { background: transparent; border: 1px solid transparent; border-bottom: none; color: var(--muted); border-radius: 4px 4px 0 0; text-transform: uppercase; font-size: 11px; }
#bench .tab.on { color: var(--gold2); background: #151a13; border-color: var(--line); }
#bench .panel { flex: 1; overflow: auto; padding: 10px 12px; }
#bench .actions { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.row > label { width: 78px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.row.mark > label, .row > label:has(input) { width: auto; min-width: 150px; color: var(--text); }
.row .val { width: 22px; text-align: right; color: var(--gold2); font-variant-numeric: tabular-nums; }
.row .bar { display: inline-block; width: 60px; height: 6px; background: #1a1f18; border-radius: 3px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--gold); }
.row.res { border-left: 3px solid #333; padding-left: 6px; }
.row.res.ok { border-left-color: var(--ok); }
.row.res.active { background: rgba(217,180,90,0.08); }
.row.res.warn { border-left-color: var(--bad); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 6px currentColor; }
.hint { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 2px 0; }
h4 { margin: 12px 0 4px; font: 700 12px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
details { border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; margin: 6px 0; }
summary { cursor: pointer; font-size: 14px; }
.muted { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.tag { --c: #9a9a9a; font: 600 10px var(--display); letter-spacing: 0.06em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); background: rgba(0,0,0,0.3); }

/* cards */
#cards { position: fixed; top: 44px; left: 12px; width: 380px; display: flex; flex-direction: column; gap: 8px; z-index: 5; pointer-events: none; }
body[data-mode="sheet"] #cards, body.nohud #cards { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; backdrop-filter: blur(3px); }
.card h3 { margin: 0 0 4px; font: 700 15px var(--display); letter-spacing: 0.06em; color: var(--gold2); }
.card .words { margin: 0 0 6px; font-style: italic; color: #e8e0c8; }
.card .stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; font-size: 13px; color: var(--muted); }
.card .stats b { color: var(--text); }
.card .stats .warn { color: var(--warn); font-style: normal; }
.chip { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 3px; font: 600 11px var(--display); letter-spacing: 0.04em; margin: 2px 0; }
.chip.on, .chip.next { border-color: var(--gold); color: var(--gold2); }
.arrow { color: var(--muted); margin: 0 3px; }
.res-chip { --c: #999; display: inline-block; border: 1px solid var(--c); color: var(--c); padding: 1px 8px; border-radius: 3px; margin: 2px 4px 2px 0; font: 600 11px var(--display); }
.res-chip i { font: italic 11px var(--serif); color: var(--muted); }
.res-chip.warn { border-style: dashed; }

/* HUD */
#hud { position: fixed; left: 12px; bottom: 12px; width: 460px; z-index: 5; pointer-events: none; }
body[data-mode="bench"] #hud, body[data-mode="sheet"] #hud, body.nohud #hud { display: none; }
#hud .hp { position: relative; height: 18px; background: #2a1c1c; border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
#hud .hp .fill { height: 100%; background: linear-gradient(90deg, #c94a4a, #e06a5a); transition: width 0.1s; }
#hud .hp span { position: absolute; inset: 0; line-height: 18px; padding-left: 8px; font: 600 11px var(--display); letter-spacing: 0.05em; color: #fff; text-shadow: 0 1px 2px #000; }
#hud .parts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
#hud .part { font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: rgba(0,0,0,0.5); }
#hud .part.bleeding { color: var(--bad); border-color: var(--bad); }
#hud .part.broken { color: var(--warn); border-color: var(--warn); }
#hud .part.severed { color: #fff; background: #4a0a12; border-color: var(--bad); }
#hud .chainbar { margin: 4px 0; }
#hud .abils { display: flex; gap: 8px; margin: 4px 0; font: 600 11px var(--display); }
#hud .ab { padding: 2px 8px; border: 1px solid var(--line); border-radius: 3px; background: rgba(0,0,0,0.5); }
#hud .ab.cd { color: #666; }
#hud .enemies { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: #ffb0a0; }
#hud .hints { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 4px; }
#log { position: fixed; right: 12px; bottom: 12px; width: 420px; font-size: 12.5px; color: #cfc8b8; background: rgba(6,9,6,0.7); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; z-index: 5; pointer-events: none; }
body[data-mode="bench"] #log, body[data-mode="sheet"] #log, body.nohud #log { display: none; }
#toast { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); background: rgba(6,9,6,0.85); border: 1px solid var(--line); padding: 8px 14px; border-radius: 4px; opacity: 0; pointer-events: none; z-index: 20; }
#toast.show { animation: toast 2.4s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
