:root {
  color-scheme: dark;
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Semantic tokens (invariant across eras) */
  --pos: #4ade80;
  --pos-bg: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.13);
  --danger: #fb7185;
  --danger-bg: rgba(251, 113, 133, 0.14);
  --story: #c084fc;
  --story-bg: rgba(192, 132, 252, 0.14);

  /* Default: America 2012 — Era 0 (Sleek 2010s Modernism) */
  --bg: #0c1218;
  --surface-0: #111a22;
  --surface-1: #17232e;
  --surface-2: #1e2e3c;
  --border: #2a4052;
  --border-strong: #3d5d75;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #34d399;
  --accent-2: #38bdf8;
  --accent-bg: rgba(52, 211, 153, 0.13);
  --scanline-opacity: 0;
}

/* Era 1: Hypergrowth Startup */
html[data-world="america-2012"][data-era="1"] {
  --bg: #0b111a;
  --surface-0: #111927;
  --surface-1: #182336;
  --surface-2: #213049;
  --border: #2e4363;
  --border-strong: #466591;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-bg: rgba(45, 212, 191, 0.14);
}

/* Era 2: Corporate Monolith */
html[data-world="america-2012"][data-era="2"] {
  --bg: #0b0d14;
  --surface-0: #121521;
  --surface-1: #191d2e;
  --surface-2: #232940;
  --border: #333a54;
  --border-strong: #515b80;
  --accent: #f59e0b;
  --accent-2: #38bdf8;
  --accent-bg: rgba(245, 158, 11, 0.13);
}

/* Era 3: Dystopian Panopticon */
html[data-world="america-2012"][data-era="3"] {
  --bg: #07070b;
  --surface-0: #0f0d14;
  --surface-1: #17121c;
  --surface-2: #221926;
  --border: #3d2432;
  --border-strong: #6b3248;
  --accent: #fb7185;
  --accent-2: #f59e0b;
  --accent-bg: rgba(251, 113, 133, 0.14);
  --scanline-opacity: 0.18;
}

/* =========================================================
   LIGHT MODE — High-Contrast 2010s Brushed Aluminum & White Cards
   (3-tier separation: Slate Desk -> Brushed Panel -> Crisp White Card)
   ========================================================= */
html[data-theme="light"] {
  color-scheme: light;
  --pos: #065f46;
  --pos-bg: rgba(6, 95, 70, 0.12);
  --warn: #9a3412;
  --warn-bg: rgba(180, 83, 9, 0.14);
  --danger: #9f1239;
  --danger-bg: rgba(190, 18, 60, 0.12);
  --story: #5b21b6;
  --story-bg: rgba(91, 33, 182, 0.12);

  /* Light Era 0: Calm Matte 2012 Brushed Slate -> Panel -> Soft Off-White Cards */
  --bg: #c6cfd9;
  --surface-0: #dfe5ec;
  --surface-1: #f3f5f8;
  --surface-2: #d4dde7;
  --border: #94a3b8;
  --border-strong: #475569;
  --text: #0b1220;
  --text-muted: #334155;
  --accent: #065f46;
  --accent-2: #075985;
  --accent-bg: rgba(6, 95, 70, 0.12);
  --scanline-opacity: 0;
}

html[data-theme="light"][data-world="america-2012"][data-era="1"] {
  --bg: #becad6;
  --surface-0: #dce4ec;
  --surface-1: #f2f5f8;
  --surface-2: #d2dde8;
  --border: #829ab1;
  --border-strong: #3e5870;
  --accent: #0f766e;
  --accent-2: #0369a1;
  --accent-bg: rgba(15, 118, 110, 0.13);
}

html[data-theme="light"][data-world="america-2012"][data-era="2"] {
  --bg: #c2c5cf;
  --surface-0: #dde0e8;
  --surface-1: #f3f4f7;
  --surface-2: #d5d8e2;
  --border: #8b92a6;
  --border-strong: #474f66;
  --accent: #9a3412;
  --accent-2: #075985;
  --accent-bg: rgba(154, 52, 18, 0.13);
}

html[data-theme="light"][data-world="america-2012"][data-era="3"] {
  --bg: #beb8bd;
  --surface-0: #dad4d8;
  --surface-1: #f4f1f3;
  --surface-2: #d3cbd0;
  --border: #8f7e87;
  --border-strong: #573b49;
  --accent: #9f1239;
  --accent-2: #9a3412;
  --accent-bg: rgba(159, 18, 57, 0.12);
  --scanline-opacity: 0.04;
}

html[data-theme="light"] body {
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 2px,
      rgba(15, 23, 42, 0.025) 2px,
      rgba(15, 23, 42, 0.025) 4px
    );
}

html[data-theme="light"] .hq-canvas,
html[data-theme="light"] .pixel-frame {
  background: #cbd5e1;
}

html[data-theme="light"] .hq-toggle-btn {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

html[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.58);
}

html[data-theme="light"] .cashflow-popover,
html[data-theme="light"] .toast {
  box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 var(--font-sans);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(52, 211, 153, 0.08), transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(56, 189, 248, 0.06), transparent 50%);
  color: var(--text);
  transition: background-color 600ms ease, color 400ms ease;
  min-height: 100vh;
}

html[data-world="america-2012"][data-era="1"] body {
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(45, 212, 191, 0.09), transparent 60%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 28px;
}

html[data-world="america-2012"][data-era="2"] body {
  background-image:
    radial-gradient(ellipse at 70% 0%, rgba(245, 158, 11, 0.08), transparent 55%),
    radial-gradient(ellipse at 15% 40%, rgba(56, 189, 248, 0.06), transparent 50%);
}

html[data-world="america-2012"][data-era="3"] body {
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(251, 113, 133, 0.11), transparent 58%),
    radial-gradient(ellipse at 85% 90%, rgba(245, 158, 11, 0.07), transparent 50%);
}

/* Live HQ Panorama Banner (Desktop & Mobile responsive) */
.hq-banner {
  position: relative;
  max-width: 1320px;
  margin: 12px auto 0;
  padding: 0 18px;
}

.hq-canvas {
  display: block;
  width: 100%;
  height: 164px;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #0a0d14;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hq-banner.collapsed .hq-canvas { display: none; }

.hq-overlay {
  position: absolute;
  inset: 8px 26px auto auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  pointer-events: none;
}

.hq-banner.collapsed .hq-overlay {
  position: static;
  padding: 2px 0;
}

.hq-toggle-btn {
  pointer-events: auto;
  background: rgba(8, 12, 18, 0.72);
  font-size: 11px;
  padding: 3px 8px;
}

@media (max-width: 760px) {
  .hq-banner { padding: 0 12px; margin-top: 8px; }
  .hq-canvas { height: 112px; }
  .hq-overlay { inset: 6px 18px auto auto; }
}

/* Subtle Era 3 panopticon scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: var(--scanline-opacity);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 3px
  );
  transition: opacity 700ms ease;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

[hidden] { display: none !important; }

/* Pinned Telemetry Header & Alert Stack */
.sticky-hud {
  position: sticky;
  top: 0;
  z-index: 40;
}

.telemetry-bar {
  background: color-mix(in srgb, var(--surface-0) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border-strong);
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.era-badge {
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 1px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 3px;
}

.calendar-pill {
  font: 600 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.telemetry-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 620px;
}

@media (max-width: 1260px) {
  .telemetry-bar {
    padding: 8px 14px;
    gap: 8px 12px;
  }
  .telemetry-metrics {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
  }
}

.metric-chip {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  min-width: 128px;
  cursor: default;
}

.metric-chip.interactive { cursor: pointer; }
.metric-chip.interactive:hover { border-color: var(--accent); }

.metric-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.metric-value {
  font: 700 15px/1.25 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.metric-sub {
  font: 600 11px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.metric-sub.pos { color: var(--pos); }
.metric-sub.warn { color: var(--warn); }
.metric-sub.danger { color: var(--danger); }

@media (max-width: 760px) {
  .desktop-only { display: none; }
  .telemetry-bar {
    padding: 6px 10px;
    gap: 6px 8px;
  }
  .brand-cluster { gap: 6px; }
  .era-badge { font-size: 10px; padding: 3px 6px; }
  .calendar-pill { font-size: 11px; }
  .header-controls { gap: 4px; }
  .speed-btn { padding: 4px 7px; font-size: 11px; }
  .telemetry-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
    flex-basis: 100%;
    order: 3;
  }
  .metric-chip {
    min-width: 0;
    padding: 4px 6px;
  }
  .metric-label { font-size: 9.5px; gap: 4px; }
  .metric-value { font-size: 13px; line-height: 1.15; }
  .metric-sub {
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.cashflow-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  z-index: 60;
  font-size: 12px;
}

.cashflow-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.cashflow-row.total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 5px;
  font-weight: 700;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.speed-btn {
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-1);
  padding: 5px 9px;
  font: 600 12px var(--font-mono);
}

.speed-btn:last-child { border-right: none; }
.speed-btn.active { background: var(--accent-bg); color: var(--accent); }

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px !important;
  margin-bottom: 12px;
}

.bulk-bar-label {
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Crisis Strip */
.crisis-strip {
  background: var(--surface-0);
  border-bottom: 1px solid var(--danger);
  padding: 8px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.crisis-meter {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crisis-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 100ms linear;
}

.bar-fill.danger { background: var(--danger); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.story { background: var(--story); }

/* Unlock Fanfare Banner */
.unlock-banner {
  background: var(--accent-bg);
  border-bottom: 1px solid var(--accent);
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.unlock-banner strong { color: var(--accent); }

/* Auto-dismissing Site Ops Uptime Alert Strip */
.ops-alert-strip {
  background: var(--warn-bg);
  border-bottom: 2px solid var(--warn);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.ops-alert-strip strong { color: var(--warn); }

.btn-warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
  font-weight: 700;
}

.panel.panel-warn {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--surface-0) 90%, var(--warn));
  animation: pulse-warn 1.8s ease-in-out infinite;
}

@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.25); }
  50% { box-shadow: 0 0 12px 2px rgba(251, 191, 36, 0.45); }
}

/* Newly Unlocked Rail Panels, Items & Unlock Banner Flash */
.unlock-banner.banner-flash {
  border-bottom: 2px solid var(--accent);
  animation: banner-unlock-flash 1.05s ease-in-out 4;
}

@keyframes banner-unlock-flash {
  0%, 100% { background: var(--accent-bg); box-shadow: none; }
  50% { background: color-mix(in srgb, var(--accent) 34%, var(--surface-0)); box-shadow: inset 0 0 0 2px var(--accent); }
}

.panel.card-new {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface-0) 88%, var(--accent));
  animation: card-unlock-flash 1.1s ease-in-out 5;
}

.ops-item.card-new {
  border-radius: 4px;
  padding: 6px 8px;
  margin: 0 -8px;
  background: color-mix(in srgb, var(--surface-0) 84%, var(--accent));
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  animation: card-unlock-flash 1.1s ease-in-out 5;
}

@keyframes card-unlock-flash {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 16px 3px color-mix(in srgb, var(--accent) 70%, transparent); }
}

.new-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font: 700 10px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  background: var(--accent);
  color: var(--surface-0);
  vertical-align: middle;
}

html.reduced-motion .unlock-banner.banner-flash,
html.reduced-motion .panel.card-new,
html.reduced-motion .ops-item.card-new,
html.reduced-motion .panel.panel-warn {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="allow"]) .unlock-banner.banner-flash,
  html:not([data-motion="allow"]) .panel.card-new,
  html:not([data-motion="allow"]) .ops-item.card-new,
  html:not([data-motion="allow"]) .panel.panel-warn {
    animation: none;
  }
}

/* Main App Shell */
.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 18px 48px;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}

.panel + .panel { margin-top: 12px; }

.panel-title {
  margin: 0 0 10px;
  font: 700 12px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel > .panel-title {
  margin: -15px -15px 12px;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

/* Tabs */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab-btn {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 14px;
  font: 600 13px var(--font-sans);
  color: var(--text-muted);
}

.tab-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--text);
}

.tab-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  margin-left: 6px;
  vertical-align: middle;
}

/* Buttons */
button, select, input {
  font: inherit;
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 6px 10px;
}

button {
  user-select: none;
  -webkit-user-select: none;
}

button * {
  pointer-events: none;
}

button:enabled { cursor: pointer; }
button:enabled:hover { border-color: var(--accent); background: var(--surface-2); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--warn);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.btn-launch {
  background: var(--pos-bg);
  border-color: var(--pos);
  color: var(--pos);
  font-weight: 700;
  animation: pulse-glow 1.6s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.35); }
  50% { box-shadow: 0 0 12px 2px rgba(74, 222, 128, 0.45); }
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.btn-small { padding: 4px 8px; font-size: 12px; }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px;
}

.card.status-building { border-color: var(--accent-2); }
.card.status-awaiting-vps { border-color: var(--pos); background: color-mix(in srgb, var(--surface-1) 92%, var(--pos)); }
.card.status-live { border-left: 3px solid var(--pos); }
.card.status-locked { opacity: 0.6; border-style: dashed; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.card-title { font-weight: 700; font-size: 15px; }
.card-tag {
  font: 600 11px var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.card-tag.live { background: var(--pos-bg); color: var(--pos); }
.card-tag.warn { background: var(--warn-bg); color: var(--warn); }
.card-tag.ready { background: var(--accent-bg); color: var(--accent); }

.card-desc { margin: 4px 0 8px; font-size: 13px; color: var(--text-muted); }

.spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.spec-chip {
  font: 600 11px var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.spec-chip.short { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.spec-chip.met { border-color: var(--pos); color: var(--pos); }

.card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ops-item {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.ops-item:first-child { border-top: none; padding-top: 0; }
.ops-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ops-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font: 700 10px/1 var(--font-mono);
  color: var(--text-muted);
  margin-left: 5px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.help-tip:hover,
.help-tip.active { border-color: var(--accent); color: var(--accent); }

.help-popover {
  position: fixed;
  z-index: 95;
  max-width: min(280px, calc(100vw - 24px));
  background: var(--surface-0);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 5px;
  padding: 8px 10px;
  font: 400 12px/1.45 var(--font-sans);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

@media (max-width: 760px) {
  .help-tip { width: 18px; height: 18px; font-size: 11px; }
}

/* Ticker & Chronicle */
.mini-ticker {
  font-size: 12px;
  color: var(--text-muted);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin-top: 8px;
}

.log-entry {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  gap: 10px;
}

.log-day { font: 600 11px var(--font-mono); color: var(--text-muted); min-width: 56px; }
.log-entry.launch .log-msg { color: var(--pos); }
.log-entry.sunset .log-msg { color: var(--warn); }
.log-entry.story .log-msg { color: var(--story); }
.log-entry.danger .log-msg { color: var(--danger); }

/* Modals (Launch Spotlight + Confirmation + Settings) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface-0);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.modal-close-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 13px/1 var(--font-mono);
  color: var(--text-muted);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  z-index: 2;
}

.modal-close-x:hover {
  color: var(--text);
  border-color: var(--accent);
}

.modal-card.wide {
  width: min(1060px, 100%);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.gallery-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px;
}

.gallery-tile:hover { border-color: var(--accent); }
.gallery-tile .pixel-frame { margin: 6px 0 0; }

.pixel-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
  background: #080a0f;
  margin: 10px 0 14px;
}

.pixel-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.spotlight-eyebrow {
  font: 700 11px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-right: 32px;
}

.spotlight-title { margin: 4px 0 0; font-size: 22px; }
.spotlight-flavor { margin: 0 0 14px; color: var(--text); font-size: 14px; line-height: 1.6; }

/* Toasts */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.toast.sunset { border-left-color: var(--warn); background: color-mix(in srgb, var(--surface-0) 90%, var(--warn)); }
.toast.danger { border-left-color: var(--danger); }

.archived-drawer { margin-top: 14px; }
.archived-drawer summary { cursor: pointer; font-size: 13px; color: var(--text-muted); padding: 6px 0; }

/* Board-Appointed AI CEO Ghost Cursor */
.ai-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 95;
  pointer-events: none;
  will-change: transform;
}

.ai-cursor-svg {
  display: block;
  filter: drop-shadow(0 2px 6px rgba(251, 113, 133, 0.7));
}

.ai-cursor-tag {
  position: absolute;
  left: 18px;
  top: 14px;
  white-space: nowrap;
  font: 700 11px/1.2 var(--font-mono);
  padding: 4px 7px;
  border-radius: 3px;
  background: rgba(15, 10, 16, 0.94);
  border: 1px solid var(--danger);
  color: var(--danger);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.ai-cursor.flip-tag .ai-cursor-tag {
  left: auto;
  right: 14px;
}

.ai-cursor-ripple {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  opacity: 0;
}

.ai-cursor-ripple.active {
  animation: ai-click-ripple 380ms ease-out forwards;
}

@keyframes ai-click-ripple {
  0% { transform: scale(0.4); opacity: 0.95; }
  100% { transform: scale(2.2); opacity: 0; }
}

.ai-pressed {
  outline: 2px solid var(--danger) !important;
  box-shadow: 0 0 14px rgba(251, 113, 133, 0.65) !important;
  transform: scale(0.96);
}

/* Reduced Motion */
html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
}

html.reduced-motion body::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="allow"]) *,
  html:not([data-motion="allow"]) *::before,
  html:not([data-motion="allow"]) *::after { animation: none !important; transition: none !important; }
  html:not([data-motion="allow"]) body::after { display: none; }
}

/* =========================================================
   EARLY-2010s PIXEL-ART SKEUOMORPHISM & WIDER BEZELS
   (Crisp stepped pixel bevels, brushed pixel metal, recessed wells)
   ========================================================= */
:root {
  --bezel-radius: 2px;
  --bezel-hi: rgba(255, 255, 255, 0.20);
  --bezel-lo: rgba(0, 0, 0, 0.52);
  --bezel-drop: rgba(0, 0, 0, 0.55);
  /* Stepped 2-band pixel gloss (no blurry smooth gradients) */
  --metal-grad: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.06) 35%, rgba(0, 0, 0, 0.06) 35%, rgba(0, 0, 0, 0.10) 100%);
  --btn-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.14) 45%, rgba(0, 0, 0, 0.12) 45%, rgba(0, 0, 0, 0.12) 100%);
  --pixel-grain: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
}

html[data-theme="light"] {
  --bezel-hi: rgba(255, 255, 255, 0.52);
  --bezel-lo: rgba(30, 41, 59, 0.28);
  --bezel-drop: rgba(15, 23, 42, 0.22);
  --metal-grad: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(15, 23, 42, 0.04) 100%);
  --btn-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.28) 46%, rgba(15, 23, 42, 0.06) 46%, rgba(15, 23, 42, 0.06) 100%);
  --pixel-grain: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.035) 0px,
    rgba(255, 255, 255, 0.035) 2px,
    rgba(15, 23, 42, 0.015) 2px,
    rgba(15, 23, 42, 0.015) 4px
  );
}

/* Brushed pixel-metal top telemetry bar */
.telemetry-bar {
  background-image: var(--pixel-grain), var(--metal-grad);
  border-bottom: 4px solid var(--border-strong);
  box-shadow: inset 0 2px 0 var(--bezel-hi), inset 0 -2px 0 var(--bezel-lo), 0 4px 0 var(--bezel-drop);
}

/* Chunky pixel-beveled panels (clean uniform surface — no misaligned 36% stripe) */
.panel {
  border: 3px solid var(--border-strong);
  border-radius: var(--bezel-radius);
  padding: 15px;
  background-image: none;
  box-shadow:
    inset 2px 2px 0 var(--bezel-hi),
    inset -2px -2px 0 var(--bezel-lo),
    3px 3px 0 var(--bezel-drop);
}

.card, .gallery-tile {
  border: 2px solid var(--border-strong);
  border-radius: var(--bezel-radius);
  background-image: none;
  box-shadow:
    inset 2px 2px 0 var(--bezel-hi),
    inset -2px -2px 0 var(--bezel-lo),
    2px 2px 0 var(--bezel-drop);
}

.metric-chip {
  border: 2px solid var(--border-strong);
  border-radius: var(--bezel-radius);
  background-image: none;
  box-shadow:
    inset 2px 2px 0 var(--bezel-hi),
    inset -2px -2px 0 var(--bezel-lo),
    2px 2px 0 var(--bezel-drop);
}

.modal-card {
  border: 4px solid var(--accent);
  border-radius: var(--bezel-radius);
  background-image: none;
  box-shadow:
    inset 2px 2px 0 var(--bezel-hi),
    inset -2px -2px 0 var(--bezel-lo),
    6px 6px 0 var(--bezel-drop);
}

html[data-theme="light"] .modal-card {
  background: #f5f7fa;
  color: #0b1220;
}

html[data-theme="light"] .spotlight-title,
html[data-theme="light"] .spotlight-flavor {
  color: #0b1220;
}

html[data-theme="light"] .btn-primary {
  background: var(--accent);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(0, 0, 0, 0.08) 100%);
  border-color: var(--accent);
  color: #f8fafc;
}

html[data-theme="light"] .btn-primary:enabled:hover {
  filter: brightness(1.08);
  color: #ffffff;
}

/* Wide machined pixel monitor bezel around HQ & Spotlight canvases */
.hq-canvas,
.pixel-frame {
  border: 4px solid var(--border-strong);
  border-radius: var(--bezel-radius);
  box-shadow:
    inset 3px 3px 0 var(--bezel-lo),
    inset -2px -2px 0 var(--bezel-hi),
    3px 3px 0 var(--bezel-drop);
}

/* Tactile pixel-beveled 2010s buttons */
button {
  border-width: 2px;
  border-radius: var(--bezel-radius);
  background-image: var(--btn-gloss);
  box-shadow:
    inset 2px 2px 0 var(--bezel-hi),
    inset -2px -2px 0 var(--bezel-lo),
    2px 2px 0 var(--bezel-drop);
  transition: none;
}

button:enabled:active {
  transform: translate(1px, 1px);
  box-shadow:
    inset 2px 2px 0 var(--bezel-lo),
    inset -1px -1px 0 var(--bezel-hi);
}

.tab-btn {
  border-width: 2px;
  border-radius: 2px 2px 0 0;
  padding: 8px 15px;
}

/* Recessed pixel LCD progress wells with stepped highlight strip */
.bar-track {
  height: 12px;
  border-radius: var(--bezel-radius);
  border: 2px solid var(--border-strong);
  box-shadow: inset 2px 2px 0 var(--bezel-lo), inset -1px -1px 0 var(--bezel-hi);
}

.bar-fill {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.32) 38%, rgba(0, 0, 0, 0.14) 38%, rgba(0, 0, 0, 0.14) 100%);
}

/* Recessed pixel spec chips */
.spec-chip {
  border-radius: var(--bezel-radius);
  border-width: 1.5px;
  box-shadow: inset 1px 1px 0 var(--bezel-lo), inset -1px -1px 0 var(--bezel-hi);
}
