:root {
  --bg: #070a14;
  --panel: rgba(12, 18, 34, 0.88);
  --border: rgba(110, 195, 255, 0.22);
  --cyan: #5ef2ff;
  --magenta: #ff6ad5;
  --gold: #ffd166;
  --text: #e6f1ff;
  --muted: #8ea7c7;
}

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

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

.topbar {
  height: 52px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(9, 13, 26, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

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

.brand-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5c4, #ffd166 42%, #ff6ad5 74%, #3c1e70 100%);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.65);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #7ef9ff, #ffd166 55%, #ff7edb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.brand-sub {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
}

.tab {
  appearance: none;
  border: 1px solid rgba(110, 195, 255, 0.22);
  background: rgba(16, 24, 46, 0.72);
  color: #b7d2f2;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.tab:hover {
  border-color: rgba(94, 242, 255, 0.65);
  color: #ffffff;
}

.tab.active {
  background: linear-gradient(135deg, rgba(94, 242, 255, 0.22), rgba(255, 209, 102, 0.22));
  border-color: var(--cyan);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(94, 242, 255, 0.28);
}

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

.pill-link {
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  color: #9ec5ea;
  border: 1px solid rgba(110, 195, 255, 0.22);
  background: rgba(16, 24, 46, 0.68);
  padding: 4px 5.5px;
  border-radius: 999px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

.action-btn {
  appearance: none;
  border: 1px solid rgba(255, 209, 102, 0.55);
  background: rgba(255, 209, 102, 0.12);
  color: #ffe39b;
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: rgba(255, 209, 102, 0.24);
  color: #ffffff;
}

.workspace {
  display: flex;
  height: calc(100vh - 52px);
  width: 100%;
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #070a14;
}

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

.hud-caption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  max-width: calc(100% - 28px);
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(8, 12, 26, 0.86);
  border: 1px solid rgba(110, 195, 255, 0.28);
  color: #cde3ff;
  font-size: 11px;
  line-height: 1.38;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.hud-caption strong { color: var(--gold); }
.hud-caption code {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
}

.sidebar {
  width: 274px;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(9, 13, 26, 0.94);
  border-left: 1px solid var(--border);
}

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

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

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

.chip {
  appearance: none;
  border: 1px solid rgba(110, 195, 255, 0.24);
  background: rgba(18, 28, 52, 0.78);
  color: #cfe4ff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 7px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.14s ease;
}

.chip:hover {
  border-color: var(--cyan);
  background: rgba(94, 242, 255, 0.14);
  color: #ffffff;
}

.chip.active {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(94, 242, 255, 0.2), rgba(255, 209, 102, 0.22));
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.22);
}

.ctrl-row {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ctrl-row label {
  font-size: 11px;
  color: #b7d2f2;
  display: flex;
  justify-content: space-between;
}

.ctrl-row label span {
  color: var(--gold);
  font-family: ui-monospace, monospace;
  font-weight: 700;
}

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

.toggle-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: 11.5px;
  color: #cfe4ff;
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--cyan);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(110, 195, 255, 0.1);
  font-size: 11px;
}

.stat-row:last-child { border-bottom: none; }
.stat-row span { color: var(--muted); flex-shrink: 0; }
.stat-row strong {
  color: #f4f9ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.8px;
  text-align: right;
  word-break: break-word;
}

/* Proofs & Certs Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 18px;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  width: min(820px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background: #0c1224;
  border: 1px solid rgba(255, 209, 102, 0.42);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.72);
  padding: 18px 20px;
}

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

.modal-head h2 {
  font-size: 17px;
  color: var(--gold);
  margin-bottom: 3px;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
}

.modal-sub code {
  color: var(--cyan);
  font-family: ui-monospace, monospace;
}

.modal-close {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.modal-close:hover { border-color: var(--magenta); color: var(--magenta); }

.cert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cert-card {
  background: rgba(15, 23, 44, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}

.cert-card h3 {
  font-size: 12.5px;
  color: var(--cyan);
  margin-bottom: 6px;
}

.cert-card p {
  font-size: 11.5px;
  line-height: 1.48;
  color: #cfe4ff;
}

.math-case { text-transform: none; }

.proof-card:nth-child(5) { grid-column: 1 / -1; }
.modal-card { padding: 16px 20px; max-height: 88vh; }
.proof-grid { gap: 10px; margin-top: 12px; }
.proof-card { padding: 11px 13px; }
.proof-card p { font-size: 11.5px; line-height: 1.44; }

/* Span Card V across full modal width so all 5 suites fit cleanly at 1024x768 */
.cert-grid { gap: 10px; }
.cert-card { padding: 11px 14px; }
.cert-card p { font-size: 11.4px; line-height: 1.42; }
.cert-card:nth-child(5) { grid-column: 1 / -1; }
.modal-card { max-height: 88vh; }
.modal-head { padding: 13px 18px 10px; }
.modal-body { padding: 12px 18px 16px; }

/* 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 8px; gap: 6px; }
  .brand { gap: 5px; }
  .brand-orb { width: 16px; height: 16px; }
  .brand-title { font-size: 0.72rem; }
  .brand-sub { font-size: 0.56rem; }
  .tabs { gap: 3px; }
  .tab { padding: 4px 7px; font-size: 0.67rem; }
  .top-actions { gap: 3px; }
  .pill-link { padding: 3px 4px; font-size: 0.61rem; }
  .action-btn { padding: 4px 7px; font-size: 0.65rem; }
}
