:root {
  --gold: #e3b04b;
  --gold-hi: #ffe39a;
  --red: #e0282e;
  --cyan: #38d8ff;
  --ink: #0b0a0d;
  --panel: rgba(12, 10, 14, 0.82);
  --text: #f3eee6;
  --muted: #a79f94;
  --chrome: linear-gradient(180deg, #ffffff 0%, #d9dde3 38%, #6d7480 52%, #e9ecf0 70%, #9aa1ab 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050406; color: var(--text); overflow: hidden;
  font-family: "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* ---------------- screens */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20; }
.screen.on { display: flex; }
.screen.panel { background: rgba(4, 3, 6, 0.55); backdrop-filter: blur(3px); }
.kicker { letter-spacing: 0.42em; font-size: 12px; color: var(--gold); font-weight: 700; }
.logo { margin: 8px 0 10px; font-family: Impact, "Arial Black", sans-serif; font-style: italic; font-size: 64px; line-height: 0.9;
  letter-spacing: 0.04em; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #2a1a08) drop-shadow(0 0 18px rgba(255, 150, 60, 0.35)); }
.logo span { background: linear-gradient(180deg, #fff3c4 0%, #f5c55a 40%, #a0621a 55%, #ffd77a 75%, #b87a22 100%);
  -webkit-background-clip: text; background-clip: text; }
.logo.big { font-size: clamp(64px, 12vw, 150px); }
#loading { background: radial-gradient(ellipse at 50% 60%, #2a1406 0%, #070508 70%); }
.load-box { text-align: center; width: min(420px, 86vw); }
.bar { height: 6px; background: #221c18; border-radius: 3px; overflow: hidden; margin-top: 14px; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #ff6a1a); transition: width 0.2s; }
#load-text { color: var(--muted); font-size: 14px; }

#title { background: linear-gradient(90deg, rgba(5, 4, 6, 0.85) 0%, rgba(5, 4, 6, 0.35) 45%, rgba(5, 4, 6, 0) 70%); justify-content: flex-start; }
.title-block { margin-left: 7vw; max-width: 560px; }
.lede { color: #d8cfc2; font-size: 17px; line-height: 1.5; max-width: 460px; }
.menu { display: flex; flex-direction: column; gap: 10px; margin: 22px 0; align-items: flex-start; }
.menu.row { flex-direction: row; justify-content: center; }
.menu button, .card > button { font: 700 15px/1 "Helvetica Neue", Arial, sans-serif; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 14px 26px; border: 1px solid rgba(227, 176, 75, 0.45); background: rgba(10, 8, 10, 0.6); color: var(--text); cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); transition: background 0.15s, color 0.15s, transform 0.1s; min-width: 240px; text-align: left; }
.menu button:hover, .menu button:focus-visible, .card > button:hover { background: var(--gold); color: #140c02; outline: none; transform: translateX(4px); }
.menu button.primary, .card > button.primary { background: linear-gradient(90deg, #c8892a, #f0c15a); color: #160d02; border-color: transparent; }
.hint { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; }
.card { background: var(--panel); border: 1px solid rgba(227, 176, 75, 0.35); padding: 28px 32px; width: min(860px, 92vw); max-height: 88vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.card.small { width: min(440px, 92vw); }
.card h2 { font-family: Impact, "Arial Black", sans-serif; font-style: italic; letter-spacing: 0.06em; font-size: 34px; margin: 6px 0 16px; color: var(--gold-hi); }
.card h3 { color: var(--gold); letter-spacing: 0.2em; font-size: 12px; margin: 18px 0 6px; }
.card ul { margin: 0; padding-left: 18px; line-height: 1.8; color: #ddd4c8; font-size: 14px; }
.card b { color: #fff; background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 3px; font-size: 12px; letter-spacing: 0.08em; }
.card .note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.card label { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; font-size: 14px; letter-spacing: 0.06em; color: #ddd4c8; }
.card select, .card input[type=range] { width: 55%; }
.card select { background: #1a1612; color: var(--text); border: 1px solid #4a3a22; padding: 6px; }
.card label.check { justify-content: flex-start; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.stats div { background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--gold); padding: 10px 12px; }
.stats span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.18em; }
.stats strong { font-size: 24px; font-family: Impact, "Arial Black", sans-serif; color: #fff; }

/* ---------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.bars { position: absolute; top: 16px; left: 16px; right: 16px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: start; }
.side .nameplate { display: flex; align-items: center; gap: 8px; font-family: Impact, "Arial Black", sans-serif; font-style: italic; letter-spacing: 0.08em; font-size: 20px; }
.side.right .nameplate { justify-content: flex-end; }
.side .nameplate img { width: 28px; height: 28px; }
.side.left .nm { color: var(--gold-hi); text-shadow: 0 0 10px rgba(255, 190, 80, 0.6); }
.side.right .nm { color: #ff8a8a; text-shadow: 0 0 10px rgba(255, 60, 60, 0.6); }
.mode { font: 700 10px/1 Arial, sans-serif; letter-spacing: 0.2em; padding: 4px 6px; border: 1px solid currentColor; color: var(--muted); font-style: normal; }
.mode.car { color: var(--cyan); }
.hp { position: relative; height: 22px; margin-top: 6px; background: #1b0d0d; border: 2px solid #d9d2c6; box-shadow: 0 0 0 2px #000, inset 0 0 10px #000;
  transform: skewX(-18deg); overflow: hidden; }
.side.right .hp, .side.right .en { transform: skewX(18deg); }
.hp .fill, .hp .trail { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; }
.hp .trail { background: #fff; opacity: 0.85; transition: width 0.6s ease-in 0.25s; }
.hp .fill { background: linear-gradient(180deg, #fff27a 0%, #f2c21a 45%, #d77a06 100%); }
.hp.low .fill { background: linear-gradient(180deg, #ff9a8a 0%, #e8322a 50%, #8a0a06 100%); animation: pulse 0.6s infinite alternate; }
.side.right .hp .fill, .side.right .hp .trail, .side.right .en .fill { left: auto; right: 0; }
.en { position: relative; height: 9px; margin-top: 5px; width: 72%; background: #0a1418; border: 1px solid #5a7a88; transform: skewX(-18deg); overflow: hidden; }
.side.right .en { margin-left: auto; }
.en .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 50%; background: linear-gradient(90deg, #0a6aa0, #38d8ff 70%, #c8f6ff); box-shadow: 0 0 10px #38d8ff; }
.en.full .fill { animation: glow 0.5s infinite alternate; }
.en i { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.5); }
.side.right .en i { left: auto !important; }
.side.right .en i:nth-of-type(1) { right: 20%; }
.side.right .en i:nth-of-type(2) { right: 35%; }
.wins { display: flex; gap: 6px; margin-top: 6px; }
.side.right .wins { justify-content: flex-end; }
.wins b { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #d9d2c6; background: transparent; }
.wins b.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.clock { text-align: center; min-width: 90px; }
#timer { font-family: Impact, "Arial Black", sans-serif; font-size: 46px; line-height: 1; color: #fff; text-shadow: 0 0 12px rgba(255, 180, 80, 0.7), 0 3px 0 #000; }
#round { font-size: 11px; letter-spacing: 0.3em; color: var(--muted); margin-top: 2px; }
.combo { position: absolute; top: 34%; font-family: Impact, "Arial Black", sans-serif; font-style: italic; opacity: 0; transition: opacity 0.25s; }
.combo.left { left: 4vw; }
.combo.right { right: 4vw; text-align: right; }
.combo.on { opacity: 1; }
.combo .n { font-size: 64px; line-height: 0.9; background: linear-gradient(180deg, #fff 0%, #ffd35a 50%, #ff7a1a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #000); }
.combo .n small { font-size: 26px; }
.combo .t { font-size: 20px; letter-spacing: 0.1em; color: #fff; text-shadow: 0 0 10px #ff7a1a, 0 2px 0 #000; }
.combo.bump .n { animation: bump 0.18s; }
#announce { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-family: Impact, "Arial Black", sans-serif; font-style: italic;
  font-size: clamp(48px, 10vw, 130px); letter-spacing: 0.05em; line-height: 1; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #1a0f04) drop-shadow(0 0 30px rgba(255, 140, 40, 0.55)); opacity: 0; transform: scale(1.4); transition: opacity 0.18s, transform 0.25s cubic-bezier(.2, 1.6, .4, 1); }
#announce.on { opacity: 1; transform: scale(1); }
#announce.gold { background: linear-gradient(180deg, #fff3c4 0%, #f5c55a 40%, #a0621a 55%, #ffd77a 75%, #b87a22 100%); -webkit-background-clip: text; background-clip: text; }
#announce.red { background: linear-gradient(180deg, #ffe0e0 0%, #ff5a4a 45%, #7a0a06 60%, #ff8a7a 80%); -webkit-background-clip: text; background-clip: text; }
#announce small { display: block; font-size: 0.28em; letter-spacing: 0.3em; margin-top: 10px; }
#hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px;
  font-size: 12px; color: rgba(255, 255, 255, 0.6); letter-spacing: 0.04em; max-width: 92vw; transition: opacity 1s; }
#hint b { color: #fff; background: rgba(255, 255, 255, 0.12); padding: 2px 6px; border-radius: 3px; font-size: 11px; }
#hint.fade { opacity: 0.18; }
.back-link { position: fixed; right: 14px; bottom: 12px; z-index: 30; color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-decoration: none; text-transform: uppercase; }
.back-link:hover { color: var(--gold); }
body.playing .back-link { display: none; }

@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.6); } }
@keyframes glow { from { box-shadow: 0 0 6px #38d8ff; } to { box-shadow: 0 0 18px #9af0ff; } }
@keyframes bump { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }

@media (max-width: 760px) {
  .side .nameplate { font-size: 15px; }
  #timer { font-size: 34px; }
  .combo .n { font-size: 44px; }
  #hint { display: none; }
}

/* property damage bill, police heat, toasts, pursuit */
#bill { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); text-align: center; font-family: Impact, "Arial Black", sans-serif; font-style: italic; pointer-events: none; }
#bill span { display: block; font-size: 11px; letter-spacing: 0.32em; color: rgba(255, 255, 255, 0.55); font-style: normal; font-family: inherit; }
#bill b { font-size: 26px; color: #7dff8a; text-shadow: 0 0 12px rgba(80, 255, 120, 0.45), 0 2px 0 #000; letter-spacing: 0.04em; }
#bill.bump b { animation: bump 0.2s; }
#heat { display: flex; gap: 5px; justify-content: center; margin-top: 4px; }
#heat i { width: 14px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
#heat i.on:nth-child(odd) { background: #ff2a2a; box-shadow: 0 0 10px #ff2a2a; animation: siren 0.5s steps(2) infinite; }
#heat i.on:nth-child(even) { background: #3a6aff; box-shadow: 0 0 10px #3a6aff; animation: siren 0.5s steps(2) infinite reverse; }
@keyframes siren { 50% { opacity: 0.35; } }
#toasts { position: absolute; left: 50%; top: 172px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#toasts div { font-family: Impact, "Arial Black", sans-serif; font-style: italic; font-size: 17px; letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 10px #ff7a1a, 0 2px 0 #000;
  animation: toast 1.8s forwards; white-space: nowrap; }
#toasts div em { color: #7dff8a; font-style: italic; margin-left: 8px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px) scale(0.9); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
#pursuit { position: absolute; left: 50%; bottom: 9vh; transform: translateX(-50%); text-align: center; font-family: Impact, "Arial Black", sans-serif; font-style: italic; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
#pursuit.on { opacity: 1; }
#pursuit span { display: block; font-size: 13px; letter-spacing: 0.4em; color: #ff4a4a; animation: siren 0.8s steps(2) infinite; }
#pursuit b { font-size: 30px; color: #fff; text-shadow: 0 0 12px #ff3a3a, 0 2px 0 #000; }
#arrow { position: absolute; width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 30px solid #ff3a3a;
  filter: drop-shadow(0 0 8px #ff3a3a); opacity: 0; transition: opacity 0.2s; pointer-events: none; margin: -15px 0 0 -14px; }
#arrow.on { opacity: 0.9; }
@media (max-width: 700px) { #bill { top: 86px; } #bill b { font-size: 20px; } }

/* fast title: the menu is up while the city and robots stream in behind it */
body.booting { background: #050406 url(../assets/ui/title.webp) center / cover no-repeat; }
body.booting #view { opacity: 0; }
#view { transition: opacity 1.2s ease; }
#fight-btn.loading { opacity: 0.75; pointer-events: none; }
#fight-btn.loading::after { content: attr(data-progress); margin-left: 10px; font-size: 12px; letter-spacing: 0.2em; opacity: 0.8; }

/* cinematic opener: letterbox, title cards, skip hint */
#cine { position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
#cine.on { opacity: 1; }
#cine .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
#cine .bar.top { top: 0; } #cine .bar.bottom { bottom: 0; }
#cine-card { position: absolute; left: 7vw; bottom: 16vh; font-family: Impact, "Arial Black", sans-serif; font-style: italic; color: #f3efe6;
  opacity: 0; transform: translateX(-20px); transition: opacity 0.6s, transform 0.8s; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
#cine-card.on { opacity: 1; transform: none; }
#cine-card b { display: block; font-size: clamp(28px, 5vw, 64px); letter-spacing: 0.08em; }
#cine-card small { display: block; font-family: system-ui, sans-serif; font-style: normal; font-size: 12px; letter-spacing: 0.5em; opacity: 0.8; margin-top: 6px; }
#cine-card.gold b { background: linear-gradient(180deg, #fff3c8, #e3b04b 55%, #8a5a14); -webkit-background-clip: text; background-clip: text; color: transparent; }
#cine-card.slam { left: 0; right: 0; bottom: auto; top: 38%; text-align: center; transform: scale(1.6); transition: opacity 0.15s, transform 0.35s cubic-bezier(.2, 1.6, .4, 1); }
#cine-card.slam.on { transform: scale(1); }
#cine-card.slam b { font-size: clamp(48px, 11vw, 150px); background: linear-gradient(180deg, #fff 0%, #ffe39a 40%, #e3b04b 60%, #7a4a10 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 24px rgba(255, 170, 60, 0.45)); }
#cine-card.slam small { font-family: Impact, "Arial Black", sans-serif; font-style: italic; font-size: clamp(14px, 2vw, 26px); letter-spacing: 0.4em; color: #ff4a3a; }
#cine .skip { position: absolute; right: 3vw; bottom: 3.5vh; font-size: 11px; letter-spacing: 0.3em; color: rgba(255, 255, 255, 0.45); text-transform: uppercase; }
