/* Powder Panic's own look: "Derby Night" from the style library (glossy premium mobile game, toy-like rider, deep
   blue and purple night, big gold numbers, fireworks). Titan One (self-hosted, SIL OFL) for the logo, numbers and
   buttons; Fredoka from games.css for reading. The slope is painted behind every screen (draw.js).
   Loaded after games.css, which keeps the shared rules. */
@font-face { font-family: "Titan One"; src: url(/fonts/titan-one.woff2) format('woff2'); font-weight: 400; font-display: swap; }
:root {
  --bg: #0f1d2e; --bg2: #1d3350; --panel: #142a44e6; --panel2: #1e3d60; --line: #4d78a8; --ink: #0a1522;
  --text: #ffffff; --soft: #cfdcea; --accent: #ffd23f; --gold: #ffb23a; --hot: #ff7a2f; --pinkish: #ff4fb8; --good: #3ee08f;
}
body.pw { background: var(--bg); overflow-x: hidden; min-height: 100dvh; }
.pw h1, .pw h2, .pw .big-num b, .pw dd, .pw .score b { font-family: "Titan One", Fredoka, system-ui, sans-serif; font-weight: 400; letter-spacing: .01em; }
.pw button { font-family: "Titan One", Fredoka, system-ui, sans-serif; font-weight: 400; border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); }
.pw button.go {
  background: linear-gradient(180deg, #fff1c8 0%, var(--accent) 35%, var(--gold) 70%, #e07b12 100%);
  color: #2a1400; font-size: 22px; min-height: 58px; text-shadow: 0 1px 0 #fff8;
  box-shadow: 0 4px 0 var(--ink), 0 0 24px #ffb23a55, inset 0 2px 0 #fff9;
}
.pw button.go.daily { background: linear-gradient(180deg, #ffd0f0 0%, #ff7ad0 35%, var(--pinkish) 70%, #b0247d 100%); color: #fff; text-shadow: 0 2px 0 #0006; box-shadow: 0 4px 0 var(--ink), 0 0 24px #ff4fb855, inset 0 2px 0 #fff9; }
.pw button.big { display: grid; gap: 2px; width: 100%; }
.pw button.big b { font-weight: 400; }
.pw button.big small { font-family: Fredoka, system-ui, sans-serif; font-weight: 600; font-size: 14px; opacity: .85; }
.pw button.quiet, .pw button.link { background: #ffffff12; color: var(--text); border: 2px solid var(--line); box-shadow: none; font-family: Fredoka, system-ui, sans-serif; font-weight: 700; }
.pw button.link { min-height: 44px; padding: 6px 14px; font-size: 16px; }
.pw button.small { min-height: 44px; padding: 6px 16px; font-size: 16px; }
.pw .muted { color: var(--soft); margin: 0; }
.pw a { color: var(--accent); font-weight: 700; }

#slope { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; z-index: 0; touch-action: none; }
main { position: relative; z-index: 2; }
.pw-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 60px; position: relative; z-index: 5; }
.pw-top .grow { flex: 1; min-width: 0; }
.pw .pw-top .back, .pw .lock-btn { background: #0f1d2ee6; color: var(--text); border-color: var(--line); }
.pw .icon { min-width: 44px; min-height: 44px; padding: 0; background: #0f1d2ecc; border: 2px solid var(--line); box-shadow: none; color: var(--text); font-size: 18px; border-radius: 12px; }

/* glassy cards over the slope */
.card-glass {
  max-width: 520px; width: calc(100% - 32px); margin: 2vh auto 24px; padding: 20px 16px; display: grid; gap: 12px; text-align: center;
  background: linear-gradient(180deg, #1d3b5cee, #11263de6); border: 2px solid #6f9fd066; border-radius: 24px;
  box-shadow: 0 10px 30px #0008, inset 0 1px 0 #ffffff33; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.logo { font-size: clamp(44px, 13vw, 78px); line-height: .95; margin: 0; }
.logo span { color: #fff; text-shadow: 0 0 16px #7fb2ffaa, 0 4px 0 #14304d; }
.logo em { font-style: normal; background: linear-gradient(180deg, #fff1c8, var(--accent) 45%, var(--hot)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #14304d) drop-shadow(0 0 16px #ff8a2a88); }
.tag { margin: 0; color: var(--soft); font-weight: 600; }
.label { margin: 4px 0 -4px; font-weight: 700; color: var(--soft); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pw .chip { min-height: 44px; padding: 6px 16px; font-size: 17px; background: #0f1d2e99; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.pw .chip[aria-pressed="true"] { background: linear-gradient(180deg, #9fd0ff, #3f7bea); color: #fff; border-color: var(--ink); box-shadow: 0 0 14px #7fb2ff88, inset 0 2px 0 #fff8; text-shadow: 0 1px 0 #0005; }
.best { margin: 0; color: var(--accent); font-family: "Titan One", sans-serif; white-space: pre-line; min-height: 1px; }
.links { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }

/* hills */
.hill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hill-list button { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; text-align: left; background: linear-gradient(180deg, #2a5582, #1a3a5c); color: #fff; min-height: 64px; padding: 8px 12px; }
.hill-list button:disabled { opacity: .5; cursor: default; }
.hill-list .num { font-size: 26px; color: var(--accent); text-align: center; }
.hill-list .nm { display: grid; }
.hill-list .nm small { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 13px; color: var(--soft); }
.hill-list .md { font-size: 26px; min-width: 32px; text-align: center; }

.how { text-align: left; margin: 0; padding-left: 20px; display: grid; gap: 8px; }

/* leaderboard */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; counter-reset: r; }
.rows li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #ffffff10; counter-increment: r; }
.rows li:not(.note)::before { content: counter(r); color: var(--accent); font-family: "Titan One", sans-serif; min-width: 24px; }
.rows li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows li b { font-family: "Titan One", sans-serif; font-weight: 400; color: var(--accent); }
.rows li.me { background: #ffd23f33; outline: 2px solid var(--accent); }
.rows li.note { justify-content: center; }

/* the run's heads-up display */
#play { position: fixed; inset: 0; pointer-events: none; }
.hud { position: absolute; top: max(64px, env(safe-area-inset-top)); left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 0 16px; gap: 8px; }
.hearts { font-size: 22px; letter-spacing: 2px; filter: drop-shadow(0 2px 0 #0008); }
.score { text-align: center; display: grid; justify-items: center; background: linear-gradient(180deg, #1d3b5cee, #11263de6); border: 2px solid #6f9fd088; border-radius: 16px; padding: 4px 16px; box-shadow: inset 0 1px 0 #fff4; }
.score b { font-size: clamp(28px, 8vw, 44px); line-height: 1; background: linear-gradient(180deg, #fff1c8, var(--accent) 50%, var(--hot)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 #14304d); }
.score span { font-size: 12px; color: var(--soft); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.prog { justify-self: end; position: relative; width: min(120px, 28vw); height: 10px; margin-top: 12px; border-radius: 6px; background: #0f1d2eaa; border: 2px solid #6f9fd088; }
.prog i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: linear-gradient(90deg, #7fb2ff, var(--accent)); }
.yeti-dot { position: absolute; top: -9px; font-size: 16px; transform: translateX(-50%); }

.call { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-family: "Titan One", sans-serif; font-size: clamp(26px, 8vw, 46px); color: var(--accent); text-shadow: 0 3px 0 #14304d, 0 0 18px #ffb23a99; animation: pop .7s ease-out both; }
.call.bad { color: #ff6b8a; text-shadow: 0 3px 0 #3a0820, 0 0 18px #ff4d6d99; }
.call small { display: block; font-size: .5em; color: #fff; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.12); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: translateY(-16px); opacity: 0; } }
.warn { position: absolute; left: 16px; right: 16px; top: 22%; text-align: center; font-family: "Titan One", sans-serif; font-size: clamp(20px, 6vw, 32px); color: #fff; background: linear-gradient(180deg, #ff4d6dee, #b0122fe6); border: 2px solid var(--ink); border-radius: 16px; padding: 8px; box-shadow: 0 4px 0 var(--ink); animation: pop 2.2s ease-out both; }
.warn small { display: block; font-family: Fredoka, sans-serif; font-size: 15px; font-weight: 700; }
.pads { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); display: none; justify-content: space-between; padding: 0 16px; }
body.touch-steer .pads { display: flex; }
.pad { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; color: #fff; background: #0f1d2e99; border: 2px solid #6f9fd088; }
.pad.on { background: #ffd23fcc; color: #2a1400; }
.tip { position: absolute; left: 16px; right: 16px; bottom: 124px; margin: 0; text-align: center; background: #fff; color: #14304d; font-weight: 700; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--ink); }

/* end card */
.endc { margin-top: 6vh; }
.medal { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-family: "Titan One", sans-serif; font-size: 18px; color: #2a1400; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink), 0 0 30px #ffd23f88, inset 0 4px 0 #fff9; animation: pop2 .6s ease-out both; }
.medal.gold { background: radial-gradient(circle at 35% 30%, #fff6c8, #ffd23f 45%, #d48a12); }
.medal.silver { background: radial-gradient(circle at 35% 30%, #ffffff, #cfd8ee 45%, #8a95b8); }
.medal.bronze { background: radial-gradient(circle at 35% 30%, #ffe0c2, #e0915a 45%, #9a5428); }
@keyframes pop2 { 0% { transform: scale(.3) rotate(-30deg); } 70% { transform: scale(1.1) rotate(6deg); } 100% { transform: scale(1); } }
.big-num { margin: 0; }
.big-num b { font-size: clamp(44px, 14vw, 68px); background: linear-gradient(180deg, #fff1c8, var(--accent) 50%, var(--hot)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #14304d); }
.new { margin: 0; color: var(--good); font-weight: 700; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.stats div { background: #ffffff10; border-radius: 12px; padding: 8px; }
.stats dt { font-size: 13px; color: var(--soft); font-weight: 700; }
.stats dd { margin: 0; font-size: 22px; color: #fff; }
.end-board { display: grid; gap: 6px; text-align: left; }
.end-board label { font-weight: 700; }
.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1; min-width: 0; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: #0f1d2e; color: #fff; padding: 8px 12px; font-size: 17px; }
.name-row button { min-height: 48px; }
.row { display: flex; gap: 10px; justify-content: center; }
.row button { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .call, .warn, .medal { animation: none; }
}

/* the JUMP button: bottom middle, between the steering pads, for either thumb */
#jump.jump { pointer-events: auto; position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: 92px; height: 92px; border-radius: 50%; font-family: "Titan One", sans-serif; font-size: 20px; letter-spacing: .5px; color: #2a1400; background: radial-gradient(circle at 40% 32%, #fff6c8, #ffd23f 55%, #e0a017); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink), 0 0 18px #ffd23f88; touch-action: none; -webkit-tap-highlight-color: transparent; }
#jump.jump:active, #jump.jump.on { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 var(--ink), 0 0 26px #ffd23fcc; }
#jump.jump.air { opacity: .55; }
@media (min-width: 900px) and (pointer: fine) { #jump.jump { width: 76px; height: 76px; font-size: 16px; } }
/* sideways the middle would cover the rider: JUMP moves to the right thumb (left of the right pad when it shows) */
@media (orientation: landscape) and (max-height: 520px) {
  #jump.jump { left: auto; right: max(16px, env(safe-area-inset-right)); transform: none; width: 84px; height: 84px; }
  #jump.jump:active, #jump.jump.on { transform: translateY(3px); }
  body.touch-steer #jump.jump { right: calc(max(16px, env(safe-area-inset-right)) + 76px); }
}

/* TURBO (bullet speed): beside JUMP; the ring around it is the meter, it glows when a go is ready */
#turbo.turbo { --m: 0.33; pointer-events: auto; position: absolute; left: calc(50% + 40px); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 70px); width: 68px; height: 68px; border-radius: 50%; padding: 0; text-align: center; font-family: "Titan One", sans-serif; font-size: 14px; letter-spacing: .3px; color: #fff; text-shadow: 0 2px 0 #7a2400; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); touch-action: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 42% 34%, #9aa3ae, #5c6570 62%, transparent 63%), conic-gradient(#ff7a1a calc(var(--m) * 360deg), #2b323c 0); }
#turbo.turbo.ready { background: radial-gradient(circle at 42% 34%, #ffe08a, #ff7a1a 58%, #c94200 62%, transparent 63%), conic-gradient(#ffd23f calc(var(--m) * 360deg), #2b323c 0); box-shadow: 0 4px 0 var(--ink), 0 0 18px #ff7a1a99; }
#turbo.turbo:active, #turbo.turbo.on { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), 0 0 30px #ff7a1add; }
#turbo.turbo.on { animation: turbo-burn .18s linear infinite alternate; }
@keyframes turbo-burn { to { box-shadow: 0 1px 0 var(--ink), 0 0 44px #ffd23fee; } }
@media (min-width: 900px) and (pointer: fine) { #turbo.turbo { width: 60px; height: 60px; font-size: 12px; left: calc(50% + 34px); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 58px); } }
@media (orientation: landscape) and (max-height: 520px) {
  #turbo.turbo { left: auto; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); width: 70px; height: 70px; }
  body.touch-steer #turbo.turbo { right: calc(max(16px, env(safe-area-inset-right)) + 83px); }
}
@media (prefers-reduced-motion: reduce) { #turbo.turbo.on { animation: none; } }
