:root { --pink: #ff3d8b; --cyan: #26d9ff; --gold: #ffc21a; --green: #3ee07a; --purple: #a46bff; --ink: #0d0f1a; --glass: rgba(16, 18, 34, .78); --line: rgba(255,255,255,.12); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0c16; color: #fff; font-family: Fredoka, system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
.hidden { display: none !important; }

/* ---------- screens */
.screen { position: fixed; inset: 0; display: none; z-index: 10; padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); overflow-y: auto; }
.screen.show { display: block; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.screen.modal { background: rgba(5,6,14,.55); display: none; align-items: center; justify-content: center; z-index: 40; }
.screen.modal.show { display: flex; }
.card { border-radius: 22px; padding: 18px; }
.glass { background: var(--glass); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); }
.head { display: flex; align-items: center; gap: 16px; margin: 54px 0 16px; }
.head h1 { font-family: Bungee, sans-serif; font-weight: 400; font-size: clamp(26px, 4vw, 44px); margin: 0; letter-spacing: 1px; text-shadow: 0 4px 0 rgba(0,0,0,.35); background: linear-gradient(90deg, #fff, #9feaff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.back { padding: 10px 16px; border-radius: 14px; background: rgba(255,255,255,.1); font-weight: 700; font-size: 17px; }
.back:hover { background: rgba(255,255,255,.2); }

/* ---------- logo */
.logo { font-family: Bungee, sans-serif; font-size: clamp(46px, 8vw, 104px); line-height: .9; letter-spacing: 1px; display: flex; align-items: center; gap: .1em; color: #fff; text-shadow: 0 6px 0 #c4166a, 0 10px 30px rgba(255,61,139,.55); transform: rotate(-4deg); }
.logo b { font-weight: 400; color: var(--cyan); text-shadow: 0 6px 0 #0a7fa8, 0 10px 30px rgba(38,217,255,.6); margin-left: .12em; }
.logo .bolt { font-size: .8em; filter: drop-shadow(0 0 16px #ffd21a); animation: zap 2.4s infinite; display: inline-block; }
@keyframes zap { 0%, 88%, 100% { transform: scale(1) rotate(0); } 91% { transform: scale(1.3) rotate(-12deg); } 94% { transform: scale(.9) rotate(8deg); } }
.logo.big { font-size: clamp(56px, 10vw, 130px); }
.tagline { margin: 18px 0 22px 6px; font-size: 18px; font-weight: 600; opacity: .9; text-shadow: 0 2px 8px rgba(0,0,0,.6); }

/* ---------- loading */
#loading { display: none; background: radial-gradient(circle at 50% 40%, #2b1250, #0b0c16 70%); align-items: center; justify-content: center; flex-direction: column; gap: 28px; z-index: 60; }
#loading.show { display: flex; }
.loadbar { width: min(420px, 70vw); height: 14px; border-radius: 10px; background: rgba(255,255,255,.1); overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 10%; background: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan)); border-radius: 10px; transition: width .3s; }
.loadtxt { opacity: .8; font-weight: 600; }

/* ---------- top bar */
#topbar { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); display: flex; gap: 8px; z-index: 30; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 30px); }
.pill { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.pill.name { cursor: pointer; } .pill.name i { opacity: .5; font-style: normal; }
.pill .av { width: 18px; height: 18px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 2px #fff; }
.pill.lvl b { background: linear-gradient(135deg, var(--purple), var(--pink)); border-radius: 8px; padding: 0 7px; }
.xpbar { width: 60px; height: 7px; border-radius: 5px; background: rgba(255,255,255,.15); overflow: hidden; } .xpbar i { display: block; height: 100%; background: var(--purple); }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc21a 50%, #d48a00); box-shadow: 0 0 10px rgba(255,194,26,.6); }
.pill.icon { width: 40px; justify-content: center; padding: 8px; font-size: 18px; }

/* ---------- menu buttons */
.mbtn { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 22px; border-radius: 16px; background: linear-gradient(180deg, #3a3f5c, #272b44); box-shadow: 0 5px 0 #15172a, 0 10px 24px rgba(0,0,0,.35); font-weight: 700; font-size: 18px; transition: transform .15s cubic-bezier(.2,1.6,.4,1), filter .15s; text-align: left; }
.mbtn:hover { transform: translateY(-3px) scale(1.03) rotate(-.6deg); filter: brightness(1.12); }
.mbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 #15172a; }
.mbtn.pink { background: linear-gradient(180deg, #ff5c9f, #e6206f); box-shadow: 0 5px 0 #9c0f48, 0 10px 30px rgba(255,61,139,.4); }
.mbtn.gold { background: linear-gradient(180deg, #ffd34d, #f5a400); box-shadow: 0 5px 0 #a86a00, 0 10px 30px rgba(255,194,26,.35); color: #2a1a00; }
.mbtn.cyan { background: linear-gradient(180deg, #4fe3ff, #0bb2e6); box-shadow: 0 5px 0 #06739a, 0 10px 30px rgba(38,217,255,.35); color: #032433; }
.mbtn.green { background: linear-gradient(180deg, #5cf094, #22c260); box-shadow: 0 5px 0 #127a3a, 0 10px 30px rgba(62,224,122,.3); color: #032611; }
.mbtn.purple { background: linear-gradient(180deg, #b98bff, #8048f0); box-shadow: 0 5px 0 #4b20a0, 0 10px 30px rgba(164,107,255,.35); }
.mbtn.big { width: min(380px, 86vw); justify-content: flex-start; padding: 12px 18px; }
.mbtn.big .ic { font-size: 30px; width: 44px; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.mbtn.big b { display: block; font-size: 21px; } .mbtn.big small { display: block; font-size: 13.5px; opacity: .8; font-weight: 600; }
.mbtn.small { font-size: 15px; padding: 9px 16px; background: rgba(255,255,255,.1); box-shadow: none; }
.mbtn.go { font-family: Bungee, sans-serif; font-weight: 400; font-size: 24px; letter-spacing: 1px; padding: 14px 30px; }
.mbtn:disabled { filter: grayscale(.8) brightness(.7); cursor: default; transform: none; }
.kbd { font-family: Fredoka; font-size: 12px; background: rgba(0,0,0,.25); padding: 2px 6px; border-radius: 6px; }

/* ---------- home */
#home { display: none; background: linear-gradient(90deg, rgba(8,8,20,.78) 0%, rgba(8,8,20,.35) 42%, rgba(8,8,20,0) 65%); }
#home.show { display: flex; justify-content: space-between; align-items: center; }
.homeL { padding-left: 2vw; padding-top: 40px; }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.menu .mbtn.big { animation: slideIn .5s cubic-bezier(.2,1.3,.4,1) backwards; }
.menu .mbtn:nth-child(2) { animation-delay: .05s } .menu .mbtn:nth-child(3) { animation-delay: .1s } .menu .mbtn:nth-child(4) { animation-delay: .15s } .menu .mbtn:nth-child(5) { animation-delay: .2s }
@keyframes slideIn { from { transform: translateX(-60px); opacity: 0; } }
.homeR { align-self: flex-end; }
.stats { width: 260px; font-size: 14.5px; }
.stats h3 { margin: 0 0 8px; font-family: Bungee; font-weight: 400; font-size: 16px; color: var(--gold); }
.stats .row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.stats .trophies { display: flex; gap: 8px; margin-top: 10px; }
.trophy { flex: 1; text-align: center; padding: 8px 4px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 12px; }
.trophy .t { font-size: 26px; display: block; filter: grayscale(1) opacity(.35); } .trophy.won .t { filter: none; }

/* ---------- quick race */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.mapc { position: relative; border-radius: 18px; overflow: hidden; background: #191c2e; border: 3px solid transparent; cursor: pointer; transition: transform .15s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.mapc:hover { transform: translateY(-4px) rotate(-.6deg); }
.mapc.sel { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,194,26,.25), 0 10px 30px rgba(0,0,0,.4); }
.mapc canvas { width: 100%; display: block; aspect-ratio: 16/10; }
.mapc .mi { padding: 8px 12px 10px; } .mapc b { font-size: 18px; } .mapc small { display: block; opacity: .75; font-size: 13px; }
.mapc .best { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); border-radius: 8px; padding: 2px 8px; font-size: 12px; }
.opts { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; position: sticky; bottom: 0; }
.opt label { display: block; font-size: 13px; opacity: .7; margin-bottom: 4px; font-weight: 600; }
.seg { display: inline-flex; background: rgba(255,255,255,.08); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 7px 13px; border-radius: 9px; font-weight: 700; font-size: 15px; }
.seg button.on { background: #fff; color: var(--ink); }

/* ---------- cups / bracket */
.cupcards { display: flex; gap: 16px; flex-wrap: wrap; }
.cupc { flex: 1; min-width: 230px; border-radius: 22px; padding: 18px; background: linear-gradient(160deg, var(--c), rgba(20,22,40,.9) 70%); box-shadow: 0 12px 30px rgba(0,0,0,.4); position: relative; overflow: hidden; }
.cupc h2 { margin: 0; font-family: Bungee; font-weight: 400; font-size: 24px; }
.cupc .cupt { font-size: 56px; position: absolute; right: 14px; top: 6px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.cupc.locked { filter: grayscale(.9) brightness(.6); }
.cupc p { margin: 6px 0 12px; opacity: .85; font-size: 14px; }
.cupc .tracks { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; } .cupc .tracks span { background: rgba(0,0,0,.3); border-radius: 8px; padding: 2px 8px; font-size: 12.5px; }
.bracket { margin-top: 16px; }
.bk { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: 18px; align-items: center; }
.bcol h3 { margin: 0 0 8px; font-family: Bungee; font-weight: 400; font-size: 15px; opacity: .85; display: flex; justify-content: space-between; }
.bcol h3 span { font-family: Fredoka; font-size: 12px; opacity: .7; }
.heat { background: rgba(255,255,255,.05); border-radius: 12px; padding: 6px 8px; margin-bottom: 8px; font-size: 12.5px; border: 1px solid rgba(255,255,255,.06); }
.heat.mine { border-color: var(--gold); background: rgba(255,194,26,.08); }
.heat .hn { font-weight: 700; font-size: 11px; opacity: .6; margin-bottom: 2px; }
.heat .d { display: flex; justify-content: space-between; padding: 1px 2px; border-radius: 5px; }
.heat .d.me { background: var(--pink); font-weight: 700; } .heat .d.thru { color: #8dffb5; } .heat .d.out { opacity: .35; text-decoration: line-through; }
.heat.cols { columns: 2; column-gap: 10px; }
.bfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 12px; flex-wrap: wrap; }
.bfoot .msg { font-size: 17px; font-weight: 600; }

/* ---------- garage */
#garage { pointer-events: none; } #garage .head, #garage .gpanel { pointer-events: auto; }
.gpanel { position: absolute; right: max(18px, env(safe-area-inset-right)); top: 110px; bottom: 18px; width: min(380px, 44vw); display: flex; flex-direction: column; }
.gtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.gtabs button { padding: 6px 11px; border-radius: 10px; background: rgba(255,255,255,.08); font-weight: 700; font-size: 14px; }
.gtabs button.on { background: var(--pink); }
.gitems { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-content: start; }
.gi { border-radius: 14px; background: rgba(255,255,255,.06); padding: 10px 6px 8px; text-align: center; font-size: 13px; font-weight: 600; border: 2px solid transparent; position: relative; }
.gi:hover { background: rgba(255,255,255,.12); }
.gi.on { border-color: var(--gold); }
.gi .sw { width: 38px; height: 38px; border-radius: 50%; margin: 0 auto 6px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.gi .pr { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; opacity: .9; margin-top: 3px; } .gi .pr .coin { width: 12px; height: 12px; }
.gi.lock .sw { opacity: .75; }
.gbuy { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.ghint { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); opacity: .6; font-weight: 600; pointer-events: none; }

/* ---------- online */
.olwrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.olstatus { font-size: 17px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.olstatus::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #888; }
.olstatus.on::before { background: var(--green); box-shadow: 0 0 10px var(--green); } .olstatus.err::before { background: #ff4d4d; } .olstatus.warn::before { background: var(--gold); }
.olstatus.busy::before { background: var(--cyan); animation: blink .8s infinite; } @keyframes blink { 50% { opacity: .2; } }
.frow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .frow .or { opacity: .6; }
#fCode { width: 120px; padding: 11px 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: #fff; font-size: 20px; letter-spacing: 3px; text-transform: uppercase; text-align: center; font-weight: 700; }
.roomcode { font-family: Bungee; font-size: 26px; margin-bottom: 8px; } .roomcode small { font-family: Fredoka; font-size: 14px; opacity: .7; display: block; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 10px 0; }
.pl { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 10px; }
.pl .av { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.pl b { display: block; font-size: 15px; } .pl small { font-size: 12px; opacity: .7; } .pl .rd { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); } .pl.off { opacity: .4; }
.pl.ai { opacity: .7; border: 1px dashed rgba(255,255,255,.15); background: none; }
.olset { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; } .olset label { display: block; font-size: 12px; opacity: .7; }
.olset select { background: #22263c; color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 7px 10px; font: inherit; font-weight: 600; }
.olbtns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.olchat { display: flex; flex-direction: column; height: 420px; }
.chatlog { flex: 1; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.chatlog .sys { opacity: .6; font-style: italic; } .chatlog b { color: var(--cyan); }
#olSay { margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: #fff; }

/* ---------- howto + settings */
.howgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; max-width: 1100px; }
.howgrid > div { background: rgba(255,255,255,.05); border-radius: 14px; padding: 14px; } .howgrid .wide { grid-column: 1 / -1; }
.howgrid p { margin: 8px 0 0; font-size: 15.5px; line-height: 1.4; }
.k { display: inline-block; min-width: 34px; padding: 5px 8px; margin-right: 4px; text-align: center; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 3px 0 #9aa3b8; } .k.wide { min-width: 80px; }
.c1 { color: #4fd1ff; font-style: normal; font-weight: 700; } .c2 { color: #ff9a2e; font-style: normal; font-weight: 700; } .c3 { color: #c46bff; font-style: normal; font-weight: 700; }
.setcard { width: min(440px, 92vw); display: flex; flex-direction: column; gap: 12px; } .setcard h2 { margin: 0 0 6px; font-family: Bungee; font-weight: 400; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 12px; } .srow label { font-weight: 600; }
.srow input[type=range] { width: 200px; accent-color: var(--pink); }
#nameIn { padding: 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: #fff; font-size: 20px; font-weight: 700; }

/* ---------- HUD */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; font-family: 'Russo One', Fredoka, sans-serif; }
#hud > * { position: absolute; }
.hpos { left: max(22px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); font-size: 18px; text-shadow: 0 4px 0 rgba(0,0,0,.4); }
.hpos b { font-family: Bungee; font-weight: 400; font-size: 84px; line-height: 1; background: linear-gradient(180deg, #fff 30%, #ffd34d); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.hpos sup { font-family: Bungee; font-size: 30px; color: #ffd34d; vertical-align: top; position: relative; top: 8px; } .hpos span { font-size: 24px; opacity: .7; margin-left: 4px; }
.hpos.p1 b { background: linear-gradient(180deg, #fff 20%, #ffd21a); -webkit-background-clip: text; background-clip: text; }
.hpos.bump { animation: bump .35s; } @keyframes bump { 40% { transform: scale(1.25); } }
.hlap { left: max(28px, env(safe-area-inset-left)); top: 118px; display: flex; align-items: baseline; gap: 8px; font-size: 15px; } .hlap b { font-size: 30px; }
.htime { left: max(28px, env(safe-area-inset-left)); top: 158px; } .htime b { font-size: 22px; display: block; } .htime span { font-size: 13px; opacity: .7; }
.hboard { left: max(22px, env(safe-area-inset-left)); top: 210px; font-family: Fredoka; font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.hboard div { display: flex; gap: 8px; align-items: center; background: rgba(10,12,26,.55); padding: 3px 10px 3px 4px; border-radius: 8px; min-width: 170px; transition: transform .3s; }
.hboard div i { font-style: normal; width: 22px; height: 22px; border-radius: 6px; text-align: center; line-height: 22px; font-weight: 700; color: #111; font-size: 13px; }
.hboard div.me { background: rgba(255,61,139,.75); } .hboard div span { flex: 1; } .hboard div em { font-style: normal; opacity: .7; font-size: 12px; }
#minimap { right: max(16px, env(safe-area-inset-right)); top: 64px; width: 200px; height: 200px; }
.hspeed { right: max(22px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.gauge { position: relative; width: 150px; height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge svg { position: absolute; inset: 0; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-width: 10; stroke-linecap: round; } .gauge .trk { stroke: rgba(255,255,255,.12); stroke-dasharray: 235.6 314.2; }
.gauge .arc { stroke: url(#g) var(--cyan); stroke: var(--cyan); stroke-dasharray: 0 314.2; filter: drop-shadow(0 0 6px var(--cyan)); transition: stroke .2s; }
.gauge.boost .arc { stroke: var(--gold); filter: drop-shadow(0 0 10px var(--gold)); }
.gauge b { font-size: 44px; line-height: 1; text-shadow: 0 3px 0 rgba(0,0,0,.4); } .gauge span { font-size: 12px; opacity: .7; }
.batt { display: flex; align-items: center; gap: 8px; font-size: 14px; } .bi { width: 150px; height: 16px; border-radius: 5px; border: 2px solid rgba(255,255,255,.7); padding: 2px; position: relative; }
.bi::after { content: ''; position: absolute; right: -6px; top: 3px; width: 4px; height: 6px; background: rgba(255,255,255,.7); border-radius: 0 2px 2px 0; }
.bi i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #2ee6ff, #6dff9e); box-shadow: 0 0 10px #2ee6ff; transition: width .1s; }
.bi.low i { background: #ff4d4d; box-shadow: 0 0 10px #ff4d4d; }
.drift { width: 150px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; opacity: 0; transition: opacity .2s; } .drift.on { opacity: 1; }
.drift i { display: block; height: 100%; width: 0; background: #4fd1ff; }
.center { left: 50%; top: 34%; transform: translate(-50%, -50%); font-family: Bungee; font-size: clamp(60px, 12vw, 150px); text-shadow: 0 8px 0 rgba(0,0,0,.35), 0 0 40px rgba(255,255,255,.3); white-space: nowrap; }
.center.go { color: #3eff7a; } .center.anim { animation: cpop .7s cubic-bezier(.2,1.6,.4,1); } @keyframes cpop { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
.center.msg { font-size: clamp(30px, 5vw, 60px); } .center.warn { color: #ff4d4d; animation: blink .5s infinite; }
.toast { left: 50%; top: 18%; transform: translateX(-50%); font-family: Bungee; font-size: 26px; opacity: 0; transition: opacity .3s, transform .3s; white-space: nowrap; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); } .toast.gold { color: var(--gold); } .toast.cyan { color: var(--cyan); } .toast.purple { color: #c46bff; } .toast.orange { color: #ff9a2e; }
.tutor { left: 50%; bottom: 120px; transform: translateX(-50%); font-family: Fredoka; font-weight: 600; font-size: 17px; background: rgba(10,12,26,.8); border-radius: 16px; padding: 12px 18px; display: none; text-align: center; border: 1px solid var(--line); }
.tutor.show { display: block; } .tutor .k { font-size: 14px; padding: 2px 7px; min-width: 26px; }
.hpause { right: max(232px, calc(env(safe-area-inset-right) + 232px)); top: max(14px, env(safe-area-inset-top)); pointer-events: auto; width: 44px; height: 44px; border-radius: 12px; background: var(--glass); font-weight: 900; }
#speedlines { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .25s; background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.0) 0deg 4deg, rgba(255,255,255,.16) 4.4deg 4.7deg); -webkit-mask: radial-gradient(circle at 50% 50%, transparent 52%, #000 90%); mask: radial-gradient(circle at 50% 50%, transparent 52%, #000 90%); }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.45)); }

/* touch */
.touchui { inset: 0; display: none; pointer-events: none; }
body.touch .touchui { display: block; }
.touchui button { pointer-events: auto; position: absolute; border-radius: 50%; background: rgba(20,22,40,.55); border: 2px solid rgba(255,255,255,.35); font-family: Bungee; font-size: 26px; color: #fff; touch-action: none; }
.touchui button.on { background: rgba(255,255,255,.35); transform: scale(.94); }
.touchui .tl button { width: 92px; height: 92px; bottom: max(26px, env(safe-area-inset-bottom)); }
.touchui .tl button:nth-child(1) { left: max(22px, env(safe-area-inset-left)); } .touchui .tl button:nth-child(2) { left: calc(max(22px, env(safe-area-inset-left)) + 106px); }
.touchui .tr .td { width: 96px; height: 96px; right: 190px; bottom: 30px; font-size: 15px; background: rgba(79,209,255,.35); }
.touchui .tr .tb { width: 74px; height: 74px; right: 196px; bottom: 140px; background: rgba(255,194,26,.4); }
.touchui .tr .tk { width: 64px; height: 64px; right: 30px; bottom: 200px; font-size: 18px; }
.touchui .tr .tg { width: 0; height: 0; opacity: 0; }
body.touch .hspeed { transform: scale(.7); transform-origin: bottom right; right: 12px; }
body.touch .hboard { display: none; }
body.touch #minimap { width: 130px; height: 130px; top: 60px; }
body.touch .hpause { right: 160px; }
@media (max-height: 520px) {
  .hpos b { font-size: 56px; } .hlap { top: 80px; } .htime { top: 112px; } .hboard { top: 156px; }
  .head { margin-top: 44px; }
  .menu { gap: 7px; } .mbtn.big { padding: 7px 14px; } .mbtn.big b { font-size: 17px; } .mbtn.big small { font-size: 12px; } .mbtn.big .ic { font-size: 22px; }
  .logo { font-size: 44px; } .tagline { margin: 8px 0 10px; font-size: 14px; }
  .stats { display: none; }
}

/* ---------- results */
#results { background: radial-gradient(circle at 50% 30%, rgba(40,10,70,.55), rgba(5,5,15,.75)); }
#results.show { display: flex; align-items: center; justify-content: center; }
.rescard { width: min(620px, 94vw); text-align: center; }
.resbig { font-family: Bungee; font-size: clamp(54px, 9vw, 96px); line-height: 1; background: linear-gradient(180deg, #fff, #ffd34d); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.ressub { font-size: 18px; margin: 6px 0 12px; opacity: .9; font-weight: 600; }
.restab { width: 100%; border-collapse: collapse; font-size: 15px; } .restab td { padding: 5px 8px; text-align: left; } .restab tr:nth-child(odd) { background: rgba(255,255,255,.04); }
.restab tr.me { background: rgba(255,61,139,.55) !important; font-weight: 700; } .restab td.t { text-align: right; font-family: 'Russo One'; } .restab td.p { font-family: Bungee; width: 40px; }
.restab .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 8px; }
.reward { display: flex; justify-content: center; gap: 18px; margin: 14px 0; font-size: 20px; font-weight: 700; } .reward span { display: flex; align-items: center; gap: 6px; }
.resbtns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (max-width: 760px) { .olwrap { grid-template-columns: 1fr; } .bk { grid-template-columns: 1fr; } .gpanel { width: 58vw; top: 96px; } #home.show { justify-content: flex-start; } .homeR { display: none; } }

/* ---------- phones / short landscape screens */
@media (max-height: 520px) {
  #topbar { top: 8px; gap: 5px; } #topbar .pill { padding: 5px 10px; font-size: 13px; } #topbar .rank, #topbar .xpbar { display: none; }
  .homeL { padding-top: 0; } .logo { font-size: 38px; margin-top: 8px; }
  .head { margin: 34px 0 8px; } .head h1 { font-size: 24px; } .back { padding: 6px 12px; font-size: 15px; }
  .maps { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
  .mapc .mi { padding: 4px 8px 6px; } .mapc b { font-size: 14px; } .mapc small { display: none; } .mapc canvas { aspect-ratio: 16/8; }
  .opts { padding: 8px 12px; gap: 8px; } .opt label { display: none; } .seg button { padding: 5px 9px; font-size: 13px; } .mbtn.go { font-size: 18px; padding: 10px 18px; }
  .gpanel { top: 74px; bottom: 8px; padding: 10px; width: min(380px, 54vw); } .gtabs button { padding: 4px 8px; font-size: 12px; } .gi { padding: 6px 4px; font-size: 11.5px; } .gi .sw { width: 30px; height: 30px; font-size: 17px; } .gitems { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); } .gbuy { min-height: 40px; font-size: 13px; } .ghint { display: none; }
  .cupc { padding: 12px; min-width: 200px; } .cupc h2 { font-size: 18px; } .cupc .cupt { font-size: 38px; }
  .olchat { height: 220px; }
  .rescard { padding: 12px; } .resbig { font-size: 44px; } .restab { font-size: 12.5px; } .restab td { padding: 2px 6px; } .reward { margin: 6px 0; font-size: 16px; }
}
body.touch .touchui .tr .td { right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 104px; height: 104px; }
body.touch .touchui .tr .tb { right: calc(max(18px, env(safe-area-inset-right)) + 116px); bottom: max(22px, env(safe-area-inset-bottom)); width: 76px; height: 76px; }
body.touch .touchui .tr .tk { right: calc(max(18px, env(safe-area-inset-right)) + 22px); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 116px); width: 62px; height: 62px; }
body.touch .hspeed { left: 50%; right: auto; bottom: 6px; transform: translateX(-50%) scale(.62); transform-origin: bottom center; align-items: center; }
body.touch .tutor { bottom: auto; top: 36%; }

/* ---------- world tour */
.tourstops { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 14px; }
.stop { border-radius: 14px; background: var(--glass); border-color: var(--line); padding: 8px; text-align: center; font-size: 13px; font-weight: 600; border: 2px solid transparent; position: relative; }
.stop .fl { font-size: 28px; display: block; } .stop small { display: block; opacity: .7; font-size: 11px; }
.stop.done { opacity: .55; } .stop.done::after { content: '✓'; position: absolute; top: 4px; right: 8px; color: var(--green); font-weight: 900; }
.stop.next { border-color: var(--gold); background: rgba(255,194,26,.12); }
.tourwrap { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
.th3 { margin: 0 0 8px; font-family: Bungee; font-weight: 400; font-size: 16px; color: var(--gold); }
.tourside { display: flex; flex-direction: column; gap: 10px; } .tourside p { margin: 0; font-size: 15px; line-height: 1.4; }
.tourside .big { font-family: Bungee; font-size: 22px; }
.olnote { margin: 0 0 10px; font-size: 15px; opacity: .9; }
@media (max-width: 900px) { .tourstops { grid-template-columns: repeat(4, 1fr); } .tourwrap { grid-template-columns: 1fr; } }
@media (max-height: 520px) { .stop { padding: 4px; } .stop .fl { font-size: 20px; } .tourstops { gap: 5px; margin-bottom: 8px; } }
