:root {
  --ink: #f2e8d5; --dim: #b8a98f; --amber: #e8a43c; --red: #e0533b; --green: #8fd16a;
  --panel: rgba(16, 12, 9, 0.78); --line: rgba(255, 225, 180, 0.16);
  --slab: 'Rockwell', 'Roboto Slab', 'Georgia', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0a0c; color: var(--ink); font: 14px/1.35 -apple-system, 'Helvetica Neue', Arial, sans-serif; user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button, #ui input, #ui .panel, #ui .toolbar, #ui .actions, #ui .card { pointer-events: auto; }
#boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0b0a09; font: 700 48px var(--slab); letter-spacing: 0.12em; color: #e9dcc2; z-index: 50; transition: opacity 0.6s; }
#boot small { font: 14px -apple-system, sans-serif; letter-spacing: 0.05em; color: var(--dim); margin-top: 10px; }
#boot.gone { opacity: 0; pointer-events: none; }

.screen { position: absolute; inset: 0; display: none; }
.screen.on { display: block; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(6px); box-shadow: 0 8px 30px rgba(0,0,0,0.35); }
button { font: inherit; color: var(--ink); background: rgba(60, 44, 30, 0.85); border: 1px solid rgba(255, 220, 170, 0.25); border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: background 0.12s, transform 0.08s; }
button:hover { background: rgba(95, 68, 42, 0.95); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.big { font: 700 17px var(--slab); padding: 12px 26px; background: linear-gradient(#b5482f, #8d3322); border-color: rgba(255, 180, 140, 0.4); }
button.big:hover { background: linear-gradient(#c9563a, #9d3a27); }
button.ghost { background: rgba(30, 24, 18, 0.7); }
kbd { display: inline-block; font: 700 12px -apple-system, sans-serif; background: var(--ink); color: #111; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }

/* title */
#s-title { background: radial-gradient(ellipse at 50% 120%, rgba(0,0,0,0.7), transparent 60%), linear-gradient(90deg, rgba(8,6,4,0.75), rgba(8,6,4,0.1) 60%); }
.title-card { position: absolute; left: 7vw; top: 50%; transform: translateY(-50%); max-width: 560px; pointer-events: auto; }
.title-card h1 { font: 800 92px/0.95 var(--slab); letter-spacing: 0.06em; margin: 6px 0 10px; color: #f3e6cc; text-shadow: 0 4px 0 #6d1f14, 0 10px 40px rgba(0,0,0,0.6); }
.kicker { font: 600 12px -apple-system, sans-serif; letter-spacing: 0.25em; text-transform: uppercase; color: var(--amber); }
.tag { font: 20px var(--slab); color: #e7d7b8; margin: 0 0 26px; }
.btns { display: flex; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.btns.col { flex-direction: column; align-items: stretch; }
.keys { font-size: 12.5px; color: var(--dim); line-height: 1.6; background: rgba(0,0,0,0.35); border-radius: 8px; padding: 10px 14px; }
.keys div + div { margin-top: 6px; }
.keys b { color: var(--ink); }
.keys.small { margin-top: 14px; }

/* build */
.topbar { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 22px; padding: 10px 16px; }
.dayname b { font: 800 22px var(--slab); margin-right: 10px; }
.dayname span { color: var(--dim); }
.dayname .blood { color: #ff6a50; font-style: normal; font-weight: 700; }
.res { display: flex; gap: 16px; }
.res .r { color: var(--dim); white-space: nowrap; }
.res .r b { color: var(--ink); font: 700 18px var(--slab); margin: 0 4px 0 4px; }
.res i { font-style: normal; color: var(--amber); }
.forecast { position: absolute; top: 14px; right: 14px; width: 330px; padding: 12px 16px; }
.forecast h3, .crew h3 { margin: 0 0 8px; font: 700 16px var(--slab); }
.forecast h3 small, .crew h3 small { font: 12px -apple-system, sans-serif; color: var(--dim); margin-left: 6px; }
.comp { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ztype { font-size: 12px; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,0.08); }
.ztype.runner { background: rgba(232, 164, 60, 0.22); } .ztype.brute { background: rgba(160, 160, 190, 0.25); }
.ztype.bloater { background: rgba(160, 200, 60, 0.25); } .ztype.boss { background: rgba(224, 83, 59, 0.45); font-weight: 700; }
.lanes .lane { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--dim); }
.lanes .lane b { margin-left: auto; color: var(--ink); }
.lanes .lane .arr { width: 22px; height: 22px; border-radius: 6px; background: rgba(255,184,74,0.2); color: #ffb84a; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.lanes .lane.heavy { color: var(--ink); } .lanes .lane.heavy .arr { background: rgba(255,74,58,0.3); color: #ff6a50; }
.note { margin: 8px 0 0; font-size: 12.5px; color: #e8cfa6; border-left: 2px solid var(--amber); padding-left: 8px; }
.crew { position: absolute; top: 76px; left: 14px; width: 300px; padding: 12px 14px; }
.sv { padding: 6px 0; border-top: 1px solid var(--line); }
.sv .nm small { display: block; color: var(--dim); font-size: 12px; }
.sv .lv { font-size: 11px; color: var(--amber); }
.sv .pp { display: flex; gap: 6px; margin-top: 6px; }
.sv .pp button { padding: 4px 10px; font-size: 12px; }
.sv .pp button.on { background: #6a8a3a; border-color: #a8d070; }
.crew .you { font-size: 12px; color: var(--dim); margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.toolbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(6px); }
.tool { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; padding: 8px 4px 6px; background: rgba(40, 30, 22, 0.8); }
.tool .k { position: absolute; top: 4px; left: 6px; font-size: 11px; color: var(--dim); }
.tool .n { font-size: 12px; font-weight: 600; }
.tool .c { font-size: 11px; color: var(--amber); }
.tool.sel { background: rgba(140, 100, 40, 0.9); border-color: #ffd27a; box-shadow: 0 0 0 1px #ffd27a inset; }
.tool.poor { opacity: 0.5; }
.actions { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; width: 210px; }
.actions button small { display: block; font-size: 11px; color: var(--dim); }
.actions .start { font: 800 18px var(--slab); padding: 14px; background: linear-gradient(#b5482f, #7d2c1d); border-color: rgba(255, 180, 140, 0.5); }
.actions .start:hover { background: linear-gradient(#cc5638, #923422); }
.hint { position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); font-size: 13px; color: #f0e2c4; background: rgba(0,0,0,0.45); padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.tip { position: absolute; display: none; padding: 7px 10px; font-size: 12.5px; background: rgba(10, 8, 6, 0.9); border: 1px solid var(--line); border-radius: 8px; max-width: 240px; }
.tip .bad { color: var(--red); } .tip .dim { color: var(--dim); } .tip .turn { color: #ffd27a; }
.tip kbd { font-size: 10px; padding: 0 4px; margin: 0 2px; }
#labels { position: absolute; inset: 0; }
.wl { position: absolute; left: 0; top: 0; font-size: 12px; text-align: center; white-space: nowrap; padding: 3px 8px; border-radius: 6px; background: rgba(10, 8, 6, 0.7); border: 1px solid var(--line); }
.wl span { display: block; color: var(--amber); font-size: 11px; }
.wl.lane { font: 700 13px var(--slab); background: rgba(60, 30, 10, 0.75); color: #ffcf7a; }
.wl.lane.heavy { background: rgba(120, 25, 15, 0.85); color: #ffd0c0; }

/* night */
.scope { position: absolute; inset: 0; display: none; background: radial-gradient(circle at 50% 50%, transparent 0, transparent 38vh, rgba(0,0,0,0.55) 38.4vh, #000 39.5vh); }
.scope.on { display: block; }
.scope i { position: absolute; background: rgba(0, 0, 0, 0.9); }
.scope i.h { left: calc(50% - 38vh); width: 76vh; top: 50%; height: 1px; }
.scope i.v { top: calc(50% - 38vh); height: 76vh; left: 50%; width: 1px; }
.scope i.h2 { left: calc(50% - 38vh); width: 76vh; top: calc(50% - 2px); height: 5px; -webkit-mask: linear-gradient(90deg, #000 0 32%, transparent 32% 68%, #000 68%); mask: linear-gradient(90deg, #000 0 32%, transparent 32% 68%, #000 68%); }
.scope i.v2 { top: calc(50% - 38vh); height: 76vh; left: calc(50% - 2px); width: 5px; -webkit-mask: linear-gradient(180deg, #000 0 32%, transparent 32% 68%, #000 68%); mask: linear-gradient(180deg, #000 0 32%, transparent 32% 68%, #000 68%); }
.scope b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -1.5px; border-radius: 50%; background: #ff3a2a; box-shadow: 0 0 4px #ff3a2a; }
.cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.cross i, .hitm i { position: absolute; background: rgba(255, 245, 225, 0.9); box-shadow: 0 0 2px #000; }
.cross i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: -14px; } .cross i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: 6px; }
.cross i:nth-child(3) { width: 8px; height: 2px; left: -14px; top: -1px; } .cross i:nth-child(4) { width: 8px; height: 2px; left: 6px; top: -1px; }
.hitm { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
.hitm i { width: 2px; height: 9px; }
.hitm i:nth-child(1) { left: -8px; top: -12px; transform: rotate(-45deg); } .hitm i:nth-child(2) { left: 6px; top: -12px; transform: rotate(45deg); }
.hitm i:nth-child(3) { left: -8px; top: 3px; transform: rotate(45deg); } .hitm i:nth-child(4) { left: 6px; top: 3px; transform: rotate(-45deg); }
.hitm.head i { background: #ffd060; } .hitm.kill i { background: #ff5040; height: 12px; }
.housebar { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: 420px; text-align: center; }
.housebar .lbl { font: 700 12px var(--slab); letter-spacing: 0.2em; color: #e8d8b8; text-shadow: 0 1px 3px #000; }
.bar { height: 10px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.18); border-radius: 6px; overflow: hidden; margin: 4px 0; }
.bar > div { height: 100%; background: linear-gradient(90deg, #d9b25a, #e8d08a); transition: width 0.15s; }
#n-house.hit { background: #ff8a6a; } #n-house.low { background: linear-gradient(90deg, #b8301c, #e0533b); }
.housebar .sub { font: 600 12px -apple-system, sans-serif; letter-spacing: 0.12em; color: #f0e2c4; text-shadow: 0 1px 3px #000; }
.bossbar { display: none; margin-top: 10px; }
.bossbar .lbl { color: #ff8a70; }
.bossbar .bar > div { background: linear-gradient(90deg, #8a1a10, #e0533b); }
.feed { position: absolute; left: 18px; top: 120px; width: 380px; display: flex; flex-direction: column; gap: 4px; }
.feed .fi { font-size: 13.5px; padding: 5px 10px; background: rgba(0,0,0,0.5); border-left: 3px solid var(--amber); border-radius: 4px; animation: fin 0.25s; }
.feed .fi.warn { border-color: var(--red); } .feed .fi.good { border-color: var(--green); }
@keyframes fin { from { opacity: 0; transform: translateX(-10px); } }
.health { position: absolute; left: 18px; bottom: 18px; width: 260px; }
.health .where { font: 600 12px -apple-system, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: #f0e2c4; text-shadow: 0 1px 3px #000; }
.health .bar { height: 12px; }
#n-hp { background: linear-gradient(90deg, #6aa84a, #9fd36a); } #n-hp.low { background: linear-gradient(90deg, #a8281c, #e0533b); }
.ammo { position: absolute; right: 22px; bottom: 16px; text-align: right; text-shadow: 0 2px 4px #000; }
.ammo .wname { font: 700 14px var(--slab); color: #e8d8b8; }
.ammo .count b { font: 800 44px var(--slab); }
.ammo .count span { font: 600 18px var(--slab); color: var(--dim); }
.ammo .slots { display: flex; gap: 10px; justify-content: flex-end; font-size: 11.5px; color: var(--dim); }
.ammo .slots .on { color: var(--amber); font-weight: 700; }
.prompt { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 15px; padding: 7px 14px; background: rgba(0,0,0,0.55); border-radius: 8px; display: none; }
.scrapn { position: absolute; right: 22px; top: 18px; font: 700 18px var(--slab); color: var(--amber); text-shadow: 0 1px 3px #000; }
.down { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; font: 800 54px var(--slab); color: #ff6a50; text-shadow: 0 4px 20px #000; background: rgba(60, 0, 0, 0.35); }
.down.on { display: flex; } .down small { font: 18px -apple-system, sans-serif; color: var(--ink); }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(150, 0, 0, 0.75) 100%); }
#banner { position: absolute; top: 28%; left: 50%; transform: translate(-50%, -10px); text-align: center; opacity: 0; transition: opacity 0.4s, transform 0.4s; }
#banner.on { opacity: 1; transform: translate(-50%, 0); }
#banner .t { font: 800 56px var(--slab); letter-spacing: 0.08em; color: #f3e2c0; text-shadow: 0 4px 0 #5a1a10, 0 10px 40px #000; }
#banner .s { font: 600 16px -apple-system, sans-serif; letter-spacing: 0.1em; color: #ffcf8a; text-shadow: 0 2px 6px #000; }
#toast { position: absolute; left: 50%; top: 70%; transform: translateX(-50%); padding: 8px 16px; background: rgba(0,0,0,0.7); border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity 0.25s; }
#toast.on { opacity: 1; }

/* overlay cards */
#s-overlay { background: rgba(5, 4, 3, 0.55); backdrop-filter: blur(3px); pointer-events: auto; }
#s-overlay .card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 460px; padding: 26px 30px; background: rgba(18, 13, 10, 0.94); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.card h2 { font: 800 34px var(--slab); margin: 4px 0 8px; } .card h2.red { color: #ff6a50; }
.card .sub { color: var(--dim); margin: 0 0 12px; }
.card .rows { margin: 12px 0; border-top: 1px solid var(--line); }
.card .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.card .row b { font-family: var(--slab); }
.card .lvl { color: var(--amber); margin: 6px 0; }
.set { display: flex; align-items: center; gap: 10px; color: var(--dim); margin-top: 8px; }
.set input { flex: 1; }
