/* Games page (and the games teaser on the home page). Builds on home.css tokens. */

/* ── Hero + lobby ───────────────────────────── */
.arcade{padding-top:clamp(92px,11vw,130px)}
.arc-hero{max-width:calc(var(--wrap) + 2*var(--gutter));margin:0 auto;padding:0 var(--gutter) clamp(26px,3vw,40px)}
.arc-kicker{font-size:12.5px;font-weight:500;letter-spacing:.32em;text-transform:uppercase;color:rgba(242,246,252,.75);margin-bottom:12px}
.arc-hero h1{font-size:clamp(36px,5.2vw,64px);font-weight:800;letter-spacing:-.025em;line-height:1.02;margin-bottom:14px}
.arc-desc{color:var(--mist);font-size:clamp(15px,1.3vw,17px);max-width:58ch}

.arc-lobby{max-width:calc(var(--wrap) + 2*var(--gutter));margin:0 auto;padding:0 var(--gutter) clamp(60px,7vw,100px);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(14px,1.8vw,22px)}
.arc-card{position:relative;display:flex;flex-direction:column;text-decoration:none;color:inherit;border-radius:24px;overflow:hidden;border:1px solid var(--edge);
  background:linear-gradient(165deg,rgba(14,26,52,.72),rgba(6,11,24,.88));box-shadow:0 30px 80px rgba(0,0,0,.4);transition:transform .25s,border-color .25s,box-shadow .25s}
.arc-card:hover{transform:translateY(-4px);border-color:var(--edge-hi);box-shadow:0 36px 90px rgba(0,0,0,.5)}
.arc-art{display:block;aspect-ratio:16/8.4;position:relative;overflow:hidden;border-bottom:1px solid rgba(170,200,255,.1)}
.arc-art svg{position:absolute;inset:0;width:100%;height:100%}
.art-run{background:radial-gradient(ellipse 80% 90% at 50% 120%,rgba(70,140,220,.35),transparent 60%),linear-gradient(180deg,#0a1630,#05091a)}
.art-orbit{background:radial-gradient(ellipse at 50% 50%,rgba(40,80,140,.25),transparent 60%),linear-gradient(180deg,#081226,#03060e)}
.art-lab{background:linear-gradient(180deg,#0e1a33,#060b18)}
.art-quiz{background:radial-gradient(ellipse 70% 80% at 50% 0%,rgba(254,197,12,.12),transparent 60%),linear-gradient(180deg,#0e1730,#060b18)}
.arc-body{position:relative;display:flex;flex-direction:column;gap:10px;padding:22px 24px 24px;flex:1}
.arc-num{font-size:12px;font-weight:600;letter-spacing:.2em;color:var(--mist)}
.arc-body h2{font-size:clamp(22px,2vw,27px);font-weight:800;letter-spacing:-.01em;line-height:1.15}
.arc-body p{color:rgba(242,246,252,.78);font-size:15px;line-height:1.55;max-width:46ch}
.arc-meta{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.chip{display:inline-flex;align-items:center;gap:7px;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);font-size:12.5px;color:rgba(242,246,252,.85)}
.chip svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round}
.chip b{font-weight:600}
.chip.diff i{width:6px;height:6px;border-radius:50%;background:rgba(255,255,255,.2)}
.chip.diff[data-d="1"] i:nth-child(-n+1),.chip.diff[data-d="2"] i:nth-child(-n+2),.chip.diff[data-d="3"] i:nth-child(-n+3){background:var(--dawn)}
.chip.diff[data-d="1"] i:nth-child(-n+1){background:#7CFFB2}
.chip.best em{font-style:normal;color:var(--sun);font-weight:600}
.arc-play{margin-top:auto;padding-top:10px;display:inline-flex;align-items:center;gap:10px;font-weight:700;font-size:15px;color:#fff}
.arc-play svg{width:20px;height:12px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;transition:transform .25s}
.arc-card:hover .arc-play svg{transform:translateX(5px)}

/* ── Game view ──────────────────────────────── */
.arc-games.play{padding-top:0;gap:0}
.arc-games .arc-game{display:flex;flex-direction:column;gap:16px;padding-bottom:clamp(50px,6vw,80px)}
.arc-games .arc-game[hidden]{display:none}
.arc-bar{display:flex;align-items:center;gap:14px}
.arc-bar h2{font-size:clamp(22px,2.4vw,32px);font-weight:800;letter-spacing:-.015em;flex:1;min-width:0;line-height:1.15}
.arc-back{display:inline-flex;align-items:center;gap:8px;padding:9px 16px 9px 12px;border-radius:999px;border:1px solid var(--edge);background:rgba(255,255,255,.04);text-decoration:none;font-size:14px;font-weight:600;color:rgba(242,246,252,.9);white-space:nowrap}
.arc-back:hover{border-color:var(--edge-hi);color:#fff}
.arc-back svg{width:18px;height:11px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.arc-help{width:40px;height:40px;border-radius:50%;border:1px solid var(--edge);background:rgba(255,255,255,.04);color:#fff;font-weight:700;font-size:16px;cursor:pointer;flex:none}
.arc-help:hover{border-color:var(--edge-hi)}
.gplay{position:relative}
.arc-game .leaderboard-panel{margin:0}

/* game canvas stage (Run, Orbit) */
.g-stage{position:relative;height:min(74vh,680px);min-height:420px;border-radius:24px;overflow:hidden;border:1px solid var(--edge);background:#050913;box-shadow:0 30px 80px rgba(0,0,0,.45);touch-action:none;user-select:none;-webkit-user-select:none}
.g-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block;cursor:crosshair}
.g-tools{position:absolute;top:12px;right:12px;display:flex;gap:8px;z-index:3}
.g-tool{width:40px;height:40px;border-radius:12px;border:1px solid rgba(255,255,255,.18);background:rgba(5,10,22,.6);backdrop-filter:blur(8px);color:#fff;display:grid;place-items:center;cursor:pointer}
.g-tool svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.g-fs .i-close,.gfull .g-fs .i-open{display:none}
.gfull .g-fs .i-close{display:block}
.g-tip{position:absolute;left:50%;bottom:18px;transform:translate(-50%,8px);max-width:min(90%,560px);text-align:center;padding:9px 16px;border-radius:999px;font-size:14px;font-weight:500;color:#fff;background:rgba(5,10,22,.72);border:1px solid rgba(92,200,255,.35);backdrop-filter:blur(8px);opacity:0;transition:opacity .3s,transform .3s;pointer-events:none;z-index:2}
.g-tip.on{opacity:1;transform:translate(-50%,0)}
.g-tip:empty{opacity:0}

/* full screen */
.gplay.gfull{position:fixed;inset:0;z-index:5000;background:#050913}
.gplay.gfull .g-stage{height:100%;min-height:0;border-radius:0;border:0}
html.fp-lock #header,html.fp-lock #progress-bar,html.fp-lock #mobile-nav,html.fp-lock #mobile-overlay,html.fp-lock #chat-btn,html.fp-lock #back-top,html.fp-lock #chat-panel{display:none!important}
html.fp-lock,html.fp-lock body{overflow:hidden;overscroll-behavior:none}

/* how-to card */
.how{position:absolute;inset:0;z-index:6;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(3,6,14,.7);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);border-radius:24px}
.how[hidden]{display:none}
.lab-play .how,.quiz-play .how{align-items:flex-start;padding-top:clamp(18px,5vw,60px);border-radius:26px}
.how-card{width:min(560px,100%);max-height:100%;overflow-y:auto;padding:clamp(22px,3vw,32px);border-radius:22px;background:linear-gradient(165deg,rgba(18,32,62,.96),rgba(8,14,30,.97));border:1px solid var(--edge-hi);box-shadow:0 40px 100px rgba(0,0,0,.6);display:flex;flex-direction:column;gap:16px}
.how-kicker{font-size:12px;letter-spacing:.24em;text-transform:uppercase;color:var(--ice);font-weight:600}
.how-card h3{font-size:clamp(22px,2.4vw,28px);font-weight:800;line-height:1.15;margin-top:-6px}
.how-steps{list-style:none;display:flex;flex-direction:column;gap:12px}
.how-steps li{display:flex;gap:14px;align-items:flex-start}
.how-steps li>span:last-child{display:flex;flex-direction:column;gap:2px}
.how-steps b{font-size:15.5px;font-weight:700}
.how-steps em{font-style:normal;color:rgba(242,246,252,.78);font-size:14.5px;line-height:1.5}
.how-ic{flex:none;width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:rgba(92,200,255,.12);border:1px solid rgba(92,200,255,.35);color:#9FE7FF}
.how-ic b{font-size:15px}
.how-ic svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.how-ic.warn{background:rgba(255,90,80,.12);border-color:rgba(255,90,80,.45);color:#FF8A7A}
.how-ic.ok{background:rgba(124,255,178,.1);border-color:rgba(124,255,178,.45);color:#7CFFB2}
.t-touch{display:none}
html.touchy .t-touch{display:inline}
html.touchy .t-keys{display:none}
.how-legend{list-style:none;display:flex;flex-wrap:wrap;gap:8px 16px;font-size:13px;color:rgba(242,246,252,.8)}
.how-legend li{display:flex;align-items:center;gap:7px}
.how-legend i{width:14px;height:14px;border-radius:50%;border:2px solid var(--c);background:color-mix(in srgb,var(--c) 25%,transparent)}
.how-note{font-size:13px;color:var(--mist);line-height:1.5}
.how-card .o-cta{align-self:flex-start}
.how-choices{display:flex;flex-wrap:wrap;gap:10px}

/* ── Baikonur Run HUD ───────────────────────── */
.run-hud{position:absolute;top:0;left:0;right:0;display:flex;align-items:flex-start;gap:16px;padding:12px 108px 0 16px;pointer-events:none;z-index:2}
.run-score{display:flex;align-items:baseline;gap:8px}
.run-score span,.run-best span,.run-sec span{font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--mist)}
.run-score b{font-size:26px;font-weight:300;color:#fff;font-variant-numeric:tabular-nums;line-height:1}
.run-score em{font-style:normal;font-weight:800;font-size:14px;color:rgba(255,255,255,.35);transition:color .2s,transform .2s}
.run-score em.hot{color:var(--sun);transform:scale(1.15)}
.run-sec{position:relative;align-self:center;margin:0 auto;font-size:13px;display:flex;align-items:center;gap:6px;padding-bottom:6px}
.run-sec b{color:#fff}
.run-sec i{position:absolute;left:0;right:0;bottom:0;height:3px;border-radius:2px;background:rgba(255,255,255,.12);overflow:hidden}
.run-sec i::after{content:'';position:absolute;inset:0;width:calc(var(--p,0)*100%);background:linear-gradient(90deg,var(--ice),#FF6B5A)}
.run-right{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.run-lives{display:flex;gap:5px;min-height:14px}
.run-lives i{width:14px;height:14px;background:#FF6B7A;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21C5 15 2 11.5 2 8a5 5 0 0 1 10-1 5 5 0 0 1 10 1c0 3.5-3 7-10 13z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21C5 15 2 11.5 2 8a5 5 0 0 1 10-1 5 5 0 0 1 10 1c0 3.5-3 7-10 13z'/%3E%3C/svg%3E") center/contain no-repeat}
.run-best{font-size:13px}
.run-best b{color:var(--sun);font-weight:600}

/* ── One-Button Orbit HUD ───────────────────── */
.os-hud-l{position:absolute;top:14px;left:16px;display:flex;flex-direction:column;gap:2px;z-index:2;pointer-events:none}
.os-hud-l span{font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--mist)}
.os-hud-l b{font-size:24px;font-weight:300;color:#fff;font-variant-numeric:tabular-nums;line-height:1.1}
.os-hud-l .os-warp{margin-top:6px;font-size:12px;letter-spacing:.08em;color:var(--sun);text-transform:none}
.os-gauges{position:absolute;top:66px;right:14px;bottom:110px;display:flex;gap:10px;z-index:2;pointer-events:none}
.os-gauge{position:relative;width:46px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end}
.os-gauge::before{content:'';position:absolute;top:0;bottom:44px;left:50%;width:14px;transform:translateX(-50%);border-radius:8px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.16)}
.os-gauge i{position:absolute;bottom:44px;left:50%;width:14px;transform:translateX(-50%);height:calc((100% - 44px)*var(--v,0));border-radius:8px;background:linear-gradient(0deg,#2E7BEF,var(--ice));transition:height .15s}
.os-gauge.ok i{background:linear-gradient(0deg,#1fae6a,#7CFFB2);box-shadow:0 0 14px rgba(124,255,178,.6)}
.os-gauge.hi i{background:linear-gradient(0deg,#d9822b,#FFB547)}
.os-zone{position:absolute;left:50%;width:22px;transform:translateX(-50%);border:1.5px dashed rgba(124,255,178,.8);border-radius:6px;background:rgba(124,255,178,.08)}
/* AP bar spans 0–100 km, green zone 35–70 km; PE bar spans −60…+60 km, green above 30 km */
.os-gauge.ap .os-zone{bottom:calc(44px + (100% - 44px)*.35);height:calc((100% - 44px)*.35)}
.os-gauge.pe .os-zone{bottom:calc(44px + (100% - 44px)*.75);height:calc((100% - 44px)*.25)}
.os-gauge b{font-size:11px;font-weight:700;color:#fff;letter-spacing:.04em;line-height:1.2;text-align:center;max-width:64px;word-break:break-word}
.os-gauge em{font-style:normal;font-size:12px;color:rgba(242,246,252,.85);font-variant-numeric:tabular-nums;line-height:1.3;min-height:16px}
.os-gauge.fuel{width:22px}
.os-gauge.fuel::before,.os-gauge.fuel i{width:10px;bottom:24px}
.os-gauge.fuel i{height:calc((100% - 24px)*var(--v,1));background:linear-gradient(0deg,#d9822b,var(--sun))}
.os-gauge.fuel b{font-size:13px}
.os-guide{top:14px;bottom:auto;transform:translate(-50%,0);max-width:min(60%,520px);border-radius:16px}
.os-guide.urgent{border-color:rgba(124,255,178,.8);background:rgba(10,40,26,.82);animation:osPulse 1s ease-in-out infinite}
@keyframes osPulse{50%{box-shadow:0 0 0 6px rgba(124,255,178,.15)}}
.os-hold{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);z-index:3;display:flex;align-items:center;justify-content:center;gap:12px;min-width:min(320px,80%);padding:18px 30px;border-radius:999px;border:1.5px solid rgba(255,255,255,.5);background:rgba(8,14,30,.75);backdrop-filter:blur(8px);color:#fff;font:800 16px var(--font);letter-spacing:.06em;text-transform:uppercase;cursor:pointer;touch-action:none;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;transition:background .15s,border-color .15s,transform .1s}
.os-hold i{width:14px;height:14px;border-radius:50%;background:rgba(255,255,255,.35)}
.os-hold.on{background:linear-gradient(90deg,#FF7A3D,#FFB547);border-color:#FFD08A;color:#1a0d00;transform:translateX(-50%) scale(.97)}
.os-hold.on i{background:#fff;box-shadow:0 0 12px #fff}
.os-stage .o-overlay{z-index:4}

@media (max-width:720px){
  .arc-lobby{grid-template-columns:1fr}
  .arc-body{padding:18px 18px 20px}
  .arc-bar h2{font-size:20px}
  .arc-back{padding:8px 12px 8px 10px;font-size:13px}
  .g-stage{height:72vh;min-height:380px;border-radius:18px}
  .run-hud{padding:10px 60px 0 12px;gap:10px}
  .run-score b{font-size:22px}
  .run-best{display:none}
  .run-sec{font-size:12px}
  .g-tools{top:10px;right:10px}
  .g-tools .g-tool{width:36px;height:36px}
  .os-gauges{top:60px;right:8px;bottom:96px;gap:6px}
  .os-gauge{width:40px}
  .os-guide{top:auto;bottom:88px;max-width:88%;font-size:13px}
  .os-hold{bottom:16px;padding:16px 24px;font-size:15px}
  .how{padding:10px}
  .how-card{padding:20px 18px;gap:12px}
  .how-steps em{font-size:14px}
}
/* the in-game run tip sits above the safe area on phones */
.gplay.gfull .g-tip{bottom:calc(18px + env(safe-area-inset-bottom))}
.gplay.gfull .os-hold{bottom:calc(18px + env(safe-area-inset-bottom))}

/* ── Home page teaser ───────────────────────── */
.arc-teaser .arc-lobby{padding:0}
.arc-teaser-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:24px}
.arc-teaser-head h2{font-size:clamp(28px,3.2vw,42px);font-weight:800;letter-spacing:-.015em;line-height:1.1}
.arc-teaser-head p{color:var(--mist);font-size:15.5px;margin-top:8px;max-width:56ch}
.arc-teaser .arc-lobby{grid-template-columns:repeat(4,minmax(0,1fr))}
.arc-teaser .arc-body{padding:16px 18px 18px;gap:6px}
.arc-teaser .arc-body h2{font-size:18px}
.arc-teaser .arc-body p,.arc-teaser .chip.best{display:none}
@media (max-width:1000px){.arc-teaser .arc-lobby{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:520px){.arc-teaser .arc-lobby{grid-template-columns:1fr 1fr;gap:10px}.arc-teaser .arc-meta{display:none}.arc-teaser .arc-body{padding:12px 12px 14px}.arc-teaser .arc-body h2{font-size:15px}.arc-teaser .arc-play{font-size:13px;padding-top:4px}}

/* hidden always wins over the display rules above */
.arcade [hidden]{display:none!important}
body.in-game .arcade{padding-top:clamp(84px,9vw,96px)}
.g-stage{height:min(calc(100vh - 176px),680px)}
@supports (height:100dvh){.g-stage{height:min(calc(100dvh - 176px),680px)}}
a.o-ghost{text-decoration:none;display:inline-flex;align-items:center}
@media (max-width:720px){.g-stage{height:calc(100svh - 150px);min-height:400px}}
/* main is a stacking context (z-index:1); release it so a full-screen game sits above the footer */
html.fp-lock main{z-index:auto}
@media (max-width:720px){.run-hud{padding-right:100px}}
/* Formula Challenge on the games page */
.arc-games .dock-badge{display:none}
@media (max-width:960px){
  .arc-games .formula-panel{order:-1;border-top:0;border-bottom:1px solid rgba(255,255,255,.08)}
}
/* One-Button Orbit on phones: shorter gauges low on the right, hint above the button */
@media (max-width:720px){
  .os-gauges{top:auto;bottom:100px;height:min(42%,300px)}
  .gplay.gfull .os-gauges{bottom:calc(100px + env(safe-area-inset-bottom))}
  .os-guide,.gplay.gfull .os-guide{top:auto;bottom:calc(92px + env(safe-area-inset-bottom));max-width:calc(100% - 140px);left:calc(50% - 50px)}
}
@media (min-width:721px){.gplay.gfull .os-guide{bottom:auto}}

/* ── Gravity Hop HUD ── */
.os-hud{position:absolute;top:0;left:0;right:0;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:12px 64px 0 16px;z-index:2;pointer-events:none}
.os-hud span{display:block;font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--mist)}
.os-score b{font-size:26px;font-weight:300;color:#fff;font-variant-numeric:tabular-nums;line-height:1.1}
.os-best{text-align:right}
.os-best b{font-size:14px;font-weight:600;color:var(--sun)}
.os-prog{position:relative;text-align:center;padding-bottom:7px;min-width:110px}
.os-prog b{font-size:15px;font-weight:700;color:#fff;font-variant-numeric:tabular-nums}
.os-prog i{position:absolute;left:0;right:0;bottom:0;height:3px;border-radius:2px;background:rgba(255,255,255,.12);overflow:hidden}
.os-prog i::after{content:'';position:absolute;inset:0;width:calc(var(--p,0)*100%);background:linear-gradient(90deg,#8CDCFF,#FFE08A);transition:width .5s ease}
.os-stage canvas{cursor:pointer}
.os-guide,.gplay.gfull .os-guide{top:auto;left:50%;bottom:calc(26px + env(safe-area-inset-bottom));max-width:min(86%,420px);transform:translate(-50%,0)}
.os-guide.on{animation:osTap 1.6s ease-in-out infinite}
@keyframes osTap{50%{opacity:.55}}
@media (max-width:720px){.os-hud{padding:10px 56px 0 12px}.os-score b{font-size:22px}.os-prog{min-width:90px}}
