/* Orbit — the operator's command center.
   Thesis: "a quiet observatory": deep-space navy, luminance-stepped glass, ONE accent per planet.
   Motion: one curve (--ease) for every open/close, containers land first and content follows (stagger 60 ms).
   No animation library: everything here is CSS, driven by a few classes and custom properties from JS. */

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #05080f;
  --l1: #0c1220;          /* tone layers: each one step lighter, never borders */
  --l2: #121a2b;
  --l3: #192338;
  --l4: #212d46;
  --ink: #eaf0f8;
  --mut: #a3b0c4;         /* ≥ 7:1 on --l1 */
  --dim: #6f7c91;
  --line: rgba(160, 180, 210, 0.09);
  --accent: #2bd576;      /* set per planet */
  --good: #2bd576;
  --warn: #ffb13d;
  --bad: #ff5c72;
  --ease: cubic-bezier(.2, .9, .22, 1);
  --r-l: 24px;
  --r-m: 16px;
  --r-s: 10px;
  /* type scale ×1.25 */
  --t1: 12.8px;
  --t2: 16px;
  --t3: 20px;
  --t4: 25px;
  --t5: 31.25px;
  --t6: 39px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% 45%, #0d1830 0%, #070b16 55%, var(--bg) 100%) fixed;
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: var(--t2);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- stars: three depth layers, slow drift ---------- */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.stars i { position: absolute; top: 0; left: 0; width: 1px; height: 1px; border-radius: 50%; background: transparent; }
.stars .s1 { animation: drift 220s linear infinite; opacity: .55; }
.stars .s2 { animation: drift 140s linear infinite; opacity: .75; width: 1.5px; height: 1.5px; }
.stars .s3 { animation: drift 90s linear infinite, twinkle 6s ease-in-out infinite; width: 2px; height: 2px; }
@keyframes drift { to { transform: translate3d(-120px, -60px, 0); } }
@keyframes twinkle { 50% { opacity: .35; } }

/* ---------- 1. boot ---------- */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 18px; }
.logo { overflow: visible; }
.logo .draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 900ms var(--ease) forwards; }
.logo .d2 { animation-delay: 220ms; }
.logo-fill { opacity: 0; transform-origin: 60px 60px; transform: scale(.6); animation: fill 520ms var(--ease) 760ms forwards; }
.logo-moon-track { opacity: 0; animation: moon-in 300ms ease 900ms forwards; }
.logo-moon { transform-box: view-box; transform-origin: 60px 60px; }
.logo-moon-track .logo-moon { animation: none; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fill { to { opacity: 1; transform: scale(1); } }
@keyframes moon-in { to { opacity: 1; } }
.boot-word {
  font-weight: 800; font-size: var(--t3); letter-spacing: .6em; text-indent: .6em; color: var(--ink); opacity: 0;
  animation: word 600ms var(--ease) 1000ms forwards;
}
@keyframes word { to { opacity: 1; letter-spacing: .32em; text-indent: .32em; } }
.boot-particles { position: absolute; inset: 0; pointer-events: none; }
.boot-particles i {
  position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; border-radius: 50%;
  background: #cfe3ff; box-shadow: 0 0 8px #9cc4ff;
  transform: translate(var(--x), var(--y)); opacity: 0;
  animation: converge 900ms var(--ease) var(--d) forwards;
}
@keyframes converge { 15% { opacity: 1; } 100% { transform: translate(0, 0); opacity: 0; } }
.boot.leave { animation: boot-out 420ms ease 0ms forwards; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }
.boot.quick .draw, .boot.quick .logo-fill, .boot.quick .logo-moon-track, .boot.quick .boot-word { animation-duration: 1ms; animation-delay: 0ms; }
.flying-logo { position: fixed; z-index: 60; transition: transform 560ms var(--ease), opacity 300ms ease 420ms; transform-origin: 0 0; pointer-events: none; }

/* ---------- app shell ---------- */
.app { position: fixed; inset: 0; z-index: 1; display: flex; flex-direction: column; opacity: 0; transition: opacity 500ms ease; }
.app.on { opacity: 1; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px; position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: var(--t3); letter-spacing: .02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e9fff3, #5cf0a0 35%, #0b5c3a 100%);
  box-shadow: 0 0 0 2px rgba(159, 178, 204, .25);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 9px -7px; border: 1.6px solid rgba(159, 178, 204, .7); border-radius: 50%; transform: rotate(-22deg);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.who { color: var(--mut); font-size: var(--t1); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--l2); color: var(--mut); transition: transform 160ms var(--ease), color 160ms; }
.icon-btn:active { transform: scale(.96); }
.icon-btn:hover { color: var(--ink); }

/* ---------- 2. the cylinder ---------- */
.space { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: none; user-select: none; transition: transform 560ms var(--ease), filter 560ms var(--ease), opacity 420ms ease; }
.space.away { transform: scale(.94); filter: blur(6px) brightness(.6); opacity: 0; pointer-events: none; }
.drum {
  position: absolute; width: min(300px, 70vw); height: min(78vh, 680px);
  border-radius: 150px / 34px;
  background:
    linear-gradient(90deg, rgba(120, 150, 200, .10) 0%, rgba(120, 150, 200, .02) 18%, rgba(255, 255, 255, .0) 50%, rgba(120, 150, 200, .02) 82%, rgba(120, 150, 200, .10) 100%),
    linear-gradient(180deg, rgba(10, 16, 30, 0) 0%, rgba(20, 30, 52, .35) 50%, rgba(10, 16, 30, 0) 100%);
  box-shadow: inset 0 0 0 1px rgba(160, 185, 225, .07), inset 0 0 60px rgba(90, 130, 200, .06);
}
.drum .rim { position: absolute; left: 0; right: 0; height: 68px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(170, 195, 235, .12); }
.drum .rim.top { top: 0; background: radial-gradient(ellipse at 50% 50%, rgba(120, 150, 200, .07), transparent 70%); }
.drum .rim.bottom { bottom: 0; }
.reel { position: relative; width: 100%; height: 100%; perspective: 1100px; outline: none; }
.slot {
  position: absolute; left: 50%; top: 50%; width: 200px; height: 200px; margin: -100px 0 0 -100px;
  display: grid; place-items: center; transform-style: preserve-3d; will-change: transform, opacity;
}
.slot.center { cursor: pointer; }

/* planets */
.planet { --size: 150px; position: relative; width: var(--size); height: var(--size); border-radius: 50%; transition: transform 200ms var(--ease); }
.planet svg { position: absolute; left: -40%; top: -40%; width: 180%; height: 180%; overflow: visible; }
.planet .glow { opacity: 0; transition: opacity 400ms ease; }
.slot.center .planet .glow { opacity: 1; }
.slot:not(.center) .planet { pointer-events: none; }
.slot.center .planet:hover { transform: scale(1.03); }
.slot.center .planet:active { transform: scale(.96); }
.planet.shake { animation: shake 420ms var(--ease); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

.planet-label {
  position: absolute; left: calc(50% + min(150px, 35vw) + 36px); top: 50%; transform: translateY(-50%); max-width: 260px;
  text-align: left; pointer-events: none; transition: opacity 240ms ease, transform 360ms var(--ease);
}
.planet-label::before { content: ''; position: absolute; left: -30px; top: 50%; width: 22px; height: 1px; background: color-mix(in srgb, var(--accent) 60%, transparent); }
.planet-label b { display: block; font-size: var(--t4); font-weight: 800; letter-spacing: -.01em; }
.planet-label span { color: var(--mut); font-size: var(--t1); letter-spacing: .04em; }
.planet-label .pill { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.planet-label.fade { opacity: 0; transform: translateY(calc(-50% + 6px)); }
.hint { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: var(--dim); font-size: var(--t1); margin: 0; }

/* ---------- gate (sign-in / unlock) + settings ---------- */
.gate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 12, .55); backdrop-filter: blur(10px); animation: fade 260ms ease; }
@keyframes fade { from { opacity: 0; } }
.gate-card {
  width: min(400px, 100%); padding: 26px 22px 18px; border-radius: var(--r-l); text-align: center;
  background: linear-gradient(180deg, rgba(33, 45, 70, .78), rgba(18, 26, 43, .9));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 24px 60px rgba(0, 0, 0, .45);
  animation: rise 420ms var(--ease);
}
@keyframes rise { from { transform: translateY(18px) scale(.98); opacity: 0; } }
.gate-card h2 { margin: 10px 0 6px; font-size: var(--t4); }
.gate-card p { margin: 0 0 18px; color: var(--mut); line-height: 1.5; }
.gate-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.btn { display: block; width: 100%; padding: 14px 18px; border-radius: 14px; font-weight: 800; transition: transform 160ms var(--ease), filter 160ms; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: #04130b; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.ghost { color: var(--mut); margin-top: 6px; }
.btn.danger { color: var(--bad); }
.settings-card { text-align: left; }
.set-row { display: flex; gap: 12px; padding: 12px 0; }
.set-row b { display: block; }
.set-row span { color: var(--mut); font-size: 14px; }
.set-steps { margin: 0 0 8px; padding-left: 20px; color: var(--mut); font-size: 14px; line-height: 1.55; }

/* ---------- 3. dashboard ---------- */
.dash { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-columns: 264px 1fr; gap: 0; }
.dash::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(160, 185, 225, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(160, 185, 225, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(900px 500px at 15% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
  opacity: 0; transition: opacity 420ms ease;
}
.dash.on::before { opacity: 1; }
.rail {
  margin: 16px 0 16px 16px; padding: 14px; border-radius: 20px; display: flex; flex-direction: column; gap: 14px;
  background: rgba(18, 26, 43, .62); backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .3);
  opacity: 0; transform: translateX(-12px); transition: opacity 360ms ease 260ms, transform 520ms var(--ease) 260ms;
}
.dash.on .rail { opacity: 1; transform: none; }
.back { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--l3); color: var(--mut); }
.back:active { transform: scale(.96); }
.rail-hero { display: flex; align-items: center; gap: 12px; }
.rail-hero b { display: block; font-size: var(--t3); }
.rail-hero span { color: var(--mut); font-size: var(--t1); }
.hero-slot { width: 56px; height: 56px; flex: none; }
.hero-slot .planet { --size: 56px; }
.hero-slot .planet .ring, .hero-slot .planet .glow { display: none; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--mut); font-weight: 700; text-align: left; transition: background 160ms, color 160ms; }
.nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, .03); }
.nav-item.on { color: var(--ink); background: var(--l3); }
.nav-item.on svg { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

.dash-main { overflow-y: auto; padding: 22px 32px 48px; -webkit-overflow-scrolling: touch; }
.dash-main > * { opacity: 0; transform: translateY(14px); }
.dash-main.in > * { animation: cascade 520ms var(--ease) forwards; }
.dash-main.in > *:nth-child(1) { animation-delay: 380ms; }
.dash-main.in > *:nth-child(2) { animation-delay: 440ms; }
.dash-main.in > *:nth-child(3) { animation-delay: 500ms; }
.dash-main.in > *:nth-child(4) { animation-delay: 560ms; }
.dash-main.in > *:nth-child(n+5) { animation-delay: 620ms; }
.dash-main.swap > * { animation-delay: 0ms !important; }
.dash-main.swap > *:nth-child(2) { animation-delay: 60ms !important; }
.dash-main.swap > *:nth-child(3) { animation-delay: 120ms !important; }
.dash-main.swap > *:nth-child(n+4) { animation-delay: 180ms !important; }
@keyframes cascade { to { opacity: 1; transform: none; } }

.greet { margin: 6px 0 22px; }
.greet small { color: var(--accent); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 11.5px; }
.greet h1 { margin: 4px 0 0; font-size: var(--t5); letter-spacing: -.02em; }
.greet p { margin: 6px 0 0; color: var(--mut); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 1180px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { padding: 16px; border-radius: var(--r-m); background: var(--l1); }
.tile.hero { background: color-mix(in srgb, var(--accent) 14%, var(--l1)); }
.tile span { display: block; color: var(--mut); font-size: var(--t1); font-weight: 700; }
.tile b { display: block; margin-top: 6px; font-size: var(--t5); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile em { font-style: normal; color: var(--dim); font-size: 12px; }
.panel { border-radius: var(--r-l); background: var(--l1); padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: var(--t3); }
.panel-head span { color: var(--mut); font-size: var(--t1); }

/* tables: row height 56, zebra by tone */
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; color: var(--dim); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 0 12px 10px; }
.tbl td { height: 56px; padding: 0 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--l3); color: var(--mut); white-space: nowrap; }
.pill.pro { background: rgba(255, 177, 61, .16); color: var(--warn); }
.pill.beta { background: rgba(77, 163, 255, .16); color: #6fb6ff; }
.pill.insider { background: rgba(167, 139, 250, .18); color: #b9a3ff; }
.pill.referral, .pill.promo, .pill.ok { background: rgba(43, 213, 118, .14); color: var(--good); }
.pill.off { background: rgba(255, 92, 114, .12); color: var(--bad); }
.row-btn { padding: 8px 12px; border-radius: 10px; background: var(--l3); color: var(--ink); font-weight: 700; font-size: 13px; }
.row-btn:active { transform: scale(.96); }
.row-btn.accent { background: color-mix(in srgb, var(--accent) 18%, var(--l2)); color: var(--accent); }
.expand td { height: auto; padding: 14px 12px; background: var(--l2) !important; }
.expand .inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; animation: cascade 360ms var(--ease) forwards; opacity: 0; transform: translateY(6px); }
.bar { height: 6px; border-radius: 3px; background: var(--l3); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* forms */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.field label { display: block; color: var(--mut); font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px; border-radius: 12px; border: 0; background: var(--l2); color: var(--ink); font: inherit; font-size: 15px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.field input:focus, .field select:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--l2); grid-column: 1 / -1; }
.seg button { flex: 1; padding: 10px 8px; border-radius: 10px; color: var(--mut); font-weight: 800; font-size: 14px; transition: background 200ms var(--ease), color 200ms; }
.seg button.on { background: var(--l4); color: var(--ink); }
.form .btn { grid-column: 1 / -1; }
.made { margin-top: 14px; display: grid; gap: 8px; }
.made-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--l2); }
.made-row .mono { flex: 1; font-size: 14px; }

.feed { display: grid; gap: 10px; }
.feed-item { padding: 14px 16px; border-radius: var(--r-m); background: var(--l2); }
.feed-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--dim); font-size: 12.5px; margin-bottom: 6px; }
.feed-item p { margin: 0; line-height: 1.55; white-space: pre-wrap; }

.empty { padding: 30px 18px; text-align: center; color: var(--mut); }
.empty b { display: block; color: var(--ink); font-size: var(--t3); margin-bottom: 6px; }
.empty .row-btn { margin-top: 14px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  padding: 12px 18px; border-radius: 14px; background: var(--l4); color: var(--ink); font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  animation: rise 360ms var(--ease);
}
.demo-ribbon { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 80; padding: 4px 12px; border-radius: 999px; background: #ffb13d; color: #2a1700; font-size: 11px; font-weight: 900; letter-spacing: .08em; }

/* the planet that flies between the reel and the dashboard (shared element) */
.flyer { position: fixed; z-index: 30; left: 0; top: 0; transform-origin: 0 0; transition: transform 560ms var(--ease); pointer-events: none; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .dash { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  /* no blur/transform on the phone rail: either one would trap the fixed tab bar inside it */
  .rail { margin: max(10px, env(safe-area-inset-top)) 12px 0; padding: 12px; flex-direction: row; align-items: center; flex-wrap: wrap;
    backdrop-filter: none; background: var(--l1); transform: none !important; }
  .rail-hero { flex: 1; }
  .hero-slot, .hero-slot .planet { --size: 44px; width: 44px; height: 44px; }
  /* thumb zone: the module tabs move to a floating bar at the bottom */
  .rail-nav {
    position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 25; margin: 0;
    flex-direction: row; justify-content: space-between; padding: 6px; border-radius: 20px;
    background: rgba(18, 26, 43, .86); backdrop-filter: blur(24px); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 10.5px; justify-content: center; }
  .nav-item .count { display: none; }
  .dash-main { padding: 18px 14px 110px; }
  .greet h1 { font-size: var(--t4); }
  .tbl .hide-sm { display: none; }
  .tbl td, .tbl th { padding-left: 8px; padding-right: 8px; }
  .planet-label { left: 0; right: 0; top: auto; bottom: 46px; transform: none; max-width: none; text-align: center; }
  .planet-label::before { display: none; }
  .planet { --size: 128px; --k: .853; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

.sub { color: var(--dim); font-size: 12px; margin-top: 3px; }
.used { display: flex; align-items: center; gap: 8px; }
/* no wrapping inside buttons, pills, dates or numbers (only the learner/code column may wrap) */
.row-btn, .pill, .tbl th { white-space: nowrap; }
.tbl td { white-space: nowrap; }
.tbl td:first-child { white-space: normal; }
.row-btn svg { vertical-align: -3px; }
.tbl .mono, .made-row .mono { white-space: nowrap; }
.panel { overflow-x: auto; }
.dash-main { overflow-x: hidden; }
