:root {
  --accent: #a24bff;
  --pink: #ff2aa6;
  --teal: #1ab3d6;
  --panel: rgba(12, 8, 24, .62);
  --text: #f3f0ff;
  --dim: #a9a0c8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0816; color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif; user-select: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.lbl { font-size: 11px; letter-spacing: .18em; color: var(--dim); font-weight: 600; }
.big { font-size: 34px; font-weight: 800; font-style: italic; line-height: 1; }
.big small { font-size: 16px; color: var(--dim); }
.panel { position: fixed; background: var(--panel); backdrop-filter: blur(6px); border-radius: 10px;
  padding: 10px 14px; border-left: 3px solid var(--accent); font-variant-numeric: tabular-nums; }

#hud-tl { top: 16px; left: 16px; min-width: 190px; }
#hud-tl .row { display: flex; justify-content: space-between; gap: 16px; margin-top: 4px; font-size: 15px; }
#hud-tr { top: 16px; right: 16px; min-width: 190px; border-left-color: var(--pink); }
#board { margin-top: 6px; font-size: 13px; }
#board div { display: flex; gap: 8px; padding: 2px 0; }
#board div.me { color: #fff; font-weight: 700; }
#board i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-top: 4px; }
#board .gap { margin-left: auto; color: var(--dim); }
#minimap { position: fixed; left: 16px; bottom: 16px; width: 200px; height: 200px;
  background: var(--panel); border-radius: 12px; }
#hud-br { right: 16px; bottom: 16px; width: 250px; border-left-color: var(--teal); }
#rpm { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
#rpmfill { height: 100%; width: 0; background: linear-gradient(90deg, #1ab3d6, #a24bff 65%, #ff2aa6 88%, #ff2a2a); }
.spd { font-size: 58px; font-weight: 800; font-style: italic; line-height: 1.05; text-align: right; }
.spd small { font-size: 15px; margin-left: 6px; color: var(--dim); font-style: normal; }
.gear { display: flex; justify-content: space-between; align-items: baseline; }
.gear #gear { font-size: 30px; font-weight: 800; color: var(--pink); }
#cam { margin-top: 4px; text-align: right; }

#hud-jev { left: 16px; top: 160px; width: 262px; border-left-color: #2ee6a6; font-size: 12px; }
.jev-hdr { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.badge { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; background: rgba(255,255,255,.14); color: var(--dim); letter-spacing: .06em; white-space: nowrap; }
.badge.text { background: rgba(46,230,166,.22); color: #2ee6a6; border: 1px solid rgba(46,230,166,.5); }
.badge.vision { background: rgba(255,42,166,.25); color: #ff66c4; border: 1px solid rgba(255,42,166,.55); }
.badge.fusion { background: rgba(120,160,255,.22); color: #8fb0ff; border: 1px solid rgba(120,160,255,.55); }
.badge.tactics { background: rgba(255,230,80,.2); color: #ffe066; border: 1px solid rgba(255,230,80,.5); }
.badge.sensor { background: rgba(255,170,40,.22); color: #ffb340; border: 1px solid rgba(255,170,40,.55); }
.jev-meta { font-size: 11px; color: var(--dim); margin-bottom: 6px; display: flex; justify-content: space-between; }
.jev-bars { display: flex; flex-direction: column; gap: 4px; }
.jev-row { display: grid; grid-template-columns: 96px 1fr 38px; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); }
.jev-row.top { color: #fff; font-weight: 700; }
.jev-bar-bg { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.jev-bar-fg { height: 100%; width: 0%; background: linear-gradient(90deg, #1ab3d6, #2ee6a6); border-radius: 3px; transition: width .12s ease-out; }
.jev-row.top .jev-bar-fg { background: linear-gradient(90deg, #a24bff, #ff2aa6); box-shadow: 0 0 8px rgba(255,42,166,.7); }
.jev-pct { text-align: right; font-size: 11px; }
.jev-state { margin-top: 6px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,.1); font-size: 10.5px; color: var(--dim); line-height: 1.35; white-space: pre-line; }

#lights { position: fixed; top: 16%; left: 50%; transform: translateX(-50%); display: flex; gap: 12px;
  background: #111; padding: 12px 16px; border-radius: 10px; opacity: 0; transition: opacity .3s; }
#lights.show { opacity: 1; }
#lights i { width: 38px; height: 38px; border-radius: 50%; background: #2a0606; box-shadow: inset 0 0 8px #000; }
#lights i.on { background: #ff1a1a; box-shadow: 0 0 22px #ff2020, inset 0 0 6px #ffb0b0; }
#msg { position: fixed; top: 30%; width: 100%; text-align: center; font-size: 64px; font-weight: 900;
  font-style: italic; letter-spacing: .05em; text-shadow: 0 4px 24px rgba(162,75,255,.8); pointer-events: none;
  opacity: 0; transition: opacity .25s; }
#msg.show { opacity: 1; }

#touch { position: fixed; bottom: 230px; left: 0; right: 0; display: none; padding: 0 16px; gap: 10px; }
#touch .sp { flex: 1; }
#touch button { width: 76px; height: 76px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  background: rgba(20,10,40,.5); color: #fff; font-size: 20px; font-weight: 700; }
#touch button.act { background: rgba(162,75,255,.6); }
@media (pointer: coarse) { #touch { display: flex; } }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(80,30,160,.35), rgba(5,3,12,.8)); }
.card { background: rgba(14,10,30,.88); border: 1px solid rgba(162,75,255,.35); border-radius: 16px;
  padding: 28px 34px; max-width: 620px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.brand { letter-spacing: .5em; font-size: 14px; color: var(--dim); }
.brand b { color: var(--pink); }
h1 { margin: 6px 0 4px; font-size: 48px; font-style: italic; font-weight: 900; letter-spacing: .06em;
  background: linear-gradient(90deg, #7b5cff, #ff2aa6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--dim); margin: 0 0 16px; }
#loadbar { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
#loadfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--accent)); transition: width .2s; }
#loadtxt { font-size: 12px; color: var(--dim); margin: 6px 0 14px; }
.opts { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: flex; margin-top: 6px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.15); }
.seg button { background: transparent; color: var(--dim); border: 0; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
button#start, button#resume, button#again, button#quit { font-size: 18px; font-weight: 800; letter-spacing: .12em;
  padding: 14px 40px; border-radius: 10px; border: 0; cursor: pointer; color: #fff; margin: 4px;
  background: linear-gradient(90deg, #6a3cff, #ff2aa6); }
button:disabled { opacity: .4; cursor: wait; }
button.ghost { background: transparent !important; border: 1px solid rgba(255,255,255,.3) !important; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-top: 18px; font-size: 13px; color: var(--dim); }
kbd { background: #2a2140; border-radius: 4px; padding: 1px 6px; color: #fff; font-family: inherit; border-bottom: 2px solid #150f25; }
#res-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-variant-numeric: tabular-nums; }
#res-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; }
#res-table tr.me td { color: #fff; font-weight: 800; background: rgba(162,75,255,.18); }
#res-table td:last-child { text-align: right; }
#res-best { color: var(--dim); }

@media (max-width: 700px) {
  #minimap { width: 130px; height: 130px; }
  #hud-br { width: 170px; }
  .spd { font-size: 40px; }
  #hud-tr, #hud-tl { min-width: 0; padding: 8px 10px; }
  #board { display: none; }
  h1 { font-size: 34px; }
  #msg { font-size: 40px; }
}
