/* Direction: premium space-science instrument — midnight canvas, violet and cyan signal colours */
/* Completed by the platform from the short form: both modes, every
   palette token, each text-on-ground pair at its floor. To restyle, write the
   short form again (the decisions in one :root) and it is completed again. */

:root {
  color-scheme: dark;
  --canvas: #050711;
  --surface: #0a1020;
  --surface-2: #101a33;
  --border: #243256;
  --border-strong: #505158;
  --ink: #f4f6ff;
  --muted: #9ca8c7;
  --accent: #7c5cff;
  --accent-hover: #9074ff;
  --accent-ink: #050711;
  --accent-text: #a99bff;
  --accent-strong: #9075ff;
  --accent-soft: #1f1a45;
  --accent-border: #3b2d7c;
  --success: #3ddc97;
  --success-ink: #ffffff;
  --success-soft: #11362e;
  --success-strong: #3ddc97;
  --warning: #f5b84a;
  --warning-ink: #ffffff;
  --warning-soft: #3a2e1e;
  --warning-strong: #f5b84a;
  --danger: #ff6b81;
  --danger-ink: #ffffff;
  --danger-soft: #3c1d2a;
  --danger-strong: #ff6b81;
  --chart-1: #7c5cff;
  --chart-2: #f74db8;
  --chart-3: #cc590a;
  --chart-4: #a19910;
  --chart-5: #1a9670;
  --chart-6: #0da7d4;

  --x-cyan: #39d5ff;
  --x-on-photo: #ffffff;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --display-weight: 600;
  --display-tracking: 0.01em;
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --font-sans: "Inter", system-ui, sans-serif;
  --eyebrow-tracking: 0.08em;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f3f3;
  --border: #dcdcde;
  --border-strong: #b4b5b8;
  --ink: #050711;
  --muted: #696a70;
  --accent: #7c5cff;
  --accent-hover: #694ed9;
  --accent-ink: #050711;
  --accent-text: #694ed8;
  --accent-strong: #694ed8;
  --accent-soft: #ede8ff;
  --accent-border: #c4b6ff;
  --success: #3ddc97;
  --success-ink: #050711;
  --success-soft: #e8fbf3;
  --success-strong: #227955;
  --warning: #f5b84a;
  --warning-ink: #050711;
  --warning-soft: #fef6e9;
  --warning-strong: #886629;
  --danger: #ff6b81;
  --danger-ink: #050711;
  --danger-soft: #ffedf0;
  --danger-strong: #a84655;
  --chart-1: #7c5cff;
  --chart-2: #f449b5;
  --chart-3: #a7490d;
  --chart-4: #9a9321;
  --chart-5: #137859;
  --chart-6: #23a0c9;
}

/* COSMOS EXPLORER — interface layer over the 3D stage. Tokens only. */

.cx-modal {
  --glass: color-mix(in srgb, var(--surface) 66%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 94%, transparent);
  --hair: color-mix(in srgb, var(--border) 75%, transparent);
  --soft: color-mix(in srgb, var(--ink) 7%, transparent);
  --soft-2: color-mix(in srgb, var(--ink) 12%, transparent);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  font-family: var(--font-body);
}
:where(.cx-modal) :is(button, input, select) { font: inherit; }
:where(.cx-modal) button { cursor: pointer; }

.cx-app {
  --glass: color-mix(in srgb, var(--surface) 66%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 92%, transparent);
  --hair: color-mix(in srgb, var(--border) 75%, transparent);
  --soft: color-mix(in srgb, var(--ink) 7%, transparent);
  --soft-2: color-mix(in srgb, var(--ink) 12%, transparent);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 52px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--canvas);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
:where(.cx-app) :is(button, input, select) { font: inherit; color: inherit; }
:where(.cx-app) button { cursor: pointer; }
:where(.cx-modal) button { color: inherit; }
.cx-app :focus-visible, .cx-modal :focus-visible { outline: 2px solid var(--x-cyan); outline-offset: 2px; }
.cx-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
.cx-stage.is-drag { cursor: grabbing; }
.cx-stage.is-hover { cursor: pointer; }
.cx-stage:focus-visible { outline: 2px solid var(--x-cyan); outline-offset: -3px; }
.cx-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at center, transparent 55%, color-mix(in srgb, var(--canvas) 70%, transparent) 100%); transition: opacity 0.4s; }
body.cx-scientific .cx-vignette { opacity: 0; }

/* ---------- labels & tooltip ---------- */
.cx-labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cx-lbl { position: absolute; left: 0; top: 0; will-change: transform; font: 500 11px/1 var(--font-body); letter-spacing: 0.04em; color: var(--ink); white-space: nowrap; padding: 3px 7px; border-radius: 99px; background: color-mix(in srgb, var(--canvas) 55%, transparent); border: 1px solid transparent; text-shadow: 0 1px 4px var(--canvas); display: none; }
.cx-lbl.is-on { display: block; }
.cx-lbl.is-sel { border-color: var(--x-cyan); color: var(--x-cyan); }
.cx-lbl.is-moon { font-size: 10px; color: var(--muted); }
.cx-lbl.is-grid { font: 400 10px/1 var(--font-mono); color: var(--muted); background: none; text-shadow: none; padding: 0; }
.cx-tooltip { position: fixed; z-index: 40; pointer-events: none; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; background: var(--glass-strong); border: 1px solid var(--hair); backdrop-filter: blur(10px); transform: translate(14px, 14px); }
.cx-tooltip small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.cx-tooltip[hidden], .cx-panel[hidden], .cx-return[hidden], .cx-fallback[hidden] { display: none; }

/* ---------- nav ---------- */
.cx-nav { position: absolute; z-index: 20; top: 10px; left: 10px; right: 10px; min-height: var(--nav-h); display: flex; align-items: center; gap: 14px; padding: 6px 10px; border-radius: 16px; background: var(--glass); border: 1px solid var(--hair); backdrop-filter: blur(16px); }
.cx-brand { margin: 0; flex: none; font-size: inherit; font-weight: inherit; }
.cx-brand button { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; border-radius: 10px; color: var(--ink); }
.cx-brand-text { font-family: var(--font-display); font-weight: 500; letter-spacing: 0.22em; font-size: 12.5px; white-space: nowrap; }
.cx-brand-text b { font-weight: 700; color: var(--x-cyan); }
.cx-logo { width: 26px; height: 26px; border-radius: 50%; flex: none; background: radial-gradient(circle at 32% 30%, var(--x-cyan), var(--accent) 55%, var(--canvas) 100%); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); position: relative; }
.cx-logo::after { content: ""; position: absolute; left: -5px; right: -5px; top: 50%; height: 7px; margin-top: -3px; border: 1.5px solid var(--x-cyan); border-radius: 50%; transform: rotate(-20deg); opacity: 0.85; }
.cx-search { position: relative; flex: 1 1 260px; max-width: 460px; display: flex; align-items: center; }
.cx-search input { width: 100%; height: 38px; padding: 0 36px 0 38px; border-radius: 12px; border: 1px solid var(--hair); background: var(--soft); color: var(--ink); font-size: 13.5px; }
.cx-search input::placeholder { color: var(--muted); }
.cx-search input:focus { background: var(--soft-2); border-color: var(--accent); outline: none; }
.cx-search-ic { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.cx-search #search-clear { position: absolute; right: 3px; width: 32px; height: 32px; }
.cx-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50; margin: 0; padding: 6px; list-style: none; max-height: min(340px, 55vh); overflow-y: auto; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--hair); backdrop-filter: blur(18px); box-shadow: 0 18px 40px color-mix(in srgb, var(--canvas) 80%, transparent); }
.cx-results[hidden] { display: none; }
.cx-result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.cx-result small { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.cx-result[aria-selected="true"], .cx-result:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.cx-result[aria-selected="true"]::before { content: "›"; color: var(--x-cyan); margin-right: -4px; }
.cx-result mark { background: color-mix(in srgb, var(--x-cyan) 28%, transparent); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.cx-noresult { padding: 14px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.cx-links { display: flex; gap: 2px; margin-left: auto; }
.cx-links button { height: 34px; padding: 0 12px; border: 0; background: none; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 500; transition: color 0.2s, background 0.2s; }
.cx-links button:hover { color: var(--ink); background: var(--soft); }
.cx-links button.is-on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.cx-tools { display: flex; gap: 2px; flex: none; }

/* ---------- buttons ---------- */
.cx-icon-btn, .cx-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; background: none; border-radius: var(--radius-btn); color: var(--ink); transition: background 0.18s, border-color 0.18s, transform 0.12s, color 0.18s; }
.cx-icon-btn { width: 36px; height: 36px; flex: none; color: var(--muted); }
.cx-icon-btn[hidden] { display: none; }
.cx-btn { height: 36px; padding: 0 12px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.cx-icon-btn:hover, .cx-btn:hover { background: var(--soft-2); color: var(--ink); }
.cx-icon-btn:active, .cx-btn:active { transform: scale(0.95); }
.cx-btn[aria-pressed="true"] { color: var(--x-cyan); background: color-mix(in srgb, var(--x-cyan) 12%, transparent); }
.cx-btn[aria-pressed="true"]::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 3px; height: 2px; border-radius: 2px; background: var(--x-cyan); }
.cx-btn-main { background: var(--accent); color: var(--ink); min-width: 92px; }
.cx-btn-main:hover { background: color-mix(in srgb, var(--accent) 82%, var(--ink)); }
#btn-sound[aria-pressed="true"] { color: var(--x-cyan); }
.cx-app .icon, .cx-modal .icon { width: 17px; height: 17px; flex: none; }
.cx-app .cx-ic { width: 14px; height: 14px; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 60; white-space: nowrap; padding: 4px 9px; border-radius: 7px; font: 500 11.5px/1.3 var(--font-body); color: var(--ink); background: var(--glass-strong); border: 1px solid var(--hair); pointer-events: none; }
.cx-dock [data-tip]:hover::after, .cx-dock [data-tip]:focus-visible::after { top: auto; bottom: calc(100% + 12px); }
.cx-tools [data-tip]:hover::after { left: auto; right: 0; transform: none; }

/* ---------- panels ---------- */
.cx-panel { position: absolute; z-index: 10; top: calc(var(--nav-h) + 20px); bottom: calc(76px + var(--safe-b)); display: flex; flex-direction: column; border-radius: 16px; background: var(--glass); border: 1px solid var(--hair); backdrop-filter: blur(16px); box-shadow: 0 20px 50px color-mix(in srgb, var(--canvas) 70%, transparent); transition: transform 0.4s var(--ease), opacity 0.3s, visibility 0s; }
.cx-left { left: 10px; width: 292px; }
.cx-right { right: 10px; width: 356px; }
.cx-right:not([hidden]) { animation: cx-in 0.42s var(--ease); }
@keyframes cx-in { from { transform: translateX(28px); } to { transform: none; } }
.cx-left.is-collapsed { transform: translateX(calc(-100% - 20px)); visibility: hidden; opacity: 0; transition: transform 0.4s var(--ease), opacity 0.3s, visibility 0s 0.4s; }
.cx-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px 10px 8px 16px; }
.cx-panel-title { margin: 0; font-family: var(--font-display); font-size: 17px; letter-spacing: 0.04em; }
.cx-count { margin: 3px 0 0; font: 400 11.5px/1.3 var(--font-mono); color: var(--muted); }
.cx-label { font: 500 10.5px/1.2 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cx-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 8px; }
.cx-chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--hair); background: none; color: var(--muted); font-size: 12px; font-weight: 500; transition: all 0.18s; }
.cx-chip:hover { color: var(--ink); background: var(--soft); }
.cx-chip.is-on { color: var(--ink); background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.cx-list { flex: 1; overflow-y: auto; padding: 0 8px 6px; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.cx-group[hidden] { display: none; }
.cx-group-title { margin: 12px 8px 4px; font: 500 10.5px/1.2 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.cx-ul { list-style: none; margin: 0; padding: 0; }
.cx-ul li[hidden] { display: none; }
.cx-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 7px 8px; border: 0; border-radius: 10px; background: none; text-align: left; position: relative; transition: background 0.15s; }
.cx-row:hover { background: var(--soft); }
.cx-row.is-sel { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.cx-row.is-sel::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--x-cyan); }
.cx-row.is-found { box-shadow: 0 0 0 2px var(--x-cyan); }
.cx-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, var(--ink)), var(--c) 55%, color-mix(in srgb, var(--c) 40%, var(--canvas))); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 45%, transparent); }
.cx-row-name { flex: 1; font-size: 13.5px; font-weight: 500; line-height: 1.2; }
.cx-row-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.cx-row-state { display: flex; gap: 4px; align-items: center; color: var(--muted); }
.cx-seen { display: none; color: var(--success); }
.cx-here { display: none; color: var(--x-cyan); }
.cx-row.is-seen .cx-seen { display: inline-flex; }
.cx-row.is-sel .cx-here { display: inline-flex; }
.cx-empty { padding: 20px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.cx-foot { padding: 10px 6px 12px; border-top: 1px solid var(--hair); }
.cx-foot .cx-label { display: block; padding: 0 10px 2px; }
.cx-tools-row { display: flex; gap: 6px; padding: 4px 14px 0; }
.cx-tools-row .btn { flex: 1; padding-inline: 8px; }

/* ---------- info panel ---------- */
.cx-info-head { align-items: center; padding-bottom: 0; }
.cx-info-body { flex: 1; overflow-y: auto; padding: 4px 18px 20px; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.cx-prev-wrap { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.cx-preview { width: 92px; height: 92px; flex: none; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
.cx-preview.is-wide { border-radius: 14px; }
.cx-name { margin: 0; font-family: var(--font-display); font-size: 28px; line-height: 1.05; font-weight: 600; letter-spacing: 0.01em; }
.cx-cat { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--x-cyan); }
.cx-desc { margin: 4px 0 14px; font-size: 13.5px; line-height: 1.6; color: color-mix(in srgb, var(--ink) 86%, transparent); }
.cx-actions-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.cx-actions-row .btn { padding-inline: 6px; font-size: 12.5px; }
.cx-sub { margin: 18px 0 8px; font: 500 10.5px/1.2 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.cx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; border-radius: 12px; overflow: hidden; background: var(--hair); border: 1px solid var(--hair); }
.cx-stats > div { padding: 9px 11px; background: color-mix(in srgb, var(--surface) 80%, transparent); min-width: 0; }
.cx-stats > div.is-wide { grid-column: span 2; }
.cx-stats dt { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.cx-stats dd { margin: 0; font: 500 13px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cx-stats dd small { display: block; font: 400 11px/1.4 var(--font-body); color: var(--muted); margin-top: 3px; }
.cx-facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cx-facts li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.55; color: color-mix(in srgb, var(--ink) 88%, transparent); }
.cx-facts li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.cx-orbit-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 9px 12px; border-radius: 10px; background: var(--soft); font-size: 12.5px; }
.cx-scale-note { margin: 14px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

/* ---------- floating bits ---------- */
.cx-return { position: absolute; z-index: 12; top: calc(var(--nav-h) + 22px); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--hair); background: var(--glass-strong); backdrop-filter: blur(12px); font-size: 13px; font-weight: 500; transition: border-color 0.2s, transform 0.12s; animation: cx-drop 0.4s var(--ease); }
.cx-return:hover { border-color: var(--x-cyan); }
@keyframes cx-drop { from { transform: translate(-50%, -12px); } to { transform: translate(-50%, 0); } }
.cx-fab { position: absolute; z-index: 11; display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--hair); background: var(--glass-strong); backdrop-filter: blur(12px); font-size: 13px; font-weight: 500; }
.cx-fab-left { left: 10px; top: calc(var(--nav-h) + 22px); }
body.cx-left-closed .cx-fab-left { display: inline-flex; }
.cx-note { position: absolute; z-index: 5; right: 14px; bottom: calc(14px + var(--safe-b)); }
.cx-note button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font-size: 11px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.cx-note button:hover { color: var(--ink); }
.cx-dock { position: absolute; z-index: 20; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px; max-width: calc(100% - 20px); border-radius: 18px; background: var(--glass); border: 1px solid var(--hair); backdrop-filter: blur(16px); box-shadow: 0 14px 40px color-mix(in srgb, var(--canvas) 75%, transparent); }
.cx-speed { display: flex; align-items: center; }
.cx-speed-out { min-width: 58px; text-align: center; font: 500 14px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--x-cyan); }
.cx-clock { display: flex; flex-direction: column; padding: 0 12px; line-height: 1.15; min-width: 118px; }
.cx-clock-tag { font: 500 9.5px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--warning); }
.cx-clock-date { margin-top: 3px; font: 500 13px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.cx-sep { width: 1px; align-self: stretch; margin: 6px 6px; background: var(--hair); }
.cx-only-mobile { display: none; }
body.cx-fs .cx-links, body.cx-fs .cx-note { display: none; }

/* ---------- fallback & loader ---------- */
.cx-fallback { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 14%, var(--canvas)), var(--canvas)); }
.cx-fallback > div { max-width: 440px; padding: 28px; border-radius: 18px; background: var(--glass); border: 1px solid var(--hair); }
.cx-fallback h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 22px; }
.cx-fallback p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.cx-loader { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 16%, var(--canvas)), var(--canvas) 70%); transition: opacity 0.7s, visibility 0s 0.7s; }
.cx-loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.cx-load-stars { position: absolute; inset: -50% 0; background-image: radial-gradient(1.2px 1.2px at 12% 18%, var(--ink), transparent), radial-gradient(1px 1px at 38% 62%, var(--x-cyan), transparent), radial-gradient(1.4px 1.4px at 66% 30%, var(--ink), transparent), radial-gradient(1px 1px at 84% 74%, var(--accent-text), transparent), radial-gradient(1px 1px at 52% 90%, var(--ink), transparent), radial-gradient(1.2px 1.2px at 24% 84%, var(--ink), transparent); background-size: 340px 340px; opacity: 0.8; animation: cx-drift 60s linear infinite; }
@keyframes cx-drift { to { transform: translateY(340px); } }
.cx-load-planet { position: relative; width: 96px; height: 96px; margin-bottom: 14px; border-radius: 50%; background: radial-gradient(circle at 30% 28%, transparent 0, color-mix(in srgb, var(--canvas) 85%, transparent) 78%), repeating-linear-gradient(100deg, var(--accent) 0 14px, var(--x-cyan) 14px 22px, var(--accent-text) 22px 40px); background-size: 100% 100%, 200px 100%; box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 50%, transparent), inset -14px -10px 24px color-mix(in srgb, var(--canvas) 80%, transparent); animation: cx-surface 8s linear infinite; }
.cx-load-planet::after { content: ""; position: absolute; left: -34px; right: -34px; top: 50%; height: 28px; margin-top: -14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--x-cyan) 55%, transparent); transform: rotate(-18deg); }
@keyframes cx-surface { to { background-position: 0 0, 200px 0; } }
.cx-load-title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 5vw, 34px); letter-spacing: 0.34em; }
.cx-load-title b { font-weight: 700; color: var(--x-cyan); }
.cx-load-sub { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: 0.06em; }
.cx-load-bar { width: min(260px, 70vw); height: 3px; margin-top: 16px; border-radius: 3px; background: var(--soft-2); overflow: hidden; }
.cx-load-bar i { display: block; height: 100%; width: 4%; background: linear-gradient(90deg, var(--accent), var(--x-cyan)); transition: width 0.35s var(--ease); }
.cx-load-step { margin: 0; font: 400 11.5px/1 var(--font-mono); color: var(--muted); }
html.reduced-motion .cx-load-stars, html.reduced-motion .cx-load-planet, html.reduced-motion .cx-right, html.reduced-motion .cx-return { animation: none; }
html.reduced-motion .cx-app * { transition-duration: 0.01s !important; }

/* ---------- modals ---------- */
.cx-modal { width: min(560px, calc(100vw - 20px)); max-height: min(86vh, 780px); padding: 0; border: 1px solid var(--hair); border-radius: 18px; background: var(--glass-strong); color: var(--ink); backdrop-filter: blur(22px); box-shadow: 0 30px 80px color-mix(in srgb, var(--canvas) 90%, transparent); overflow: hidden; }
.cx-modal[open] { display: flex; flex-direction: column; animation: cx-pop 0.3s var(--ease); }
.cx-modal.cx-wide { width: min(920px, calc(100vw - 20px)); }
.cx-modal::backdrop { background: color-mix(in srgb, var(--canvas) 62%, transparent); backdrop-filter: blur(3px); }
@keyframes cx-pop { from { transform: translateY(14px) scale(0.98); } to { transform: none; } }
.cx-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--hair); }
.cx-modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 19px; letter-spacing: 0.03em; }
.cx-modal-body { padding: 16px 20px 22px; overflow-y: auto; min-height: 0; font-size: 13.5px; scrollbar-width: thin; }
.cx-field { margin-bottom: 18px; }
.cx-field > .cx-label { display: block; margin-bottom: 8px; }
.cx-hint { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.cx-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--soft); border: 1px solid var(--hair); }
.cx-seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; transition: all 0.18s; }
.cx-seg button:hover { color: var(--ink); }
.cx-seg button.is-on { background: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent-text) inset; }
.cx-select { width: 100%; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink); }
.cx-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-bottom: 14px; }
.cx-switch { display: flex; align-items: center; gap: 11px; padding: 8px 0; cursor: pointer; position: relative; font-size: 13.5px; }
.cx-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cx-switch-ui { flex: none; width: 36px; height: 20px; border-radius: 20px; background: var(--soft-2); border: 1px solid var(--hair); position: relative; transition: background 0.2s; }
.cx-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.2s var(--ease), background 0.2s; }
.cx-switch input:checked + .cx-switch-ui { background: var(--accent); }
.cx-switch input:checked + .cx-switch-ui::after { transform: translateX(16px); background: var(--ink); }
.cx-switch input:focus-visible + .cx-switch-ui { outline: 2px solid var(--x-cyan); outline-offset: 2px; }
.cx-switch-text small { display: block; color: var(--muted); font-size: 11.5px; }
.cx-range { width: 100%; accent-color: var(--accent); }
.cx-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cx-help { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cx-help .cx-sub:first-child { margin-top: 0; }
.cx-keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; align-items: center; }
.cx-keys dt { white-space: nowrap; } .cx-keys dd { margin: 0; color: var(--muted); }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--soft); font: 500 11.5px/1.4 var(--font-mono); text-align: center; }
.cx-plain { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.65; font-size: 13px; }
p.cx-plain { padding: 0; }

/* missions & discoveries & progress */
.cx-cards { display: grid; gap: 10px; }
.cx-card2 { padding: 14px 16px; border-radius: 14px; background: var(--soft); border: 1px solid var(--hair); transition: border-color 0.2s; }
.cx-card2.is-active { border-color: var(--accent); }
.cx-card2.is-done { border-color: color-mix(in srgb, var(--success) 60%, transparent); }
.cx-card2 h3 { margin: 0; font-family: var(--font-display); font-size: 16px; }
.cx-card2 p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.cx-card2-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cx-tag { font: 500 10.5px/1 var(--font-mono); letter-spacing: 0.12em; color: var(--accent-text); }
.cx-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.cx-state.ok { color: var(--success); }
.cx-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.cx-steps li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cx-steps li .cx-tick { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--canvas); }
.cx-steps li.ok .cx-tick { background: var(--success); border-color: var(--success); }
.cx-steps li.ok { color: var(--muted); }
.cx-steps .btn { margin-left: auto; }
.cx-meter { height: 6px; border-radius: 6px; background: var(--soft-2); overflow: hidden; margin-top: 12px; }
.cx-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--x-cyan)); transition: width 0.5s var(--ease); }
.cx-summary { margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: color-mix(in srgb, var(--success) 12%, transparent); font-size: 13px; line-height: 1.55; }
.cx-burst { animation: cx-burst 0.9s var(--ease); }
@keyframes cx-burst { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 70%, transparent); transform: scale(0.97); } 60% { box-shadow: 0 0 0 18px transparent; transform: scale(1.015); } 100% { transform: none; } }
html.reduced-motion .cx-burst { animation: none; }
.cx-discover { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cx-prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.cx-prog-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--hair); background: var(--soft); text-align: left; font-size: 13px; }
.cx-prog-item:hover { border-color: var(--accent); }
.cx-prog-item.is-no { opacity: 0.6; border-style: dashed; }
.cx-prog-item small { display: block; color: var(--muted); font-size: 11px; }

/* compare & sizes */
.cx-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cx-pick .cx-chip.is-on::before { content: "✓ "; }
.cx-cmp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.cx-cmp-card { position: relative; padding: 12px; border-radius: 14px; background: var(--soft); border: 1px solid var(--hair); text-align: center; }
.cx-cmp-card canvas { width: 72px; height: 72px; }
.cx-cmp-card h3 { margin: 6px 0 2px; font-family: var(--font-display); font-size: 16px; }
.cx-cmp-card small { color: var(--muted); font-size: 11.5px; }
.cx-cmp-card .cx-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; }
.cx-cmp-size { display: flex; align-items: flex-end; justify-content: center; gap: 14px; min-height: 96px; margin: 4px 0 16px; padding: 10px; border-radius: 12px; background: var(--soft); }
.cx-cmp-size span { display: block; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, var(--ink)), var(--c) 55%, color-mix(in srgb, var(--c) 35%, var(--canvas))); }
.cx-metric { margin-bottom: 16px; }
.cx-metric-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; font-size: 12.5px; font-weight: 500; }
.cx-metric-h em { font: 400 11px/1 var(--font-body); font-style: normal; color: var(--warning); }
.cx-bar { display: grid; grid-template-columns: 92px 1fr 118px; align-items: center; gap: 10px; margin-bottom: 5px; font-size: 12px; }
.cx-bar-track { height: 10px; border-radius: 10px; background: var(--soft-2); overflow: hidden; }
.cx-bar-fill { display: block; height: 100%; border-radius: 10px; min-width: 2px; background: var(--c); transition: width 0.5s var(--ease); }
.cx-bar-val { font: 500 12px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.cx-bar-val.is-na { color: var(--muted); font-weight: 400; }
.cx-cmp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cx-size-canvas { width: 100%; height: 300px; display: block; border-radius: 14px; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 12%, var(--canvas)), var(--canvas)); touch-action: none; cursor: grab; }
.cx-size-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0; font-size: 12.5px; }
.cx-size-legend span { color: var(--muted); } .cx-size-legend b { color: var(--ink); font-weight: 500; }
.cx-size-note { margin: 10px 0; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; background: color-mix(in srgb, var(--warning) 12%, transparent); }
.cx-ratio { font-size: 13.5px; margin: 8px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cx-links button { padding: 0 8px; }
  .cx-brand-text { display: none; }
  .cx-right { width: 320px; }
  .cx-left { width: 264px; }
}
@media (max-width: 900px) {
  .cx-nav { flex-wrap: wrap; gap: 6px 8px; padding: 6px 8px; }
  .cx-search { order: 1; flex: 1 1 0; min-width: 120px; max-width: none; }
  .cx-tools { order: 2; }
  .cx-links { order: 3; flex: 1 0 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .cx-links button { flex: 1; white-space: nowrap; }
  .cx-panel { --nav-h: 100px; top: auto; left: 8px; right: 8px; width: auto; bottom: calc(70px + var(--safe-b)); max-height: 52vh; }
  .cx-left { transform-origin: bottom; }
  .cx-left.is-collapsed { transform: translateY(calc(100% + 90px)); }
  .cx-right:not([hidden]) { animation: cx-rise 0.42s var(--ease); }
  @keyframes cx-rise { from { transform: translateY(40px); } to { transform: none; } }
  .cx-fab-left { display: none !important; }
  .cx-only-mobile { display: inline-flex; }
  .cx-return { top: auto; bottom: calc(80px + var(--safe-b)); }
  body.cx-sheet-open .cx-return { display: none; }
  .cx-note { display: none; }
  .cx-dock { left: 8px; right: 8px; transform: none; max-width: none; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .cx-dock > * { flex: none; }
  .cx-clock { min-width: 104px; }
  .cx-help, .cx-switches { grid-template-columns: 1fr; }
  .cx-tools [data-tip]:hover::after { display: none; }
  .cx-btn { height: 40px; }
  .cx-icon-btn { width: 40px; height: 40px; }
}
@media (max-width: 520px) {
  .cx-btn span:not(#play-ic):not(#play-text) { display: none; }
  .cx-btn { padding: 0 11px; }
  .cx-btn.cx-only-mobile span { display: inline; }
  .cx-bar { grid-template-columns: 70px 1fr 96px; gap: 6px; }
  #btn-full { display: none; }
  .cx-actions-row .btn { font-size: 12px; }
}
