:root {
  --brick: #b5332a; --brick-dark: #7a1f1a; --maple: #f2c744; --spruce: #1f6b4a; --cream: #f6efe0; --ink: #1d1a1a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --display: "Arial Black", "Helvetica Neue", Impact, Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--cream); font-family: var(--body); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#touchZone { position: absolute; inset: 0; touch-action: none; z-index: 2; pointer-events: none; }
body.touch #touchZone { pointer-events: auto; }
.hidden { display: none !important; }
.dim { opacity: .65; }
button { font-family: inherit; cursor: pointer; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); overflow: auto; }
#menu { background: linear-gradient(180deg, rgba(20,16,16,.55), rgba(20,16,16,.78)); backdrop-filter: blur(2px); }
#loading { background: var(--ink); z-index: 50; }
.load-inner { text-align: center; }
#loadText { margin-top: 14px; opacity: .7; letter-spacing: .04em; }
.menu-inner { text-align: center; max-width: 620px; width: 100%; }
.logo { display: inline-flex; flex-direction: column; line-height: .82; font-family: var(--display); font-weight: 900; letter-spacing: -.02em; transform: rotate(-3deg); margin-bottom: 14px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.45)); }
.logo .l1 { font-size: clamp(46px, 10vw, 92px); color: var(--cream); }
.logo .l2 { font-size: clamp(74px, 16vw, 150px); color: var(--maple); -webkit-text-stroke: 2px var(--brick-dark); text-shadow: 5px 5px 0 var(--brick); }
.logo.small .l1 { font-size: 36px; } .logo.small .l2 { font-size: 60px; }
#tagline { font-size: clamp(15px, 2.4vw, 19px); line-height: 1.45; margin: 8px auto 20px; max-width: 540px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.big-btn { font-family: var(--display); font-size: clamp(22px, 4vw, 30px); font-weight: 900; letter-spacing: .04em; background: var(--maple); color: var(--ink); border: 0; border-radius: 16px; padding: 14px 34px; box-shadow: 0 6px 0 #8a6a12, var(--shadow); transition: transform .08s; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #8a6a12; }
.chip-btn { margin: 12px 6px 0; background: rgba(255,255,255,.1); color: var(--cream); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.chip-btn:hover { background: rgba(255,255,255,.18); }
#menuBest { margin-top: 12px; font-weight: 700; }
#howto { margin-top: 22px; font-size: 14px; line-height: 2; }
.key { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 0 8px; font-weight: 800; font-size: 12px; letter-spacing: .06em; margin: 0 2px; }
.howto-sub { opacity: .7; font-size: 13px; line-height: 1.4; margin-top: 8px; }
.touch-only { display: none; } body.touch .touch-only { display: block; } body.touch .howto-row:not(.touch-only) { display: none; }
#credit, .map-credit { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 12px; opacity: .7; }
#credit a, .map-credit a { color: var(--maple); text-decoration: none; }

/* ---------- cards ---------- */
.card { background: rgba(24,20,20,.92); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 22px 22px 18px; box-shadow: var(--shadow); max-width: 560px; width: 100%; margin: 0 auto; }
.card-title { font-family: var(--display); font-size: clamp(22px, 5vw, 34px); letter-spacing: .04em; color: var(--maple); }
.card-big { font-family: var(--display); font-size: clamp(48px, 12vw, 84px); line-height: 1; margin: 6px 0; text-shadow: 4px 4px 0 var(--brick); }
.card-sub { font-size: 15px; margin-top: 4px; }
.card-btns { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.card-btns .chip-btn { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; margin: 14px auto 4px; max-width: 420px; text-align: left; font-size: 14px; }
.stat { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(255,255,255,.15); padding: 3px 0; }
.stat b { color: var(--maple); }

/* ---------- leaderboard ---------- */
.lb { margin-top: 16px; text-align: left; }
.lb-tabs { display: flex; gap: 6px; justify-content: center; }
.lb-chip { background: rgba(255,255,255,.08); color: var(--cream); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 800; letter-spacing: .05em; }
.lb-chip.sel { background: var(--maple); color: var(--ink); border-color: var(--maple); }
.lb-status { text-align: center; font-size: 12px; opacity: .75; margin: 8px 0 4px; }
#lbList { list-style: none; padding: 0; margin: 0 auto; max-width: 380px; }
#lbList li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 4px 8px; border-radius: 8px; font-size: 14px; }
#lbList li.me { background: rgba(242,199,68,.18); }
#lbList .rank { opacity: .6; font-weight: 800; } #lbList .sc { font-weight: 800; color: var(--maple); }
.lb-form { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.lb-form input { flex: 1; max-width: 220px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: var(--cream); padding: 7px 12px; font-size: 14px; }
.lb-rename { display: block; margin: 8px auto 0; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }
#hudTop { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; }
#scoreBox { text-align: left; }
#score { font-family: var(--display); font-size: clamp(28px, 5vw, 44px); line-height: 1; color: var(--cream); text-shadow: 3px 3px 0 var(--brick), 0 0 12px rgba(0,0,0,.5); }
#combo { font-family: var(--display); font-size: 18px; color: var(--maple); opacity: 0; transition: transform .1s, opacity .2s; transform-origin: left; letter-spacing: .04em; }
#combo.show { opacity: 1; } #combo.pop { transform: scale(1.4); }
#timer { font-family: var(--display); font-size: clamp(26px, 5vw, 40px); background: rgba(20,16,16,.55); padding: 4px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.15); }
#timer.urgent { color: var(--maple); animation: pulse .5s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
.hud-chip { background: rgba(20,16,16,.55); color: var(--cream); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; width: 40px; height: 40px; font-size: 18px; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
#crosshair::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: #fff; border-radius: 50%; }
#chargeRing { --p: 0; position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; opacity: 0; background: conic-gradient(var(--maple) calc(var(--p) * 360deg), rgba(255,255,255,.15) 0); -webkit-mask: radial-gradient(circle, transparent 19px, #000 20px); mask: radial-gradient(circle, transparent 19px, #000 20px); transition: opacity .1s; }
#chargeRing.on { opacity: 1; } #chargeRing.max { background: conic-gradient(#ff6a3d 360deg, #ff6a3d 0); box-shadow: 0 0 18px rgba(255,106,61,.7); }
#announcer { position: absolute; left: 0; right: 0; top: 26%; text-align: center; font-family: var(--display); font-size: clamp(34px, 8vw, 76px); color: var(--cream); text-shadow: 4px 4px 0 var(--brick), 0 0 24px rgba(0,0,0,.6); opacity: 0; transform: scale(.6) rotate(-4deg); transition: transform .12s cubic-bezier(.2,1.6,.4,1), opacity .15s; letter-spacing: .02em; }
#announcer.show { opacity: 1; transform: scale(1) rotate(-4deg); }
#announcer.gold { color: var(--maple); } #announcer.hot { color: #ff7a4a; }
#floaters { position: absolute; inset: 0; overflow: hidden; }
.floater { position: absolute; left: 0; top: 0; font-family: var(--display); font-size: 18px; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.6); white-space: nowrap; will-change: transform, opacity; }
.floater.pts { color: var(--maple); } .floater.big { color: #ffd34a; font-size: 26px; text-shadow: 3px 3px 0 var(--brick); }
.floater.small { font-size: 14px; }
.floater.yelp { font-family: var(--body); font-weight: 700; font-size: 14px; background: rgba(255,255,255,.92); color: #1d1a1a; padding: 4px 10px; border-radius: 14px; text-shadow: none; }
#hudBottom { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); text-align: center; }
#itemBar { display: inline-flex; gap: 6px; background: rgba(20,16,16,.55); padding: 6px; border-radius: 16px; border: 1px solid rgba(255,255,255,.15); }
.item-chip { position: relative; width: 50px; height: 50px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.08); color: var(--cream); font-size: 26px; display: grid; place-items: center; transition: transform .08s; }
.item-chip.sel { border-color: var(--maple); background: rgba(242,199,68,.2); transform: translateY(-4px) scale(1.06); }
.item-chip .ik { position: absolute; right: 4px; bottom: 2px; font-size: 10px; font-weight: 800; opacity: .7; }
#itemName { margin-top: 6px; font-size: 13px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
#hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; font-size: 12px; background: rgba(20,16,16,.55); padding: 6px 12px; border-radius: 999px; white-space: nowrap; opacity: .85; }
#mute { position: absolute; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 30; background: rgba(20,16,16,.55); color: var(--cream); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; width: 40px; height: 40px; font-size: 18px; }
#pauseOverlay { background: rgba(10,8,8,.6); z-index: 25; }
#pauseCard { text-align: center; pointer-events: auto; }

/* ---------- touch controls ---------- */
#stickBase { display: none; position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35); z-index: 3; pointer-events: none; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.75); transform: translate(-50%,-50%); }
#touchButtons { display: none; position: absolute; right: 14px; bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px)); flex-direction: column; align-items: flex-end; gap: 10px; z-index: 4; }
body.touch #touchButtons { display: flex; }
body.touch #itemBar { display: none; }
body.touch #itemName { display: none; }
body.touch #hint { display: none; }
body.touch #hudBottom { bottom: 14px; }
.tbtn { pointer-events: auto; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); background: rgba(20,16,16,.55); color: var(--cream); font-size: 24px; font-weight: 900; touch-action: none; }
.tbtn.big { width: 96px; height: 96px; font-family: var(--display); font-size: 22px; background: rgba(242,199,68,.9); color: var(--ink); border-color: #fff3c4; box-shadow: 0 6px 0 #8a6a12; }
.tbtn.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #8a6a12; }
body.touch #mute { bottom: 14px; right: auto; left: 14px; }

/* ---------- cutscene ---------- */
#cutscene { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; }
#cutTitle { display: flex; flex-direction: column; line-height: .82; font-family: var(--display); font-weight: 900; transform: rotate(-3deg) scale(.6); opacity: 0; transition: transform .5s cubic-bezier(.2,1.4,.4,1), opacity .4s; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)); text-align: center; }
#cutTitle .l1 { font-size: clamp(44px, 9vw, 96px); color: var(--cream); }
#cutTitle .l2 { font-size: clamp(80px, 17vw, 170px); color: var(--maple); -webkit-text-stroke: 2px var(--brick-dark); text-shadow: 6px 6px 0 var(--brick); }
#cutTitle.in { transform: rotate(-3deg) scale(1); opacity: 1; }
#cutTitle.out { transform: rotate(-3deg) scale(1.15) translateY(-20px); opacity: 0; transition: transform .6s, opacity .6s; }
#cutSub { margin-top: 18px; font-family: var(--display); font-size: clamp(14px, 2.6vw, 22px); letter-spacing: .12em; text-transform: uppercase; opacity: 0; transform: translateY(10px); transition: all .5s; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
#cutSub.in { opacity: 1; transform: none; } #cutSub.out { opacity: 0; }
#skipHint { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); font-size: 12px; opacity: .6; letter-spacing: .08em; }

@media (max-height: 520px) {
  .logo .l1 { font-size: 34px; } .logo .l2 { font-size: 58px; }
  #tagline { font-size: 13px; margin-bottom: 10px; }
  #howto { display: none; }
  .card { padding: 12px 14px; } .card-big { font-size: 44px; } .stats { font-size: 12px; gap: 2px 12px; }
}

/* OG capture mode: nothing but the 3D scene */
body.og #hud, body.og #menu, body.og #results, body.og #cutscene, body.og #loading, body.og #mute, body.og #touchButtons, body.og #stickBase { display: none !important; }

/* ---------- mode selector ---------- */
#modeSelect { display: flex; gap: 10px; justify-content: center; margin: 4px auto 18px; flex-wrap: wrap; }
.mode-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: rgba(255,255,255,.08); color: var(--cream); border: 2px solid rgba(255,255,255,.2); border-radius: 14px; padding: 10px 16px; min-width: 210px; transition: transform .08s, border-color .1s, background .1s; }
.mode-btn b { font-size: 16px; letter-spacing: .02em; }
.mode-btn span { font-size: 11.5px; opacity: .7; }
.mode-btn.sel { border-color: var(--maple); background: rgba(242,199,68,.16); transform: translateY(-2px); }
.mode-btn:hover { background: rgba(255,255,255,.14); }
#yeetPrompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); font-family: var(--display); font-size: 13px; letter-spacing: .06em; color: var(--maple); background: rgba(20,16,16,.5); padding: 3px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
/* yeet mode hides the throwable bar */
body.mode-yeet #itemBar, body.mode-yeet #itemName, body.touch.mode-yeet #itemBtn { display: none !important; }
body.mode-throw #yeetPrompt { display: none !important; }

/* ---------- time selector ---------- */
#timeSelect { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 2px auto 6px; }
.ts-label { font-size: 11px; letter-spacing: .12em; opacity: .6; font-weight: 800; margin-right: 2px; }
.time-btn { background: rgba(255,255,255,.08); color: var(--cream); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.time-btn.sel { background: var(--maple); color: var(--ink); border-color: var(--maple); }
.time-btn:hover { background: rgba(255,255,255,.16); }
/* skate HUD hint chip */
#skateChip { position: absolute; left: 50%; transform: translateX(-50%); bottom: 128px; font-family: var(--display); font-size: 14px; letter-spacing: .05em; color: #7ad4ff; background: rgba(20,16,16,.62); border: 1px solid rgba(122,212,255,.5); padding: 5px 16px; border-radius: 999px; white-space: nowrap; pointer-events: auto; cursor: pointer; }
#skateChip.on { color: #1d1a1a; background: #7ad4ff; border-color: #7ad4ff; }
body.touch #skateChip { display: none; }
#skateChip:empty { display: none; }
