/* ORBITAL — interface. Fonts are self-hosted (SIL OFL 1.1, see vendor/fonts). */
@font-face { font-family: "Space Grotesk"; src: url("vendor/fonts/SpaceGrotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("vendor/fonts/JetBrainsMono-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
    --bg: #04050c;
    --ink: #eef2ff;
    --dim: #9aa6cf;
    --faint: #5f6a94;
    --cyan: #7be9ff;
    --violet: #a594ff;
    --gold: #ffd78a;
    --rose: #ff8fb4;
    --danger: #ff6b7d;
    --glass: rgba(12, 16, 36, 0.52);
    --glass-strong: rgba(10, 13, 30, 0.86);
    --line: rgba(160, 185, 255, 0.16);
    --line-strong: rgba(160, 200, 255, 0.42);
    --display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
    font-family: var(--display); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#fade { position: fixed; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.45s ease; z-index: 20; }
#fade.on { opacity: 1; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2, h3, p { margin: 0; }
a { color: var(--cyan); }
kbd { font-family: var(--mono); font-size: 0.72em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.06); color: var(--ink); white-space: nowrap; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 10px; }

.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
    backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.34em; color: var(--cyan); text-transform: uppercase; }

/* ---------------- buttons ---------------- */
.btn { font: inherit; font-weight: 500; font-size: 15px; letter-spacing: 0.04em; color: var(--ink); cursor: pointer;
    min-height: 46px; padding: 11px 22px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
    transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, box-shadow 0.18s; }
.btn:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.primary { border-color: transparent; color: #071019; font-weight: 600;
    background: linear-gradient(120deg, #9ff3ff, #b9a8ff 60%, #ffc4dc); box-shadow: 0 8px 34px rgba(123, 233, 255, 0.28); }
.btn.primary:hover { box-shadow: 0 10px 44px rgba(165, 148, 255, 0.45); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.btn.danger { border-color: rgba(255, 107, 125, 0.5); color: #ffb3bd; }
.iconBtn { width: 46px; height: 46px; display: inline-grid; place-items: center; border-radius: 14px; cursor: pointer; color: var(--dim);
    border: 1px solid transparent; background: transparent; transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s var(--ease); }
.iconBtn.glass { border: 1px solid var(--line); color: var(--ink); }
.iconBtn:hover { color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px); }
.iconBtn[disabled] { opacity: 0.35; pointer-events: none; }

/* ---------------- screens ---------------- */
.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; animation: screenIn 0.6s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }

/* title */
#title { justify-content: center; padding: calc(24px + var(--safe-t)) 7vw calc(24px + var(--safe-b));
    background: linear-gradient(90deg, rgba(4, 5, 12, 0.72) 0%, rgba(4, 5, 12, 0.28) 46%, transparent 72%); }
.titleBlock { max-width: 100%; }
.wordmark { width: max-content; max-width: 100%; font-weight: 300; font-size: clamp(44px, 10vw, 132px); line-height: 0.95; letter-spacing: 0.2em; margin: 14px 0 16px -0.04em;
    background: linear-gradient(180deg, #ffffff 0%, #cfe6ff 45%, #a594ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 0 28px rgba(123, 233, 255, 0.28)); }
.wordmark span { opacity: 0.55; }
.lede { font-size: clamp(16px, 2.1vw, 21px); color: var(--dim); max-width: 26em; }
.menu { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.menu .btn.primary { min-width: 150px; }
.foot { position: absolute; left: 7vw; right: 7vw; bottom: calc(18px + var(--safe-b)); display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: var(--faint); }
.foot a { color: var(--dim); }

/* star chart */
#chart { padding: calc(20px + var(--safe-t)) 5vw calc(20px + var(--safe-b)); background: radial-gradient(ellipse at 50% 40%, rgba(4, 5, 12, 0.68), rgba(4, 5, 12, 0.93)); }
.chartHead { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chartHead h2 { font-weight: 500; font-size: clamp(20px, 3vw, 28px); }
.chartHead > div:nth-child(2) { text-align: center; }
.chartTotal { font-family: var(--mono); font-size: 15px; min-width: 96px; text-align: right; }
.star { color: var(--faint); } .star.on { color: var(--gold); text-shadow: 0 0 12px rgba(255, 215, 138, 0.7); }
#constellation { position: relative; flex: 1; min-height: 0; margin: 12px 0; }
#chartLines { position: absolute; inset: 0; width: 100%; height: 100%; stroke-width: 1.2; overflow: visible; }
#chartLines line { stroke: rgba(160, 185, 255, 0.22); stroke-dasharray: 3 7; }
#chartLines line.done { stroke: rgba(123, 233, 255, 0.75); stroke-dasharray: none; filter: drop-shadow(0 0 5px rgba(123, 233, 255, 0.7)); }
.node { position: absolute; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; cursor: pointer; color: var(--ink);
    display: grid; place-items: center; font-family: var(--mono); font-size: 14px; border: 1px solid var(--line-strong);
    background: radial-gradient(circle at 35% 30%, rgba(190, 215, 255, 0.28), rgba(12, 16, 36, 0.8));
    transition: transform 0.22s var(--ease), box-shadow 0.22s, border-color 0.22s; animation: nodeIn 0.5s var(--ease) both; }
@keyframes nodeIn { from { opacity: 0; transform: scale(0.4); } }
.node:hover, .node.sel { transform: scale(1.14); border-color: var(--cyan); box-shadow: 0 0 26px rgba(123, 233, 255, 0.55); }
.node.done { background: radial-gradient(circle at 35% 30%, #fff7dd, #ffd78a 40%, rgba(120, 80, 20, 0.7)); color: #2a1a00; border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 215, 138, 0.5); }
.node.next::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 1px solid var(--cyan); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { opacity: 0.9; transform: scale(0.85); } to { opacity: 0; transform: scale(1.45); } }
.node.locked { opacity: 0.38; cursor: not-allowed; border-style: dashed; }
.node .pips { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: 2px; white-space: nowrap; color: var(--gold); text-shadow: 0 0 8px rgba(255, 215, 138, 0.7); }
.node .pips .star { color: rgba(255, 255, 255, 0.22); text-shadow: none; }
#chartInfo { align-self: center; width: min(520px, 100%); padding: 18px 20px; }
#chartInfo h3 { font-weight: 500; font-size: 22px; margin: 4px 0 6px; }
#chartInfo .row { margin-top: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stars { font-size: 20px; letter-spacing: 3px; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; animation: screenIn 0.5s var(--ease) both; }
#hud > * { pointer-events: auto; }
.hudTop { position: absolute; top: calc(14px + var(--safe-t)); left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none !important; }
.hudTop > * { pointer-events: auto; }
.pill { border-radius: 999px; padding: 9px 16px; display: flex; align-items: center; gap: 10px; min-height: 46px; }
.levelTag .mono { color: var(--cyan); font-size: 13px; }
.levelTag span:last-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.dust { gap: 9px; padding: 9px 18px; }
.dust i { width: 12px; height: 12px; transform: rotate(45deg); border: 1px solid rgba(255, 215, 138, 0.6); border-radius: 3px; transition: all 0.3s var(--ease); }
.dust i.on { background: var(--gold); box-shadow: 0 0 14px var(--gold); transform: rotate(45deg) scale(1.25); }
.hudBtns { display: flex; gap: 8px; }
.status { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); width: min(560px, calc(100% - 32px)); text-align: center;
    font-size: 15px; color: var(--dim); text-shadow: 0 2px 12px #000; pointer-events: none !important; transition: color 0.2s; }
.status.warn { color: var(--rose); }
.dock { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
    padding: 10px 10px 10px 14px; border-radius: 26px; max-width: calc(100% - 24px); }
.inventory { display: flex; gap: 8px; }
.chip { position: relative; width: 64px; min-height: 72px; padding: 8px 4px 6px; border-radius: 16px; cursor: grab; color: var(--ink); font: inherit;
    border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); display: flex; flex-direction: column; align-items: center; gap: 5px; touch-action: none;
    transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, opacity 0.18s; }
.chip:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); transform: translateY(-3px); }
.chip:active { cursor: grabbing; }
.chip .orb { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff, var(--c) 45%, rgba(0, 0, 0, 0.55) 115%); box-shadow: 0 0 16px var(--c); }
.chip[data-type="moon"] .orb { width: 20px; height: 20px; margin: 5px 0; }
.chip[data-type="giant"] .orb { width: 34px; height: 34px; margin: -2px 0; box-shadow: 0 0 16px var(--c), 0 0 0 4px rgba(255, 190, 120, 0.14); }
.chip[data-type="pulsar"] .orb { width: 16px; height: 16px; margin: 7px 0; background: #fff; box-shadow: 0 0 18px 4px var(--c); }
.chip[data-type="blackhole"] .orb { background: #000; box-shadow: 0 0 0 3px #ff9a4a, 0 0 18px #ff7a2a; width: 22px; height: 22px; margin: 4px 0; }
.chip small { font-size: 10.5px; letter-spacing: 0.06em; color: var(--dim); }
.chip .count { position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center;
    font-family: var(--mono); font-size: 11px; background: var(--ink); color: #0a0d1e; }
.chip.empty { opacity: 0.3; pointer-events: none; }
.launch { min-width: 132px; min-height: 72px; border: 0; border-radius: 20px; cursor: pointer; font: inherit; font-weight: 600; font-size: 16px; letter-spacing: 0.05em; color: #071019;
    display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(120deg, #9ff3ff, #b9a8ff 60%, #ffc4dc);
    box-shadow: 0 8px 34px rgba(123, 233, 255, 0.3); transition: transform 0.18s var(--ease), box-shadow 0.18s, filter 0.18s; }
.launch:hover { transform: translateY(-2px); box-shadow: 0 12px 44px rgba(165, 148, 255, 0.5); }
.launch:active { transform: scale(0.97); }
.launch.flying { background: rgba(255, 255, 255, 0.08); color: var(--ink); box-shadow: none; border: 1px solid var(--line-strong); }
.launch svg { stroke-width: 2.2; }

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; overflow-y: auto;
    background: rgba(4, 5, 12, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: overlayIn 0.3s ease both; }
@keyframes overlayIn { from { opacity: 0; } }
.card { width: min(440px, 100%); padding: 30px 26px 24px; text-align: center; background: var(--glass-strong); animation: cardIn 0.5s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.card.left { text-align: left; width: min(520px, 100%); }
.card h2 { font-weight: 500; font-size: 28px; margin: 6px 0 4px; }
.bigStars { font-size: 54px; letter-spacing: 10px; margin: 10px 0 6px 10px; color: rgba(255, 255, 255, 0.13); }
.bigStars span { display: inline-block; }
.bigStars span.on { color: var(--gold); text-shadow: 0 0 26px rgba(255, 215, 138, 0.85); animation: starPop 0.6s cubic-bezier(0.2, 1.9, 0.4, 1) both; }
.bigStars span.on:nth-child(2) { animation-delay: 0.18s; } .bigStars span.on:nth-child(3) { animation-delay: 0.36s; }
@keyframes starPop { from { transform: scale(0) rotate(-120deg); opacity: 0; } }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 20px; }
.facts div { padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.facts small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; color: var(--faint); margin-bottom: 2px; }
.facts b { font-size: 17px; font-weight: 500; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.actions.col { flex-direction: column; margin-top: 16px; }
.head { margin-bottom: 8px; }
.setRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); min-height: 58px; cursor: pointer; }
.setRow small { display: block; color: var(--faint); font-size: 13px; }
input[type="range"] { width: 160px; accent-color: var(--violet); height: 28px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); position: relative; cursor: pointer; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.switch:checked { background: linear-gradient(120deg, #7be9ff, #a594ff); }
.switch:checked::after { transform: translateX(22px); }
.help { border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; color: var(--dim); }
.help p + p { margin-top: 8px; line-height: 1.9; }

.toast { position: fixed; left: 50%; top: calc(76px + var(--safe-t)); transform: translate(-50%, -12px); z-index: 9; padding: 11px 18px; border-radius: 999px; font-size: 15px;
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--ease); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 107, 125, 0.55); color: #ffd0d6; }
.toast.good { border-color: rgba(123, 233, 255, 0.55); }

/* ---------------- small screens ---------------- */
@media (max-width: 700px) {
    #title { background: linear-gradient(180deg, rgba(4, 5, 12, 0.5), rgba(4, 5, 12, 0.15) 45%, rgba(4, 5, 12, 0.7)); align-items: center; text-align: center; }
    .wordmark { letter-spacing: 0.12em; margin-left: 0.12em; }
    .menu { justify-content: center; }
    .lede { margin: 0 auto; }
    .chip { width: 56px; min-height: 66px; }
    .launch { min-width: 96px; min-height: 66px; }
    .launch span { display: none; }
    .dock { gap: 8px; padding: 8px; }
    .node { width: 46px; height: 46px; margin: -23px 0 0 -23px; font-size: 12px; }
    .chartHead h2 { display: none; }
    .levelTag span:last-child { max-width: 26vw; }
}
@media (max-height: 520px) {
    .wordmark { font-size: clamp(40px, 16vh, 96px); margin: 6px 0 8px; }
    .menu { margin-top: 16px; }
    .status { bottom: calc(104px + var(--safe-b)); font-size: 13px; }
    #chartInfo { display: flex; align-items: center; gap: 16px; padding: 10px 16px; width: min(760px, 100%); }
    #chartInfo .row { margin: 0 0 0 auto; }
    #chartInfo #infoText { display: none; }
    .card { padding: 18px 20px 16px; }
    .bigStars { font-size: 38px; margin: 2px 0 2px 10px; }
    .facts { margin: 10px 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
