/* ==========================================================
   BOSS OS — BIRTHDAY PROTOCOL
   Design language: premium dark futuristic -> warm celebration
   ========================================================== */

:root {
  /* --- tech phase palette --- */
  --bg-0: #05070a;
  --bg-1: #090c11;
  --bg-2: #0d1219;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);
  --glass: rgba(255, 255, 255, 0.035);
  --text: #e9edf3;
  --text-dim: #8a93a1;
  --text-faint: #4c5560;
  --blue: #62a8ff;
  --blue-glow: rgba(98, 168, 255, 0.28);
  --green: #6fe3ab;

  /* --- celebration phase palette (introduced on scene 7+) --- */
  --gold: #e9c581;
  --gold-2: #f6e2ae;
  --warm-0: #0e0a06;
  --warm-1: #17110a;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --sans: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  background: radial-gradient(ellipse 120% 90% at 50% -10%, #0f1620 0%, var(--bg-0) 55%);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 1.4s var(--ease);
}

body.theme-warm {
  background: radial-gradient(ellipse 120% 90% at 50% -10%, #241a0d 0%, var(--warm-0) 55%);
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: -10%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grain-shift 8s steps(8) infinite;
}
@keyframes grain-shift {
  0%,100% { transform: translate(0,0); }
  50% { transform: translate(-2%, 1%); }
}

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
}

/* ---------- generic scene shell ---------- */
.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  filter: blur(8px);
  transform: scale(1.02);
  transition: opacity 0.7s var(--ease), filter 0.7s var(--ease), transform 0.8s var(--ease);
  text-align: center;
}
.scene.active {
  opacity: 1;
  visibility: visible;
  filter: blur(0);
  transform: scale(1);
}
.scene.leaving {
  opacity: 0;
  filter: blur(6px);
  transform: scale(0.985);
}

@media (prefers-reduced-motion: reduce) {
  .scene { transition: opacity 0.25s linear; filter: none !important; transform: none !important; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

.hidden { display: none !important; }

/* ---------- typography helpers ---------- */
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.dim { color: var(--text-dim); }
.small { font-size: 0.8rem; }
.accent { color: var(--blue); }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.eyebrow.light { color: var(--gold); }

.title-glow {
  text-shadow: 0 0 24px var(--blue-glow);
}

.cursor {
  display: inline-block;
  animation: blink 1s steps(1) infinite;
  color: var(--blue);
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- terminal card (scenes 1,2,3,6) ---------- */
.terminal-card {
  width: min(560px, 92vw);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 36px);
  backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02), 0 30px 60px -30px rgba(0,0,0,0.7);
}
.terminal-card.wide { width: min(640px, 94vw); }

.terminal-card h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin: 6px 0 22px;
  font-weight: 600;
}
.terminal-card h2 {
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  margin: 4px 0 20px;
  font-weight: 500;
  color: var(--text);
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin: 6px 0 20px;
}
.progress-track.big { height: 8px; margin: 22px 0 8px; }
.progress-track.thin { height: 2px; width: min(320px, 70vw); margin: 22px auto; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), #a9d2ff);
  border-radius: 3px;
  transition: width 0.35s var(--ease);
  box-shadow: 0 0 12px var(--blue-glow);
}

.terminal-log {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  min-height: 108px;
}
.terminal-log li {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 3px 0;
  opacity: 0;
  transform: translateY(4px);
  animation: log-in 0.4s var(--ease) forwards;
}
.terminal-log li .ok { color: var(--green); margin-left: 6px; }
@keyframes log-in { to { opacity: 1; transform: translateY(0); } }

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue-glow);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ---------- radar (scene 2) ---------- */
.radar {
  width: 130px; height: 130px;
  margin: 6px auto 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  position: relative;
  background:
    repeating-radial-gradient(circle, transparent 0, transparent 20px, var(--line-soft) 21px);
  overflow: hidden;
}
.radar-sweep {
  position: absolute; inset: 0;
  background: conic-gradient(from 0deg, var(--blue-glow), transparent 40%);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.network-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  max-height: 46vh;
  overflow-y: auto;
}
.network-list::-webkit-scrollbar { width: 4px; }
.network-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.network-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 6px 2px;
  color: var(--text-dim);
  opacity: 0;
  transform: translateY(4px);
  animation: log-in 0.4s var(--ease) forwards;
}
.network-row .node-name { min-width: 92px; color: var(--text); }
.network-row .dots { flex: 1; overflow: hidden; color: var(--text-faint); white-space: nowrap; }
.network-row .node-status { color: var(--green); opacity: 0; transition: opacity 0.3s; }
.network-row.done .node-status { opacity: 1; }
.network-row .node-indicator {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.network-row.done .node-indicator { background: var(--green); box-shadow: 0 0 6px rgba(111,227,171,0.6); }

.network-footer { margin-top: 6px; text-align: center; }
.network-online {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 8px; font-size: 0.95rem;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(111,227,171,0.7);
  animation: pulse 1.2s ease-in-out infinite;
}

/* ---------- identification (scene 3) ---------- */
.id-card { width: min(420px, 92vw); }
.scanner {
  width: 128px; height: 128px;
  margin: 4px auto 18px;
  border-radius: 50%;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-1);
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--text-faint);
}
.scanner-ring {
  position: absolute; inset: 6px;
  border-radius: 50%;
  border: 1px solid var(--blue-glow);
  animation: spin 4s linear infinite;
}
.scanner-ring.ring-2 { inset: 16px; animation-duration: 6s; animation-direction: reverse; opacity: 0.6; }
.id-photo, .scanner-photo-fallback img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.scan-line {
  position: absolute; left: 6px; right: 6px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  top: 10%;
  animation: scan-move 1.8s ease-in-out infinite;
  box-shadow: 0 0 8px var(--blue-glow);
}
@keyframes scan-move {
  0%,100% { top: 10%; }
  50% { top: 88%; }
}

.id-details { margin-top: 10px; }
.id-details.hidden { display: none; }
.id-name {
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  margin: 4px 0 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hologram-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(98,168,255,0.06), transparent);
  padding: 14px 16px;
  text-align: left;
}
.hologram-row {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 0.8rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-soft);
  color: var(--text-dim);
}
.hologram-row:last-child { border-bottom: none; }
.hologram-row b { color: var(--blue); font-weight: 600; }

/* ---------- panel card (scenes 4,5) ---------- */
.panel-card {
  width: min(500px, 92vw);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(26px, 5vw, 40px);
  backdrop-filter: blur(14px);
}
.update-title {
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  margin: 6px 0 4px;
  font-weight: 700;
}
.feature-list {
  margin: 24px 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feature-row {
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0;
  transform: translateX(-8px);
  animation: feature-in 0.5s var(--ease) forwards;
  display: flex; gap: 10px; align-items: baseline;
}
.feature-row span {
  font-family: var(--mono);
  color: var(--blue);
  font-weight: 600;
  min-width: 64px;
}
@keyframes feature-in { to { opacity: 1; transform: translateX(0); } }

.btn-primary {
  appearance: none;
  border: 1px solid var(--blue-glow);
  background: linear-gradient(180deg, rgba(98,168,255,0.16), rgba(98,168,255,0.05));
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding: 14px 30px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s;
  box-shadow: 0 0 24px -6px var(--blue-glow);
  min-height: 48px;
  min-width: 200px;
}
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 0 30px -4px var(--blue-glow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: default; transform: none; }

.eta { margin-top: 16px; }

.progress-percent {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 4px 0 10px;
  color: var(--blue);
}
.install-complete { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.install-complete .accent { font-size: 1rem; letter-spacing: 0.05em; }

/* ---------- reboot (scene 6) ---------- */
.reboot-content { text-align: center; }
.countdown {
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 700;
  color: var(--blue);
  text-shadow: 0 0 30px var(--blue-glow);
}

/* ==========================================================
   CELEBRATION PHASE (scenes 7+)
   ========================================================== */
.scene-celebration { color: #fbf3e3; }

.reveal-content { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.reveal-emoji { font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1; }
.reveal-title {
  font-size: clamp(2.1rem, 9vw, 4.2rem);
  font-weight: 700;
  margin: 6px 0;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fff, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(233, 197, 129, 0.35);
}
.reveal-name {
  font-size: clamp(1.8rem, 8vw, 3.2rem);
  font-weight: 700;
  margin-top: 6px;
  color: var(--gold-2);
}

.photo-frame-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.photo-frame {
  width: min(280px, 62vw);
  height: min(280px, 62vw);
  border-radius: 50%;
  padding: 6px;
  background: conic-gradient(from 180deg, var(--gold), #fff6df, var(--gold));
  box-shadow: 0 0 60px -10px rgba(233,197,129,0.5);
}
.photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: var(--warm-1);
}
.photo-label {
  font-family: var(--mono);
  letter-spacing: 0.3em;
  font-size: 0.78rem;
  color: var(--gold);
}

.warning-card {
  width: min(440px, 92vw);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(233,197,129,0.25);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 34px);
  backdrop-filter: blur(10px);
}
.warning-icon { font-size: 2rem; margin-bottom: 6px; }
.warning-title {
  font-family: var(--mono);
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.warning-text { font-size: 1.05rem; line-height: 1.5; margin: 10px 0; }
.warning-text.small { font-size: 0.88rem; color: #d8cbb3; }
.warning-status { margin: 14px 0; font-size: 0.9rem; }

.card-message {
  width: min(520px, 92vw);
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(233,197,129,0.22);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 6vw, 44px);
  backdrop-filter: blur(10px);
}
.card-title {
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  color: var(--gold-2);
  margin-bottom: 18px;
  font-weight: 600;
}
.card-body {
  font-size: 1.02rem;
  line-height: 1.75;
  color: #f1e6cf;
  margin-bottom: 26px;
}
.card-signoff { font-size: 0.92rem; color: #d8cbb3; margin-bottom: 26px; }
.card-team { color: var(--gold); font-weight: 600; margin-top: 4px; }

.final-content { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.final-title {
  font-size: clamp(1.7rem, 7vw, 3rem);
  font-weight: 700;
  color: var(--gold-2);
  text-shadow: 0 0 50px rgba(233,197,129,0.35);
}
.final-icons { font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: 0.2em; }

.btn-ghost, .btn-ghost-outline {
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 13px 26px;
  min-height: 46px;
  min-width: 180px;
  transition: transform 0.25s var(--ease), background 0.25s;
}
.btn-ghost {
  border: 1px solid rgba(233,197,129,0.4);
  background: rgba(233,197,129,0.08);
  color: var(--gold-2);
}
.btn-ghost:hover { transform: scale(1.02); background: rgba(233,197,129,0.14); }
.btn-ghost-outline {
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: #e5dcc8;
}
.btn-ghost-outline:hover { transform: scale(1.02); background: rgba(255,255,255,0.05); }

/* ---------- gallery ---------- */
.scene-gallery { align-items: stretch; overflow-y: auto; padding: 60px 20px; }
.gallery-wrap { width: min(900px, 96vw); margin: 0 auto; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 22px 0 30px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(233,197,129,0.2);
  cursor: pointer;
  transition: transform 0.3s var(--ease);
}
.gallery-grid img:hover { transform: scale(1.03); }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5,4,2,0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff; font-size: 1.1rem; cursor: pointer;
}

/* ---------- sound toggle ---------- */
.sound-toggle {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 10;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: opacity 0.4s, background 0.25s;
}
.sound-toggle:hover { background: rgba(255,255,255,0.09); }
.sound-toggle.muted { color: var(--text-faint); }

/* ---------- responsive tweaks ---------- */
@media (max-width: 430px) {
  .terminal-card, .panel-card, .warning-card, .card-message { padding: 20px; }
  .btn-primary, .btn-ghost, .btn-ghost-outline { width: 100%; }
}
