:root {
  --ink: #0b1a33;
  --red: #ff2d4a; --blue: #1f7bff; --gold: #ffc21a; --green: #35e08a;
  --font: "Avenir Next Rounded", "SF Pro Rounded", ui-rounded, "Avenir Next", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3f7; font-family: var(--font); color: #fff; touch-action: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* sizes follow the short side so a TV across the room reads them */
#hud { position: fixed; top: calc(env(safe-area-inset-top) + 2.2vmin); left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 0 calc(env(safe-area-inset-left) + 3vmin); pointer-events: none; }
.pill { display: flex; align-items: center; gap: 1.6vmin; padding: 1.4vmin 3.2vmin; border-radius: 99vmin; background: rgba(11, 26, 51, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 800; font-size: 7.5vmin; line-height: 1; letter-spacing: 0.02em; box-shadow: 0 1vmin 3vmin rgba(0,0,0,0.18); font-variant-numeric: tabular-nums; }
.pill.gold { background: linear-gradient(180deg, #ffd34d, #ffae00); color: #3b2300; font-size: 6vmin; }
.flagIcon { width: 5.5vmin; height: 6.5vmin; position: relative; }
.flagIcon::before { content: ""; position: absolute; left: 0.4vmin; top: 0; width: 0.9vmin; height: 6.5vmin; background: #fff; border-radius: 1vmin; }
.flagIcon::after { content: ""; position: absolute; left: 1.3vmin; top: 0.3vmin; border-left: 4.2vmin solid var(--red); border-top: 1.6vmin solid transparent; border-bottom: 1.6vmin solid transparent; }

#big { position: fixed; left: 0; right: 0; top: 30%; text-align: center; font-weight: 900; font-size: 22vmin; line-height: 1; pointer-events: none; text-shadow: 0 1.2vmin 0 rgba(11,26,51,0.35), 0 0 6vmin rgba(31,123,255,0.45); opacity: 0; transform: scale(0.6); transition: opacity .25s, transform .35s cubic-bezier(.2,1.6,.4,1); }
#big.show { opacity: 1; transform: scale(1); }
#pop { position: fixed; left: 0; right: 0; top: 18%; text-align: center; pointer-events: none; }
.popText { display: inline-block; font-weight: 900; font-size: 11vmin; color: #fff; text-shadow: 0 0.8vmin 0 rgba(11,26,51,0.35); animation: pop 1.1s ease-out forwards; }
.popText.good { color: #fff7d6; text-shadow: 0 0.8vmin 0 #c77800, 0 0 5vmin rgba(255,194,26,0.9); }
.popText.miss { color: #e8eef7; font-size: 8vmin; text-shadow: 0 0.6vmin 0 rgba(11,26,51,0.4); }
@keyframes pop { 0% { transform: translateY(4vmin) scale(0.5); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 30% { transform: scale(1); } 100% { transform: translateY(-8vmin) scale(1); opacity: 0; } }

#meter { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 3vmin); width: 56vmin; transform: translateX(-50%); pointer-events: none; }
.meterTrack { position: relative; height: 4.2vmin; border-radius: 99vmin; background: linear-gradient(90deg, rgba(31,123,255,0.75), rgba(255,255,255,0.35) 42%, rgba(255,255,255,0.35) 58%, rgba(255,45,74,0.75)); box-shadow: inset 0 0 0 0.5vmin rgba(255,255,255,0.7), 0 1vmin 3vmin rgba(0,0,0,0.15); }
.meterMid { position: absolute; left: 50%; top: -1vmin; bottom: -1vmin; width: 0.7vmin; margin-left: -0.35vmin; background: #fff; border-radius: 1vmin; opacity: 0.9; }
#knob { position: absolute; top: 50%; left: 50%; width: 7.5vmin; height: 7.5vmin; margin: -3.75vmin 0 0 -3.75vmin; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffe08a 45%, #ffae00); box-shadow: 0 0.8vmin 2vmin rgba(0,0,0,0.3), 0 0 0 0.6vmin #fff; }
.meterLabels { display: flex; justify-content: space-between; font-weight: 800; font-size: 3.2vmin; margin-top: 1.2vmin; text-shadow: 0 0.4vmin 1vmin rgba(11,26,51,0.5); letter-spacing: 0.1em; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vmin; background: radial-gradient(ellipse at center, rgba(11,26,51,0.15), rgba(11,26,51,0.55)); }
.logo { margin: 0; font-size: 26vmin; font-weight: 900; letter-spacing: -0.02em; line-height: 0.9; background: linear-gradient(180deg, #ffffff 30%, #bfe0ff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1.4vmin 0 rgba(11,26,51,0.35)) drop-shadow(0 0 5vmin rgba(31,123,255,0.5)); }
.logo.small { font-size: 13vmin; }
.tag { margin: 0; font-size: 6vmin; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; text-shadow: 0 0.5vmin 1.5vmin rgba(11,26,51,0.6); }
.hint { margin: 1vmin 0 0; font-size: 3.4vmin; font-weight: 700; opacity: 0.95; text-shadow: 0 0.4vmin 1.2vmin rgba(11,26,51,0.7); text-align: center; max-width: 80vw; }
.hint.big { font-size: 5vmin; }
.bigBtn { margin-top: 3vmin; font: 900 6.5vmin var(--font); color: var(--ink); background: linear-gradient(180deg, #fff, #dbeaff); border: 0; padding: 2.6vmin 8vmin; border-radius: 99vmin; box-shadow: 0 1.2vmin 0 #8fb3e0, 0 2vmin 5vmin rgba(0,0,0,0.25); animation: breathe 1.8s ease-in-out infinite; cursor: pointer; }
@keyframes breathe { 50% { transform: scale(1.06); } }

.calCard, .doneCard { background: rgba(11,26,51,0.62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 6vmin; padding: 5vmin 9vmin; text-align: center; box-shadow: 0 2vmin 8vmin rgba(0,0,0,0.3), inset 0 0 0 0.4vmin rgba(255,255,255,0.25); min-width: 70vmin; }
.calCard h2, .doneCard h2 { margin: 0; font-size: 11vmin; font-weight: 900; line-height: 1.05; }
.calCard p { margin: 1.5vmin 0 0; font-size: 4.6vmin; font-weight: 700; opacity: 0.9; }
.calBar { margin: 4vmin auto 0; width: 60vmin; height: 2.4vmin; border-radius: 99vmin; background: rgba(255,255,255,0.2); overflow: hidden; }
#calFill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), #b8ffd9); border-radius: 99vmin; transition: width .1s linear; }
.calIcon { width: 22vmin; height: 20vmin; margin: 0 auto 2vmin; position: relative; transition: transform .5s cubic-bezier(.3,1.5,.5,1); }
.calIcon::before { content: ""; position: absolute; left: 1vmin; right: 1vmin; bottom: 2vmin; height: 2.4vmin; border-radius: 2vmin; background: #ffb547; box-shadow: 0 0 0 0.5vmin #fff; }
.calIcon::after { content: ""; position: absolute; left: 50%; bottom: 0; margin-left: -2.5vmin; border-left: 2.5vmin solid transparent; border-right: 2.5vmin solid transparent; border-bottom: 3vmin solid #fff; }
.calIcon i { position: absolute; left: 50%; bottom: 4.4vmin; width: 6vmin; height: 12vmin; margin-left: -3vmin; border-radius: 3vmin 3vmin 1vmin 1vmin; background: #ff3b6b; box-shadow: 0 0 0 0.5vmin #fff; }
.calIcon i::before { content: ""; position: absolute; left: 50%; top: -5.5vmin; width: 5vmin; height: 5vmin; margin-left: -2.5vmin; border-radius: 50%; background: #fff; }
.calIcon.left { transform: rotate(-16deg); } .calIcon.right { transform: rotate(16deg); }

.choices { display: flex; gap: 6vmin; margin-top: 2vmin; }
.choice { position: relative; overflow: hidden; width: 52vmin; padding: 4vmin 4vmin 5vmin; border-radius: 5vmin; background: rgba(11,26,51,0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); text-align: center; box-shadow: inset 0 0 0 0.5vmin rgba(255,255,255,0.3), 0 2vmin 6vmin rgba(0,0,0,0.25); transition: transform .2s, box-shadow .2s; cursor: pointer; }
.choice:active { transform: scale(1.05); }
.choice.lean { transform: scale(1.07); box-shadow: inset 0 0 0 0.8vmin #fff, 0 2vmin 8vmin rgba(255,194,26,0.45); }
.choice h3 { margin: 1.5vmin 0 0; font-size: 7.5vmin; font-weight: 900; position: relative; z-index: 1; }
.choice p { margin: 1vmin 0 0; font-size: 3.6vmin; font-weight: 700; opacity: 0.85; position: relative; z-index: 1; }
.choice .fill { position: absolute; left: 0; bottom: 0; height: 100%; width: 0%; background: linear-gradient(90deg, rgba(53,224,138,0.55), rgba(53,224,138,0.85)); z-index: 0; }
.dot { width: 10vmin; height: 10vmin; margin: 0 auto; position: relative; z-index: 1; }
.dot.green { border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0.7vmin #fff; }
.dot.black { width: 8.5vmin; height: 8.5vmin; background: #111; transform: rotate(45deg); box-shadow: 0 0 0 0.7vmin #fff; margin-top: 1vmin; }
.arrow { position: absolute; top: 3.5vmin; width: 0; height: 0; border-top: 3vmin solid transparent; border-bottom: 3vmin solid transparent; z-index: 1; opacity: 0.85; }
.arrow.left { left: 3.5vmin; border-right: 4vmin solid #fff; }
.arrow.right { right: 3.5vmin; border-left: 4vmin solid #fff; }

.stars { display: flex; justify-content: center; gap: 3vmin; margin: 3vmin 0; }
.star { width: 15vmin; height: 15vmin; background: rgba(255,255,255,0.18); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transform: scale(0.4); opacity: 0.4; transition: transform .5s cubic-bezier(.2,1.8,.4,1), opacity .3s, background .3s; }
.star.on { background: linear-gradient(180deg, #fff3b0, #ffc21a 55%, #ff9a00); transform: scale(1); opacity: 1; filter: drop-shadow(0 0 3vmin rgba(255,194,26,0.8)); }
.star.half { transform: scale(0.8); opacity: 0.6; }
.doneStats { display: flex; gap: 7vmin; justify-content: center; }
.doneStats div { display: flex; flex-direction: column; }
.doneStats b { font-size: 9vmin; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.doneStats span { font-size: 3.2vmin; font-weight: 700; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.12em; }

#gear { position: fixed; right: calc(env(safe-area-inset-right) + 2vmin); bottom: calc(env(safe-area-inset-bottom) + 2vmin); width: 8vmin; height: 8vmin; border-radius: 50%; border: 0; background: rgba(11,26,51,0.35) center/58% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19.4 13a7.6 7.6 0 0 0 0-2l2.1-1.6-2-3.5-2.5 1a7.4 7.4 0 0 0-1.7-1L15 3h-4l-.4 2.9a7.4 7.4 0 0 0-1.7 1l-2.5-1-2 3.5L6.6 11a7.6 7.6 0 0 0 0 2l-2.1 1.6 2 3.5 2.5-1a7.4 7.4 0 0 0 1.7 1L11 21h4l.4-2.9a7.4 7.4 0 0 0 1.7-1l2.5 1 2-3.5zM13 15.5A3.5 3.5 0 1 1 13 8.5a3.5 3.5 0 0 1 0 7z'/%3E%3C/svg%3E"); opacity: 0.6; cursor: pointer; }

/* results sit low so the finish cinematic stays in view */
#sDone { justify-content: flex-end; padding-bottom: 4vmin; background: linear-gradient(180deg, rgba(11,26,51,0) 40%, rgba(11,26,51,0.45)); }
#sDone .doneCard { padding: 3vmin 7vmin; }
#sDone .doneCard h2 { font-size: 9vmin; }
#sDone .stars { margin: 1.5vmin 0; }
#sDone .star { width: 11vmin; height: 11vmin; }
#sDone .doneStats b { font-size: 7.5vmin; }
#sDone { align-items: flex-start; justify-content: center; padding: 0 0 0 calc(env(safe-area-inset-left) + 5vmin); background: linear-gradient(90deg, rgba(11,26,51,0.4), rgba(11,26,51,0) 55%); }
#sDone .doneCard { min-width: 0; width: 74vmin; padding: 3vmin 4vmin; }
#sDone .doneCard h2 { font-size: 8vmin; white-space: nowrap; }
#sDone .doneStats { gap: 4vmin; }
#fs { position: fixed; left: calc(env(safe-area-inset-left) + 2vmin); bottom: calc(env(safe-area-inset-bottom) + 2vmin); width: 8vmin; height: 8vmin; border-radius: 50%; border: 0; background: rgba(11,26,51,0.35) center/56% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E"); opacity: 0.6; cursor: pointer; z-index: 20; }
#fs.on { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5'/%3E%3C/svg%3E"); }
#fs.hidden, #fsTip.hidden { display: none; }
#fsTip { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; width: min(80vw, 110vmin); padding: 4vmin 5vmin; border-radius: 4vmin; background: rgba(11,26,51,0.92); display: flex; flex-direction: column; gap: 2vmin; font-size: 4vmin; font-weight: 600; line-height: 1.35; text-align: center; box-shadow: 0 2vmin 6vmin rgba(0,0,0,0.35); }
#fsTip > b { font-size: 5vmin; }
#fsTip .ok { align-self: center; margin-top: 1vmin; padding: 1.6vmin 5vmin; border-radius: 99vmin; background: #1f7bff; font-weight: 800; }

/* game picker */
.pick { background: linear-gradient(180deg, #2f8fe8 0%, #8fd0ff 46%, #eaf7ff 70%, #bfe9a8 70.2%, #6fbf5a 100%); gap: 2.5vmin; z-index: 20; }
.games { display: flex; flex-wrap: wrap; justify-content: center; gap: 5vmin; }
.game { display: flex; flex-direction: column; align-items: center; width: 62vmin; padding: 0 0 3vmin; border: 0; border-radius: 5vmin; overflow: hidden; background: #fff; color: var(--ink); font-family: var(--font); cursor: pointer; box-shadow: 0 1.4vmin 0 rgba(11,26,51,0.25), 0 3vmin 7vmin rgba(11,26,51,0.3); transition: transform .2s cubic-bezier(.3,1.6,.5,1), opacity .2s; animation: bobble 2.6s ease-in-out infinite; }
.game:nth-child(2) { animation-delay: -1.3s; }
.game:active, .game.picked { transform: scale(1.06); animation: none; }
.loading .game:not(.picked) { opacity: 0.45; }
.game .art { display: block; width: 100%; height: 34vmin; background: #9fd0f5 center/cover no-repeat; }
.game .art.ski { background-image: url(img/card_ski.jpg); }
.game .art.run { background-image: url(img/card_run.jpg); }
.game b { margin-top: 2.2vmin; font-size: 7.5vmin; font-weight: 900; line-height: 1; }
.game i { margin-top: 1vmin; font-style: normal; font-size: 3.3vmin; font-weight: 700; opacity: 0.7; }
@keyframes bobble { 50% { transform: translateY(-1.2vmin); } }
@media (orientation: portrait) { .game { width: 78vmin; } .game .art { height: 30vmin; } .pick .logo.small { font-size: 10vmin; } }
body.picking #gear, body.hill #gear { display: none; }
#home { position: fixed; right: calc(env(safe-area-inset-right) + 12vmin); bottom: calc(env(safe-area-inset-bottom) + 2vmin); width: 8vmin; height: 8vmin; border-radius: 50%; border: 0; z-index: 10; background: rgba(11,26,51,0.35) center/56% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 3 2.5 11.2h2.7V20h5v-5.6h3.6V20h5v-8.8h2.7z'/%3E%3C/svg%3E"); cursor: pointer; }
body.hill #home { right: calc(env(safe-area-inset-right) + 2vmin); }

/* Pancake Run: what to do next, big enough to read from the sofa */
#prompt { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 1.6vmin); transform: translateX(-50%); display: flex; align-items: center; gap: 3vmin; pointer-events: none; animation: promptIn .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes promptIn { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.pBody { min-width: 52vmin; padding: 1.6vmin 4vmin 2vmin; border-radius: 5vmin; background: rgba(11,26,51,0.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: center; box-shadow: 0 1.5vmin 5vmin rgba(0,0,0,0.25), inset 0 0 0 0.4vmin rgba(255,255,255,0.28); }
#pText { font-size: 5.6vmin; font-weight: 900; line-height: 1.1; white-space: nowrap; text-shadow: 0 0.4vmin 0 rgba(11,26,51,0.4); }
@media (max-aspect-ratio: 4/3) { #pText { white-space: normal; } .pBody { min-width: 0; max-width: 70vw; } }
.pBar { margin: 1.6vmin auto 0; height: 2.2vmin; border-radius: 99vmin; background: rgba(255,255,255,0.22); overflow: hidden; }
#pFill { height: 100%; width: 0%; border-radius: 99vmin; background: linear-gradient(90deg, #ffd34d, #ff9a00); }
#prompt.wait #pFill { background: linear-gradient(90deg, #8fe3ff, #ffffff); }
#prompt.nobar .pBar { display: none; }
.pArrow { width: 0; height: 0; border-top: 5vmin solid transparent; border-bottom: 5vmin solid transparent; opacity: 0.18; filter: drop-shadow(0 0.6vmin 0 rgba(11,26,51,0.35)); }
.pArrow.l { border-right: 8vmin solid #fff; } .pArrow.r { border-left: 8vmin solid #fff; }
#prompt.left .pArrow.l, #prompt.right .pArrow.r { opacity: 1; animation: nudgeL .7s ease-in-out infinite; }
#prompt.right .pArrow.r { animation-name: nudgeR; }
#prompt.left .pArrow.l { border-right-color: #ffd34d; } #prompt.right .pArrow.r { border-left-color: #ffd34d; }
#prompt.rock .pArrow { opacity: 1; animation: rockL .5s ease-in-out infinite; }
#prompt.rock .pArrow.r { animation-name: rockR; }
@keyframes nudgeL { 50% { transform: translateX(-2.2vmin) scale(1.12); } }
@keyframes nudgeR { 50% { transform: translateX(2.2vmin) scale(1.12); } }
@keyframes rockL { 0%, 100% { transform: translateX(-2vmin) scale(1.15); opacity: 1; } 50% { transform: none; opacity: 0.3; } }
@keyframes rockR { 0%, 100% { transform: none; opacity: 0.3; } 50% { transform: translateX(2vmin) scale(1.15); opacity: 1; } }
#fs { z-index: 25; }
.pick .logo.small { font-size: 11vmin; }
#meter { transition: transform .4s, opacity .4s; transform-origin: 50% 100%; }
#meter.small { transform: translateX(-50%) translateY(2vmin) scale(0.62); opacity: 0.85; }
