/* StarCode — Stylesheet */

/* The `hidden` attribute must always win. A plain class selector like
   `.anomaly-overlay { display: flex }` is author-origin and beats the UA
   stylesheet's `[hidden] { display: none }`, so any panel styled that way
   stays on screen forever, painting an opaque scrim over the whole app.
   Every panel here is toggled via `el.hidden = true/false`, so this rule
   is the correct single place to enforce it — when the attribute is
   removed the element's own display value applies again as normal. */
[hidden] { display: none !important; }

:root {
  --bg-deep: #040810;
  --bg-panel: #080e1a;
  --bg-card: #0d1525;
  --bg-card-hover: #141f38;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-dim: #4a5568;
  --accent: #f59e0b;
  --accent-dim: #b45309;
  --accent-glow: rgba(245, 158, 11, 0.15);
  --border: #1a2235;
  --border-light: #2d3a50;
  --success: #22c55e;
  --danger: #ef4444;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-data: "SF Mono", "Cascadia Code", "Fira Code", "Consolas", monospace;
}

[data-theme="nebula"] {
  --bg-deep: #060812;
  --bg-panel: #0a0e1e;
  --bg-card: #0f1328;
  --bg-card-hover: #161d3a;
  --text-primary: #d8dff0;
  --text-secondary: #8898c4;
  --text-dim: #4a5580;
  --accent: #818cf8;
  --accent-dim: #5b64c4;
  --accent-glow: rgba(129, 140, 248, 0.15);
  --border: #1a1f3a;
  --border-light: #2a3358;
}

[data-theme="ember"] {
  --bg-deep: #0a0608;
  --bg-panel: #120a0e;
  --bg-card: #1a0f15;
  --bg-card-hover: #281820;
  --text-primary: #f0e0e4;
  --text-secondary: #b89098;
  --text-dim: #6a4a52;
  --accent: #f0a0b0;
  --accent-dim: #c07080;
  --accent-glow: rgba(240, 160, 176, 0.15);
  --border: #2a1820;
  --border-light: #3d2830;
}

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

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* ── Background starfield canvas ────────────────────── */

#bgStarfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Build stamp (DCOSMOS-BUILDSTAMP) ──────────────── */

/* ── Layout ─────────────────────────────────────────── */

.view {
  display: none;
  height: calc(100dvh - var(--header-h, 58px));
  position: relative;
  z-index: 1;
  overflow-y: auto;
}
.view.active {
  display: flex;
  flex-direction: column;
  animation: viewFadeIn 0.2s ease forwards;
}
/* DCOSMOS-ANIMENTRY: the departing view stays rendered while it fades out,
   then JS removes the class and it returns to display:none. */
.view.view-exit {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  animation: viewFadeOut 0.15s ease forwards;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes viewFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 76px 12px 24px;
  background: rgba(8, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

header nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}

header nav button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
header nav button:hover {
  color: var(--text-secondary);
  border-color: var(--border);
}
header nav button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

.view-body {
  flex: 1;
  padding: 32px 24px;
  width: 100%;
  min-height: 0;
}

/* ── Landing ────────────────────────────────────────── */

#landing .view-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 40px;
}

.landing-title {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(245, 158, 11, 0.2), 0 0 80px rgba(245, 158, 11, 0.08);
  animation: titleGlow 4s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { text-shadow: 0 0 40px rgba(245, 158, 11, 0.15), 0 0 80px rgba(245, 158, 11, 0.05); }
  to { text-shadow: 0 0 60px rgba(245, 158, 11, 0.3), 0 0 120px rgba(245, 158, 11, 0.1); }
}

.landing-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.7;
  opacity: 0.8;
}

.landing-actions {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  width: 260px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.landing-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.landing-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}
.landing-card:hover::before { opacity: 1; }

.landing-card h3 {
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 8px;
}
.landing-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.landing-card .phase-tag {
  display: inline-block;
  font-size: 10px;
  font-family: var(--font-data);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Primary and secondary buttons, used across every screen. */
.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.btn-primary:hover {
  background: #d97706;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}
.btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text-secondary);
}
