/* Space-rescue theme: loaded after style.css. Backdrop, planets, rocket, star map, story scenes. */

:root {
  --on-sky: #ffffff;
  --sky1: #071a2e; --sky2: #0f3d5c;
  --hill1: #7df0b4; --hill2: #2fb37c; --hill3: #167a52; --accent: #06a77d;
  --glass: rgba(9, 15, 36, .74);
  --glass-line: rgba(255, 255, 255, .2);
}
body[data-land="0"] { --sky1: #071a2e; --sky2: #0f3d5c; --hill1: #7df0b4; --hill2: #2fb37c; --hill3: #167a52; --accent: #06a77d; --on-sky: #fff; }
body[data-land="1"] { --sky1: #06182f; --sky2: #134a7a; --hill1: #9fdcff; --hill2: #3f93c9; --hill3: #1f5f8f; --accent: #118ab2; --on-sky: #fff; }
body[data-land="2"] { --sky1: #120a33; --sky2: #3a2378; --hill1: #d3b8ff; --hill2: #8257e0; --hill3: #4a2c8f; --accent: #7b5cd6; --on-sky: #fff; }
body[data-land="3"] { --sky1: #1c0f2b; --sky2: #5a2e3a; --hill1: #ffd28a; --hill2: #e8902f; --hill3: #a8551a; --accent: #e07a1f; --on-sky: #fff; }
body[data-land="4"] { --sky1: #170b1f; --sky2: #4a1f33; --hill1: #ffa598; --hill2: #d2543f; --hill3: #8f2b22; --accent: #c2412f; --on-sky: #fff; }
body[data-land="5"] { --sky1: #0b0930; --sky2: #2f2470; --hill1: #fff3a6; --hill2: #f2b400; --hill3: #b97800; --accent: #f29e00; --on-sky: #fff; }

/* ---------- backdrop ---------- */
body { background: #050a1c; }
.scenery { background: #050a1c; }
.skyimg { position: absolute; inset: -5%; background-size: cover; background-position: center; animation: skydrift 80s ease-in-out infinite alternate; }
.tint {
  position: absolute; inset: 0; mix-blend-mode: screen; opacity: .42; transition: opacity .6s;
  background: radial-gradient(circle at 16% 6%, var(--accent), transparent 55%), radial-gradient(circle at 92% 78%, var(--sky2), transparent 60%);
}
.twinkles, body[data-land="5"] .twinkles { opacity: 1; }
.twinkles i { width: calc(var(--s, 1) * 2px); height: calc(var(--s, 1) * 2px); box-shadow: 0 0 6px 1px rgba(255, 255, 255, .7); }
.shoot { position: absolute; top: 12%; left: 62%; width: 150px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff); transform: rotate(152deg); animation: shoot 11s linear infinite; }
/* the curve of the planet you are standing on: the painted planet, enormous */
.horizon {
  position: absolute; left: 50%; width: 210vmax; height: 210vmax; margin-left: -105vmax; bottom: calc(-210vmax + 17vh);
  border-radius: 50%; background-color: var(--hill2); background-size: 125%; background-position: center;
  box-shadow: 0 -4px 60px 6px color-mix(in srgb, var(--hill1) 55%, transparent), inset 0 24px 50px -24px color-mix(in srgb, var(--hill1) 35%, transparent);
  transition: opacity .5s;
}
body[data-view="MapScreen"] .horizon, body[data-view="Cutscene"] .horizon { opacity: 0; }

/* ---------- planets ---------- */
.pl { position: relative; display: block; width: 100%; aspect-ratio: 1; }
.pl-img { position: absolute; left: -12.5%; top: -12.5%; width: 125%; height: 125%; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.pl-orbit { position: absolute; left: -50%; top: -50%; width: 200%; height: 200%; pointer-events: none; overflow: visible; }
.pl-beacon { position: absolute; left: 50%; top: -10%; width: 5%; height: 16%; margin-left: -2.5%; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, #f4f6fb, #7f8aa8); }
.pl-beacon i { position: absolute; left: 50%; top: -60%; width: 280%; aspect-ratio: 1; margin-left: -140%; border-radius: 50%; background: #4d5774; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.saved .pl-beacon i { background: radial-gradient(#fff, #ffe066 55%, #ff9f1c); box-shadow: 0 0 16px 6px rgba(255, 224, 102, .8); animation: beacon 1s ease-in-out infinite alternate; }

/* ---------- rocket ---------- */
.rocket-svg { width: 100%; height: auto; display: block; overflow: visible; }
.rocket-svg .flame { animation: flick .16s ease-in-out infinite alternate; transform-origin: 80px 196px; }
.rocket-svg .shield-ring { animation: dash 2.4s linear infinite; }
.rocket-svg .blink { animation: blinkLight 1.1s steps(2) infinite; }

/* ---------- home ---------- */
.hangar { display: flex; align-items: center; gap: clamp(8px, 2vw, 24px); }
.home-rocket { width: clamp(96px, 17vw, 170px); animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 0 22px rgba(120, 200, 255, .45)); }
.inst { background: var(--glass); color: #fff; border: 2px solid var(--glass-line); backdrop-filter: blur(8px); }
.inst.on { background: rgba(255, 255, 255, .96); color: var(--ink); border-color: var(--sun); box-shadow: 0 0 26px rgba(255, 209, 102, .55), var(--shadow); }
.logo span:first-child { text-shadow: 0 6px 0 #7a4a00, 0 0 34px rgba(255, 209, 102, .55); }
.logo span:last-child { color: #7df9ff; text-shadow: 0 6px 0 #0b5a78, 0 0 34px rgba(125, 249, 255, .55); }
.total-stars { background: var(--glass); color: #fff; border: 1px solid var(--glass-line); }
.intro-card h3 small { display: block; font-size: .55em; opacity: .7; font-weight: 700; margin-top: 2px; }

/* ---------- 2.5D star map ---------- */
.starmap-screen { height: 100dvh; min-height: 0; gap: 8px; padding-bottom: 12px; overflow: hidden; }
.starmap-screen .topbar h2 { text-transform: uppercase; letter-spacing: 5px; font-size: clamp(20px, 3vw, 30px); text-shadow: 0 0 22px rgba(125, 249, 255, .8); }
.parts-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); font-size: 18px; backdrop-filter: blur(8px); }
.slots { display: flex; gap: 5px; }
.slots i { width: 11px; height: 11px; border-radius: 3px; transform: rotate(45deg); background: rgba(255, 255, 255, .18); }
.slots i.on { background: var(--sun); box-shadow: 0 0 8px var(--sun); }

.starmap { --base: clamp(92px, 19vmin, 190px); position: relative; flex: 1; width: 100%; min-height: 240px; }
.orbit-plane {
  position: absolute; left: 50%; top: 56%; width: 150%; height: 170%;
  transform: translate(-50%, -50%) perspective(900px) rotateX(67deg);
  border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle, rgba(125, 249, 255, .16) 0, rgba(125, 249, 255, .04) 30%, transparent 62%),
    repeating-linear-gradient(0deg, rgba(125, 249, 255, .12) 0 1.5px, transparent 1.5px 72px),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, .12) 0 1.5px, transparent 1.5px 72px);
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
}
.orbit-plane i { position: absolute; inset: 9%; border: 2px solid rgba(160, 230, 255, .28); border-radius: 50%; box-shadow: 0 0 18px rgba(125, 249, 255, .25), inset 0 0 18px rgba(125, 249, 255, .12); }
.orbit-plane i:nth-child(2) { inset: 24%; }
.orbit-plane i:nth-child(3) { inset: 38%; border-style: dashed; animation: spin 60s linear infinite; }
.orbit-plane b { position: absolute; left: 50%; top: 50%; width: 14%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #fff, rgba(125, 249, 255, .7) 30%, transparent 70%); }

.routes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.routes path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.r-glow { stroke: rgba(140, 190, 255, .1); stroke-width: 9px; }
.r-glow.open { stroke: rgba(255, 214, 102, .3); stroke-width: 13px; filter: blur(3px); }
.r-core { stroke: rgba(255, 255, 255, .32); stroke-width: 2.5px; stroke-dasharray: 2 11; }
.r-core.open { stroke: #ffeaa6; stroke-width: 3.5px; stroke-dasharray: 12 11; animation: dash 1.1s linear infinite; }

.planet {
  position: absolute; width: calc(var(--base) * var(--s)); transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; color: #fff;
}
.p-body { position: relative; display: block; width: 100%; animation: float 4.5s ease-in-out infinite; filter: brightness(calc(.72 + .28 * var(--s))); }
.planet:active .p-body { scale: .95; }
/* glowing landing ring on the orbit plane under each planet */
.p-pad { position: absolute; left: 50%; top: calc(var(--base) * var(--s) * .9); width: 160%; aspect-ratio: 1; transform: translate(-50%, -50%) scaleY(.24); pointer-events: none; }
.p-pad i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--pc) 75%, transparent);
  background: radial-gradient(circle, rgba(0, 0, 0, .55) 0, rgba(0, 0, 0, .25) 35%, color-mix(in srgb, var(--pc) 22%, transparent) 60%, transparent 72%);
  box-shadow: 0 0 22px color-mix(in srgb, var(--pc) 60%, transparent); }
.planet.current .p-pad i { border: 5px dashed var(--pc); animation: spin 9s linear infinite; }
.planet.locked .p-pad i { border-color: rgba(255, 255, 255, .16); box-shadow: none; background: radial-gradient(circle, rgba(0, 0, 0, .5) 0, transparent 60%); }
.planet.saved .p-body { filter: brightness(calc(.8 + .28 * var(--s))) drop-shadow(0 0 14px color-mix(in srgb, var(--pc) 70%, transparent)); }
.planet.locked .pl-img, .planet.locked .pl-orbit { filter: grayscale(.92) brightness(.5); }
.p-fog { position: absolute; inset: -6% -22%; pointer-events: none; filter: blur(7px); animation: fog 6s ease-in-out infinite alternate;
  background: radial-gradient(ellipse at 28% 62%, rgba(150, 142, 200, .9), transparent 52%), radial-gradient(ellipse at 74% 38%, rgba(118, 110, 170, .85), transparent 52%), radial-gradient(ellipse at 55% 80%, rgba(150, 142, 200, .7), transparent 45%); }
.p-lock { position: absolute; left: 50%; top: 50%; width: 38%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: calc(var(--base) * var(--s) * .18); color: #fff;
  background: rgba(14, 18, 42, .78); border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.p-tag { position: relative; margin-top: 9%; display: flex; flex-direction: column; align-items: center; padding: 4px 12px 5px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(6px); line-height: 1.2; }
.p-tag b { font-size: clamp(11px, 1.9vmin, 16px); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.p-tag em { font-style: normal; font-size: clamp(11px, 1.7vmin, 14px); font-weight: 800; color: var(--sun); display: inline-flex; align-items: center; gap: 3px; }
.p-tag em small { opacity: .6; font-size: .85em; }
.p-tag em.dim { color: #a9aed0; font-weight: 700; }
.planet.current .p-tag { border-color: var(--pc); box-shadow: 0 0 16px color-mix(in srgb, var(--pc) 65%, transparent); }
.planet.locked .p-tag { opacity: .75; }
.planet.shake { animation: shakeP .35s; }

.map-rocket { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .55)) drop-shadow(0 0 10px rgba(255, 200, 80, .35)); }
.map-rocket.flying .flame { animation: none; transform: scaleY(1.9); }
.btn.school { position: absolute; left: 0; top: 0; z-index: 200; background: var(--glass); color: #fff; border: 1px solid var(--glass-line); box-shadow: none; backdrop-filter: blur(8px); }
.btn.school.glow { animation: pulse 1.3s ease-in-out infinite; background: var(--sun); color: var(--ink); }

/* ---------- mission panel ---------- */
.mission-panel {
  width: 100%; flex: none; color: #fff; padding: 12px 18px 14px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(22, 32, 68, .9), rgba(8, 13, 34, .94));
  border: 1px solid var(--glass-line); border-top: 3px solid var(--accent);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .45), 0 0 34px color-mix(in srgb, var(--accent) 45%, transparent);
  backdrop-filter: blur(12px); animation: slideUp .25s ease-out;
}
.mission-panel .land-head { margin-bottom: 10px; }
.mission-panel .land-title h3 { letter-spacing: 1px; }
.mission-panel .land-title p { opacity: .8; }
.mp-planet { width: 58px; flex: none; margin: 4px 6px 0 2px; }
.mp-planet .pl-beacon { display: none; }
.mp-close { width: 44px; height: 44px; box-shadow: none; background: rgba(255, 255, 255, .12); color: #fff; font-size: 18px; border: 1px solid var(--glass-line); }
.mission-panel .trail::before { top: 36px; border-top: 3px dashed rgba(255, 255, 255, .22); }
.mission-panel .node-disc { width: 72px; height: 72px; border-radius: 20px; border: 2px solid color-mix(in srgb, var(--accent) 80%, #fff); background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent), 0 5px 0 rgba(0, 0, 0, .35); }
.mission-panel .node.done .node-disc { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); border-color: #fff; }
.mission-panel .node.locked .node-disc { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .04); color: rgba(255, 255, 255, .4); box-shadow: none; }
.mission-panel .node.next .node-disc { animation: pulse 1.3s ease-in-out infinite; border-color: var(--sun); }
.mission-panel .node-name { color: #fff; }
.mission-panel .star { color: rgba(255, 255, 255, .2); }
.mission-panel .star.on { color: var(--sun); }

/* ---------- story scenes ---------- */
.cutscene { justify-content: center; gap: 20px; position: relative; }
.cutscene .skip { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 18px; background: var(--glass); color: #fff; border: 1px solid var(--glass-line); box-shadow: none; }
.cs-panel {
  width: 100%; max-width: 920px; display: flex; align-items: center; gap: 26px; padding: 30px;
  background: linear-gradient(180deg, rgba(22, 32, 68, .72), rgba(8, 13, 34, .8)); border: 1px solid var(--glass-line); border-radius: 34px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 40px color-mix(in srgb, var(--accent) 35%, transparent); backdrop-filter: blur(10px);
  animation: popIn .3s cubic-bezier(.2, 1.4, .4, 1);
}
.cs-art { width: clamp(130px, 27vw, 240px); flex: none; animation: float 3.5s ease-in-out infinite; }
.cs-art.rocket { width: clamp(110px, 19vw, 180px); filter: drop-shadow(0 0 22px rgba(120, 200, 255, .5)); }
.cs-art svg.rocket-svg, .cs-art svg.hush-svg, .cs-art svg.buddy-svg { width: 100%; height: auto; display: block; overflow: visible; }
.cs-planet { width: clamp(130px, 24vw, 220px); margin: 6% 3% 3%; }
.cs-planet.saved { filter: drop-shadow(0 0 26px rgba(255, 240, 160, .8)); }
.cs-bubble { flex: 1; background: #fff; border-radius: 26px; padding: 16px 24px 20px; box-shadow: var(--soft); }
.cs-bubble b { color: var(--plum); font-size: 17px; text-transform: uppercase; letter-spacing: 2px; }
.cs-bubble p { margin: 6px 0 0; font-size: clamp(20px, 2.9vw, 29px); font-weight: 700; line-height: 1.35; }

@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes flick { to { transform: scaleY(1.22) scaleX(.94); } }
@keyframes dash { to { stroke-dashoffset: -23; } }
@keyframes beacon { from { opacity: .75; } to { opacity: 1; scale: 1.15; } }
@keyframes blinkLight { 50% { opacity: .25; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes fog { to { transform: translateX(6%) scale(1.06); opacity: .8; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
@keyframes shakeP { 25% { margin-left: -8px; } 75% { margin-left: 8px; } }
@keyframes skydrift { to { transform: scale(1.08) translate(-1.5%, 1%); } }
@keyframes shoot {
  0%, 92% { opacity: 0; translate: 0 0; }
  93% { opacity: 1; }
  100% { opacity: 0; translate: -46vw 24vw; }
}

@media (max-width: 700px) {
  .cs-panel { flex-direction: column; text-align: center; padding: 18px; }
  .hangar .inst { width: 118px; }
  .mission-panel .node-disc { width: 58px; height: 58px; border-radius: 16px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .p-body, .cs-art, .home-rocket, .r-core.open, .skyimg, .shoot, .orbit-plane i, .p-pad i { animation: none; }
}
