:root {
  --bg: #070b14;
  --panel: #0d1424;
  --card: #111a2e;
  --border: rgba(110, 210, 255, 0.18);
  --cyan: #2cf6ff;
  --magenta: #ff4fd8;
  --gold: #ffd45a;
  --emerald: #44f5a8;
  --indigo: #7c6bff;
  --text: #e6f1ff;
  --muted: #8ea5c6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

.topbar {
  height: 46px;
  background: linear-gradient(180deg, #0f172a 0%, #090e1a 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  gap: 5px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-glyph {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: radial-gradient(circle at 35% 35%, var(--cyan), #4b2394 70%, #091326);
  box-shadow: 0 0 10px rgba(44, 246, 255, 0.45);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #fff;
}

.brand-text h1 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f3f9ff;
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.tab {
  background: rgba(20, 31, 56, 0.72);
  border: 1px solid rgba(110, 210, 255, 0.18);
  color: #b7cde8;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tab:hover {
  border-color: rgba(44, 246, 255, 0.55);
  color: #fff;
}

.tab.active {
  background: linear-gradient(135deg, rgba(44, 246, 255, 0.92), rgba(70, 224, 255, 0.85));
  color: #04101d;
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(44, 246, 255, 0.42);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.pill-link {
  text-decoration: none;
  color: #9dc5ef;
  background: rgba(18, 29, 52, 0.85);
  border: 1px solid rgba(110, 210, 255, 0.22);
  padding: 4px 5px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.pill-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.action-btn {
  background: rgba(20, 31, 56, 0.85);
  border: 1px solid rgba(110, 210, 255, 0.25);
  color: #d6e7ff;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-btn:hover {
  border-color: var(--cyan);
  color: #fff;
}

.action-btn.active {
  background: rgba(44, 246, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}

.action-btn.gold {
  border-color: rgba(255, 212, 90, 0.55);
  color: var(--gold);
  background: rgba(58, 44, 14, 0.45);
}

.action-btn.gold:hover {
  background: rgba(255, 212, 90, 0.2);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 292px;
  height: calc(100vh - 46px);
  width: 100%;
}

.stage-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 46% 48%, #0d162c 0%, #060912 78%);
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.stage-banner {
  position: absolute;
  top: 10px;
  left: 12px;
  pointer-events: none;
  background: rgba(8, 13, 25, 0.78);
  border: 1px solid rgba(110, 210, 255, 0.22);
  backdrop-filter: blur(6px);
  padding: 7px 12px;
  border-radius: 9px;
  max-width: 560px;
}

.stage-kicker {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 2px;
}

.stage-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f3f9ff;
}

.stage-caption {
  position: absolute;
  bottom: 10px;
  left: 12px;
  pointer-events: none;
  background: rgba(8, 13, 25, 0.80);
  border: 1px solid rgba(110, 210, 255, 0.18);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 11px;
  color: #b7cde8;
  max-width: 470px;
  line-height: 1.35;
}

.sidebar {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chamber-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.chamber-panel.active {
  display: flex;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

.card.cert {
  border-color: rgba(255, 212, 90, 0.35);
  background: linear-gradient(180deg, rgba(28, 25, 18, 0.55), rgba(15, 22, 38, 0.92));
}

.card h3 {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 7px;
}

.card.cert h3 {
  color: var(--gold);
}

.math-case {
  text-transform: none;
  letter-spacing: 0.01em;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.btn-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.btn {
  background: rgba(18, 29, 54, 0.85);
  border: 1px solid rgba(110, 210, 255, 0.22);
  color: #cfe2fa;
  padding: 6px 7px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.14s ease;
}

.btn:hover {
  border-color: var(--cyan);
  color: #fff;
}

.btn.active {
  background: rgba(44, 246, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(44, 246, 255, 0.22);
}

.btn.magenta.active {
  background: rgba(255, 79, 216, 0.18);
  border-color: var(--magenta);
  color: var(--magenta);
}

.btn.gold {
  border-color: rgba(255, 212, 90, 0.45);
  color: var(--gold);
}

.btn.gold:hover {
  background: rgba(255, 212, 90, 0.16);
}

.control-row {
  margin-bottom: 7px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #b7cde8;
  margin-bottom: 3px;
}

.control-label span:last-child {
  color: var(--gold);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
  cursor: pointer;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  padding: 2.5px 0;
  border-bottom: 1px dashed rgba(110, 210, 255, 0.10);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-k {
  color: var(--muted);
}

.stat-v {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-weight: 600;
  color: #eef6ff;
}

.stat-v.ok {
  color: var(--emerald);
}

.stat-v.gold {
  color: var(--gold);
}

.stat-v.mag {
  color: var(--magenta);
}

.stat-v.cyan {
  color: var(--cyan);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  place-items: center;
  z-index: 100;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(760px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  background: #0d1527;
  border: 1px solid rgba(255, 212, 90, 0.45);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 16px;
  color: var(--gold);
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
}

.proof-item {
  background: rgba(17, 27, 48, 0.72);
  border: 1px solid rgba(110, 210, 255, 0.16);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 9px;
}

.proof-item h4 {
  font-size: 12.5px;
  color: var(--cyan);
  margin-bottom: 4px;
}

.proof-item p {
  font-size: 11.5px;
  color: #cddff5;
  line-height: 1.5;
}

.proof-item code {
  color: var(--gold);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 4px;
  border-radius: 4px;
}

/* Golden home-star pill linking back to The Neon Decet — Grand Constellation Atlas */
.atlas-home-pill {
  color: #ffd666 !important;
  border-color: rgba(255, 214, 102, 0.58) !important;
  background: rgba(255, 214, 102, 0.12) !important;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 0 10px rgba(255, 214, 102, 0.18);
}
.atlas-home-pill:hover {
  color: #fff3c4 !important;
  border-color: rgba(255, 214, 102, 0.92) !important;
  background: rgba(255, 214, 102, 0.24) !important;
  box-shadow: 0 0 14px rgba(255, 214, 102, 0.38);
}

/* Responsive single-row fit for full 10-volume Decet + Atlas header at 1024px */
@media (max-width: 1240px) {
  .topbar { padding: 0 6px; gap: 5px; }
  .brand { gap: 4px; }
  .brand-glyph { width: 22px; height: 22px; font-size: 0.8rem; }
  .brand-text h1 { font-size: 0.72rem; }
  .tabs { gap: 2.5px; }
  .tab { padding: 4px 6px; font-size: 0.65rem; }
  .top-actions { gap: 2.5px; }
  .pill-link { padding: 2.5px 3.5px; font-size: 0.59rem; }
  .action-btn { padding: 3.5px 5.5px; font-size: 0.62rem; }
}
