/* Ski Slalom 3D - stage + in-game UI. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --ice:#2c7bb6; --ice-d:#1b5a8a; --sun:#ffc21a; --red:#e8383d; --green:#3ddc6a; --ink:#16293d; --snow:#f4f9ff;
  position: relative; width: min(100%, calc(78vh * 0.5625)); width: min(100%, calc(78svh * 0.5625)); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden;
  border-radius: 14px; background: linear-gradient(#7fc0ef 0%, #cfe9ff 70%, #f4f9ff 100%); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; line-height: 1.25; }
#stage.is-big { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; z-index: 99999; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#stage #app { position: absolute; inset: 0; }
#stage #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#stage #ui { position: absolute; inset: 0; pointer-events: none; }
#stage #ui button, #stage #ui .panel, #stage #ui input { pointer-events: auto; }
#stage button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
#stage button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

#stage #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#2c7bb6 0%, #7fc0ef 60%, #f4f9ff 100%); }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-shadow: 0 2px 0 rgba(10,40,80,.4); text-align: center; padding: 0 18px; }
#stage .load-in b { font-size: 26px; letter-spacing: 3px; }
#stage .spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(255,255,255,.4); border-top-color: #fff; animation: skspin .9s linear infinite; }
@keyframes skspin { to { transform: rotate(360deg); } }
#stage #ctxlost { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: rgba(22,41,61,.85); color: #fff; font-weight: 700; }
#stage #ctxlost[hidden] { display: none; }

/* HUD */
#stage #hud { position: absolute; inset: 0; pointer-events: none; }
#stage #hud[hidden] { display: none; }
#stage .zones { position: absolute; inset: 0; display: flex; }
#stage .zones i { flex: 1; transition: background .08s; }
#stage .zones i.on { background: linear-gradient(to top, rgba(255,255,255,.22), rgba(255,255,255,0) 60%); }
#stage .hud-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
#stage .hud-time { background: rgba(22,41,61,.62); color: #fff; border-radius: 10px; padding: 5px 10px; min-width: 96px; }
#stage .hud-time b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; font-family: "JetBrains Mono", Consolas, monospace; }
#stage .hud-time small { display: block; font-size: 11px; color: #ffb4b6; min-height: 13px; }
#stage .hud-mid { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
#stage .hud-mid #hud-delta { font-family: "JetBrains Mono", Consolas, monospace; min-height: 16px; padding: 0 6px; border-radius: 6px; }
#stage #hud-delta.ahead { background: rgba(61,220,106,.85); color: #06310f; }
#stage #hud-delta.behind { background: rgba(232,56,61,.85); color: #fff; }
#stage .hud-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(22,41,61,.62); color: #fff; font-weight: 900; font-size: 16px; letter-spacing: 1px; }
#stage #hud-speed { position: absolute; left: 10px; bottom: 90px; color: #fff; background: rgba(22,41,61,.55); border-radius: 8px; padding: 4px 8px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
#stage #hint { position: absolute; left: 16px; right: 16px; top: 74px; text-align: center; color: #fff; font-weight: 800; font-size: 15px; background: rgba(22,41,61,.7); border-radius: 12px; padding: 8px 10px; opacity: 0; transition: opacity .25s; }
#stage #hint.on { opacity: 1; }
#stage #toast { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45); opacity: 0; transform: translateY(8px); transition: opacity .15s, transform .15s; }
#stage #toast.on { opacity: 1; transform: none; }
#stage #toast.bad { color: #ffd1d3; } #stage #toast.good { color: #c9ffd8; }
#stage #count { position: absolute; left: 0; right: 0; top: 24%; text-align: center; font-size: 84px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 rgba(10,40,80,.5); opacity: 0; transform: scale(.8); transition: opacity .15s, transform .15s; }
#stage #count.on { opacity: 1; transform: scale(1); }
#stage .tuckbtn { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: 112px; height: 64px; border-radius: 32px; border: 3px solid #fff; background: rgba(44,123,182,.85); color: #fff; font-weight: 900; font-size: 18px; letter-spacing: 1.5px; box-shadow: 0 3px 0 rgba(10,40,80,.45); touch-action: none; }
#stage .tuckbtn.on { background: var(--sun); color: #3a2a00; }
#stage #flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
#stage #flash.f-bad { opacity: 1; background: radial-gradient(transparent 55%, rgba(232,56,61,.4)); animation: skfade .26s ease-out forwards; }
@keyframes skfade { to { opacity: 0; } }

/* screens */
#stage #screens { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(22,41,61,.32); }
#stage #screens[hidden], #stage #pausebox[hidden] { display: none; }
#stage #pausebox { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(22,41,61,.5); }
#stage .panel { width: 100%; max-height: 100%; background: var(--snow); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 28px rgba(10,30,60,.4); }
#stage .panel.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; }
#stage .panel h2 { font-size: 20px; line-height: 1.1; }
#stage .panel h3 { font-size: 15px; margin-top: 4px; }
#stage .head { display: flex; align-items: center; gap: 8px; }
#stage .note { font-size: 13px; color: #3b5068; }
#stage .logo { text-align: center; color: var(--ice-d); line-height: 1; }
#stage .logo b { font-size: 32px; letter-spacing: 2px; display: block; }
#stage .logo span { font-size: 22px; font-weight: 900; color: var(--red); letter-spacing: 6px; }
#stage .statrow, #stage .rewards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#stage .chip { display: inline-block; background: #dbe9f6; border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 800; color: var(--ice-d); }
#stage .chip.coin { background: #fff0b8; color: #6b4a00; } #stage .chip.hot { background: #ffd6d8; color: #9b1c21; }
#stage .xp { height: 8px; background: #dbe9f6; border-radius: 4px; overflow: hidden; } #stage .xp i { display: block; height: 100%; background: var(--ice); }
#stage .b { min-height: 44px; border: 0; border-radius: 12px; background: #dbe9f6; color: var(--ink); font-weight: 800; font-size: 15px; padding: 8px 12px; box-shadow: 0 3px 0 #b3c9de; }
#stage .b.primary { background: var(--ice); color: #fff; box-shadow: 0 3px 0 var(--ice-d); }
#stage .b.big { min-height: 56px; font-size: 19px; }
#stage .b.ghosty { background: transparent; box-shadow: none; border: 2px solid #b3c9de; }
#stage .b.dim { background: #e8eef4; color: #8aa0b6; box-shadow: none; }
#stage .b.danger { background: var(--red); color: #fff; box-shadow: 0 3px 0 #a52126; }
#stage .b.back { background: transparent; box-shadow: none; padding: 8px 6px; color: var(--ice-d); min-width: 70px; text-align: left; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .list { display: flex; flex-direction: column; gap: 7px; }
#stage .card { position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k s" "n s" "u s"; align-items: center; text-align: left; border: 2px solid #cfe0ef; background: #fff; border-radius: 12px; padding: 8px 10px; min-height: 58px; color: var(--ink); gap: 0 8px; }
#stage .card b { grid-area: n; font-size: 15px; } #stage .card .k { grid-area: k; } #stage .card .sub { grid-area: u; font-size: 12px; color: #54708c; }
#stage .card .stars, #stage .card .lock { grid-area: s; font-size: 18px; color: #f2a900; letter-spacing: 1px; }
#stage .stars i { font-style: normal; color: #cfd9e3; }
#stage .card.locked { opacity: .6; background: #eef3f8; } #stage .card.sel { border-color: var(--ice); }
#stage .k { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: #54708c; }
#stage .k-slalom { color: #c22b30; } #stage .k-gs { color: #1b5a8a; } #stage .k-dh { color: #6b3fb3; }
#stage .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 2px solid #cfe0ef; border-radius: 12px; padding: 8px 10px; min-height: 52px; }
#stage .row.got { border-color: #7fd69a; background: #f0fff4; }
#stage .row b { display: block; font-size: 14px; } #stage .sub { display: block; font-size: 12px; color: #54708c; }
#stage .row .b { min-width: 64px; }
#stage .pips { display: flex; gap: 4px; margin-top: 4px; } #stage .pips i { width: 16px; height: 8px; border-radius: 4px; background: #cfd9e3; } #stage .pips i.on { background: var(--ice); }
#stage .bar { height: 7px; background: #dbe9f6; border-radius: 4px; overflow: hidden; margin-top: 5px; } #stage .bar i { display: block; height: 100%; background: var(--green); }
#stage .suits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#stage .suit { border: 2px solid #cfe0ef; background: #fff; border-radius: 12px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 800; color: var(--ink); }
#stage .suit i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px #9db4c9; }
#stage .suit.sel { border-color: var(--ice); background: #e9f3fb; } #stage .suit.locked { opacity: .55; }
#stage .medals { display: flex; justify-content: space-around; font-weight: 800; font-variant-numeric: tabular-nums; } #stage .medals div { text-align: center; } #stage .medals span { display: block; font-size: 26px; }
#stage .kindline { font-size: 13px; } #stage .toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: 14px; } #stage .toggle input { width: 24px; height: 24px; }
#stage .medalbig { text-align: center; padding: 6px 0; } #stage .medalbig span { font-size: 54px; display: block; line-height: 1; } #stage .medalbig b { font-size: 20px; letter-spacing: 3px; } #stage .medalbig .nm { font-size: 18px; font-weight: 800; color: #54708c; }
#stage .tbl { width: 100%; border-collapse: collapse; font-size: 14px; } #stage .tbl td { padding: 4px 2px; border-bottom: 1px solid #dbe5ee; } #stage .tbl td:last-child { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
#stage .tbl .tot td { font-size: 17px; } #stage .tbl em { font-style: normal; color: #c22b30; font-size: 11px; }
#stage .place { text-align: center; font-size: 14px; } #stage .goal { text-align: center; font-weight: 700; font-size: 13px; color: var(--ice-d); } #stage .ach { font-size: 12px; color: #6b4a00; background: #fff6d4; padding: 4px 8px; border-radius: 8px; }
#stage .setrow { display: flex; flex-direction: column; gap: 5px; font-weight: 800; font-size: 14px; } #stage .seg { display: flex; gap: 6px; flex-wrap: wrap; } #stage .seg .b { flex: 1; min-width: 70px; }
#stage .help { padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
#stage .menu .logo { margin: 4px 0; }

.sk-bar { text-align: center; margin: .6rem 0 .2rem; }
.sk-keys { text-align: center; font-size: .78rem; color: #64748b; max-width: 420px; margin: 0 auto; }
.sk-guide { max-width: 680px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.65; }
.sk-guide h2 { font-size: 1.35rem; margin-bottom: .6rem; }
.sk-guide h3 { font-size: 1.05rem; margin: 1rem 0 .3rem; }
.sk-guide p { margin-bottom: .6rem; color: #334155; }
@media (max-height: 560px) { #stage .panel { padding: 10px; gap: 6px; } #stage #count { font-size: 60px; } }
@media (prefers-reduced-motion: reduce) { #stage .spinner { animation: none; } #stage #flash.f-bad { animation: none; opacity: 0; } }
#stage .hud-btns { display: flex; gap: 6px; }
#stage #hud-streak { position: absolute; left: 10px; bottom: 130px; padding: 4px 10px; border-radius: 999px; background: #ffd23f; color: #3a2a00; font-weight: 900; font-size: 14px; opacity: 0; transform: scale(.9); transition: opacity .15s; }
#stage #hud-streak.on { opacity: 1; transform: none; }
#stage #hud-streak.pop { animation: skstreak .25s ease-out; }
@keyframes skstreak { from { transform: scale(1.35); } to { transform: scale(1); } }
#stage .hud-top { top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); }
@media (prefers-reduced-motion: reduce) { #stage #hud-streak.pop { animation: none; } }
/* Shell full screen (native + immersive): fit the game beside the shell rail, clear of notch and home bar. */
html.pip-immersive #stage.is-big { inset: var(--pip-vvt, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) calc(var(--pip-rail-w, 0px) + env(safe-area-inset-left, 0px)); width: auto; height: auto; }
html.pip-immersive .sk-bar, html.pip-immersive .sk-keys, html.pip-immersive .game-header, html.pip-immersive .ad-well, html.pip-immersive .sk-guide { display: none; }
html.pip-immersive #stage .tuckbtn { bottom: max(14px, env(safe-area-inset-bottom)); }
html.pip-immersive #stage #hud-streak { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 80px); }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive #stage .tuckbtn { width: 96px; height: 56px; bottom: 8px; }
  html.pip-immersive #stage #hud-streak { bottom: 76px; }
}
