/* KANT Snowboard Online — UI styles. Mobile-first (Telegram Mini App, portrait phone), then landscape, then desktop.
   Animations use transform/opacity only. No backdrop-filter on touch devices (GPU budget for WebGL). */

:root {
  color-scheme: dark;
  --ink: #0b1820;
  --ink2: #10222c;
  --paper: #f1f6f1;
  --muted: #a3b6b4;
  --muted2: #7f9594;
  --lime: #d9fa57;
  --lime-hi: #e8ff8c;
  --lime-ink: #15200c;
  --red: #ff5446;
  --amber: #ffb229;
  --blue: #3d8bff;
  --line: rgba(222, 242, 236, .14);
  --line2: rgba(222, 242, 236, .24);
  --glass: rgba(9, 21, 28, .80);
  --glass-hi: rgba(10, 23, 31, .92);
  --chip: rgba(8, 18, 24, .74);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --display: "Archivo Black", "Arial Black", "Avenir Next Condensed", "Avenir Next", "Helvetica Neue", Roboto, system-ui, sans-serif;
  --type: Inter, -apple-system, "SF Pro Text", system-ui, Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Roboto Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  /* safe areas (Telegram fullscreen overrides via html.tg-safe) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --gut: 14px;
}
html.tg-safe {
  --sat: max(var(--tg-t, 0px), env(safe-area-inset-top, 0px));
  --sab: max(var(--tg-b, 0px), env(safe-area-inset-bottom, 0px));
  --sal: max(var(--tg-l, 0px), env(safe-area-inset-left, 0px));
  --sar: max(var(--tg-r, 0px), env(safe-area-inset-right, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%;
  background: var(--ink); color: var(--paper);
  font-family: var(--type); font-size: 16px; line-height: 1.35;
  overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body { position: fixed; inset: 0; touch-action: none; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.noscript { position: fixed; inset: 20%; z-index: 99; background: var(--ink); padding: 24px; border-radius: 16px; }
input { -webkit-user-select: text; user-select: text; }

/* ─────────────── loader ─────────────── */
#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(120% 80% at 50% 110%, #1d3a47 0%, #0f2530 45%, #0a161d 100%);
  transition: opacity .55s var(--ease);
}
#loader.done { opacity: 0; pointer-events: none; }
.ld-inner { width: min(320px, 84vw); text-align: center; transform: translateY(-4vh); }
.ld-peak { width: 190px; height: 88px; display: block; margin: 0 auto 10px; overflow: visible; }
.ld-ridge { fill: none; stroke: rgba(241, 246, 241, .55); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 420; stroke-dashoffset: 420; animation: ld-draw 1.8s var(--ease) .1s forwards; }
.ld-snow { fill: var(--paper); opacity: 0; animation: ld-fade .8s ease 1.2s forwards; }
@keyframes ld-draw { to { stroke-dashoffset: 0; } }
@keyframes ld-fade { to { opacity: .9; } }
.ld-title { font: italic 900 64px/0.9 var(--display); letter-spacing: -.08em; transform: skewX(-3deg); color: #f4f7ef; }
.ld-title i, .title .dot { display: inline-block; width: .15em; height: .14em; margin-left: .07em; background: var(--lime); transform: skewX(-7deg); }
.ld-sub { margin-top: 10px; font: 600 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ld-bar { position: relative; height: 4px; margin: 28px 0 12px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.ld-bar i { position: absolute; inset: 0; background: var(--lime); transform-origin: 0 50%; transform: scaleX(0); transition: transform .35s var(--ease); border-radius: 4px; }
.ld-bar.indet i { width: 35%; transform: none; animation: ld-indet 1.2s ease-in-out infinite; }
@keyframes ld-indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.ld-text { font: 500 13px/1.4 var(--type); color: var(--muted); min-height: 1.4em; }

/* ─────────────── root & shared ─────────────── */
#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; isolation: isolate; font-variant-numeric: tabular-nums; }
#ui button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#ui button:disabled { cursor: default; opacity: .4; }
#ui button:focus-visible, #ui input:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
#ui [hidden] { display: none !important; }
.sym { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }
.mono { font-family: var(--mono); }
.mark { width: 38px; height: 29px; color: var(--lime); }
.label { font: 650 10.5px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #c3d3d0; text-shadow: 0 1px 4px rgba(4, 12, 17, .75); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
#ui:not(.touch) .touch-only { display: none !important; }

.view { position: absolute; inset: 0; display: none; }
#ui[data-view=menu] .v-menu, #ui[data-view=lobby] .v-lobby, #ui[data-view=hud] .v-hud, #ui[data-view=results] .v-results { display: flex; }
#ui[data-view=menu] .v-menu > *, #ui[data-view=lobby] .v-lobby > *, #ui[data-view=results] .v-results > * { animation: view-in .42s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translate3d(0, 14px, 0); } }

.scrim { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 20, 27, .55) 0%, rgba(8, 20, 27, 0) 22%, rgba(8, 20, 27, .35) 44%, rgba(8, 20, 27, .92) 70%, #0a1820 100%); }
#ui[data-view=menu] .scrim, #ui[data-view=lobby] .scrim, #ui[data-view=results] .scrim { opacity: 1; }

/* buttons */
.btn {
  pointer-events: auto; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; padding: 0 18px; border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 750 !important; font-size: 16px !important; letter-spacing: -.015em; white-space: nowrap;
  transition: transform .14s var(--ease), background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.btn.primary { background: var(--lime); color: var(--lime-ink) !important; box-shadow: 0 8px 24px -10px rgba(217, 250, 87, .55); }
.btn.primary.big { min-height: 58px; font-size: 19px !important; justify-content: space-between; padding: 0 22px; border-radius: 18px; }
.btn.primary.big span { font-family: var(--display); font-style: italic; font-weight: 900; letter-spacing: -.02em; font-size: 21px; }
.btn.secondary { background: rgba(241, 246, 241, .1); border-color: var(--line2); color: var(--paper); }
.btn.ghost { background: rgba(9, 21, 28, .55); border-color: var(--line2); color: var(--paper); }
.btn.ghost.danger { color: #ffb4ab !important; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px !important; border-radius: 14px; }
@media (hover: hover) {
  .btn.primary:hover { background: var(--lime-hi); }
  .btn.secondary:hover, .btn.ghost:hover { background: rgba(241, 246, 241, .16); }
}
.icon-btn {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; height: 44px; padding: 0 11px; border-radius: 14px;
  background: var(--chip); border: 1px solid var(--line2); color: var(--paper);
  transition: transform .14s var(--ease), background-color .15s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.off { color: var(--muted2); }
.lbl-wide { display: none; font-size: 14px; font-weight: 650; }

.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-6px); } }

/* avatars */
.avatar { position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: #1a2d37; box-shadow: 0 0 0 2px var(--ring, var(--lime)), 0 6px 16px -6px rgba(0, 0, 0, .6); overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; -webkit-user-drag: none; }
.avatar b { font: italic 900 22px var(--display); color: var(--muted); }
.avatar.xs { width: 30px; height: 30px; box-shadow: 0 0 0 1.5px var(--ring, var(--lime)); }
.avatar.xs b { font-size: 13px; }
.avatar.sm { width: 34px; height: 34px; box-shadow: 0 0 0 1.5px var(--ring, var(--lime)); }
.avatar.lg { width: 58px; height: 58px; }
.avatar.xl { width: 84px; height: 84px; box-shadow: 0 0 0 3px var(--ring, var(--lime)), 0 10px 30px -8px rgba(0, 0, 0, .7); }
.avatar.ghost { box-shadow: 0 0 0 1.5px var(--line2); color: var(--muted2); background: rgba(255, 255, 255, .04); }

/* ─────────────── top bar ─────────────── */
.topbar { position: absolute; z-index: 3; top: calc(var(--sat) + 10px); left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut));
  display: none; align-items: center; justify-content: space-between; }
#ui[data-view=menu] .topbar { display: flex; }
#ui[data-view=menu] .topbar .brand { display: none; }
.topbar { justify-content: flex-end; }
.brand { display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.brand .mark { filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.brand span { font: 750 9.5px/1.3 var(--mono); letter-spacing: .14em; color: #e5efec; }
.top-actions { display: flex; gap: 8px; }
html.tg .brand { visibility: hidden; } /* Telegram header already names the app; keep room for its buttons */

/* ─────────────── panels (menu / lobby / results) ─────────────── */
.v-menu, .v-lobby, .v-results {
  flex-direction: column; justify-content: flex-start; align-items: center;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(var(--sat) + 64px) calc(var(--sar) + var(--gut)) calc(var(--sab) + 14px) calc(var(--sal) + var(--gut));
  pointer-events: auto; touch-action: pan-y;
}
.v-menu::-webkit-scrollbar, .v-lobby::-webkit-scrollbar, .v-results::-webkit-scrollbar { display: none; }
.menu-panel, .lobby-panel, .res-panel { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 12px; flex: none; margin-top: auto; }
.v-menu { padding-top: calc(var(--sat) + 10px); }
.name-field { display: none !important; }

.hero { position: relative; padding: 0 160px 0 2px; min-height: 92px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; }
.me-pill { pointer-events: auto; position: absolute; right: 0; bottom: 0; display: inline-flex; align-items: center; gap: 6px; max-width: 150px; height: 36px; padding: 0 12px 0 10px; border-radius: 18px;
  background: var(--chip); border: 1px solid var(--line2); color: var(--paper); font-size: 13.5px; font-weight: 700; }
.me-pill .ico { width: 16px; height: 16px; color: var(--lime); }
.me-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { margin: 0; font: italic 900 clamp(50px, 14.5vw, 70px)/.82 var(--display); letter-spacing: -.085em; color: #f6f9f2;
  transform: skewX(-3deg); transform-origin: 0 100%; text-shadow: 0 4px 28px rgba(5, 15, 20, .45); white-space: nowrap; margin-left: -.04em; }
.tagline { margin: 8px 0 0; font: 600 13px/1.3 var(--type); color: #dbe7e3; letter-spacing: .005em; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }

.invite-banner { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: var(--r-md); background: rgba(217, 250, 87, .12); border: 1px solid rgba(217, 250, 87, .45); }
.invite-banner > div { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.invite-banner .ico { color: var(--lime); }
.invite-banner b { color: var(--lime); letter-spacing: .12em; }

/* riders */
.riders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rider { pointer-events: auto; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  padding: 10px 6px 8px; border-radius: var(--r-md); background: var(--glass); border: 1.5px solid var(--line);
  transition: transform .15s var(--ease), border-color .18s, background-color .18s; }
.rider:active { transform: scale(.97); }
.rider .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); transition: box-shadow .2s; }
.rider.on { border-color: var(--lime); background: rgba(30, 44, 30, .9); }
.rider.on .avatar { box-shadow: 0 0 0 2.5px var(--ring), 0 0 0 5px rgba(217, 250, 87, .22); }
.rname { font-size: 13.5px; font-weight: 750; letter-spacing: -.01em; text-align: center; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rsub { display: none; }
.rider .tick { position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; border-radius: 50%; background: var(--lime); color: var(--lime-ink);
  display: grid; place-items: center; opacity: 0; transform: scale(.5); transition: opacity .18s, transform .25s var(--spring); }
.rider .tick .ico { width: 13px; height: 13px; stroke-width: 3; }
.rider.on .tick { opacity: 1; transform: scale(1); }
.riders.compact .rider { flex-direction: row; padding: 8px; gap: 8px; justify-content: flex-start; }
.riders.compact .avatar { width: 36px; height: 36px; }
.riders.compact .rname { font-size: 13px; text-align: left; }
.riders.compact .tick { display: none; }

/* course carousel */
.car { display: grid; grid-template-columns: 1fr; position: relative; }
.car-view { pointer-events: auto; touch-action: pan-y; min-width: 0; --drag: 0px; }
.car-view > .course-card { transform: translate3d(var(--drag), 0, 0); transition: transform .2s var(--ease); }
.car-arrow { pointer-events: auto; position: absolute; z-index: 2; top: 10px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: var(--paper); transition: transform .14s var(--ease), background-color .15s; }
.car-arrow:active { transform: scale(.92); background: rgba(255, 255, 255, .16); }
.car-arrow.prev { right: 56px; }
.car-arrow.next { right: 10px; }
.car-arrow .ico { width: 20px; height: 20px; stroke-width: 2.3; }
.car.locked .car-arrow { display: none; }
.course-card { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--line); padding: 14px 16px 12px 18px; }
.course-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--acc); }
.course-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--acc) 22%, transparent), transparent); pointer-events: none; }
.course-card.empty { color: var(--muted); font-size: 14px; padding: 24px 18px; }
.course-card.in-r { animation: card-r .32s var(--ease); }
.course-card.in-l { animation: card-l .32s var(--ease); }
@keyframes card-r { from { opacity: .2; transform: translate3d(28px, 0, 0); } }
@keyframes card-l { from { opacity: .2; transform: translate3d(-28px, 0, 0); } }
.cc-top { display: flex; align-items: center; gap: 8px; min-height: 40px; padding-right: 96px; flex-wrap: wrap; }
.car.locked .cc-top { padding-right: 0; }
.diff { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 8px; border-radius: 13px; font: 700 12px/1 var(--type); background: rgba(255, 255, 255, .08); white-space: nowrap; }
.diff i { width: 11px; height: 11px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.diff.d-red i { background: #e8322b; }
.diff.d-black i { background: #0a0a0a; }
.diff.d-expert i { background: #0a0a0a; border-radius: 2px; transform: rotate(45deg) scale(.9); box-shadow: 0 0 0 2px #fff, 5px -5px 0 -1px #0a0a0a, 5px -5px 0 1px #fff; }
.cc-tags { display: inline-flex; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 13px; font: 600 11.5px/1 var(--type); color: #d6e2df; background: rgba(255, 255, 255, .06); white-space: nowrap; }
.tag .ico { width: 14px; height: 14px; }
.cc-name { margin: 6px 0 0; font: italic 900 23px/1.05 var(--display); letter-spacing: -.035em; color: #fff; }
.cc-sub { margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 550; }
.cc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 12px 0 0; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.cc-stats div { min-width: 0; }
.cc-stats small { display: block; font: 600 9.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted2); white-space: nowrap; }
.cc-stats b { display: block; margin-top: 3px; font: 800 18px/1.1 var(--type); letter-spacing: -.03em; white-space: nowrap; }
.cc-stats em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.cc-desc { margin: 10px 0 0; font-size: 13.5px; line-height: 1.42; color: #c9d7d4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; min-height: 20px; }
.rec, .par { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rec .ico, .par .ico { width: 16px; height: 16px; color: var(--lime); }
.rec b { color: var(--lime); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); transition: width .25s var(--ease), background-color .2s; }
.dots i.on { width: 18px; background: var(--lime); }

/* name + actions */
.input-wrap { pointer-events: auto; position: relative; display: flex; align-items: center; }
.input-wrap .ico { position: absolute; left: 14px; color: var(--muted2); width: 20px; height: 20px; pointer-events: none; }
#ui input { pointer-events: auto; width: 100%; height: 50px; border-radius: var(--r-md); border: 1px solid var(--line2); background: var(--glass);
  color: var(--paper); font: 600 16px var(--type); padding: 0 14px 0 44px; outline: none; transition: border-color .15s; -webkit-appearance: none; appearance: none; }
#ui input::placeholder { color: var(--muted2); font-weight: 500; }
#ui input:focus { border-color: var(--lime); }
.name-field .label { display: block; margin: 0 2px 8px; }
.actions { display: grid; gap: 10px; margin-top: 2px; }
.join-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; }
#ui .code-input { padding: 0; text-align: center; letter-spacing: .32em; text-indent: .32em; font: 700 20px var(--mono); text-transform: uppercase; }
#ui .code-input.full { border-color: var(--lime); color: var(--lime); }
#ui .code-input::placeholder { letter-spacing: .2em; font-size: 15px; }

/* ─────────────── lobby ─────────────── */
.room-head { text-align: center; padding: 12px 12px 12px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--line); }
.room-code { margin: 4px 0 10px; font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: .26em; text-indent: .26em; color: var(--lime); text-shadow: 0 0 30px rgba(217, 250, 87, .25); }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn.icon-only { width: 50px; padding: 0; }
.share-row .btn { padding: 0 10px; font-size: 14px !important; }
.players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 6px; }
.vs { align-self: center; font: italic 900 15px var(--display); color: var(--muted2); }
.pcard { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px 8px 10px; min-width: 0;
  border-radius: var(--r-md); background: var(--glass); border: 1.5px solid var(--line); transition: border-color .2s; }
.pcard.ready { border-color: var(--lime); }
.pcard.off { opacity: .55; }
.pcard.empty { border-style: dashed; }
.pc-txt { min-width: 0; width: 100%; }
.pc-name { display: flex; justify-content: center; align-items: center; gap: 5px; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name .crown .ico { width: 15px; height: 15px; color: var(--amber); }
.pc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-state { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 12px; font: 700 11px var(--type); background: rgba(255, 255, 255, .07); color: var(--muted); }
.pcard.ready .pc-state { background: var(--lime); color: var(--lime-ink); }
.pc-state .ico { width: 13px; height: 13px; stroke-width: 3; }
.pulse { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; transform: scale(.6); } }
.v-lobby { padding-top: calc(var(--sat) + 12px); }
.v-lobby .cc-desc { display: none; }
.v-lobby .avatar.lg { width: 48px; height: 48px; }
.lobby-status { text-align: center; font-size: 14px; color: #d4e0dd; font-weight: 600; min-height: 20px; }
.lobby-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.ready-btn { min-height: 56px; }
.ready-btn.on { background: #2e3f1c; color: var(--lime) !important; border-color: var(--lime); box-shadow: none; }

/* ─────────────── HUD (phone first) ─────────────── */
.v-hud { pointer-events: none; }
.hud-strip { position: absolute; top: calc(var(--sat) + 8px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 60px); display: flex; gap: 6px; }
.hc { min-width: 0; padding: 6px 10px 7px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); line-height: 1; }
.hl { display: block; font: 650 8.5px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.hc b { display: block; font: 800 21px/1 var(--type); letter-spacing: -.035em; white-space: nowrap; }
.h-score { flex: 1.35; }
.h-score { position: relative; }
.h-score .row { display: flex; align-items: baseline; gap: 6px; }
.combo { position: absolute; top: 4px; right: 5px; font: 800 10.5px/1 var(--mono); color: var(--muted); padding: 2px 5px; border-radius: 6px; background: rgba(255, 255, 255, .07); transition: color .2s, background-color .2s; }
.combo.hot { color: var(--lime-ink); background: var(--lime); }
.h-speed { flex: 1; position: relative; overflow: hidden; }
.h-speed b { font-family: var(--display); font-style: italic; font-weight: 900; letter-spacing: -.05em; }
.spd-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .08); }
.spd-bar > i { position: absolute; inset: 0; background: var(--lime); transform-origin: 0 50%; transform: scaleX(0); transition: transform .12s linear; }
.h-time { flex: 1.1; }
.h-time b { font-family: var(--mono); font-weight: 650; font-size: 18px; letter-spacing: -.02em; }
.h-gates { display: none; }
.hud-btns { position: absolute; top: calc(var(--sat) + 8px); right: calc(var(--sar) + 10px); display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.hud-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--chip); border: 1px solid var(--line2); color: var(--paper); transition: transform .12s var(--ease); }
.hud-btn:active { transform: scale(.9); }
.hud-btn .ico { width: 20px; height: 20px; }
.hud-btn[data-act=pause] .ico { width: 18px; height: 18px; }
/* hud-btns are inside .hud-strip in the DOM → pull them out of flow */
.hud-strip .hud-btns { right: -50px; top: 0; }

.hud-prog { position: absolute; top: calc(var(--sat) + 62px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 60px); padding: 7px 10px 9px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); }
.hp-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.hp-name .v-course { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-r { display: inline-flex; gap: 8px; font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
.hp-r b { color: var(--paper); font-weight: 700; }
.v-gates2 { display: inline-flex; align-items: center; gap: 4px; }
.v-gates2 .ico { width: 13px; height: 13px; }
.track { position: relative; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .14); margin-right: 16px; }
.track .fill { position: absolute; inset: 0; border-radius: 2px; background: var(--lime); transform-origin: 0 50%; transform: scaleX(0); }
.mk { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: var(--lime); border: 2.5px solid #0d1d25; box-shadow: 0 0 0 1px var(--lime); }
.mk.opp { background: #ff7a3d; box-shadow: 0 0 0 1px #ff7a3d; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; }
.track .fin { position: absolute; right: -18px; top: -9px; color: var(--paper); }
.track .fin .ico { width: 15px; height: 15px; }

.hud-inj { position: absolute; top: calc(var(--sat) + 116px); left: calc(var(--sal) + 10px); display: flex; gap: 5px; flex-wrap: wrap; max-width: 60%; }
.inj { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 5px; border-radius: 13px; background: var(--chip); border: 1px solid; font: 700 11px var(--type); animation: inj-in .45s var(--spring); }
.inj .ico { width: 17px; height: 17px; }
.inj.lv1 { color: var(--amber); border-color: rgba(255, 178, 41, .55); }
.inj.lv2 { color: #fff; background: rgba(196, 30, 22, .88); border-color: #ff6b5e; }
.inj em { font-style: normal; }
@keyframes inj-in { from { transform: scale(.4); opacity: 0; } }

.hud-opp { position: absolute; top: calc(var(--sat) + 116px); right: calc(var(--sar) + 10px); display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 22px; background: var(--chip); border: 1px solid var(--line); max-width: 54%; }
.opp-av { flex: none; display: grid; }
.opp-txt { min-width: 0; line-height: 1.1; }
.opp-name { display: block; font-size: 11px; font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-score { display: block; font-size: 14px; font-weight: 700; }
.opp-gap { font-size: 13px; font-weight: 700; padding: 3px 7px; border-radius: 8px; background: rgba(255, 255, 255, .08); white-space: nowrap; }
.opp-gap.ahead { color: var(--lime); }
.opp-gap.behind { color: #ff9a8e; }
.opp-gap.fin { color: var(--amber); }

.hud-air { position: absolute; left: calc(var(--sal) + 10px); top: calc(var(--sat) + 158px); transform: translate3d(0, -6px, 0); opacity: 0; transition: opacity .15s, transform .2s var(--ease);
  display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: 12px; background: var(--chip); }
.hud-air.on { opacity: 1; transform: none; }
.hud-air .hl { margin: 0; }
.hud-air b { font-size: 15px; font-weight: 700; color: var(--lime); }
.charge { display: none; }
.keys-hint { display: none; }

/* ─────────────── touch controls ─────────────── */
.tpad { display: none; position: absolute; inset: 0; pointer-events: none; transition: opacity .25s; }
#ui.touch .tpad { display: block; }
.tpad.hidden { opacity: 0; }
.tpad.hidden * { pointer-events: none !important; }
.stick-zone, .act-zone { position: absolute; bottom: 0; top: 44%; pointer-events: auto; touch-action: none; -webkit-user-select: none; }
.stick-zone { left: 0; width: 50%; }
.act-zone { right: 0; width: 50%; }
.stick-base { position: absolute; left: calc(var(--sal) + 26px); bottom: calc(var(--sab) + 30px); width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(8, 18, 24, .25), rgba(8, 18, 24, .55)); border: 1.5px solid rgba(255, 255, 255, .28);
  opacity: .55; transition: opacity .2s; will-change: transform; }
.stick-zone.active .stick-base { opacity: 1; transition: none; }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f9fff0, #cfe0cf); box-shadow: 0 6px 18px rgba(0, 0, 0, .45), inset 0 -3px 0 rgba(0, 0, 0, .12); }
.stick-zone.active .stick-knob { background: radial-gradient(circle at 40% 35%, #f2ffbf, var(--lime)); }
.sb { position: absolute; color: rgba(255, 255, 255, .7); transition: color .12s, transform .12s; }
.sb .ico { width: 18px; height: 18px; stroke-width: 2.4; }
.sb-up { left: 50%; top: 6px; margin-left: -9px; }
.sb-down { left: 50%; bottom: 6px; margin-left: -9px; }
.sb-l { top: 50%; left: 6px; margin-top: -9px; }
.sb-r { top: 50%; right: 6px; margin-top: -9px; }
.stick-base.u .sb-up, .stick-base.d .sb-down, .stick-base.l .sb-l, .stick-base.r .sb-r { color: var(--lime); transform: scale(1.25); }
.zone-lbl { position: absolute; left: calc(var(--sal) + 26px); width: 132px; text-align: center; bottom: calc(var(--sab) + 8px); }
.stick-zone.active .zone-lbl { opacity: 0; }
.tpad.tilt .sb-l, .tpad.tilt .sb-r { opacity: .25; }
.tl { font: 700 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .78); text-shadow: 0 1px 4px rgba(0, 0, 0, .7); pointer-events: none; transition: opacity .2s; }

.tb { pointer-events: auto; position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 50%;
  background: rgba(8, 18, 24, .62); border: 1.5px solid rgba(255, 255, 255, .42); color: #fff; touch-action: none; -webkit-user-select: none;
  transition: transform .1s var(--ease), background-color .1s, border-color .1s; }
.tb .ico { width: 26px; height: 26px; stroke-width: 2.2; }
.tb .tl { font-size: 8.5px; }
.tb.pressed { transform: scale(.92); background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.tb.pressed .tl { color: var(--lime-ink); text-shadow: none; }
.act-pad { position: absolute; right: calc(var(--sar) + 16px); bottom: calc(var(--sab) + 20px); width: 190px; height: 190px; pointer-events: none; }
.tb-jump { right: 0; bottom: 0; width: 104px; height: 104px; border-color: var(--lime); color: var(--lime); background: rgba(8, 18, 24, .7); }
.tb-jump .ico { width: 32px; height: 32px; }
.tb-jump .tl { color: var(--lime); }
.tb-jump .ring { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; overflow: visible; }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: rgba(255, 255, 255, .0); }
.v-hud:not(.charging) .ring .fg { opacity: 0; }
.ring .fg { stroke: var(--lime); stroke-linecap: round; stroke-dasharray: 289.03; stroke-dashoffset: 289.03; transition: stroke-dashoffset .06s linear; filter: drop-shadow(0 0 4px rgba(217, 250, 87, .7)); }
.v-hud.charged .tb-jump { animation: charged .5s ease-in-out infinite alternate; }
@keyframes charged { to { transform: scale(1.05); } }
.tb-grab { right: 18px; bottom: 120px; width: 70px; height: 70px; }
.tb-up, .tb-down { display: none; width: 64px; height: 64px; }
.tb-down { right: 118px; bottom: 8px; }
.tb-up { right: 118px; bottom: 84px; }
.tpad[data-mode=buttons] .tb-up, .tpad[data-mode=buttons] .tb-down { display: flex; }
.tpad[data-mode=buttons] .stick-zone { display: none; }
.dir-btns { display: none; }
.tpad[data-mode=buttons] .dir-btns { display: block; position: absolute; left: calc(var(--sal) + 16px); bottom: calc(var(--sab) + 20px); width: 180px; height: 90px; }
.tb-dir { width: 84px; height: 84px; bottom: 0; border-radius: 26px; }
.tb-dir[data-in=left] { left: 0; }
.tb-dir[data-in=right] { left: 96px; }
.tb-dir .ico { width: 32px; height: 32px; stroke-width: 2.6; }
.swipe-hint { position: absolute; right: calc(var(--sar) + 34px); bottom: calc(var(--sab) + 220px); display: flex; align-items: center; gap: 4px; opacity: .0; pointer-events: none;
  font: 700 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.swipe-hint .ico { width: 14px; height: 14px; }
.act-zone.swiped .tb-jump { animation: swiped .35s var(--ease); }
@keyframes swiped { 30% { transform: translate3d(0, -8px, 0) scale(1.06); background-color: var(--lime); } }

/* tutorial */
.tut { position: absolute; inset: 0; z-index: 8; pointer-events: auto; background: rgba(5, 14, 19, .58); animation: fade-in .3s ease; }
.tut-zone { position: absolute; top: 44%; bottom: calc(var(--sab) + 6px); border: 2px dashed rgba(217, 250, 87, .9); border-radius: 26px; background: rgba(217, 250, 87, .08); opacity: 0; transition: opacity .25s; }
.tz-left { left: calc(var(--sal) + 6px); width: calc(50% - 10px); }
.tz-right { right: calc(var(--sar) + 6px); width: calc(50% - 10px); }
.tut[data-zone=left] .tz-left, .tut[data-zone=right] .tz-right { opacity: 1; animation: zone-pulse 1.4s ease-in-out infinite; }
@keyframes zone-pulse { 50% { opacity: .55; } }
.tut-card { position: absolute; left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut)); top: calc(var(--sat) + 120px); max-width: 420px; margin: 0 auto;
  padding: 18px 18px 14px; border-radius: var(--r-lg); background: var(--glass-hi); border: 1px solid var(--line2); border-top: 3px solid var(--lime); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.tut-step { font-size: 11px; color: var(--lime); letter-spacing: .14em; }
.tut-h { margin: 6px 0 6px; font: italic 900 22px/1.1 var(--display); letter-spacing: -.03em; }
.tut-p { margin: 0; font-size: 15px; line-height: 1.45; color: #d6e2df; }
.tut-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
#ui:not(.touch) .tut-zone { display: none; }
@keyframes fade-in { from { opacity: 0; } }

/* toasts / countdown / flash / conn / snack */
.toasts { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 262px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 4; }
.toast { display: inline-flex; align-items: baseline; gap: 10px; max-width: calc(100vw - 40px); padding: 9px 16px; border-radius: 16px;
  background: rgba(8, 18, 24, .86); border: 1px solid rgba(255, 255, 255, .16); font-weight: 800; font-size: 17px; letter-spacing: -.02em;
  text-align: center; animation: toast-in .34s var(--spring) both; transition: opacity .3s, transform .3s var(--ease); }
.toast .pts { color: var(--lime); font: italic 900 19px var(--display); letter-spacing: -.03em; }
.toast.bad { color: #ffc2b8; border-color: rgba(255, 84, 70, .45); }
.toast.bad .pts { color: #ff8e80; }
.toast.info { font-weight: 650; font-size: 15px; color: #e3ecea; }
.toast.big { font: italic 900 22px/1.08 var(--display); padding: 12px 20px; border-color: rgba(217, 250, 87, .5); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.toast.big .pts { font-size: 23px; }
.toast > span { text-wrap: balance; }
.toast.out { opacity: 0; transform: translate3d(0, -10px, 0) scale(.96); }
@keyframes toast-in { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.85); } }

.countdown { position: absolute; left: 50%; top: 38%; z-index: 5; transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  font: italic 900 150px/1 var(--display); letter-spacing: -.06em; color: #fff; text-shadow: 0 8px 40px rgba(0, 0, 0, .45), 0 0 2px rgba(0, 0, 0, .4); white-space: nowrap; }
.countdown.show { animation: cd .9s var(--ease) both; }
.countdown.go { color: var(--lime); font-size: 92px; animation: cd-go 1.1s var(--ease) both; }
@keyframes cd { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.8); } }
@keyframes cd-go { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }

.flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; }
.flash.bad { background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 60, 40, .55) 100%); }
.flash.good { background: radial-gradient(ellipse at center, transparent 58%, rgba(217, 250, 87, .4) 100%); }
.flash.white { background: radial-gradient(ellipse at center, rgba(255, 255, 255, .0) 40%, rgba(255, 255, 255, .45) 100%); }
.flash.impact { background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 35%, rgba(5, 10, 14, .7) 100%); }
.flash.blood { background: radial-gradient(ellipse at 50% 45%, rgba(120, 0, 0, 0) 32%, rgba(150, 8, 8, .45) 62%, rgba(95, 0, 0, .9) 100%); }

.conn { position: absolute; z-index: 9; left: 50%; top: calc(var(--sat) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; border-radius: 20px; background: var(--glass-hi); border: 1px solid rgba(255, 178, 41, .55); font-size: 13.5px; font-weight: 650; white-space: nowrap; max-width: calc(100vw - 120px); animation: fade-in .2s; }
.conn span { overflow: hidden; text-overflow: ellipsis; }
.conn.error { border-color: rgba(255, 84, 70, .7); }
.conn.ok { border-color: rgba(217, 250, 87, .6); }
.conn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: var(--amber); animation: spin .8s linear infinite; flex: none; }
.conn.ok .spin { border-top-color: var(--lime); }
.conn.error .spin { animation: none; border-color: #ff5446; background: #ff5446; width: 10px; height: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.snack { position: absolute; z-index: 9; left: 50%; bottom: calc(var(--sab) + 24px); transform: translate3d(-50%, 20px, 0); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 14px; background: #f1f6f1; color: #10212b; font-size: 14px; font-weight: 700; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, transform .3s var(--ease); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.snack.on { opacity: 1; transform: translate3d(-50%, 0, 0); }

/* ─────────────── modals (bottom sheets on phone) ─────────────── */
.modal { position: absolute; inset: 0; z-index: 7; pointer-events: auto; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 12, 17, .62); animation: fade-in .2s ease; touch-action: pan-y; }
.sheet { position: relative; width: 100%; max-width: 520px; max-height: calc(100% - var(--sat) - 20px); overflow-y: auto; overscroll-behavior: contain;
  padding: 20px calc(var(--sar) + 18px) calc(var(--sab) + 18px) calc(var(--sal) + 18px); border-radius: 26px 26px 0 0;
  background: #10222c; border: 1px solid var(--line2); border-bottom: 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, .45); animation: sheet-up .36s var(--ease); }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); margin: -8px auto 12px; }
@keyframes sheet-up { from { transform: translate3d(0, 40%, 0); opacity: .4; } }
.sheet-label { display: flex; align-items: center; gap: 8px; font: 700 9.5px var(--mono); letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.sheet-label .mark { width: 26px; height: 20px; }
.sheet-label .ico:not(.mark) { width: 16px; height: 16px; color: var(--lime); }
.sheet h2 { margin: 8px 0 14px; font: italic 900 30px/1 var(--display); letter-spacing: -.04em; }
.sheet .close { position: absolute; top: 14px; right: calc(var(--sar) + 14px); }
.pause-note { margin: -6px 0 14px; font-size: 14px; color: var(--amber); font-weight: 600; }
.pause-stack { display: grid; gap: 10px; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pause-grid .btn { justify-content: flex-start; padding: 0 14px; font-size: 15px !important; }

.set-list { display: grid; gap: 8px; margin-bottom: 12px; }
.set-row { pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 14px; border-radius: var(--r-md); text-align: left;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--paper); }
.set-row > .ico { color: var(--muted); width: 22px; height: 22px; }
.set-row.on > .ico { color: var(--lime); }
.st { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st b { font-size: 15.5px; font-weight: 750; }
.st small { font-size: 12.5px; color: var(--muted); }
.sw { position: relative; flex: none; width: 50px; height: 30px; border-radius: 15px; background: rgba(255, 255, 255, .16); transition: background-color .2s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .25s var(--spring); }
.set-row.on .sw { background: var(--lime); }
.set-row.on .sw::after { transform: translateX(20px); }
.seg-row { flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.seg button { pointer-events: auto; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-size: 13.5px !important; font-weight: 700 !important; color: var(--muted) !important; }
.seg button.on { background: var(--lime); color: var(--lime-ink) !important; }
.tut-again { width: 100%; margin-bottom: 10px; }
.m-settings .btn.primary, .m-help > .sheet > .btn.primary { width: 100%; }

.help-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.help-grid h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 11px var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--lime); }
.help-grid h3 .ico { width: 18px; height: 18px; }
#ui:not(.touch) .help-touch { display: none; }
#ui.touch .help-keys { display: none; }
.ctl-list, .rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ctl-list li { display: grid; grid-template-columns: 124px 1fr; gap: 10px; align-items: center; font-size: 14px; color: #d8e3e0; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ctl-list .k { display: inline-flex; align-items: center; gap: 5px; font-weight: 750; color: #fff; font-size: 13.5px; flex-wrap: wrap; }
.ctl-list .k .ico { width: 18px; height: 18px; }
.ctl-list .k.lime { color: var(--lime); }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; background: #20343e; border: 1px solid #3c535c; border-bottom-width: 2.5px; font: 700 12px var(--mono); color: #fff; }
kbd.w { min-width: 0; padding: 0 9px; }
.rules li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; color: #d2dfdc; }
.rules .ico { width: 18px; height: 18px; color: var(--muted); margin-top: 1px; }
.rules b { color: #fff; }

/* ─────────────── results ─────────────── */
.res-panel { max-width: 560px; padding: 18px 16px 16px; border-radius: var(--r-lg); background: var(--glass-hi); border: 1px solid var(--line2); gap: 14px; }
.res-hero { display: flex; align-items: center; gap: 16px; padding: 4px 2px; }
.res-hero.won .avatar { box-shadow: 0 0 0 3px var(--lime), 0 0 30px rgba(217, 250, 87, .45); }
.res-hero h2 { margin: 6px 0 4px; font: italic 900 32px/1 var(--display); letter-spacing: -.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-hero-txt { min-width: 0; }
.res-sum { font-size: 14px; color: var(--muted); font-weight: 600; }
.res-sum b { color: var(--lime); font-size: 18px; }
.res-hero.solo { flex-direction: column; align-items: flex-start; gap: 4px; }
.res-big { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.res-big b { font: italic 900 64px/0.95 var(--display); letter-spacing: -.06em; color: #fff; }
.res-big span { font-size: 15px; color: var(--muted); font-weight: 650; }
.res-time { font-size: 18px; color: #e0ebe8; font-weight: 600; }
.badge-new, .res-rec { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; padding: 6px 12px 6px 9px; border-radius: 12px; font-size: 14px; font-weight: 750; }
.badge-new { background: var(--lime); color: var(--lime-ink); animation: toast-in .5s var(--spring) .2s both; }
.res-rec { background: rgba(255, 255, 255, .07); color: var(--muted); }
.res-rec b { color: #fff; }
.badge-new .ico, .res-rec .ico { width: 18px; height: 18px; }
.res-table-wrap { overflow-x: auto; margin: 0 -4px; }
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.res-table th { font: 650 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted2); text-align: left; padding: 0 4px 8px; white-space: nowrap; }
.res-table td { padding: 9px 4px; border-top: 1px solid var(--line); white-space: nowrap; }
.res-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.res-table tr.me td { background: rgba(217, 250, 87, .06); }
.res-table tr.dnf td { color: var(--muted2); }
.res-table .who { display: flex; align-items: center; gap: 8px; font-weight: 750; max-width: 140px; }
.res-table .who span { overflow: hidden; text-overflow: ellipsis; }
.res-table .who em { font-style: normal; font: 600 9.5px var(--mono); color: var(--lime); margin-left: 5px; text-transform: uppercase; letter-spacing: .1em; }
.res-table .tot { font-weight: 850; color: var(--lime); font-size: 15px; }
.res-table .bonus { color: var(--muted); }
.res-table .t { font-size: 12.5px; }
.place { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: italic 900 14px var(--display); background: rgba(255, 255, 255, .08); }
.place.gold { background: linear-gradient(145deg, #ffe680, #d9a91a); color: #3a2b00; }
.place.silver { background: linear-gradient(145deg, #f2f5f7, #9fadb6); color: #1e2a31; }
.place.bronze { background: linear-gradient(145deg, #f1b98a, #a9642f); color: #2e1606; }
.res-bd { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.res-bd .bd { grid-column: span 2; }
.res-bd .bd:nth-child(4), .res-bd .bd:nth-child(5) { grid-column: span 3; }
.bd { padding: 10px 10px 9px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); min-width: 0; }
.bd small { display: block; font: 650 9px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd b { display: block; margin-top: 4px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd span { display: block; font: 600 12px var(--mono); color: var(--lime); margin-top: 2px; }
.res-bd .bd.wide { grid-column: span 6; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bd.wide small { flex-basis: 100%; }
.bd.wide b { margin: 0; font-style: italic; }
.res-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 2px; }
.res-actions .btn { min-height: 56px; }
.btn.waiting { opacity: .7; }

/* ─────────────── modes (menu) ─────────────── */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { pointer-events: auto; position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 9px; row-gap: 2px; align-items: center; text-align: left;
  min-height: 64px; padding: 10px 12px; border-radius: var(--r-md); background: var(--glass); border: 1.5px solid var(--line); transition: transform .14s var(--ease), border-color .18s, background-color .18s; }
.mode:active { transform: scale(.97); }
.mode .ico { grid-row: 1 / span 2; width: 26px; height: 26px; color: var(--muted); }
.mode b { font: italic 900 15.5px/1.05 var(--display); letter-spacing: -.02em; }
.mode small { font-size: 11.5px; line-height: 1.25; color: var(--muted); }
.mode.on { border-color: var(--lime); background: rgba(30, 44, 30, .92); }
.mode.on .ico { color: var(--lime); }
#ui[data-mode=free] .v-menu .race-only, #ui[data-mode=race] .v-menu .free-only { display: none; }
#ui[data-lmode=free] .v-lobby .race-only { display: none; }
#ui:not(.free) .m-pause .free-only { display: none; }
.map-card { pointer-events: auto; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: var(--r-lg); text-align: left;
  background: var(--glass); border: 1px solid var(--line); color: var(--paper); transition: transform .14s var(--ease); }
.map-card:active { transform: scale(.98); }
.mc-art { flex: none; width: 104px; height: 64px; border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, #8fb8e6, #cfe0ee); }
.mc-art svg { width: 100%; height: 100%; display: block; }
.mc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mc-txt b { font: italic 900 19px/1.05 var(--display); letter-spacing: -.03em; }
.mc-txt small { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.map-card > .ico { color: var(--lime); }

/* lobby mode seg */
.seg-wide { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.seg-wide button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.seg-wide button .ico { width: 17px; height: 17px; }
.seg-wide.locked button:not(.on) { opacity: .35; }
#ui[data-lmode=free] .ready-btn { background: var(--lime); color: var(--lime-ink) !important; border-color: transparent; }

/* push-to-talk */
.ptt { pointer-events: auto; display: none; place-items: center; width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: rgba(8, 18, 24, .7); border: 1.5px solid rgba(255, 255, 255, .45); color: #fff; touch-action: none; transition: transform .1s var(--ease), background-color .12s; }
.ptt .ico { width: 26px; height: 26px; }
#ui.talk-ok .ptt { display: grid; }
#ui.talking-me .ptt, .ptt.pressed { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); transform: scale(1.06); box-shadow: 0 0 0 6px rgba(217, 250, 87, .25), 0 0 24px rgba(217, 250, 87, .6); }
.ptt-hud { position: absolute; bottom: calc(var(--sab) + 228px); right: calc(var(--sar) + 40px); }
#ui.talk-ok .lobby-actions { grid-template-columns: 1fr auto 1.6fr; }
.ptt-lobby { align-self: center; }
.talk-ind { position: absolute; z-index: 6; right: calc(var(--sar) + 10px); top: calc(var(--sat) + 158px); transform: translate3d(0, -8px, 0); opacity: 0; pointer-events: none; transition: opacity .18s, transform .25s var(--ease);
  display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 12px; border-radius: 20px; background: var(--glass-hi); border: 1px solid rgba(255, 122, 61, .6); font-size: 13.5px; font-weight: 750; white-space: nowrap; }
.talk-ind.on { opacity: 1; transform: none; }
.talk-ind.me { border-color: rgba(217, 250, 87, .7); }
.bars { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.bars i { width: 3.5px; height: 100%; border-radius: 2px; background: #ff7a3d; transform-origin: 50% 100%; animation: bar .7s ease-in-out infinite alternate; }
.talk-ind.me .bars i { background: var(--lime); }
.bars i:nth-child(2) { animation-delay: -.25s; } .bars i:nth-child(3) { animation-delay: -.5s; } .bars i:nth-child(4) { animation-delay: -.1s; }
@keyframes bar { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
#ui[data-view=lobby] .talk-ind { top: auto; bottom: calc(var(--sab) + 92px); right: auto; left: 50%; transform: translateX(-50%); }

/* free-ride HUD */
.hud-piste { position: absolute; top: calc(var(--sat) + 62px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 60px); display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 7px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); }
#ui:not(.free) .hud-piste, #ui.free .hud-prog, #ui.free .h-time { display: none; }
.pz-ref, .ms-badge { flex: none; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px; font: 800 15px var(--type); color: #fff; background: #e8322b; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.d-blue.pz-ref, .ms-badge.d-blue { background: #2f7bff; } .d-black.pz-ref, .ms-badge.d-black { background: #111417; } .d-orange.pz-ref, .ms-badge.d-orange { background: #ff8a1f; }
.pz-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pz-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-alt { font-size: 11.5px; color: var(--muted); }
.opp-gap.dist { color: #ffb184; }
#ui.riding-lift .tpad, #ui.riding-lift .hud-air { display: none !important; }

/* junction sign (Italian piste sign) */
.sign { position: absolute; z-index: 4; left: 0; right: 0; top: calc(var(--sat) + 204px); display: flex; justify-content: center; pointer-events: none; opacity: 0; transform: translate3d(0, -12px, 0); transition: opacity .2s, transform .35s var(--spring); }
.sign.on { opacity: 1; transform: none; }
.sg { display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 40px); padding: 8px 10px 8px 8px; border-radius: 8px; background: #e8322b; color: #fff; border: 3px solid #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.sg.d-blue { background: #2f6fe0; } .sg.d-black { background: #15191c; } .sg.d-orange { background: #f08019; }
.sg-ref { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 50%; background: #fff; color: #15191c; font: 900 14px var(--type); }
.sg-t { font: 800 16px/1.15 var(--type); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.sg-a .ico { width: 24px; height: 24px; stroke-width: 3; }

/* lift prompt + ride */
.lift-card { position: absolute; z-index: 6; left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut)); bottom: calc(var(--sab) + 300px); max-width: 460px; margin: 0 auto; pointer-events: auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: var(--r-lg); background: var(--glass-hi); border: 1px solid var(--line2); border-left: 4px solid var(--lime);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4); animation: toast-in .35s var(--spring); }
.lc-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(217, 250, 87, .14); color: var(--lime); }
.lc-ico.sm { width: 30px; height: 30px; border-radius: 9px; }
.lc-ico.sm .ico { width: 18px; height: 18px; }
.lc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lc-kind { font: 650 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-name { font-size: 15.5px; font-weight: 800; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-meta { font-size: 11.5px; color: var(--muted); }
.lc-x { width: 40px; min-width: 40px; height: 40px; padding: 0; background: transparent; border-color: transparent; color: var(--muted); }
.lift-ride { position: absolute; z-index: 6; left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut)); bottom: calc(var(--sab) + 18px); max-width: 460px; margin: 0 auto; pointer-events: auto;
  padding: 12px; border-radius: var(--r-lg); background: var(--glass-hi); border: 1px solid var(--line2); box-shadow: 0 14px 40px rgba(0, 0, 0, .4); animation: sheet-up .35s var(--ease); }
.lr-top { display: flex; align-items: center; gap: 10px; }
.lr-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-eta { font-size: 13px; color: var(--muted); }
.lr-track { position: relative; height: 5px; margin: 10px 0 12px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.lr-track i { position: absolute; inset: 0; background: var(--lime); transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s linear; }
.lr-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lr-btns .btn { padding: 0 10px; font-size: 14px !important; }
.lr-fast.on { border-color: var(--lime); color: var(--lime) !important; }

/* piste map */
.v-map { position: absolute; inset: 0; z-index: 7; pointer-events: auto; background: #c9d6df; animation: fade-in .2s ease; }
.map-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.map-top { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut)); display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-top .icon-btn { pointer-events: auto; background: var(--glass-hi); }
.map-title { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border-radius: 14px; background: var(--glass-hi); border: 1px solid var(--line); min-width: 0; }
.map-title b { font: italic 900 18px/1 var(--display); letter-spacing: -.03em; }
.map-title small { font: 600 10px var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-legend { position: absolute; top: calc(var(--sat) + 66px); left: calc(var(--sal) + var(--gut)); display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, .88); color: #10222c; font-size: 11.5px; font-weight: 700; max-width: calc(100% - 90px); pointer-events: none; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lgd { width: 14px; height: 4px; border-radius: 2px; background: #2f7bff; }
.lgd.d-red { background: #e8322b; } .lgd.d-black { background: #111417; } .lgd.lift { height: 2px; background: #1a2730; }
.map-zoom { position: absolute; right: calc(var(--sar) + var(--gut)); top: calc(var(--sat) + 66px); display: flex; flex-direction: column; gap: 6px; }
.map-zoom .icon-btn { background: var(--glass-hi); }
.map-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 12px 18px; border-radius: 14px; background: var(--glass-hi); font-weight: 700; font-size: 14px; pointer-events: none; }
.map-sel { position: absolute; left: calc(var(--sal) + var(--gut)); right: calc(var(--sar) + var(--gut)); bottom: calc(var(--sab) + 14px); max-width: 480px; margin: 0 auto; padding: 14px; border-radius: var(--r-lg);
  background: var(--glass-hi); border: 1px solid var(--line2); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); display: grid; gap: 12px; }
.map-sel.pop { animation: sheet-up .3s var(--ease); }
.map-sel .btn { width: 100%; justify-content: space-between; }
.ms-head { display: flex; align-items: center; gap: 12px; }
.ms-badge.lift, .ms-badge.st { background: rgba(217, 250, 87, .14); color: var(--lime); box-shadow: none; }
.ms-badge .ico { width: 20px; height: 20px; }
.ms-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-kind { font: 650 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ms-name { font-size: 18px; font-weight: 800; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-meta { font-size: 12.5px; color: var(--muted); }

/* piste choice */
.piste-list { display: grid; gap: 8px; margin-bottom: 12px; }
.piste-row { pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 12px 8px 10px; border-radius: var(--r-md); text-align: left;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--paper); transition: transform .12s var(--ease); }
.piste-row:active { transform: scale(.98); background: rgba(255, 255, 255, .1); }
.piste-row > .ico { color: var(--muted); }
.empty-note { color: var(--muted); font-size: 14px; }

/* prizes */
.prizes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prizes.one { grid-template-columns: 1fr; }
.prize { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 8px; border-radius: var(--r-md); border: 1px solid var(--line); min-width: 0; animation: toast-in .5s var(--spring) .15s both; }
.prize svg { flex: none; width: 64px; height: 64px; }
.prize.beer { background: linear-gradient(135deg, rgba(255, 196, 60, .2), rgba(255, 196, 60, .05)); border-color: rgba(255, 196, 60, .45); }
.prize.gag { background: linear-gradient(135deg, rgba(255, 111, 181, .2), rgba(255, 111, 181, .05)); border-color: rgba(255, 111, 181, .45); animation-delay: .3s; }
.pz-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pz-t small { font: 650 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-t b { font: italic 900 15px/1.1 var(--display); letter-spacing: -.02em; }
.prize.beer b { color: #ffd25e; } .prize.gag b { color: #ff9fd0; }
.pz-t span { font-size: 12px; line-height: 1.3; color: #d6e2df; }
.prizes:not(.one) .prize { flex-direction: column; text-align: center; padding: 10px 8px; }
.prizes:not(.one) .prize svg { width: 70px; height: 70px; }

/* settings extras */
.set-group { margin: 14px 2px 8px; font: 700 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--lime); }
.sheet h2 + .set-group { margin-top: 0; }
.range-row { flex-wrap: wrap; }
.range-row input[type=range] { flex-basis: 100%; }
#ui input[type=range] { -webkit-appearance: none; appearance: none; height: 30px; padding: 0; border: 0; background: transparent; --p: 50%; }
#ui input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--lime) var(--p), rgba(255, 255, 255, .16) var(--p)); }
#ui input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
#ui input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .16); }
#ui input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--lime); }
#ui input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; }
.input-row input.set-name { flex: 1; height: 42px !important; padding: 0 12px !important; max-width: 60%; }
.set-list .seg { flex-wrap: wrap; }
.set-row:has([data-seg]) { flex-wrap: wrap; row-gap: 10px; }
.set-row [data-seg] { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
.ready-btn.on .ico { color: var(--lime); }

/* left-handed: mirror thumb zones */
#ui.lefty .stick-zone { left: auto; right: 0; }
#ui.lefty .act-zone { right: auto; left: 0; }
#ui.lefty .stick-base, #ui.lefty .zone-lbl { left: auto; right: calc(var(--sar) + 26px); }
#ui.lefty .act-pad { right: auto; left: calc(var(--sal) + 16px); transform: scaleX(-1); }
#ui.lefty .act-pad .tb > * { transform: scaleX(-1); }
#ui.lefty .ptt-hud { right: auto; left: calc(var(--sal) + 22px); }
#ui.lefty .tpad[data-mode=buttons] .dir-btns { left: auto; right: calc(var(--sar) + 16px); }

/* ─────────────── phone: short portrait screens ─────────────── */
@media (max-height: 740px) and (orientation: portrait) {
  .title { font-size: clamp(52px, 15vw, 66px); }
  .tagline { margin-top: 6px; font-size: 13px; }
  .menu-panel, .lobby-panel { gap: 11px; }
  .rider { padding: 9px 6px 8px; gap: 6px; }
  .rider .avatar { width: 46px; height: 46px; }
  .cc-desc { -webkit-line-clamp: 1; }
  .btn.primary.big { min-height: 54px; }
  .room-code { font-size: 44px; margin-bottom: 10px; }
  .pcard { padding: 10px 8px; }
  .avatar.lg { width: 48px; height: 48px; }
}
@media (max-height: 640px) and (orientation: portrait) {
  .cc-desc { display: none; }
  .hero { display: flex; align-items: baseline; gap: 12px; }
  .title { font-size: 46px; }
  .tagline { margin: 0; font-size: 12px; }
}

/* ─────────────── phone landscape ─────────────── */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --gut: 12px; }
  .v-menu, .v-lobby, .v-results { justify-content: flex-start; padding-top: calc(var(--sat) + 10px); padding-bottom: calc(var(--sab) + 10px); }
  .topbar { top: calc(var(--sat) + 8px); }
  .brand { display: none; }
  .menu-panel { max-width: 900px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 14px; row-gap: 10px; align-items: start;
    grid-template-areas: "hero course" "modes course" "riders course" "inv actions" ". actions"; }
  .menu-panel > .hero { grid-area: hero; min-height: 70px; }
  .menu-panel > .invite-banner { grid-area: inv; }
  .menu-panel > .modes { grid-area: modes; }
  .menu-panel > .f-riders { grid-area: riders; }
  .menu-panel > .f-course { grid-area: course; padding-top: 50px; }
  .menu-panel > .actions { grid-area: actions; }
  .menu-panel > .actions { margin-top: -10px; }
  .mode { min-height: 52px; padding: 7px 10px; } .mode small { display: none; }
  .title { font-size: 46px; }
  .tagline { margin-top: 6px; font-size: 12.5px; }
  .rider { flex-direction: row; padding: 7px; gap: 8px; justify-content: flex-start; }
  .rider .avatar { width: 38px; height: 38px; }
  .rname { font-size: 13px; text-align: left; }
  .rider .tick { display: none; }
  .cc-desc { -webkit-line-clamp: 1; }
  .actions { gap: 8px; }
  .btn.primary.big { min-height: 52px; }
  .lobby-panel { max-width: 900px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; row-gap: 10px; }
  .lobby-panel > .room-head { grid-column: 1; }
  .lobby-panel > .players { grid-column: 1; }
  .lobby-panel > .field:nth-of-type(1) { grid-column: 2; grid-row: 1; }
  .lobby-panel > .field:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .lobby-panel > .lobby-status { grid-column: 1 / -1; }
  .lobby-panel > .lobby-actions { grid-column: 1 / -1; }
  .room-code { font-size: 40px; margin: 4px 0 10px; }
  .pcard { padding: 8px; gap: 6px; }
  .avatar.lg { width: 42px; height: 42px; }
  .res-panel { max-width: 720px; }
  .res-big b { font-size: 48px; }

  /* HUD landscape: one compact row, controls in the corners */
  .hud-strip { right: auto; width: min(430px, 52vw); }
  .hud-prog { top: calc(var(--sat) + 8px); left: auto; right: calc(var(--sar) + 60px); width: min(260px, 30vw); }
  .hud-strip .hud-btns { position: fixed; right: calc(var(--sar) + 10px); top: calc(var(--sat) + 8px); }
  .hud-opp { top: calc(var(--sat) + 62px); right: calc(var(--sar) + 60px); }
  .hud-inj { top: calc(var(--sat) + 62px); }
  .hud-air { top: calc(var(--sat) + 104px); }
  .toasts { top: calc(var(--sat) + 150px); }
  .sign { top: calc(var(--sat) + 104px); }
  .talk-ind { top: calc(var(--sat) + 116px); right: calc(var(--sar) + 60px); }
  .ptt-hud { bottom: calc(var(--sab) + 22px); right: calc(var(--sar) + 216px); }
  .lift-card { bottom: calc(var(--sab) + 16px); max-width: 420px; }
  .hud-piste { top: calc(var(--sat) + 8px); left: auto; right: calc(var(--sar) + 60px); width: min(260px, 30vw); }
  .stick-zone, .act-zone { top: 30%; width: 42%; }
  .act-pad { transform: scale(.9); transform-origin: 100% 100%; }
  .stick-base { bottom: calc(var(--sab) + 22px); left: calc(var(--sal) + 30px); }
  .zone-lbl { display: none; }
  .tut-zone { top: 30%; }
  .tz-left, .tz-right { width: 42%; }
  .tut-card { top: calc(var(--sat) + 40px); }
  .countdown { top: 42%; font-size: 120px; }
  .sheet { max-height: calc(100% - var(--sat) - 8px); }
  .modal { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line2); padding-bottom: 16px; }
  .sheet::before { display: none; }
  .help-grid { grid-template-columns: 1fr 1fr; }
}

/* ─────────────── tablets & desktop ─────────────── */
@media (min-width: 900px) and (min-height: 560px) {
  :root { --gut: 32px; }
  .scrim { background: linear-gradient(90deg, rgba(8, 20, 27, .94) 0, rgba(9, 22, 29, .86) 420px, rgba(9, 22, 29, .25) 640px, transparent 860px), linear-gradient(0deg, rgba(8, 20, 27, .4), transparent 30%); }
  .brand span { font-size: 10px; }
  .lbl-wide { display: inline; }
  .v-menu, .v-lobby { align-items: flex-start; justify-content: center; padding-top: calc(var(--sat) + 80px); padding-left: calc(var(--sal) + 48px); }
  .menu-panel, .lobby-panel { width: 420px; margin: auto 0; }
  .title { font-size: 112px; }
  .tagline { font-size: 17px; margin-top: 14px; }
  .rsub { display: block; font-size: 11px; color: var(--muted); text-align: center; }
  .v-results { justify-content: center; }
  .res-panel { padding: 24px 24px 20px; }
  .modal { align-items: center; }
  .sheet { border-radius: 26px; border-bottom: 1px solid var(--line2); padding: 26px; max-height: calc(100% - 60px); }
  .sheet::before { display: none; }
  .sheet .close { top: 18px; right: 18px; }
  .sheet.wide { max-width: 860px; }
  .help-grid { grid-template-columns: 1fr 1fr; gap: 26px; }

  /* desktop HUD */
  #ui:not(.touch) .hud-strip { top: calc(var(--sat) + 22px); left: 28px; right: auto; gap: 8px; }
  #ui:not(.touch) .hc { padding: 9px 14px 11px; border-radius: 16px; }
  #ui:not(.touch) .hl { font-size: 9.5px; margin-bottom: 6px; }
  #ui:not(.touch) .h-score { min-width: 160px; }
  #ui:not(.touch) .h-score b { font-size: 34px; }
  #ui:not(.touch) .h-time { min-width: 116px; }
  #ui:not(.touch) .h-time b { font-size: 24px; }
  #ui:not(.touch) .h-gates { display: block; min-width: 92px; }
  #ui:not(.touch) .h-gates b { font-size: 24px; font-family: var(--mono); font-weight: 650; }
  #ui:not(.touch) .hp-r .v-gates2 { display: none; }
  #ui:not(.touch) .h-speed { position: fixed; right: 28px; bottom: 26px; min-width: 170px; padding: 12px 18px 16px; text-align: right; }
  #ui:not(.touch) .h-speed .hl { position: absolute; right: 18px; bottom: 18px; margin: 0; }
  #ui:not(.touch) .h-speed b { font-size: 64px; padding-right: 64px; text-align: left; }
  #ui:not(.touch) .hud-strip .hud-btns { position: fixed; top: calc(var(--sat) + 22px); right: 28px; flex-direction: row; }
  #ui:not(.touch) .hud-btn { width: 48px; height: 48px; }
  #ui:not(.touch) .hud-prog { top: calc(var(--sat) + 22px); left: 50%; right: auto; width: min(440px, 30vw); transform: translateX(-50%); margin-left: 60px; padding: 10px 14px 12px; }
  #ui:not(.touch) .hud-opp { top: calc(var(--sat) + 82px); right: 28px; }
  #ui:not(.touch) .hud-inj { top: calc(var(--sat) + 104px); left: 28px; }
  #ui:not(.touch) .hud-air { top: 30%; }
  #ui:not(.touch) .toasts { top: 20%; }
  #ui:not(.touch) .charge { display: block; position: fixed; left: 50%; bottom: 13%; width: 76px; height: 76px; margin-left: -38px; opacity: 0; transform: scale(.8); transition: opacity .15s, transform .2s var(--ease); }
  #ui:not(.touch) .charge.on { opacity: 1; transform: scale(1); }
  .charge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
  .charge circle { fill: rgba(8, 18, 24, .55); stroke-width: 6; }
  .charge .bg { stroke: rgba(255, 255, 255, .18); }
  .charge .fg { fill: none; stroke: var(--lime); stroke-linecap: round; stroke-dasharray: 276.46; stroke-dashoffset: 276.46; }
  .charge span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
  #ui:not(.touch) .keys-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; position: fixed; left: 28px; bottom: 26px; max-width: 560px; padding: 10px 14px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line);
    font-size: 12.5px; color: #d0dcd9; font-weight: 600; transition: opacity .8s ease; }
  .keys-hint span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  .keys-hint kbd { min-width: 22px; height: 22px; font-size: 11px; }
  .keys-hint.fade { opacity: 0; }
  #ui:not(.touch) .tut { background: rgba(5, 14, 19, .45); }
  #ui:not(.touch) .tut-card { top: auto; bottom: 120px; }
  .countdown { font-size: 200px; }
  .countdown.go { font-size: 130px; }
}
@media (min-width: 900px) and (min-height: 560px) and (hover: hover) and (pointer: fine) {
  .course-card, .rider, .room-head, .pcard, #ui input, .hc, .res-panel { -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
  .course-card, .rider, .room-head, .pcard, #ui input { background-color: rgba(9, 21, 28, .7); }
  .rider:hover { border-color: var(--line2); }
  .car-arrow:hover { background: rgba(255, 255, 255, .16); }
}

@media (prefers-reduced-motion: reduce) {
  #ui *, #loader * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
