/* Sol Leap: full-screen 3D platformer page. Same brand tokens as Sol Sprint; the HUD is bold and outlined so it reads over a bright sky. */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-latin-wght-v6.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #0B0420; --panel: rgba(16, 8, 36, .80); --line: rgba(255, 255, 255, .16); --text: #F4F0FF; --muted: #B9AEDB;
  --purple: #9945FF; --green: #14F195; --pink: #FF3EA5; --cyan: #2EE6FF; --gold: #FFC93A;
  --grad: linear-gradient(90deg, #9945FF, #14F195);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- shared bits ---------- */
.screen { position: absolute; inset: 0; z-index: 10; padding: calc(14px + var(--sat)) calc(14px + var(--sar)) calc(14px + var(--sab)) calc(14px + var(--sal)); }
.screen.dim { display: grid; place-items: center; background: rgba(5, 2, 15, .55); z-index: 40; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.card { width: min(420px, 100%); max-height: calc(100dvh - 28px - var(--sat) - var(--sab)); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.menu { display: grid; gap: 10px; text-align: center; }
.btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); font-weight: 800; font-size: 16px; color: var(--text); text-decoration: none; transition: transform .08s, background .15s; }
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: scale(.97); }
.btn.big, #btn-resume, #btn-next, #btn-over, #btn-help-close { background: var(--grad); border: 0; color: #0B0420; font-weight: 900; font-size: 18px; letter-spacing: .04em; box-shadow: 0 8px 30px rgba(153, 69, 255, .35); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; font-size: 18px; font-weight: 800; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.icon[aria-pressed="false"] { opacity: .5; }
.chip { display: inline-flex; align-items: center; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; font-weight: 700; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tools { display: flex; gap: 8px; }
.row-opt { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-size: 14px; }
.row-opt input { width: 18px; height: 18px; accent-color: var(--green); }
.row-opt select { font: inherit; font-weight: 700; padding: 4px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: inherit; }
.row-opt select option { color: #1a0f3a; }

/* ---------- loading ---------- */
#loading { display: grid; place-content: center; gap: 18px; text-align: center; background: radial-gradient(ellipse at 50% 80%, #3B1166 0%, var(--bg) 70%); z-index: 50; }
.logo, .title-block h1 { font-weight: 900; font-size: clamp(38px, 9vw, 76px); letter-spacing: .06em; line-height: 1; margin: 0; text-shadow: 0 4px 0 rgba(11, 4, 32, .55), 0 0 26px rgba(153, 69, 255, .55); }
.logo b, .title-block h1 b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar { width: min(260px, 70vw); height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; margin: 0 auto; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 6px; transition: width .2s; }
#load-msg { color: var(--muted); margin: 0; }
#fail { display: grid; place-items: center; z-index: 60; }

/* ---------- title ---------- */
#title { display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
#title > * { pointer-events: auto; }
.title-block { text-align: center; margin-top: 2vh; pointer-events: none !important; }
.tag { margin: 10px 0 0; font-weight: 700; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .55); }
.bottom-panel { width: min(440px, 100%); margin: 0 auto; display: grid; gap: 12px; }
.picker { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.arrow { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); font-size: 30px; line-height: 1; }
.who { text-align: center; min-width: 0; }
.who h2 { margin: 2px 0; font-size: 24px; font-weight: 900; }
.who span { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- map ---------- */
#map { display: flex; flex-direction: column; gap: 10px; background: radial-gradient(ellipse at 50% 30%, #2A7BD8 0%, #1B3E8F 55%, #120A3A 100%); }
.map-stats { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 18px; padding: 0 14px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.map-stats b { margin-right: 8px; }
.map-wrap { position: relative; width: min(760px, 100%, calc((100dvh - 260px) * 400 / 260)); aspect-ratio: 400 / 260; margin: auto; }
#map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-nodes { position: absolute; inset: 0; }
.mnode { position: absolute; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: #3a2a6b; color: #fff; font-weight: 900; font-size: 20px; box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 0 0 rgba(20, 241, 149, .0); transition: transform .12s, box-shadow .2s; display: grid; place-items: center; }
.mnode.open { background: linear-gradient(160deg, #FF5FA8, #9945FF); }
.mnode.done { background: linear-gradient(160deg, #14F195, #0BA374); color: #0B0420; }
.mnode.locked { background: #4a4560; opacity: .75; cursor: not-allowed; }
.mnode.sel { transform: translate(-50%, -50%) scale(1.14); box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 0 8px rgba(255, 201, 58, .55); }
.mnode small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 10px; white-space: nowrap; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: rgba(11, 4, 32, .75); }
.mnode .solc { position: absolute; bottom: -8px; right: -10px; font-size: 11px; padding: 2px 6px; border-radius: 8px; background: #0B0420; color: var(--gold); border: 1px solid var(--gold); }
.map-info { width: min(560px, 100%); margin: 0 auto; display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.map-info .btn { min-width: 120px; }
.map-best { margin-top: 4px !important; font-size: 13px !important; color: var(--gold) !important; font-weight: 700; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; padding: calc(10px + var(--sat)) calc(12px + var(--sar)) 0 calc(12px + var(--sal)); display: flex; justify-content: space-between; align-items: flex-start; font-weight: 900; color: #fff; }
#hud b { font-size: 22px; text-shadow: 0 2px 0 #1a0f3a, 0 0 2px #1a0f3a, 2px 0 0 #1a0f3a, -2px 0 0 #1a0f3a, 0 -2px 0 #1a0f3a; font-variant-numeric: tabular-nums; }
.hud-row { display: flex; align-items: center; gap: 6px; height: 30px; }
.hud-right { text-align: right; display: grid; justify-items: end; margin-right: 54px; }
.hud-right .score b { font-size: 26px; letter-spacing: .04em; }
.ic-life, .ic-coin, .ic-sol, .ic-time { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #1a0f3a; }
.ic-life { background: radial-gradient(circle at 35% 30%, #fff 0 12%, transparent 13%), linear-gradient(160deg, #FF5FA8, #C2186B); border-radius: 50% 50% 46% 46%; }
.ic-coin { background: radial-gradient(circle at 35% 30%, #fff8c8 0 14%, transparent 15%), radial-gradient(circle, #FFD54A 0 58%, #E09A00 60%); }
.ic-sol { background: linear-gradient(135deg, #9945FF, #14F195); }
.ic-time { background: conic-gradient(#1a0f3a 0 25%, #fff 0); }
.sol-slots { display: flex; gap: 4px; margin-top: 4px; }
.sol-slots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); background: rgba(0, 0, 0, .25); }
.sol-slots i.got { border-color: #1a0f3a; background: linear-gradient(135deg, #9945FF, #14F195); box-shadow: 0 0 8px rgba(20, 241, 149, .8); }
.hud-mid { position: absolute; left: 50%; top: calc(8px + var(--sat)); transform: translateX(-50%); }
.reserve { width: 52px; height: 52px; border-radius: 12px; border: 3px solid #fff; background: rgba(26, 15, 58, .55); display: grid; place-items: center; pointer-events: auto; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.reserve i { width: 30px; height: 30px; border-radius: 50%; }
.reserve i.grow { background: radial-gradient(circle at 35% 30%, #fff 0 14%, transparent 15%), linear-gradient(160deg, #6FFFD2, #14B8A6); border-radius: 30% 30% 50% 50%; }
.reserve i.fire { background: radial-gradient(circle at 50% 70%, #FFF3B0 0 22%, #FF8A1F 45%, #E02F1F 75%); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.reserve i.glide { background: linear-gradient(160deg, #EAD9FF, #9945FF); border-radius: 50% 10% 50% 10%; }
.pmeter { display: flex; gap: 3px; align-items: center; margin-top: 4px; }
.pmeter i { width: 12px; height: 10px; border-radius: 3px; background: rgba(255, 255, 255, .25); border: 1px solid #1a0f3a; transform: skewX(-15deg); }
.pmeter i.on { background: #FFD54A; }
.pmeter em { font-style: normal; font-size: 13px; padding: 0 5px; border-radius: 5px; background: rgba(255, 255, 255, .25); color: #1a0f3a; }
.pmeter.full i, .pmeter.full em { background: #FF3EA5; animation: blink .25s steps(2) infinite; }
@keyframes blink { 50% { filter: brightness(1.6); } }
/* cape flight fuel: shown only while the cape form is held */
.flightmeter { display: flex; gap: 3px; align-items: center; margin-top: 6px; }
.flightmeter[hidden] { display: none; }
.flightmeter i { width: 12px; height: 10px; border-radius: 3px; background: rgba(255, 255, 255, .25); border: 1px solid #1a0f3a; transform: skewX(-15deg); }
.flightmeter i.on { background: #B892FF; }
.flightmeter.empty i.on { background: #5A4A7A; animation: blink .25s steps(2) infinite; }
/* title screen: 3D / 2D camera choice */
.view-toggle { display: flex; gap: 2px; margin: 10px auto 0; padding: 3px; border-radius: 999px; background: rgba(0,0,0,.25); width: fit-content; }
.view-note { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,.65); text-align: center; }
.view-btn { font: 700 13px/1 inherit; padding: 7px 18px; border-radius: 999px; border: none; background: transparent; color: rgba(255,255,255,.65); cursor: pointer; }
.view-btn[aria-pressed="true"] { background: #fff; color: #1a0f3a; }
.pause-btn { position: absolute; top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); pointer-events: auto; font-size: 13px; }
#toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-size: clamp(26px, 6vw, 46px); font-weight: 900; letter-spacing: .05em; text-shadow: 0 3px 0 #1a0f3a, 0 0 18px rgba(153, 69, 255, .7); opacity: 0; transition: opacity .3s; white-space: nowrap; }
#toast.show { opacity: 1; }

/* ---------- touch ---------- */
#touch { position: absolute; inset: 0; z-index: 25; pointer-events: none; }
.stick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; pointer-events: auto; touch-action: none; }
.stick-base { position: absolute; left: calc(26px + var(--sal)); bottom: calc(26px + var(--sab)); width: 132px; height: 132px; border-radius: 50%; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .3); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255, 255, 255, .75); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.btns { position: absolute; right: calc(18px + var(--sar)); bottom: calc(22px + var(--sab)); width: 200px; height: 190px; pointer-events: none; }
.tbtn { position: absolute; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .55); color: #fff; font-weight: 900; font-size: 24px; pointer-events: auto; touch-action: none; box-shadow: 0 5px 0 rgba(0, 0, 0, .3); }
.tbtn.on { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); filter: brightness(1.25); }
.t-jump { width: 92px; height: 92px; right: 0; bottom: 0; background: rgba(20, 241, 149, .55); }
.t-spin { width: 70px; height: 70px; right: 104px; bottom: 6px; background: rgba(153, 69, 255, .6); }
.t-run { width: 70px; height: 70px; right: 14px; bottom: 104px; background: rgba(255, 62, 165, .55); }

/* ---------- help / tallies ---------- */
.help table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; margin: 4px 0 8px; }
.help th { padding: 6px 8px 6px 0; color: #fff; white-space: nowrap; vertical-align: top; }
.help td { padding: 6px 0; color: var(--muted); }
.tally { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; margin: 6px 0 10px; text-align: left; font-size: 16px; }
.tally dt { color: var(--muted); }
.tally dd { margin: 0; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.tally .total { color: var(--gold); font-size: 20px; }

@media (max-width: 560px) {
  #hud b { font-size: 18px; }
  .hud-right .score b { font-size: 20px; }
  .map-info { flex-direction: column; align-items: stretch; text-align: center; }
  .mnode { width: 52px; height: 52px; font-size: 17px; }
}
@media (max-height: 460px) {
  .title-block h1 { font-size: 34px; }
  .tag { display: none; }
}

/* zone transitions and the world switcher */
#fade { position: fixed; inset: 0; background: #07030f; opacity: 0; pointer-events: none; z-index: 4; transition: opacity .06s linear; }
.map-worlds { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px auto 6px; font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.map-worlds .chip { min-width: 40px; font-size: 22px; line-height: 1; }
.map-worlds .chip:disabled { opacity: .35; cursor: default; }
.mnode { font-size: 16px; }
.mnode.k-secret { border-color: #FFC93A; }
.mnode.k-tower { border-radius: 14px; }

/* Sol Leap 2.0: all-worlds overview and the travel scene */
#map-overview { position: absolute; inset: 12% 6% auto; z-index: 30; display: flex; flex-direction: column; gap: 10px; max-height: 76%; overflow: auto; }
.ov-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ov-card { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--wc, var(--line)); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.ov-card b { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--wc, var(--text)); }
.ov-card span { font-weight: 900; font-size: 17px; }
.ov-card small { color: var(--muted); font-size: 13px; }
.ov-card.locked { opacity: .5; cursor: default; }
.ov-card.soon { border-style: dashed; border-color: var(--line); cursor: default; }
#travel { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, rgba(40,20,90,.92), rgba(10,4,30,.97)); padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
#travel[hidden] { display: none; }
.travel-card { width: min(560px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: #fff; }
.travel-card h2 { margin: 6px 0 0; font-size: 28px; }
.travel-card p { margin: 0; color: rgba(255,255,255,.82); font-size: 16px; max-width: 46ch; }
.travel-path { display: flex; align-items: center; gap: 10px; width: 100%; }
.tw { flex: none; padding: 8px 12px; border-radius: 12px; font-weight: 900; font-size: 13px; background: rgba(255,255,255,.1); }
.tw.from { border: 2px solid var(--from); } .tw.to { border: 2px solid var(--to); }
.trail { position: relative; flex: 1; height: 4px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 8px, transparent 8px 16px); border-radius: 2px; }
.trail i { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 14px #fff; }
#travel.go .trail i { animation: travel 3.6s cubic-bezier(.45,.05,.4,1) forwards; }
#travel.go .tw.to { animation: arrive .6s 3.4s both; }
@keyframes travel { from { left: 0; } to { left: 100%; } }
@keyframes arrive { from { transform: scale(1); } 50% { transform: scale(1.18); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { #travel.go .trail i { animation: none; left: 100%; } #travel.go .tw.to { animation: none; } }
