:root {
  --ember: #ff5a2a; --cobalt: #2f7bff; --amber: #ffb020;
  --ink: #f2f4f7; --mute: #9aa3b2; --panel: rgba(12, 15, 21, 0.78); --line: rgba(255, 255, 255, 0.1);
  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body: "Barlow", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07090d; color: var(--ink); font: 15px/1.5 var(--f-body); overflow: hidden; }
#game { position: fixed; inset: 0; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; inset: 0; pointer-events: none; font-family: var(--f-display); user-select: none; }
.hud-board { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: stretch; height: 44px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.hud-board .team { width: 64px; display: grid; place-items: center; position: relative; }
.hud-board .t0 { background: linear-gradient(180deg, #3b86ff, #1f5fd6); clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%); }
.hud-board .t1 { background: linear-gradient(180deg, #ff6a3a, #d9421a); clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 100%, 0 100%); }
.hud-board .score { font: 800 34px/1 var(--f-display); font-style: italic; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.2); font-variant-numeric: tabular-nums; }
.hud-board .clock { min-width: 92px; background: rgba(10,12,17,.86); display: grid; place-items: center; position: relative; }
.hud-board .time { font: 700 26px/1 var(--f-display); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.hud-board .ot { position: absolute; bottom: -18px; font: 700 11px/1 var(--f-body); letter-spacing: 2px; color: var(--amber); opacity: 0; }
.hud-board.is-ot .ot { opacity: 1; }
.hud-board.is-low .time { color: #ffcf5a; }

.hud-boost { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 132px; height: 132px; }
.hud-boost svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud-boost .seg { fill: rgba(255,255,255,.12); transition: fill .12s; }
.hud-boost .seg.on { fill: #ffb020; }
.hud-boost.full .seg.on { fill: #ffd24a; }
.hud-boost.ss .seg.on { fill: #fff1c8; }
.hud-boost .num { position: absolute; inset: 34px 0 auto; text-align: center; font: 800 44px/1 var(--f-display); font-style: italic; font-variant-numeric: tabular-nums; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hud-boost.empty .num { color: rgba(255,255,255,.45); }
.hud-boost .lbl { position: absolute; top: 80px; width: 100%; text-align: center; font: 700 10px/1 var(--f-body); letter-spacing: 3px; color: var(--mute); }
.hud-boost .spd { position: absolute; bottom: -6px; width: 100%; text-align: center; font: 600 12px/1 var(--f-body); color: var(--mute); }
.hud-boost .spd b { color: var(--ink); font: 700 14px var(--f-display); }

.hud-center { position: absolute; left: 0; right: 0; top: 26%; display: grid; justify-items: center; gap: 8px; }
.hud-center .count { font: 900 120px/1 var(--f-display); font-style: italic; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.5); animation: countIn .9s var(--ease) both; }
.hud-center .count.go { color: var(--amber); }
@keyframes countIn { 0% { transform: scale(1.8); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: scale(.92); opacity: 0; } }

.callout { text-align: center; animation: slam .45s cubic-bezier(.2,1.6,.4,1) both; }
.callout .main { font: 900 128px/0.9 var(--f-display); font-style: italic; letter-spacing: -1px; color: #fff;
  -webkit-text-stroke: 2px rgba(0,0,0,.25); text-shadow: 0 8px 40px rgba(0,0,0,.45); }
.callout.team0 .main { color: #eaf2ff; text-shadow: 0 0 28px rgba(47,123,255,.9), 0 8px 40px rgba(0,0,0,.45); }
.callout.team1 .main { color: #fff1ea; text-shadow: 0 0 28px rgba(255,90,42,.9), 0 8px 40px rgba(0,0,0,.45); }
.callout.tier2 .main { font-size: 150px; }
.callout.tier3 .main { font-size: 168px; color: #ffe7a8; }
.callout.tier4 .main { font-size: 190px; color: #ffd24a; animation: shimmer 1.2s linear infinite; }
.callout .sub { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.callout .sub span { font: 800 22px/1 var(--f-display); font-style: italic; letter-spacing: 1px; padding: 6px 12px; background: rgba(10,12,17,.75); border-radius: 4px; }
.callout .meta { margin-top: 10px; font: 600 18px/1 var(--f-body); color: #e8ecf2; display: flex; gap: 14px; justify-content: center; }
.callout .meta span { color: var(--amber); font-family: var(--f-display); font-weight: 700; font-size: 22px; }
.callout.out { animation: flyOut .5s ease-in both; }
@keyframes slam { 0% { transform: scale(2.6) skewX(-8deg); opacity: 0; filter: blur(6px); } 60% { transform: scale(.94) skewX(-8deg); opacity: 1; filter: blur(0); } 100% { transform: scale(1) skewX(-8deg); } }
@keyframes flyOut { to { transform: translateY(-40px) scale(1.1) skewX(-8deg); opacity: 0; } }
@keyframes shimmer { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }
.hud-center .msg { font: 800 40px/1 var(--f-display); font-style: italic; text-shadow: 0 4px 20px rgba(0,0,0,.5); animation: countIn 1.8s var(--ease) both; }

.hud-feed { position: absolute; top: 16px; right: 18px; display: grid; gap: 6px; justify-items: end; }
.hud-feed .item { font: 600 14px/1 var(--f-body); padding: 7px 10px; background: rgba(10,12,17,.72); border-radius: 4px; border-left: 3px solid #fff; transition: opacity .4s, transform .4s; }
.hud-feed .item.team0 { border-color: var(--cobalt); } .hud-feed .item.team1 { border-color: var(--ember); }
.hud-feed .item.out { opacity: 0; transform: translateX(10px); }
.hud-tip { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); font: 500 14px var(--f-body); color: var(--mute); background: rgba(10,12,17,.6); padding: 6px 12px; border-radius: 4px; opacity: 0; transition: opacity .3s; }
.hud-tip.show { opacity: 1; }

@media (max-width: 700px) {
  .hud-board { height: 36px; } .hud-board .team { width: 48px; } .hud-board .score { font-size: 26px; } .hud-board .time { font-size: 21px; } .hud-board .clock { min-width: 72px; }
  .hud-boost { width: 104px; height: 104px; left: auto; right: 18px; bottom: 150px; } .hud-boost .num { inset: 27px 0 auto; font-size: 34px; } .hud-boost .lbl { top: 63px; }
  .callout .main { font-size: 72px !important; } .hud-center .count { font-size: 80px; }
}
@media (prefers-reduced-motion: reduce) { .callout, .hud-center .count, .hud-center .msg { animation-duration: .01s; } }

/* ---------------------------------------------------------------- touch controls */
.touch { position: fixed; inset: 0; pointer-events: none; z-index: 3; touch-action: none; user-select: none; -webkit-user-select: none; }
.touch > * { pointer-events: auto; touch-action: none; }
.touch .stick { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%;
  background: rgba(10,12,17,.35); border: 2px solid rgba(255,255,255,.18); display: grid; place-items: center; }
.touch .knob { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.22); border: 2px solid rgba(255,255,255,.5); transition: transform .05s; }
.touch .tb { position: absolute; border-radius: 50%; display: grid; place-items: center; font: italic 800 15px/1 var(--f-display); letter-spacing: .5px; color: #fff;
  background: rgba(10,12,17,.45); border: 2px solid rgba(255,255,255,.28); }
.touch .tb.on { background: rgba(255,176,32,.55); border-color: var(--amber); }
.touch .jump { right: max(22px, env(safe-area-inset-right)); bottom: 26px; width: 92px; height: 92px; font-size: 18px; }
.touch .boost { right: 128px; bottom: 44px; width: 78px; height: 78px; border-color: rgba(255,176,32,.6); }
.touch .slide { right: 42px; bottom: 132px; width: 66px; height: 66px; }
.touch .cam { right: 128px; bottom: 136px; width: 52px; height: 52px; font-size: 12px; }
.touch .pause { right: 16px; top: 64px; width: 44px; height: 44px; border-radius: 10px; font-size: 14px; }

.hud-replay { position: absolute; top: 18px; left: 22px; display: flex; align-items: center; gap: 8px; font: italic 800 22px/1 var(--f-display); letter-spacing: 2px; opacity: 0; transition: opacity .25s; }
.hud-replay i { width: 10px; height: 10px; border-radius: 50%; background: #ff3b2f; animation: rec 1s steps(2) infinite; }
.hud-replay.show { opacity: 1; }
.hud.replaying .hud-boost, .hud.replaying .hud-feed { opacity: 0; }
.hud.replaying::before, .hud.replaying::after { content: ""; position: absolute; left: 0; right: 0; height: 7vh; background: #000; }
.hud.replaying::before { top: 0; } .hud.replaying::after { bottom: 0; }
@keyframes rec { 50% { opacity: .2; } }
