/* Mini Drift — light page, dark glass race HUD. Every colour is a token below; icons are Lucide (ISC) masks. */
:root {
  color-scheme:light;
  --bg:#f5f5f2; --surface:#ffffff; --surface-2:#efefea; --border:#e3e3dc; --border-strong:#cdcdc4;
  --text:#18181b; --text-muted:#56565e; --text-subtle:#85858d;
  --brand:#ff6a45; --brand-hover:#ff7f5e; --brand-ink:#2a120a; --brand-subtle:#ffe9e1; --brand-text:#c4432a;
  --glass:rgba(13,17,26,.6); --glass-strong:rgba(13,17,26,.8); --glass-line:rgba(255,255,255,.12); --glass-tile:rgba(255,255,255,.06); --glass-hover:rgba(255,255,255,.12); --glass-active:rgba(255,106,69,.18);
  --on-glass:#f7f7f4; --on-glass-muted:rgba(247,247,244,.72); --on-glass-subtle:rgba(247,247,244,.5);
  --shadow-sm:0 1px 2px rgba(20,22,34,.06),0 2px 8px rgba(20,22,34,.06); --shadow-md:0 1px 2px rgba(20,22,34,.08),0 8px 24px rgba(20,22,34,.12); --shadow-glass:0 1px 0 rgba(255,255,255,.06) inset,0 8px 32px rgba(8,10,18,.28);
  --text-shadow:0 1px 2px rgba(8,10,18,.55),0 4px 16px rgba(8,10,18,.35);
  --star:#ffc542; --star-off:rgba(247,247,244,.28); --coin:#ffc542; --coin-text:#a86d00; --success:#3ccf91; --warning:#f2b53c; --warning-subtle:#fdf3dd; --warning-text:#87600f;
  --sky:#badfd5; --sky-top:#b5dfdd; --grass:#9bcf9c;
  --track-coast:#5fc6c0; --track-forest:#7ccf74; --track-summit:#ff9a5c; --track-canyon:#e0a060; --track-night:#ff5fb2; --track-snow:#6cc2f2;
  --fx-boost:#ff9a3c; --fx-banner:#fffdf4; --fx-banner-shadow:#ff6a45; --fx-go:#ffd84a; --fx-charge-1:#7fd8ff; --fx-charge-2:#ffd257; --fx-charge-3:#ff6b3d;
  --item-turbo:#ff9a3c; --item-balloon:#5ab8f0; --item-jelly:#f27fb8; --item-shield:#7edbc4; --item-lightning:#ffd84a; --item-magnet:#ef5a5a; --item-phantom:#c3b4ff;
  --ease:cubic-bezier(.16,1,.3,1);
  --i-chevron-left:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E");
  --i-chevron-right:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
  --i-pause:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='14' y='4' width='4' height='16' rx='1'/%3E%3Crect x='6' y='4' width='4' height='16' rx='1'/%3E%3C/svg%3E");
  --i-play:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='6 3 20 12 6 21 6 3'/%3E%3C/svg%3E");
  --i-music:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
  --i-volume-x:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='22' x2='16' y1='9' y2='15'/%3E%3Cline x1='16' x2='22' y1='9' y2='15'/%3E%3C/svg%3E");
  --i-flag:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cline x1='4' x2='4' y1='22' y2='15'/%3E%3C/svg%3E");
  --i-timer:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='10' x2='14' y1='2' y2='2'/%3E%3Cline x1='12' x2='15' y1='14' y2='11'/%3E%3Ccircle cx='12' cy='14' r='8'/%3E%3C/svg%3E");
  --i-gift:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13'/%3E%3Cpath d='M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7'/%3E%3Cpath d='M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E");
  --i-zap:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2'/%3E%3C/svg%3E");
  --i-rotate-ccw:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E");
  --i-megaphone:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 14v-3z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
  --i-chevrons-down:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 6 5 5 5-5'/%3E%3Cpath d='m7 13 5 5 5-5'/%3E%3C/svg%3E");
  --i-wind:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2'/%3E%3Cpath d='M9.6 4.6A2 2 0 1 1 11 8H2'/%3E%3Cpath d='M12.6 19.4A2 2 0 1 0 14 16H2'/%3E%3C/svg%3E");
  --i-shopping-bag:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E");
  --i-arrow-right:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
  --i-refresh-cw:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3Cpath d='M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16'/%3E%3Cpath d='M8 16H3v5'/%3E%3C/svg%3E");
  --i-x:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
  --i-lock:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  --i-graduation-cap:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z'/%3E%3Cpath d='M22 10v6'/%3E%3Cpath d='M6 12.5V16a6 3 0 0 0 12 0v-3.5'/%3E%3C/svg%3E");
  --i-settings:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --i-message-square:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}
*,*::before,*::after { box-sizing:border-box; }
[hidden] { display:none !important; }
html { scroll-padding-top:8px; }
body { margin:0; background:var(--bg); color:var(--text); font-family:Pretendard,-apple-system,BlinkMacSystemFont,'Apple SD Gothic Neo','Malgun Gothic',sans-serif; line-height:1.6; letter-spacing:-.01em; word-break:keep-all; overflow-wrap:break-word; -webkit-font-smoothing:antialiased; }
button,a { -webkit-tap-highlight-color:transparent; }
button { font:inherit; letter-spacing:inherit; cursor:pointer; transition:background-color .15s var(--ease),border-color .15s var(--ease),color .15s var(--ease),transform .15s var(--ease),opacity .15s var(--ease); }
button:disabled { cursor:default; opacity:.45; }
:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
a { color:inherit; text-decoration:none; }
.ico,.icon-button::before,.start-button::after,.shop-open::before,.ranking-refresh span { display:inline-block; flex:none; width:20px; height:20px; background:currentColor; -webkit-mask:var(--i) center/contain no-repeat; mask:var(--i) center/contain no-repeat; }
.ico--left { --i:var(--i-chevron-left); }.ico--right { --i:var(--i-chevron-right); }.ico--flag { --i:var(--i-flag); }.ico--timer { --i:var(--i-timer); }.ico--gift { --i:var(--i-gift); }.ico--zap { --i:var(--i-zap); }.ico--reset { --i:var(--i-rotate-ccw); }.ico--horn { --i:var(--i-megaphone); }.ico--brake { --i:var(--i-chevrons-down); }.ico--drift { --i:var(--i-wind); }.ico--practice { --i:var(--i-graduation-cap); }

/* Page chrome */
.site-header { max-width:1600px; height:64px; margin:auto; padding:0 32px; display:flex; align-items:center; justify-content:space-between; }
.brand { display:flex; align-items:center; gap:4px; font-size:16px; font-weight:700; letter-spacing:-.02em; }
.brand span { font-weight:400; color:var(--text-subtle); }.brand i { margin-left:4px; font-style:normal; font-size:20px; color:var(--brand); }
.header-actions { display:flex; align-items:center; gap:24px; }
.back-link { display:flex; gap:8px; font-size:14px; color:var(--text-muted); }.back-link:hover { color:var(--text); }
.site-header .acct__login,.site-header .acct__me { min-height:40px; font-size:14px; }.site-header .acct__avatar { width:28px; height:28px; }.site-header .acct__menu { z-index:50; }
.kart-layout { width:100%; max-width:1600px; padding:0 24px 16px; margin:auto; }
.game-heading { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:4px 4px 16px; }
.game-wordmark { display:flex; align-items:center; gap:12px; }
.game-wordmark h1 { margin:0; font-size:28px; font-weight:800; letter-spacing:-.04em; font-style:italic; line-height:1; }.game-wordmark h1 em { color:var(--brand); font-style:inherit; }
.wordmark-track { width:32px; height:32px; display:grid; place-items:center; border-radius:10px; background:var(--text); color:var(--bg); font-size:20px; line-height:1; transform:skewX(-8deg); }
.game-korean { font-size:14px; color:var(--text-subtle); }
.game-heading > p { margin:0; color:var(--text-muted); font-size:14px; }.game-heading > p b { color:var(--text); font-weight:600; }.heading-dots { display:none; }
.game-footnote { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 4px 0; color:var(--text-subtle); font-size:12px; }
.game-footnote p { margin:0; }.game-footnote p:nth-child(2) { display:flex; flex-wrap:wrap; gap:4px 16px; }.game-footnote a { color:var(--text-muted); }.game-footnote a:hover { color:var(--text); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.noscript { margin:24px; padding:24px; border-radius:12px; background:var(--warning-subtle); color:var(--warning-text); text-align:center; }

/* Stage */
.race-stage { position:relative; isolation:isolate; width:100%; height:clamp(480px,calc(100svh - 156px),820px); overflow:hidden; border-radius:24px; background:var(--sky); box-shadow:var(--shadow-md); }
#race-canvas { display:block; width:100%; height:100%; touch-action:none; background:linear-gradient(var(--sky-top) 0 43%,var(--grass) 43% 100%); }
#race-canvas:focus-visible { outline-offset:-4px; }
.world-shade { position:absolute; inset:0; z-index:1; pointer-events:none; background:linear-gradient(180deg,rgba(8,12,20,.28) 0,transparent 22%,transparent 64%,rgba(8,12,20,.34) 100%); }
.speed-fx { position:absolute; inset:0; width:100%; height:100%; z-index:1; pointer-events:none; }
.race-stage::after { content:""; position:absolute; inset:0; z-index:1; pointer-events:none; opacity:0; background:radial-gradient(ellipse at 50% 55%,transparent 52%,color-mix(in srgb,var(--fx-boost) 38%,transparent) 100%); transition:opacity .25s var(--ease); }
.race-stage.is-boosting::after { opacity:1; }
.race-stage.is-flash::before { content:""; position:absolute; inset:0; z-index:4; pointer-events:none; background:var(--item-lightning); animation:flash .35s ease-out both; }
@keyframes flash { from { opacity:.55; } to { opacity:0; } }

/* Glass surfaces shared by the HUD */
.race-stats,.icon-button,.mini-map,#online-status,.driving-hud,.touch-controls button,.drive-tools button,.coach,.overlay-card,.shop,.course-label { background:var(--glass); border:1px solid var(--glass-line); box-shadow:var(--shadow-glass); color:var(--on-glass); -webkit-backdrop-filter:blur(16px) saturate(140%); backdrop-filter:blur(16px) saturate(140%); }

/* Top HUD */
.race-hud { position:absolute; inset:16px 16px auto; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; z-index:3; pointer-events:none; }
.race-stats { display:flex; align-items:stretch; padding:12px 4px; border-radius:16px; }
.race-stats > div { display:grid; align-content:center; gap:4px; padding:0 16px; border-left:1px solid var(--glass-line); }.race-stats > div:first-child { border:0; }
.race-stats span { font-size:11px; font-weight:600; letter-spacing:.08em; color:var(--on-glass-subtle); white-space:nowrap; }
.race-stats strong { font-size:20px; line-height:1.1; font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; white-space:nowrap; }
.position-stat p { display:flex; align-items:baseline; gap:4px; margin:0; }
.position-stat p strong { font-size:40px; line-height:.9; font-weight:800; font-style:italic; letter-spacing:-.04em; }
.position-stat p small { font-size:14px; color:var(--on-glass-subtle); font-variant-numeric:tabular-nums; }.position-stat p small span { font-size:inherit; letter-spacing:0; font-weight:500; color:inherit; }
.position-stat p strong.is-pop { animation:position-pop .45s var(--ease); }
@keyframes position-pop { 0% { transform:scale(1.5); } 100% { transform:scale(1); } }
.hud-utilities { display:flex; gap:8px; pointer-events:auto; }
.icon-button { display:grid; place-items:center; width:44px; height:44px; padding:0; border-radius:12px; font-size:0; }
.icon-button:hover:not(:disabled) { background:var(--glass-strong); }
.icon-button:active:not(:disabled) { transform:scale(.96); }
#sound-toggle::before { content:""; --i:var(--i-music); }#sound-toggle[aria-pressed="false"]::before { --i:var(--i-volume-x); }#sound-toggle[aria-pressed="false"] { color:var(--on-glass-subtle); }
#settings-toggle::before { content:""; --i:var(--i-settings); }#pause-toggle::before { content:""; --i:var(--i-pause); }#pause-toggle[data-paused="true"]::before { --i:var(--i-play); }
.icon-button--text { width:auto; min-width:52px; padding:0 12px; font-size:13px; font-weight:600; }.icon-button--text::before { display:none; }
.course-label { position:absolute; left:16px; top:104px; z-index:2; display:flex; align-items:center; gap:8px; padding:6px 12px; border-radius:999px; font-size:12px; font-weight:600; }
.course-label #race-mode { padding-left:8px; border-left:1px solid var(--glass-line); color:var(--on-glass-subtle); font-size:11px; letter-spacing:.06em; }
.live-dot { width:6px; height:6px; border-radius:50%; background:var(--success); box-shadow:0 0 0 3px color-mix(in srgb,var(--success) 25%,transparent); }
.online-tools { position:absolute; top:148px; left:16px; z-index:3; max-width:min(360px,calc(100% - 220px)); pointer-events:none; }
#online-status { display:table; max-width:100%; margin:0; padding:6px 12px; border-radius:10px; font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.online-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; pointer-events:auto; }
.online-actions button { min-height:44px; padding:8px 12px; border:1px solid var(--glass-line); border-radius:10px; background:var(--glass-strong); color:var(--on-glass); font-size:13px; font-weight:600; -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px); }
.online-actions button:hover { background:var(--glass); }
#online-discard { color:var(--on-glass-muted); }
.overlay-card .online-actions { margin-top:16px; }.overlay-card .online-actions button { flex:1; background:var(--glass-tile); -webkit-backdrop-filter:none; backdrop-filter:none; }.overlay-card .online-actions button:hover { background:var(--glass-hover); }
.mini-map { position:absolute; right:16px; top:72px; z-index:2; width:176px; padding:12px; border-radius:16px; text-align:center; }
#minimap { display:block; width:152px; height:95px; }
.mini-map > span { display:flex; justify-content:center; align-items:baseline; gap:8px; margin-top:8px; color:var(--on-glass-subtle); font-size:11px; }
.mini-map b { color:var(--on-glass); font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; }
.standings { list-style:none; margin:8px 0 0; padding:0; display:grid; gap:2px; text-align:left; }
.standings li { display:flex; align-items:center; gap:8px; padding:2px 8px; border-radius:6px; font-size:12px; line-height:1.5; color:var(--on-glass-muted); }
.standings li b { width:12px; font-style:italic; font-weight:700; color:var(--on-glass-subtle); }
.standings li i { width:8px; height:8px; border-radius:50%; flex:none; }
.standings li.is-me { background:var(--glass-active); color:var(--on-glass); font-weight:600; }.standings li.is-me b { color:var(--brand); }

/* Bottom HUD */
.driving-hud { position:absolute; left:50%; bottom:16px; transform:translateX(-50%); z-index:2; display:flex; align-items:center; gap:20px; padding:12px 20px; border-radius:20px; pointer-events:none; }
.speedometer { display:flex; align-items:baseline; gap:4px; min-width:112px; }
.speedometer strong { font-size:48px; line-height:1; font-weight:800; font-style:italic; letter-spacing:-.04em; font-variant-numeric:tabular-nums; }
.speedometer > span { font-size:12px; color:var(--on-glass-subtle); }
.drift-charge { width:176px; }
.drift-cue { position:absolute; left:0; right:0; bottom:calc(100% + 8px); margin:0; padding:8px 10px; border:1px solid var(--glass-line); border-radius:12px; background:var(--glass-strong); color:var(--on-glass); text-align:center; font-size:13px; font-weight:700; line-height:1.4; }
.drift-cue[data-state="ready"],.drift-cue[data-state="success"] { background:var(--brand); border-color:var(--brand); color:var(--brand-ink); }
.drift-charge > div { display:flex; align-items:baseline; gap:6px; white-space:nowrap; margin-bottom:8px; color:var(--on-glass-subtle); font-size:11px; font-weight:600; letter-spacing:.08em; }
.drift-charge b { margin-left:auto; color:var(--fx-go); font-size:16px; line-height:1; font-variant-numeric:tabular-nums; }
.boost-caption { font-size:11px; letter-spacing:.08em; }
#drift-meter { display:block; width:100%; height:8px; border:0; border-radius:8px; overflow:hidden; appearance:none; background:var(--glass-hover); color:var(--fx-charge-2); }
#drift-meter::-webkit-progress-bar { background:var(--glass-hover); }
#drift-meter::-webkit-progress-value { background:var(--fx-charge-2); border-radius:8px; transition:width .1s linear; }#drift-meter::-moz-progress-bar { background:var(--fx-charge-2); border-radius:8px; }
#drift-meter[data-level="1"]::-webkit-progress-value { background:var(--fx-charge-1); }#drift-meter[data-level="1"]::-moz-progress-bar { background:var(--fx-charge-1); }
#drift-meter[data-level="2"]::-webkit-progress-value { background:var(--fx-charge-2); }#drift-meter[data-level="2"]::-moz-progress-bar { background:var(--fx-charge-2); }
#drift-meter[data-level="3"]::-webkit-progress-value { background:var(--fx-charge-3); }#drift-meter[data-level="3"]::-moz-progress-bar { background:var(--fx-charge-3); }
.item-slot { display:grid; place-items:center; align-content:center; gap:4px; width:64px; height:64px; border-radius:16px; background:var(--glass-tile); border:1px solid var(--glass-line); text-align:center; }
.item-slot__icon { width:28px; height:28px; border-radius:50%; background:var(--glass-hover); }
.item-slot__name { font-size:11px; font-weight:600; line-height:1.2; color:var(--on-glass-muted); }
.item-slot[data-item="turbo"] .item-slot__icon { background:var(--item-turbo); }
.item-slot[data-item="balloon"] .item-slot__icon { background:var(--item-balloon); }
.item-slot[data-item="jelly"] .item-slot__icon { background:var(--item-jelly); border-radius:50% 50% 12px 12px; }
.item-slot[data-item="shield"] .item-slot__icon { background:transparent; border:4px solid var(--item-shield); }
.item-slot[data-item="lightning"] .item-slot__icon { background:var(--item-lightning); clip-path:polygon(45% 0,90% 0,60% 40%,95% 40%,25% 100%,40% 55%,5% 55%); border-radius:0; }
.item-slot[data-item="magnet"] .item-slot__icon { background:transparent; border:6px solid var(--item-magnet); border-top-color:transparent; }
.item-slot[data-item="phantom"] .item-slot__icon { background:var(--item-phantom); border-radius:50% 50% 30% 30%; opacity:.8; }
.item-slot.is-new { animation:position-pop .45s var(--ease); }
.race-message { position:absolute; left:50%; bottom:148px; transform:translateX(-50%); z-index:2; width:min(560px,calc(100% - 48px)); margin:0; color:var(--on-glass); text-align:center; font-size:14px; font-weight:600; line-height:1.4; text-shadow:var(--text-shadow); pointer-events:none; min-height:20px; }

/* Touch and tool buttons */
.touch-controls { position:absolute; left:16px; right:16px; bottom:16px; z-index:3; display:flex; align-items:flex-end; justify-content:space-between; gap:16px; pointer-events:none; }
.steer-controls,.power-controls { display:flex; gap:8px; pointer-events:auto; }
.touch-controls button { display:flex; align-items:center; justify-content:center; gap:8px; min-height:64px; padding:8px 16px; border-radius:16px; touch-action:none; -webkit-user-select:none; user-select:none; text-align:left; }
.touch-controls button:hover { background:var(--glass-strong); }
.touch-controls button.is-pressed,.touch-controls button:active { background:var(--glass-active); border-color:var(--brand); transform:scale(.97); }
.steer-controls button { width:72px; padding:0; }.steer-controls .ico { width:28px; height:28px; }
.power-controls button > span:nth-child(2) { font-size:14px; font-weight:700; line-height:1.3; }
.power-controls small { display:block; font-size:11px; font-weight:500; color:var(--on-glass-subtle); }
.power-controls .ico { width:24px; height:24px; }
.power-controls .boost-button { background:color-mix(in srgb,var(--brand) 78%,transparent); border-color:color-mix(in srgb,var(--brand) 60%,white); color:var(--brand-ink); }
.power-controls .boost-button small { color:color-mix(in srgb,var(--brand-ink) 70%,transparent); }
.power-controls .boost-button:hover { background:var(--brand); }
.power-controls .item-button .ico { color:var(--item-phantom); }
.drive-tools { position:absolute; right:16px; bottom:96px; z-index:3; display:flex; gap:8px; }
.drive-tools button { display:flex; align-items:center; gap:8px; min-height:40px; padding:8px 12px; border-radius:12px; font-size:12px; font-weight:600; touch-action:none; -webkit-user-select:none; user-select:none; }
.drive-tools .ico { width:16px; height:16px; }
.drive-tools button:hover { background:var(--glass-strong); }
.drive-tools button.is-pressed { background:var(--glass-active); border-color:var(--brand); }
.drive-tools button.is-suggested { background:var(--brand); border-color:var(--brand); color:var(--brand-ink); animation:position-pop .6s var(--ease) 3; }

/* Centre moments */
.countdown { position:absolute; inset:36% 0 auto; z-index:4; margin:0; text-align:center; color:var(--fx-banner); font-size:clamp(80px,11vw,152px); font-weight:800; font-style:italic; letter-spacing:-.04em; line-height:1; text-shadow:0 6px 0 var(--fx-banner-shadow),0 12px 40px rgba(8,10,18,.35); pointer-events:none; }
.countdown.is-pop { animation:count-pop .9s var(--ease) both; }
.countdown.is-go { color:var(--fx-go); font-size:clamp(96px,14vw,192px); animation-duration:.75s; }
@keyframes count-pop { 0% { transform:scale(1.8); opacity:0; } 22% { transform:scale(1); opacity:1; } 78% { opacity:1; } 100% { transform:scale(.92); opacity:0; } }
.race-banner { position:absolute; left:0; right:0; top:24%; z-index:4; margin:0; text-align:center; color:var(--fx-banner); font-size:clamp(32px,5vw,64px); font-weight:800; font-style:italic; letter-spacing:-.03em; line-height:1.1; text-shadow:0 4px 0 var(--fx-banner-shadow),0 8px 32px rgba(8,10,18,.35); pointer-events:none; }
.race-banner small { display:block; margin-top:8px; font-size:.32em; font-style:normal; letter-spacing:.08em; }
.race-banner.is-show { animation:banner-in 1.6s var(--ease) both; }
.race-banner--finish { color:var(--fx-go); font-size:clamp(48px,8vw,104px); }
@keyframes banner-in { 0% { transform:translateX(-24%) skewX(-12deg); opacity:0; } 16% { transform:none; opacity:1; } 82% { transform:none; opacity:1; } 100% { transform:translateX(16%) skewX(-12deg); opacity:0; } }
.voice-bubble { position:absolute; left:50%; bottom:152px; z-index:4; margin:0; padding:8px 16px; transform:translateX(-50%); border-radius:16px; background:var(--surface); box-shadow:var(--shadow-md); color:var(--text); font-size:14px; font-weight:700; white-space:nowrap; pointer-events:none; }
.voice-bubble::after { content:""; position:absolute; left:50%; bottom:-6px; width:12px; height:12px; transform:translateX(-50%) rotate(45deg); background:var(--surface); }
.voice-bubble small { margin-right:8px; font-size:12px; font-weight:600; color:var(--text-muted); }
.voice-bubble.is-pop { animation:bubble-pop 1.5s var(--ease) both; }
@keyframes bubble-pop { 0% { opacity:0; transform:translateX(-50%) translateY(8px) scale(.8); } 12% { opacity:1; transform:translateX(-50%) scale(1); } 80% { opacity:1; } 100% { opacity:0; transform:translateX(-50%) translateY(-6px); } }
.coach { position:absolute; top:16px; left:50%; transform:translateX(-50%); z-index:5; width:min(440px,calc(100% - 32px)); padding:16px; border-radius:16px; pointer-events:auto; }
.coach__head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.coach__step { font-size:12px; font-weight:700; color:var(--brand); letter-spacing:.06em; }
.coach__skip { min-height:32px; padding:4px 12px; border:1px solid var(--glass-line); border-radius:8px; background:transparent; color:var(--on-glass-muted); font-size:12px; }
.coach__skip:hover { background:var(--glass-hover); color:var(--on-glass); }
.coach strong { display:block; margin-top:4px; font-size:16px; line-height:1.4; }
.coach p { margin:4px 0 0; font-size:13px; line-height:1.6; color:var(--on-glass-muted); }
.coach kbd,.overlay-note kbd { display:inline-block; min-width:20px; padding:0 6px; border:1px solid var(--glass-line); border-bottom-width:2px; border-radius:6px; background:var(--glass-tile); font:inherit; font-size:11px; font-weight:700; color:var(--on-glass); text-align:center; }
.coach__dots { display:flex; gap:4px; margin-top:12px; }
.coach__dots i { flex:1; height:4px; border-radius:4px; background:var(--glass-hover); }
.coach__dots i.is-done { background:var(--brand); }
.coach.is-pass { animation:coach-pass .25s var(--ease); }
@keyframes coach-pass { from { opacity:.6; } to { opacity:1; } }
.race-stage.is-practicing :is(.online-tools,.course-label,.mini-map) { visibility:hidden; }
.coach .coach__feedback { color:var(--fx-go); font-weight:600; min-height:20px; }
.coach__footer { display:flex; align-items:center; gap:12px; margin-top:8px; }
.coach__footer .coach__dots { flex:1; margin:0; }
.coach__retry { min-height:44px; padding:6px 12px; border:1px solid var(--glass-line); border-radius:10px; background:var(--glass-tile); color:var(--on-glass); font:inherit; font-size:12px; }
.coach__retry:hover { background:var(--glass-hover); }
.camera-setting { display:flex; align-items:center; gap:10px; min-height:44px; color:var(--on-glass); font-size:13px; cursor:pointer; }
.camera-setting input { width:20px; height:20px; margin:0; accent-color:var(--brand); flex-shrink:0; }
.camera-setting small { display:block; margin-top:2px; font-size:11px; line-height:1.5; color:var(--on-glass-subtle); }
.wallet-storage { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.wallet-storage p { flex:1; min-width:180px; }
.wallet-storage p,.wallet-storage-summary { margin:0; font-size:12px; line-height:1.5; color:var(--on-glass-muted); }
.wallet-storage-summary:empty { display:none; }
.wallet-storage button { min-height:44px; border:1px solid var(--brand); border-radius:10px; padding:6px 12px; background:var(--glass-tile); color:var(--on-glass); font-size:12px; }

/* Menu card (lobby, pause, results) */
.game-overlay { position:absolute; inset:0; z-index:6; display:flex; align-items:stretch; justify-content:flex-start; padding:16px; pointer-events:none; background:linear-gradient(90deg,rgba(8,12,20,.38) 0,rgba(8,12,20,.12) 36%,transparent 60%); }
.overlay-card { position:relative; display:flex; flex-direction:column; width:420px; max-height:100%; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:var(--glass-hover) transparent; padding:24px 24px 0; pointer-events:auto; border-radius:24px; background:var(--glass-strong); }
.overlay-card > :last-child { margin-bottom:24px; }
.overlay-eyebrow { display:flex; align-items:center; gap:8px; color:var(--brand); font-size:11px; font-weight:700; letter-spacing:.12em; }
.overlay-card h2 { margin:8px 0 4px; font-size:28px; line-height:1.25; letter-spacing:-.03em; font-weight:700; white-space:pre-line; }
.overlay-card > p:not(.overlay-note) { margin:0 0 24px; color:var(--on-glass-muted); font-size:14px; line-height:1.6; white-space:pre-line; }
.lobby-options { display:grid; gap:20px; }
.selector-label { display:flex; align-items:baseline; gap:8px; margin-bottom:8px; color:var(--on-glass-muted); font-size:12px; font-weight:600; }
.star-total { color:var(--star); font-weight:700; }
.track-picker,.mode-picker { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.track-picker > button,.mode-picker > button,.color-picker > button,.shop-open,.local-run-button { border:1px solid var(--glass-line); background:var(--glass-tile); color:var(--on-glass); }
.track-picker > button:hover,.mode-picker > button:hover,.color-picker > button:hover,.shop-open:hover,.local-run-button:hover { background:var(--glass-hover); }
.track-picker > button[aria-pressed="true"],.mode-picker > button[aria-pressed="true"],.color-picker > button[aria-pressed="true"] { border-color:var(--brand); background:var(--glass-active); box-shadow:0 0 0 1px var(--brand) inset; }
.track-picker > button { min-width:0; padding:8px 8px 12px; border-radius:12px; text-align:left; }
.track-picker b { display:block; font-size:13px; font-weight:600; line-height:1.4; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.track-picker small { display:block; font-size:11px; color:var(--on-glass-subtle); }
.track-thumb { display:block; width:100%; height:28px; margin-bottom:8px; }
.track-thumb svg { display:block; width:100%; height:100%; overflow:visible; }
.track-thumb path { fill:none; stroke:var(--on-glass-subtle); stroke-width:5; stroke-linecap:round; stroke-linejoin:round; }
.track-thumb--coast path { stroke:var(--track-coast); }.track-thumb--forest path { stroke:var(--track-forest); }.track-thumb--summit path { stroke:var(--track-summit); }.track-thumb--canyon path { stroke:var(--track-canyon); }.track-thumb--night path { stroke:var(--track-night); }.track-thumb--snow path { stroke:var(--track-snow); }
.track-stars { display:block; margin-top:4px; font-size:11px; letter-spacing:2px; color:var(--star); }.track-stars i { font-style:normal; color:var(--star-off); }
.mode-picker > button { display:grid; justify-items:start; align-content:start; gap:8px; min-height:96px; padding:12px; border-radius:12px; text-align:left; }
.mode-picker > button > .ico { color:var(--on-glass-muted); }.mode-picker > button[aria-pressed="true"] > .ico { color:var(--brand); }
.mode-picker > button > span:nth-child(2) { font-size:14px; font-weight:600; line-height:1.3; }
.mode-picker small { display:block; margin-top:4px; font-size:11px; font-weight:400; line-height:1.4; color:var(--on-glass-subtle); }
.shop-open { display:flex; align-items:center; gap:12px; width:100%; min-height:48px; padding:8px 16px; border-radius:12px; font-size:13px; font-weight:600; text-align:left; }
.shop-open::before { content:""; --i:var(--i-shopping-bag); color:var(--on-glass-muted); }
.shop-open > span { flex:1; min-width:0; }
.shop-open b { color:var(--coin); font-size:14px; font-variant-numeric:tabular-nums; }
.selector-group--color .selector-label { flex-wrap:wrap; }
.color-hint { font-size:11px; font-weight:400; color:var(--on-glass-subtle); }
.color-note { display:none; }
.color-picker { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:4px; }
.color-picker > button { position:relative; display:grid; place-items:center; min-width:0; height:44px; padding:0; border-radius:10px; }
.color-picker > button > span { display:block; width:24px; height:16px; border-radius:6px 6px 4px 4px; background:var(--kart-color); box-shadow:inset 0 -3px 0 rgba(0,0,0,.18),inset 0 2px 0 rgba(255,255,255,.35); }
.color-picker > button.is-locked { opacity:.5; }
.color-picker > button.is-locked::after { content:attr(data-need); position:absolute; inset:auto 0 2px; font-size:10px; font-weight:700; line-height:1; color:var(--on-glass-muted); text-align:center; }
.start-button { position:sticky; bottom:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:56px; margin-top:24px; padding:12px 20px; border:0; border-radius:14px; background:var(--brand); color:var(--brand-ink); font-size:16px; font-weight:700; box-shadow:0 -16px 24px 8px var(--glass-strong),0 6px 20px color-mix(in srgb,var(--brand) 45%,transparent); }
.start-button::after { content:""; --i:var(--i-arrow-right); }
.start-button:hover { background:var(--brand-hover); }
.start-button:active { transform:translateY(1px) scale(.99); }
.local-run-button { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:48px; margin-top:8px; padding:8px 16px; border-radius:12px; font-size:13px; font-weight:600; }
.tutorial-button small { font-size:12px; font-weight:400; color:var(--on-glass-subtle); }
.tutorial-button.is-suggested { border-color:var(--brand); color:var(--on-glass); box-shadow:0 0 0 1px var(--brand) inset; }
.tutorial-button { flex-direction:column; gap:4px; margin:0 0 16px; min-height:60px; flex-shrink:0; }
.restart-button { display:block; min-height:44px; margin:8px auto 0; padding:8px 16px; border:0; border-radius:10px; background:transparent; color:var(--on-glass-muted); font-size:13px; }
.restart-button:hover { background:var(--glass-hover); color:var(--on-glass); }
.overlay-note { margin:16px 0 0; color:var(--on-glass-subtle); font-size:12px; line-height:2; }
#ranked-entry-disclosure { display:block; margin:8px 0 0; color:var(--on-glass-subtle); font-size:12px; line-height:1.6; }
.result-panel { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:16px; }
.result-panel > div { display:grid; gap:4px; padding:12px 16px; border-radius:12px; background:var(--glass-tile); text-align:left; }
.result-panel > div:first-child { grid-column:1 / -1; display:flex; align-items:baseline; justify-content:space-between; }
.result-panel span { font-size:12px; color:var(--on-glass-subtle); }
.result-panel strong { font-size:20px; font-weight:700; font-variant-numeric:tabular-nums; }
.result-panel > div:first-child strong { color:var(--brand); font-size:56px; line-height:1; font-style:italic; letter-spacing:-.04em; }
.result-panel strong.result-stars,.result-stars { color:var(--star); letter-spacing:2px; }
#result-online { display:block; margin:16px 0 0; color:var(--on-glass-muted); font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.game-overlay[data-state="paused"],.game-overlay[data-state="finished"] { justify-content:center; align-items:center; background:rgba(8,12,20,.42); }
.game-overlay[data-state="paused"] .overlay-card,.game-overlay[data-state="finished"] .overlay-card { width:400px; text-align:center; }
.game-overlay[data-state="paused"] .overlay-eyebrow,.game-overlay[data-state="finished"] .overlay-eyebrow { justify-content:center; }
.game-overlay[data-state="paused"] #lobby-options,.game-overlay[data-state="finished"] #lobby-options,.game-overlay[data-state="paused"] #ranked-entry-disclosure,.game-overlay[data-state="finished"] #ranked-entry-disclosure { display:none; }
.game-overlay[data-state="paused"] .start-button,.game-overlay[data-state="finished"] .start-button { box-shadow:0 6px 20px color-mix(in srgb,var(--brand) 45%,transparent); }
.game-overlay[data-state="finished"].is-podium { justify-content:flex-start; align-items:flex-end; background:linear-gradient(90deg,rgba(8,12,20,.42) 0,transparent 55%); }
/* In the lobby and the shop only the scene, the map and the menu stay; driving controls appear with the race. */
.race-stage:has(> .game-overlay[data-state="lobby"]:not([hidden])) :is(.race-stats,.course-label,.driving-hud,.touch-controls,.drive-tools,.race-message),
.race-stage:has(> .shop:not([hidden])) :is(.race-stats,.course-label,.driving-hud,.touch-controls,.drive-tools,.race-message,.mini-map) { visibility:hidden; }
.race-stage.is-podium .driving-hud,.race-stage.is-podium .touch-controls,.race-stage.is-podium .drive-tools,.race-stage.is-podium .race-message,.race-stage.is-podium .speed-fx,.race-stage.is-podium .mini-map,.race-stage.is-podium .course-label,.race-stage.is-podium .race-stats,.race-stage.is-podium .online-tools { display:none; }

/* Shop */
.shop { position:absolute; z-index:7; left:16px; top:16px; bottom:16px; width:min(460px,calc(100% - 32px)); display:flex; flex-direction:column; gap:16px; padding:20px; border-radius:24px; background:var(--glass-strong); overflow-y:auto; overscroll-behavior:contain; }
.shop > :not(.shop__grid) { flex-shrink:0; }
.shop__head { display:flex; align-items:center; gap:12px; }
.shop__head h2 { margin:0; font-size:20px; font-weight:700; }
.shop__coins { margin-left:auto; font-size:13px; color:var(--on-glass-muted); }.shop__coins b { color:var(--coin); font-size:16px; font-variant-numeric:tabular-nums; }
.shop__close { display:grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--glass-line); border-radius:10px; background:transparent; color:var(--on-glass-muted); font-size:0; }
.shop__close::before { content:""; display:block; width:18px; height:18px; background:currentColor; -webkit-mask:var(--i-x) center/contain no-repeat; mask:var(--i-x) center/contain no-repeat; }
.shop__close:hover { background:var(--glass-hover); color:var(--on-glass); }
/* Settings: one glass panel like the shop — account box (portal docs/GAME-ACCOUNT-FEEDBACK.md) and feedback. */
.settings { gap:24px; }
.settings-group { display:grid; gap:8px; padding:16px; border-radius:16px; background:var(--glass-tile); }
.settings-group h3 { margin:0 0 4px; color:var(--on-glass-subtle); font-size:12px; font-weight:600; letter-spacing:.06em; }
.settings-account-name { margin:0; color:var(--on-glass); font-size:16px; font-weight:600; word-break:keep-all; }
.settings-note { margin:0; max-width:68ch; color:var(--on-glass-muted); font-size:13px; line-height:1.6; letter-spacing:-.01em; word-break:keep-all; }
.settings-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.settings-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:8px 16px; border:1px solid var(--glass-line); border-radius:12px; background:var(--glass-tile); color:var(--on-glass); font:inherit; font-size:14px; font-weight:600; }
.settings-button:hover:not(:disabled) { background:var(--glass-hover); }
.settings-button:active:not(:disabled) { transform:scale(.98); }
.settings-button--primary { border-color:var(--brand); background:var(--brand); color:var(--brand-ink); }
.settings-button--primary:hover:not(:disabled) { background:var(--brand-hover); }
.settings-button[aria-busy="true"] { cursor:progress; opacity:.7; }
.settings-button--quiet { border-color:transparent; background:transparent; color:var(--on-glass-muted); }
.settings-button--feedback::before,.restart-button--feedback::before { content:""; width:18px; height:18px; background:currentColor; -webkit-mask:var(--i-message-square) center/contain no-repeat; mask:var(--i-message-square) center/contain no-repeat; }
.restart-button--feedback { display:flex; align-items:center; justify-content:center; gap:8px; }
.shop__tabs { display:grid; grid-template-columns:repeat(5,1fr); gap:4px; padding:4px; border-radius:12px; background:var(--glass-tile); }
.shop__tabs button { min-height:36px; border:0; border-radius:8px; background:transparent; color:var(--on-glass-muted); font-size:13px; font-weight:600; }
.shop__tabs button:hover { color:var(--on-glass); }
.shop__tabs button[aria-selected="true"] { background:var(--glass-hover); color:var(--on-glass); }
.shop__grid { flex:1 0 104px; min-height:104px; overflow:auto; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-content:start; gap:8px; scrollbar-width:thin; scrollbar-color:var(--glass-hover) transparent; }
.shop-card { display:grid; justify-items:center; align-content:center; gap:4px; min-height:104px; padding:12px 8px; border:1px solid var(--glass-line); border-radius:12px; background:var(--glass-tile); color:var(--on-glass); font-size:13px; text-align:center; }
.shop-card:hover { background:var(--glass-hover); }
.shop-card[aria-pressed="true"] { border-color:var(--brand); background:var(--glass-active); box-shadow:0 0 0 1px var(--brand) inset; }
.shop-card__swatch { width:40px; height:40px; border-radius:50%; background:var(--swatch,var(--glass-hover)); box-shadow:inset 0 0 0 2px rgba(255,255,255,.35); }
.shop-card__name { font-weight:600; line-height:1.3; }
.shop-card__state { font-size:11px; color:var(--on-glass-subtle); }
.shop-card__state.is-price { color:var(--coin); font-weight:700; }
.shop-card__state.is-on { color:var(--success); font-weight:700; }
.shop__detail { display:flex; align-items:center; gap:12px; padding-top:16px; border-top:1px solid var(--glass-line); }
.shop__detail > div { flex:1; min-width:0; }
.shop__detail strong { font-size:16px; }
.shop__detail p { margin:4px 0 0; font-size:12px; line-height:1.5; color:var(--on-glass-muted); }
.shop__action { min-width:112px; min-height:48px; padding:8px 20px; border:0; border-radius:12px; background:var(--brand); color:var(--brand-ink); font-size:14px; font-weight:700; }
.shop__action:hover:not(:disabled) { background:var(--brand-hover); }
.shop__note { margin:0; font-size:11px; line-height:1.6; color:var(--on-glass-subtle); }

/* Leaderboard below the stage */
.kart-leaderboard { margin:40px auto 16px; padding:32px; border:1px solid var(--border); border-radius:24px; background:var(--surface); box-shadow:var(--shadow-sm); }
.ranking-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:32px; }
.ranking-eyebrow { margin:0 0 8px; color:var(--brand-text); font-size:11px; letter-spacing:.12em; font-weight:700; }
.ranking-heading h2 { margin:0; font-size:32px; line-height:1.25; letter-spacing:-.03em; font-weight:700; }
#ranking-disclosure { max-width:68ch; margin:12px 0 0; color:var(--text-muted); font-size:14px; line-height:1.7; }
.ranking-refresh { flex:none; display:flex; align-items:center; gap:8px; min-height:44px; padding:8px 16px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text-muted); font-size:14px; font-weight:600; }
.ranking-refresh span { --i:var(--i-refresh-cw); width:16px; height:16px; font-size:0; }
.ranking-refresh:hover { background:var(--surface-2); color:var(--text); }
.ranking-filters { display:grid; grid-template-columns:minmax(0,2fr) minmax(220px,1fr); gap:32px; margin-top:32px; }
.ranking-filter-group > span { display:block; color:var(--text-subtle); font-size:12px; font-weight:600; margin-bottom:8px; }
.ranking-tracks,.ranking-modes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px; border-radius:12px; background:var(--surface-2); }.ranking-modes { grid-template-columns:repeat(2,minmax(0,1fr)); }
.ranking-tracks button,.ranking-modes button { min-width:0; min-height:40px; padding:8px 12px; border:0; border-radius:8px; background:transparent; color:var(--text-muted); font-size:13px; font-weight:600; }
.ranking-tracks button:hover,.ranking-modes button:hover { color:var(--text); }
.ranking-tracks button[aria-pressed="true"],.ranking-modes button[aria-pressed="true"] { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.ranking-body { display:grid; grid-template-columns:minmax(240px,.8fr) minmax(0,1.9fr); gap:32px; margin-top:32px; }
.kart-leaderboard .account-record { min-width:0; padding:24px; border-radius:16px; background:var(--bg); align-self:start; }
.kart-leaderboard .account-record h3,.ranking-results-heading h3 { margin:0; font-size:16px; font-weight:700; letter-spacing:-.02em; }
.account-record-metrics { margin:16px 0 0; display:grid; gap:16px; }
.account-record-metrics dt { margin-bottom:4px; color:var(--text-subtle); font-size:12px; }
.account-record-metrics dd { display:flex; align-items:baseline; gap:4px; margin:0; }
.account-record-metrics strong { font-size:32px; font-weight:700; letter-spacing:-.03em; line-height:1.15; font-variant-numeric:tabular-nums; }
.account-record-metrics small { font-size:13px; color:var(--text-subtle); }
.account-record-copy { margin:16px 0 0; color:var(--text-muted); font-size:13px; line-height:1.7; }
.ranking-login { display:flex; justify-content:space-between; align-items:center; gap:16px; width:100%; min-height:48px; margin-top:16px; padding:8px 16px; border:0; border-radius:12px; background:var(--text); color:var(--bg); font-size:14px; font-weight:600; }
.ranking-login:hover { background:var(--text-muted); }
.account-record-fine,.ranking-fine { margin:12px 0 0; color:var(--text-subtle); font-size:12px; line-height:1.7; }
.ranking-results { min-width:0; }
.ranking-results-heading { display:flex; justify-content:space-between; align-items:baseline; gap:16px; margin-bottom:12px; }
.ranking-results-heading h3 span { margin-left:8px; color:var(--text-subtle); font-size:11px; letter-spacing:.08em; font-weight:600; }
.ranking-results-heading > span { color:var(--text-subtle); font-size:12px; }
.ranking-notice { margin:0 0 12px; padding:12px 16px; border-radius:10px; background:var(--warning-subtle); color:var(--warning-text); font-size:13px; line-height:1.7; }
.ranking-columns,.rank-entry { display:grid; grid-template-columns:56px minmax(0,1fr) minmax(104px,152px); align-items:center; gap:12px; }
.ranking-columns { padding:8px 16px; color:var(--text-subtle); font-size:12px; }.ranking-columns > :last-child { text-align:right; }
.ranking-list { padding:0; margin:0; list-style:none; }
.rank-entry { min-height:56px; padding:8px 16px; border-radius:12px; }
.rank-entry:nth-child(odd) { background:var(--bg); }
.rank-entry--me,.rank-entry--me:nth-child(odd) { background:var(--brand-subtle); box-shadow:0 0 0 1px color-mix(in srgb,var(--brand) 35%,transparent) inset; }
.rank-entry__position { color:var(--text-subtle); font-size:20px; font-weight:700; font-style:italic; font-variant-numeric:tabular-nums; }
.rank-entry:nth-child(-n+3) .rank-entry__position { color:var(--brand-text); }
.rank-entry__name { min-width:0; font-size:14px; line-height:1.5; overflow-wrap:anywhere; }
.rank-entry__time { font-size:16px; font-weight:700; letter-spacing:-.02em; text-align:right; font-variant-numeric:tabular-nums; }
.rank-entry__badge { display:inline-block; margin-left:8px; padding:2px 8px; border-radius:999px; background:var(--brand); color:var(--brand-ink); font-size:11px; font-weight:700; vertical-align:1px; }
.rank-empty { padding:48px 16px; border-radius:12px; background:var(--bg); text-align:center; color:var(--text-subtle); font-size:14px; line-height:1.8; }

/* Narrow desktop and tablets */
@media (max-width:1050px) {
  .site-header { padding-inline:24px; }.kart-layout { padding-inline:16px; }.game-korean { display:none; }
  .race-stats > div { padding-inline:12px; }.mini-map { width:152px; }#minimap { width:128px; height:80px; }
  .drift-charge { width:136px; }.speedometer strong { font-size:40px; }.speedometer { min-width:96px; }
}
@media (max-width:900px) {
  .overlay-card { width:380px; }
  .kart-leaderboard { padding:24px; }.ranking-body { grid-template-columns:1fr; gap:24px; }.ranking-filters { grid-template-columns:1fr; gap:16px; }
}

/* Phone, portrait */
@media (max-width:700px) {
  .site-header { height:52px; padding:0 16px; }.brand { font-size:14px; }.brand i { font-size:16px; }.header-actions { gap:16px; }.back-link { font-size:12px; }
  .site-header .acct__login,.site-header .acct__me { min-height:36px; font-size:12px; }.site-header .acct__avatar { width:24px; height:24px; }
  .kart-layout { padding:0 8px max(8px,env(safe-area-inset-bottom)); }
  .game-heading { padding:0 4px 8px; }.game-wordmark h1 { font-size:20px; }.wordmark-track { width:24px; height:24px; border-radius:8px; font-size:16px; }.game-heading > p { font-size:12px; }
  .race-stage { height:calc(100svh - 104px - env(safe-area-inset-bottom)); min-height:440px; max-height:900px; border-radius:16px; }
  .race-hud { inset:8px 8px auto; gap:8px; }
  .race-stats { min-width:0; padding:8px 0; border-radius:12px; }.race-stats > div { padding-inline:10px; gap:2px; }
  .race-stats span { font-size:10px; letter-spacing:.04em; }.race-stats strong { font-size:14px; }.clock-stat strong { font-size:13px; }
  .position-stat p strong { font-size:28px; }.position-stat p small { font-size:12px; }
  .hud-utilities { gap:4px; }.icon-button { width:40px; height:44px; }.icon-button--text { min-width:40px; padding:0 8px; font-size:12px; }
  .course-label { top:68px; left:8px; padding:4px 10px; font-size:11px; }.course-label #race-mode { font-size:10px; }
  .online-tools { top:104px; left:8px; max-width:calc(100% - 136px); }#online-status { padding:4px 8px; font-size:11px; }
  .mini-map { top:68px; right:8px; width:112px; padding:8px; border-radius:12px; }#minimap { width:96px; height:60px; }.mini-map > span { font-size:10px; margin-top:4px; }.mini-map b { font-size:11px; }
  .standings li { font-size:11px; padding:1px 4px; gap:4px; }
  .driving-hud { left:8px; bottom:96px; transform:none; gap:12px; padding:8px 12px; border-radius:14px; }
  .speedometer { min-width:72px; }.speedometer strong { font-size:32px; }.speedometer > span { font-size:10px; }
  .drift-charge { width:96px; }.drift-charge > div { font-size:10px; margin-bottom:4px; }.drift-charge b { font-size:14px; }#drift-label,.boost-caption { display:none; }
  .item-slot { width:48px; height:48px; border-radius:12px; }.item-slot__icon { width:20px; height:20px; }.item-slot__name { font-size:10px; }
  .race-message { left:8px; right:60px; bottom:204px; width:auto; transform:none; text-align:left; font-size:13px; }
  .touch-controls { left:8px; right:8px; bottom:8px; gap:8px; }
  .steer-controls,.power-controls { gap:4px; }
  .touch-controls button { min-height:72px; border-radius:14px; }
  .steer-controls button { width:64px; }
  .power-controls button { flex-direction:column; gap:4px; padding:8px 12px; text-align:center; }
  .power-controls button > span:nth-child(2) { font-size:12px; }.power-controls small { display:none; }
  .drive-tools { right:8px; bottom:88px; flex-direction:column; gap:4px; }
  .drive-tools button { width:44px; height:44px; min-height:44px; padding:0; justify-content:center; font-size:0; }.drive-tools .ico { width:18px; height:18px; }
  .voice-bubble { bottom:216px; font-size:12px; padding:6px 12px; }
  .coach { top:104px; }
  .game-overlay { padding:8px; align-items:flex-end; background:linear-gradient(0deg,rgba(8,12,20,.42) 0,transparent 60%); }
  .overlay-card { width:100%; max-height:min(100%,640px); padding:20px 16px 0; border-radius:20px; }
  .overlay-card > :last-child { margin-bottom:16px; }
  .overlay-eyebrow { display:none; }.overlay-card h2 { margin:0 0 16px; font-size:22px; }.overlay-card > p:not(.overlay-note) { display:none; }
  .lobby-options { gap:16px; }
  .track-thumb { height:20px; margin-bottom:4px; }
  .track-picker > button { padding:8px; }.track-picker b { font-size:12px; }.track-picker small { display:none; }
  .mode-picker > button { min-height:0; gap:4px; padding:10px; }.mode-picker small { display:none; }.mode-picker > button > span:nth-child(2) { font-size:13px; }
  .color-hint { display:none; }
  .start-button { min-height:52px; margin-top:16px; }
  .game-overlay[data-state="lobby"] .overlay-card::after { content:"휴대폰을 가로로 돌리면 더 넓게 달릴 수 있어요"; display:block; margin:12px 0 16px; font-size:12px; line-height:1.6; color:var(--on-glass-subtle); text-align:center; }
  .game-overlay[data-state="paused"] .overlay-card,.game-overlay[data-state="finished"] .overlay-card { width:100%; }
  .result-panel > div:first-child strong { font-size:44px; }
  .shop { left:8px; right:8px; top:8px; bottom:8px; width:auto; padding:16px; gap:12px; }
  .shop__tabs button { font-size:12px; }
  .kart-leaderboard { margin:24px 0 16px; padding:20px 16px; border-radius:20px; }
  .ranking-heading { flex-wrap:wrap; align-items:flex-start; gap:16px; }.ranking-heading h2 { font-size:24px; }#ranking-disclosure { font-size:13px; }
  .account-record-metrics { grid-template-columns:1fr 1fr; }.account-record-metrics strong { font-size:26px; }
  .ranking-columns,.rank-entry { grid-template-columns:32px minmax(0,1fr) 96px; gap:8px; }.ranking-columns { padding:8px; }.rank-entry { padding:8px; }
  .rank-entry__position { font-size:16px; }.rank-entry__name { font-size:13px; }.rank-entry__time { font-size:14px; }
  .game-footnote { flex-wrap:wrap; }.game-footnote p:nth-child(2) { display:none; }
}
@media (max-width:370px) {
  .race-stats > div { padding-inline:8px; }.race-stats span { font-size:9px; }.clock-stat strong { font-size:12px; }
  .hud-utilities { flex-direction:column; }
  .mini-map { top:120px; width:96px; }#minimap { width:80px; height:50px; }
  .steer-controls button { width:52px; }.power-controls button { padding-inline:8px; }
  .coach { top:68px; left:8px; transform:none; width:calc(100% - 72px); padding:10px; }
  .coach strong { font-size:13px; }.coach p { font-size:12px; line-height:1.4; }
  .coach .coach__feedback,.coach__footer .coach__dots { display:none; }
  .coach__skip { min-height:28px; padding:4px 8px; font-size:11px; }
  .coach__retry { padding:4px 8px; font-size:11px; }
  .color-picker { grid-template-columns:repeat(4,minmax(0,1fr)); }
}

/* Phone, landscape (also the store app) */
@media (max-height:550px) and (min-width:480px) {
  .site-header { height:44px; padding-inline:16px; }.brand { font-size:13px; }.back-link { font-size:12px; }
  .site-header .acct__login,.site-header .acct__me { min-height:32px; font-size:12px; }.site-header .acct__avatar { width:22px; height:22px; }
  .kart-layout { padding:0 8px 8px; }.game-heading { display:none; }
  .race-stage { height:calc(100svh - 52px); min-height:280px; border-radius:16px; }
  .race-hud { inset:8px 8px auto; }
  .race-stats { padding:6px 0; border-radius:12px; }.race-stats > div { padding-inline:12px; gap:2px; }.race-stats span { font-size:10px; }.race-stats strong { font-size:14px; }
  .position-stat p strong { font-size:26px; }.position-stat p small { font-size:11px; }
  .icon-button { width:40px; height:40px; border-radius:10px; }
  .course-label { top:60px; left:8px; padding:4px 10px; font-size:11px; }
  .online-tools { top:92px; left:8px; max-width:calc(100% - 160px); }#online-status { font-size:11px; padding:4px 8px; }
  .mini-map { top:56px; right:8px; width:112px; padding:8px; border-radius:12px; }#minimap { width:96px; height:60px; }.mini-map > span { font-size:10px; margin-top:4px; }.mini-map b { font-size:11px; }
  .standings li { font-size:10px; padding:0 4px; gap:4px; }
  .driving-hud { bottom:8px; gap:12px; padding:8px 14px; border-radius:14px; }
  .speedometer { min-width:72px; }.speedometer strong { font-size:30px; }.speedometer > span { font-size:10px; }
  .drift-charge { width:96px; }.drift-charge > div { font-size:10px; margin-bottom:4px; }#drift-label,.boost-caption { display:none; }.drift-charge b { font-size:13px; }
  .item-slot { width:44px; height:44px; border-radius:10px; }.item-slot__icon { width:18px; height:18px; }.item-slot__name { display:none; }
  .race-message { bottom:112px; font-size:12px; }
  .touch-controls { left:8px; right:8px; bottom:8px; }
  .touch-controls button { min-height:60px; border-radius:14px; }.steer-controls button { width:60px; }
  .power-controls button { flex-direction:column; gap:2px; padding:6px 12px; text-align:center; }.power-controls small { display:none; }.power-controls button > span:nth-child(2) { font-size:12px; }
  .drive-tools { right:8px; bottom:76px; }
  .drive-tools button { width:40px; height:40px; min-height:40px; padding:0; justify-content:center; font-size:0; }
  .voice-bubble { bottom:120px; font-size:12px; padding:6px 12px; }
  .coach { top:8px; left:auto; right:calc(176px + env(safe-area-inset-right)); transform:none; width:clamp(220px,calc(100% - 456px),360px); padding:8px 12px; }.coach strong { font-size:14px; }.coach p { font-size:12px; }
  .coach .coach__feedback { display:none; }
  .coach__footer .coach__dots { display:none; }
  .game-overlay { padding:8px; }
  .overlay-card { width:400px; padding:16px 16px 0; border-radius:18px; }
  .overlay-card > :last-child { margin-bottom:16px; }
  .overlay-eyebrow,.overlay-card > p:not(.overlay-note) { display:none; }
  .overlay-card h2 { margin:0 0 12px; font-size:20px; }
  .lobby-options { gap:12px; }
  .track-thumb { display:none; }.track-picker > button { padding:8px; }.track-picker b { font-size:12px; }.track-picker small { display:none; }.track-stars { margin-top:2px; }
  .mode-picker > button { min-height:0; padding:8px 10px; gap:2px; grid-template-columns:auto 1fr; align-items:center; column-gap:8px; }.mode-picker small { display:none; }.mode-picker > button > span:nth-child(2) { font-size:13px; }
  .color-hint { display:none; }.color-picker > button { height:40px; }
  .start-button { min-height:48px; margin-top:12px; font-size:15px; }
  .local-run-button { min-height:44px; }
  .game-overlay[data-state="lobby"] .overlay-note { display:none; }
  #ranked-entry-disclosure { font-size:11px; line-height:1.5; }
  .result-panel { margin-top:8px; }.result-panel > div { padding:8px 12px; }.result-panel > div:first-child strong { font-size:40px; }
  .shop { top:8px; bottom:8px; left:8px; padding:12px; gap:8px; width:min(520px,calc(100% - 16px)); }
  .shop__grid { grid-template-columns:repeat(4,minmax(0,1fr)); }.shop-card { min-height:84px; padding:8px 4px; }.shop-card__swatch { width:32px; height:32px; }
  .shop__note { display:none; }
  .kart-leaderboard { margin-top:24px; }
}
@media (max-height:550px) and (min-width:480px) and (max-width:760px) {
  .driving-hud { left:8px; bottom:76px; transform:none; }
  .race-message { bottom:auto; top:92px; }
}

/* Store app (html:is([data-offline],[data-app])): only the full-screen race, landscape, clear of display cutouts. */
html:is([data-offline],[data-app]),html:is([data-offline],[data-app]) body { height:100%; overflow:hidden; overscroll-behavior:none; background:var(--sky); }
html:is([data-offline],[data-app]) body { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
html:is([data-offline],[data-app]) .site-header,html:is([data-offline],[data-app]) .game-heading,html:is([data-offline],[data-app]) .game-footnote,html:is([data-offline],[data-app]) .kart-leaderboard,html:is([data-offline],[data-app]) .online-tools,html[data-offline] #ranked-entry-disclosure,html:is([data-offline],[data-app]) #overlay-local { display:none !important; }
html:is([data-offline],[data-app]) .kart-layout { padding:0; margin:0; max-width:none; width:100%; height:100%; }
html:is([data-offline],[data-app]) .race-stage { position:fixed; inset:0; width:100%; height:100%; max-height:none; min-height:0; border-radius:0; box-shadow:none; touch-action:none; }
html:is([data-offline],[data-app]) .race-hud,html:is([data-offline],[data-app]) .touch-controls { left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); }
html:is([data-offline],[data-app]) .course-label { left:max(12px,env(safe-area-inset-left)); }
html:is([data-offline],[data-app]) .mini-map,html:is([data-offline],[data-app]) .drive-tools { right:max(12px,env(safe-area-inset-right)); }
html:is([data-offline],[data-app]) .game-overlay { padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)); }
html:is([data-offline],[data-app]) .touch-controls { bottom:max(12px,env(safe-area-inset-bottom)); }

/* The web game also uses viewport-fit=cover on phones with display cutouts. */
@media (orientation:landscape) {
  .race-hud,.touch-controls { left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right)); }
  .course-label { left:max(8px,env(safe-area-inset-left)); }
  .mini-map,.drive-tools { right:max(8px,env(safe-area-inset-right)); }
  .game-overlay { padding-left:max(8px,env(safe-area-inset-left)); padding-right:max(8px,env(safe-area-inset-right)); }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}
