/* Гонка в космическом тоннеле */
html, body { background: #05061a; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
#race-hud { position: fixed; z-index: 5; top: max(8px, env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right));
  display: flex; align-items: center; gap: 8px; font-family: var(--font); pointer-events: none; }
#race-hud .round, #race-hud a { pointer-events: auto; flex: none; }
#race-hud .stat { flex: none; padding: 5px 12px; font-size: 16px; }
#race-hud .round { width: 40px; height: 40px; line-height: 38px; font-size: 18px; padding: 0; }
#track-bar { position: relative; flex: 1; height: 10px; border-radius: 6px; background: #ffffff22; }
#track-bar .dot { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--c); border: 2px solid #06192b; }
#track-bar .dot.me { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-color: #fff; z-index: 2; }
#speed { position: fixed; z-index: 5; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(220px, 36vw); text-align: center; color: #fff; font: 800 15px var(--font); pointer-events: none; }
#speed b { font-size: 20px; }
#speed-bar { height: 8px; border-radius: 5px; background: #ffffff26; overflow: hidden; }
#speed-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6fe3ff, #ffd447 65%, #ff5a3c); background-size: min(220px, 36vw) 100%; }
#drift-chip { position: fixed; z-index: 6; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 3px 14px; border-radius: 999px; background: #e0472ee6; color: #fff; font: 800 15px var(--font); pointer-events: none; }
#count { position: fixed; z-index: 7; inset: 0; display: grid; place-items: center; font: 900 clamp(70px, 26vh, 150px) var(--font); color: #fff; text-shadow: 0 0 28px #6fe3ff; pointer-events: none; }
#count[hidden] { display: none; }
#brake-zone { position: fixed; z-index: 4; top: 56px; right: 0; bottom: 0; width: 34vw; display: none; align-items: flex-end; justify-content: flex-end; padding: 0 calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) 0; touch-action: none; }
#brake-zone span { padding: 16px 22px; border-radius: 20px; background: #06192bbb; border: 2px solid #ffffff44; color: #fff; font: 800 18px var(--font); backdrop-filter: blur(6px); }
#brake-zone.on span { background: linear-gradient(180deg, #ff8a6b, #e0472e); border-color: #fff; }
@media (pointer: coarse) { #brake-zone { display: flex; } }
#fire { position: fixed; overflow: visible; z-index: 6; right: calc(18px + env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom)); width: 78px; height: 78px; border-radius: 50%;
  border: 3px solid #fff; background: radial-gradient(circle at 40% 35%, #ff8a6b, #d0302a); color: #fff; font: 800 26px/1 var(--font); display: grid; place-items: center; align-content: center; gap: 1px; touch-action: none; cursor: pointer; box-shadow: 0 6px 18px #0008; }
#fire small { font-size: 12px; }
#fire.cool { filter: grayscale(.7) brightness(.75); }
#fire .bomb { position: absolute; top: -6px; right: -6px; font-size: 22px; font-style: normal; display: none; filter: drop-shadow(0 2px 2px #000a); }
#fire.has-bomb .bomb { display: block; }
#fire.charging::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 5px solid #39ff6a; clip-path: inset(0 0 100% 0); animation: charge .8s linear forwards; }
@keyframes charge { to { clip-path: inset(0 0 0 0); } }
@media (pointer: fine) { #fire { width: 64px; height: 64px; font-size: 22px; } }
@media (max-height: 520px) { #fire { bottom: calc(76px + env(safe-area-inset-bottom)); width: 70px; height: 70px; } }
#replay-bar { position: fixed; z-index: 6; left: 50%; top: calc(max(8px, env(safe-area-inset-top)) + 52px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: #06192bcc; color: #fff; font: 800 15px var(--font); }
#replay-bar[hidden] { display: none; }
#replay-bar .round { width: 46px; height: 46px; padding: 0; font-size: 18px; }
body.replay #fire, body.replay #brake-zone, body.replay #joy, body.replay #drift-chip { display: none !important; }
#overlay table { border-collapse: collapse; color: #fff; font-size: 16px; }
#ov-table { display: grid; gap: 4px; min-width: min(360px, 80vw); }
#ov-table .r { display: flex; align-items: center; gap: 10px; padding: 5px 12px; border-radius: 12px; background: #ffffff14; border: 2px solid transparent; font-size: 15px; text-align: left; }
#ov-table .r.me { border-color: var(--c); }
#ov-table .r .n { flex: 1; }
#ov-table .r .d { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
#ov-stars:empty { display: none; }
@media (max-height: 520px) {
  #overlay { gap: 6px; padding: 8px; }
  #ov-table .r { padding: 2px 10px; font-size: 13px; }
  #brake-zone span { padding: 10px 14px; font-size: 15px; }
  #joy { left: 18px; bottom: 16px; }
}
#ov-buttons a.huge { text-decoration: none; display: inline-block; }

/* радио гонок: что сейчас играет (нажатие — следующий трек) */
.radio-chip { position: fixed; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 8px;
  max-width: min(70vw, 420px); padding: 6px 14px 6px 10px; border-radius: 999px; border: 1px solid rgba(63,243,255,.55); background: rgba(10,6,30,.72);
  color: #e9fbff; font: 700 13px/1.2 system-ui, sans-serif; letter-spacing: .02em; box-shadow: 0 0 16px rgba(63,243,255,.35), inset 0 0 12px rgba(255,63,180,.18); cursor: pointer; }
.radio-chip .rt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-chip.flash { animation: radio-in .9s ease both; }
@keyframes radio-in { 0% { opacity: 0; transform: translateX(-50%) translateY(10px); box-shadow: 0 0 40px rgba(255,63,180,.9); } 100% { opacity: 1; } }

/* голос в командной гонке */
.mic-btn { position: fixed; right: calc(14px + env(safe-area-inset-right)); bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 31; min-width: 76px; min-height: 52px;
  border-radius: 999px; border: 1.5px solid rgba(255,63,180,.7); background: rgba(14,8,34,.78); color: #fff; font: 800 16px system-ui, sans-serif;
  box-shadow: 0 0 14px rgba(255,63,180,.4); cursor: pointer; }
.mic-btn.rec { background: #e11d48; border-color: #fff; animation: mic-pulse .8s ease-in-out infinite; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 10px rgba(225,29,72,.25); } }
