/* Alpine Rush: navy and ice, alpine red and gold, sporty condensed italics */
:root { --navy: #0b1e3a; --navy2: #132c52; --ice: #f2f7fc; --red: #e3262f; --blue: #4fa3d9; --gold: #f5b301; --card: rgba(11, 30, 58, .86); --line: rgba(242, 247, 252, .22); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1e3a; color: var(--ice); font: 600 15px/1.35 'Barlow', Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#game, #game canvas { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
.logo, #banner .bt, .btn, h2, .codebig, #rtitle, .rk, #place, #count, #rtime, #kmh, #trick, .seg span, .lbl, #gatemsg, #split { font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif; font-style: italic; font-weight: 800; letter-spacing: .5px; }
.panel { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: max(14px, env(safe-area-inset-top)) 12px 24px; z-index: 20; touch-action: pan-y; }
#title { background: linear-gradient(180deg, rgba(11, 30, 58, .15) 0%, rgba(11, 30, 58, .55) 45%, rgba(11, 30, 58, .85) 100%); }
.tbox { width: min(860px, 100%); text-align: center; }
.logo { font-size: clamp(54px, 11vw, 104px); line-height: .9; margin: 6px 0 0; color: #fff; text-shadow: 0 4px 0 var(--navy), 0 10px 30px rgba(0,0,0,.35); transform: skewX(-4deg); }
.logo span { color: var(--red); }
.logo.small { font-size: 42px; }
.sub { font-size: 16px; letter-spacing: 3px; text-transform: uppercase; opacity: .9; margin: 4px 0 14px; }
.lbl { font-size: 18px; letter-spacing: 3px; color: var(--gold); margin: 10px 0 6px; }
.chars { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chr { width: 96px; padding: 6px 4px 7px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); cursor: pointer; transition: transform .12s; }
.chr img.av { width: 64px; height: 64px; display: block; margin: 0 auto 3px; border-radius: 50%; background: linear-gradient(180deg, #7fb4e6, #cfe3f6); object-fit: cover; }
.chr b { display: block; font-size: 15px; } .chr small { display: block; font-size: 11px; opacity: .75; font-weight: 500; }
.chr.sel { border-color: var(--gold); background: rgba(19, 44, 82, .95); transform: translateY(-2px); box-shadow: 0 0 0 2px var(--gold); }
.chr.taken { opacity: .3; cursor: not-allowed; }
#racerinfo { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 2px; font-size: 18px; }
#racerinfo b { display: block; font-size: 22px; } #racerinfo small { display: block; font-size: 13px; opacity: .85; }
img.av { width: 28px; height: 28px; border-radius: 50%; background: #9cc4ea; object-fit: cover; vertical-align: middle; }
img.av.big { width: 54px; height: 54px; }
.opts { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px 0; }
.seg { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.seg span { font-size: 14px; letter-spacing: 2px; padding: 0 8px; color: var(--gold); }
.seg button { font: 700 14px 'Barlow', Arial, sans-serif; color: var(--ice); background: transparent; border: 0; padding: 7px 11px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--red); color: #fff; }
.seg.dim { opacity: .4; pointer-events: none; }
.maptip, .modesub { font-size: 13px; opacity: .85; max-width: 560px; font-weight: 500; }
.howto { font-weight: 500; font-size: 14px; max-width: 640px; margin: 8px auto; padding: 10px 14px; border-radius: 12px; background: rgba(242, 247, 252, .92); color: var(--navy); }
.howto b { color: var(--red); }
.brow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.btn { font-size: 26px; color: #fff; background: var(--red); border: 0; border-radius: 12px; padding: 12px 30px; cursor: pointer; box-shadow: 0 5px 0 #8e1219; transform: skewX(-6deg); }
.btn:active { transform: skewX(-6deg) translateY(3px); box-shadow: 0 2px 0 #8e1219; }
.btn.alt { background: var(--blue); box-shadow: 0 5px 0 #255d86; }
.btn.small { font-size: 19px; padding: 8px 18px; }
.game-info { max-width: 700px; margin: 18px auto 0; text-align: left; font-weight: 500; font-size: 14px; opacity: .85; }
.game-info h2 { font-size: 20px; margin: 0 0 6px; }
.corner { position: fixed; z-index: 30; top: max(10px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: #fff; font-size: 20px; cursor: pointer; }
#mutebtn { right: 10px; } #musicbtn { right: 60px; } #musicbtn.off { opacity: .45; } #menubtn { left: 10px; }
/* loading */
#loading { align-items: center; background: radial-gradient(circle at 50% 40%, #1d4170, #0b1e3a); }
.lbox { text-align: center; width: min(420px, 90vw); }
.lt { margin: 10px 0; font-size: 17px; } .ls { font-size: 13px; opacity: .8; margin-bottom: 12px; }
.lbar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; } #loadfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--ice)); transition: width .2s; }
/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#tl { position: absolute; left: max(64px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#place { font-size: 48px; line-height: .9; color: #fff; text-shadow: 0 3px 0 var(--navy); min-width: 70px; }
#place small { font-size: 22px; opacity: .8; }
#pbar { display: flex; flex-direction: column; gap: 3px; }
.pc2 { display: flex; align-items: center; gap: 5px; padding: 2px 8px 2px 2px; border-radius: 999px; background: rgba(11, 30, 58, .62); font-size: 13px; }
.pc2 .pl { width: 16px; text-align: center; font-weight: 800; color: var(--gold); }
.pc2 img.av { width: 22px; height: 22px; } .pc2.me { background: rgba(227, 38, 47, .85); } .pc2.out { opacity: .45; }
#timer { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); text-align: center; }
#rtime { font-size: 40px; color: #fff; text-shadow: 0 3px 0 var(--navy); background: rgba(11, 30, 58, .55); padding: 0 14px; border-radius: 10px; }
#pen { font-weight: 800; color: #ff8a8f; font-size: 16px; } #best { font-size: 13px; opacity: .9; }
#speedo { position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 52px); text-align: right; background: rgba(11, 30, 58, .55); padding: 6px 12px; border-radius: 12px; }
#kmh { font-size: 46px; line-height: .9; } #speedo .u { font-size: 12px; opacity: .8; letter-spacing: 2px; }
.sbar { width: 110px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); margin-top: 4px; overflow: hidden; } #speedbar { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold), var(--red)); }
.gates { font-size: 13px; margin-top: 4px; }
#cbar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(520px, 70vw); height: 22px; }
.ctrack { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.5); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.cdot { position: absolute; top: 5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; border: 2px solid #fff; transition: left .25s linear; }
.cdot.me { width: 16px; height: 16px; top: 3px; margin-left: -8px; z-index: 2; box-shadow: 0 0 0 2px var(--red); } .cdot.out { opacity: .3; } .cdot.ghost { background: rgba(160, 230, 255, .6) !important; border-style: dashed; }
.ccp { position: absolute; top: -12px; margin-left: -6px; font-size: 13px; color: var(--red); font-weight: 800; } .cflag { position: absolute; right: -24px; top: 0; font-size: 16px; }
#elimbox { position: absolute; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 30px); transform: translateX(-50%); background: rgba(227, 38, 47, .85); padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 14px; }
#count { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(0); font-size: 130px; color: #fff; text-shadow: 0 6px 0 var(--red), 0 12px 30px rgba(0,0,0,.4); opacity: 0; }
#count.pop { animation: pop 0.9s ease-out; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
#banner { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); text-align: center; opacity: 0; width: 92vw; }
#banner .bt { font-size: clamp(30px, 6vw, 52px); color: #fff; text-shadow: 0 4px 0 var(--navy), 0 8px 24px rgba(0,0,0,.35); }
#banner .bs { font-size: 16px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
#banner.show { animation: ban 3s ease-out forwards; }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, 10px); } 10% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
#gatemsg { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); font-size: 28px; opacity: 0; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
#gatemsg.show { animation: gm .9s ease-out; } #gatemsg.ok { color: #9df5a8; } #gatemsg.bad { color: #ff8a8f; font-size: 34px; }
@keyframes gm { 0% { opacity: 0; transform: translate(-50%, 8px); } 20% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
#split { position: absolute; left: 50%; top: calc(58% + 36px); transform: translateX(-50%); font-size: 30px; opacity: 0; padding: 0 12px; border-radius: 8px; }
#split.show { animation: gm 1.6s ease-out; } #split.fast { background: rgba(30, 160, 70, .85); } #split.slow { background: rgba(227, 38, 47, .85); }
#trick { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); font-size: 42px; color: var(--gold); opacity: 0; text-shadow: 0 3px 0 var(--navy); white-space: nowrap; }
#trick.show { animation: ban 1.6s ease-out forwards; }
#feed { position: absolute; right: 12px; bottom: 60px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
#feed div { background: rgba(11, 30, 58, .7); padding: 3px 10px; border-radius: 8px; font-size: 13px; }
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 9; }
.ntag { position: absolute; left: 0; top: 0; padding: 1px 7px; border-radius: 6px; background: rgba(11, 30, 58, .7); border-bottom: 3px solid; font-size: 12px; white-space: nowrap; }
.ntag.out { opacity: .4; text-decoration: line-through; }
/* touch */
#touch { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
#steerzone { position: absolute; left: 0; bottom: 0; width: 60%; height: 62%; pointer-events: auto; }
#steerzone .hint { position: absolute; left: 20px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 34px); font-size: 13px; opacity: .6; }
#steerknob { position: absolute; width: 74px; height: 74px; margin: 0; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); background: rgba(11,30,58,.35); transform: translate(-50%, -50%); opacity: 0; }
#steerknob.on { opacity: 1; }
#tbtns { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 30px); display: grid; grid-template-columns: 74px 74px; gap: 10px; pointer-events: auto; }
#tbtns button { height: 66px; border-radius: 16px; border: 2px solid rgba(255,255,255,.6); background: rgba(11, 30, 58, .55); color: #fff; font: 800 italic 17px 'Barlow Condensed', Arial, sans-serif; }
#tbtns button.on { background: var(--red); }
#tuckbtn { grid-column: 1 / 3; }
/* results / messages */
.rbox, .pbox, .nbox { margin-top: 6vh; width: min(560px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
#results { background: rgba(11, 30, 58, .4); } #rwin { font-size: 15px; opacity: .9; }
.rrow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 4px 0; border-radius: 10px; background: rgba(255,255,255,.07); text-align: left; }
.rrow.me { background: rgba(227, 38, 47, .45); } .rrow .rk { width: 30px; font-size: 22px; text-align: center; } .rrow .nm { flex: 1; } .rrow .pc { font-weight: 700; } .rrow small { opacity: .75; font-size: 12px; }
#msg { align-items: center; background: rgba(0,0,0,.4); z-index: 40; } #msg .pbox { margin: 0; }
#netui { background: rgba(11, 30, 58, .55); }
.nbox { max-width: 720px; } .nbox h2 { margin: 0 0 8px; font-size: 30px; } .nbox p { font-size: 15px; margin: 6px 0; font-weight: 500; }
.codein { font: 800 italic 34px 'Barlow Condensed', Arial, sans-serif; width: 170px; text-align: center; letter-spacing: 6px; text-transform: uppercase; border-radius: 12px; border: 2px solid #fff; background: rgba(255,255,255,.1); color: #fff; padding: 4px; }
.nstatus { min-height: 22px; font-size: 15px; margin-top: 10px; } .nstatus.err { color: #ffb0b0; }
.codebig { font-size: 56px; letter-spacing: 8px; color: var(--gold); }
.plist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.pl { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 15px; }
.pl small { font-size: 12px; opacity: .8; } .pl.rdy { background: rgba(60, 190, 100, .35); }
.linkrow { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; font-size: 13px; } .linkrow input { width: min(320px, 70vw); font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 0; }
.nbox .chr { width: 84px; } .nbox .chr img.av { width: 52px; height: 52px; }
@media (max-width: 640px) { .tbox { padding-top: 46px; } .logo { font-size: 58px; } }
@media (max-width: 640px), (max-height: 520px) {
  .chr { width: 74px; } .chr img.av { width: 48px; height: 48px; } .chr small { display: none; }
  .seg button { padding: 6px 8px; font-size: 13px; } .btn { font-size: 22px; padding: 10px 22px; }
  #place { font-size: 36px; } #rtime { font-size: 30px; } #kmh { font-size: 34px; } .pc2 { font-size: 11px; } .pc2 img.av { width: 18px; height: 18px; }
  #pbar { max-height: 46vh; overflow: hidden; }
}
@media (max-height: 520px) { #pbar { display: none; } #speedo { top: 60px; } }
