:root { --bg: #0d1218; --panel: rgba(12, 18, 26, 0.82); --line: rgba(255, 255, 255, 0.12); --text: #eef3f8; --muted: #9fb0c2; --accent: #ffcf3f; --good: #37e07a; --bad: #ff5a5a; --warn: #ffb340; --blue: #4fd1ff; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: var(--text); background: #243142; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover { background: #2f4157; }
button.primary { background: var(--accent); color: #1a1406; border-color: transparent; font-weight: 700; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: default; }
input, select { font: inherit; color: var(--text); background: #1a2431; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
h1, h2, h3 { margin: 0 0 8px; }
small, .muted { color: var(--muted); }

#loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; background: radial-gradient(ellipse at top, #2a3a4c, #0b1016); z-index: 50; }
#loading .logo, .logo { font-weight: 900; letter-spacing: 0.25em; font-size: clamp(32px, 7vw, 64px); background: linear-gradient(180deg, #fff, #9fb6c9); -webkit-background-clip: text; background-clip: text; color: transparent; }
#loading .bar { width: min(320px, 80vw); height: 6px; background: #223; border-radius: 3px; overflow: hidden; margin: auto; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* full-screen menus over the 3D showroom */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: auto; }
#ui > * { pointer-events: auto; }
.screen { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; background: linear-gradient(90deg, rgba(8, 12, 18, 0.88) 0%, rgba(8, 12, 18, 0.6) 55%, rgba(8, 12, 18, 0.2) 100%); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; backdrop-filter: blur(6px); }
.menu { width: min(1100px, 100%); display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #233244; font-size: 12px; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.role { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #172230; cursor: pointer; position: relative; }
.role:hover { border-color: #4a6280; }
.role.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.role .who { position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 700; }
.role b { font-size: 15px; }
.role p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.code { font-size: 34px; font-weight: 900; letter-spacing: 0.2em; color: var(--accent); }
.players { display: flex; gap: 8px; flex-wrap: wrap; }
.player { padding: 6px 10px; border-radius: 10px; background: #1b2838; border-left: 4px solid; }
.brief p { margin: 6px 0; }
.brief .who { font-weight: 700; color: var(--accent); }
.obj { margin: 4px 0; }
.obj.done { color: var(--good); }
.upgrades { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.upg { background: #172230; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.pips i { display: inline-block; width: 14px; height: 6px; margin-right: 3px; border-radius: 2px; background: #334; }
.pips i.on { background: var(--accent); }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.photo { background: #000; border-radius: 8px; overflow: hidden; position: relative; aspect-ratio: 16/9; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo span { position: absolute; left: 6px; bottom: 4px; font-weight: 900; font-size: 18px; text-shadow: 0 1px 3px #000; }
.photo em { position: absolute; right: 6px; bottom: 6px; font-size: 11px; text-shadow: 0 1px 3px #000; font-style: normal; }
.big { font-size: 28px; font-weight: 900; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* in-game HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; pointer-events: none; }
#mtitle { font-weight: 700; }
#timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; }
#dpbox { text-align: center; line-height: 1; } #dp { font-size: 20px; font-weight: 900; color: var(--accent); display: block; } #dpbox small { font-size: 10px; }
#objectives { position: absolute; top: 10px; right: 10px; width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 13px; pointer-events: none; }
#vanbox { position: absolute; top: 10px; left: 10px; width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 12px; pointer-events: none; }
.bar2 { height: 7px; background: #263342; border-radius: 4px; overflow: hidden; margin: 2px 0 6px; } .bar2 i { display: block; height: 100%; }
#crewbox { position: absolute; top: 150px; left: 10px; width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 12px; pointer-events: none; }
#crewbox div { display: flex; justify-content: space-between; }
#radio { position: absolute; left: 10px; bottom: 120px; width: min(420px, 46vw); max-height: 30vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; pointer-events: none; font-size: 13px; }
#radio div { background: rgba(10, 14, 20, 0.7); border-radius: 8px; padding: 4px 8px; animation: fadein .3s; }
#radio b { color: var(--accent); }
#radio .alert { border-left: 3px solid var(--bad); } #radio .win { border-left: 3px solid var(--good); } #radio .warn { border-left: 3px solid var(--warn); }
#rolebar { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
#rolebar button { padding: 6px 10px; font-size: 12px; }
#rolebar button.active { background: var(--accent); color: #111; font-weight: 800; }
#rolebar button.shaken { background: var(--bad); }
#panel { position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%); min-width: 340px; max-width: min(640px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 13px; }
#panel h3 { font-size: 14px; margin-bottom: 4px; }
#panel .keys { color: var(--muted); font-size: 12px; }
#minimap { position: absolute; right: 10px; bottom: 10px; width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); background: #0b1118; }
#bigmap { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: min(78vh, 62vw); height: min(78vh, 62vw); border-radius: 14px; border: 2px solid #2d3f55; background: #0b1118; cursor: crosshair; }
#centermsg { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-size: 26px; font-weight: 900; text-shadow: 0 2px 8px #000; pointer-events: none; text-align: center; }
#banner { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); pointer-events: none; text-align: center; }
#banner div { background: rgba(10, 14, 20, 0.8); border: 1px solid var(--line); padding: 6px 14px; border-radius: 10px; margin-top: 4px; font-weight: 700; }
#quick { position: absolute; right: 240px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
#quick button { font-size: 11px; padding: 4px 8px; }
.seq { display: flex; gap: 6px; margin: 6px 0; }
.seq span { width: 34px; height: 34px; display: grid; place-content: center; border-radius: 8px; background: #263342; font-size: 20px; font-weight: 900; }
.seq span.ok { background: var(--good); color: #062; }
.seq span.next { outline: 2px solid var(--accent); }
.parts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.parts button { padding: 6px 4px; font-size: 12px; }
.shake { animation: shake .3s; }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-6px, 3px); } 75% { transform: translate(6px, -3px); } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
#aim { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#dmgflash { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse, transparent 40%, rgba(255, 40, 40, 0.55)); opacity: 0; transition: opacity .4s; }
@media (max-width: 800px) { #objectives { width: 180px; font-size: 11px; } #vanbox, #crewbox { width: 170px; } #minimap { width: 150px; height: 150px; } #quick { display: none; } #radio { bottom: 170px; } }
