:root {
  /* Brand */
  --orange: var(--primary);
  --orange-dark: var(--primary);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fast: 0.16s;
  --med: 0.28s;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 9999px;

  /* Typography */
  --font-sans: "DM Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", "Fira Code", "Consolas", monospace;
  --font-serif: "Fraunces", "Georgia", "Cambria", ui-serif, serif;

  /* Session type colors (invariant) */
  --color-panel: #1e88e5;
  --color-panel-soft: rgba(33, 150, 243, 0.08);
  --color-poster: #ab47bc;
  --color-poster-soft: rgba(156, 39, 176, 0.08);
  --color-break-soft: rgba(247, 236, 19, 0.18);
  --color-break-text: #9e8c00;

  /* Danger & Warning */
  --danger: #e24b4a;
  --danger-soft: rgba(226, 75, 74, 0.06);
  --warning: #faae00;
  --warning-dark: #d68900;
  --warning-soft: rgba(250, 174, 0, 0.12);

  /* Tema claro (default) */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f8f8f8;
  --surface3: #f0f0f0;
  --on: #2d2d2d;
  --on2: #555555;
  --on3: #888888;
  --outline: #d0d0d0;
  --outline-dim: #e8e8e8;
  --primary: #f16922;
  --primary-soft: rgba(241, 105, 34, 0.08);
  --primary-med: rgba(241, 105, 34, 0.14);
  --live: #e53935;
  --live-glow: rgba(229, 57, 53, 0.12);
  --success: #2e7d32;
  --success-soft: rgba(46, 125, 50, 0.08);
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --nav-bg: rgba(255, 255, 255, 0.95);
  --scrim: rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --surface2: #252525;
    --surface3: #2c2c2c;
    --on: #ececec;
    --on2: #aaaaaa;
    --on3: #777777;
    --outline: #3a3a3a;
    --outline-dim: #2a2a2a;
    --primary: #ff8a50;
    --primary-soft: rgba(255, 138, 80, 0.1);
    --primary-med: rgba(255, 138, 80, 0.18);
    --live: #ff5252;
    --live-glow: rgba(255, 82, 82, 0.15);
    --success: #66bb6a;
    --success-soft: rgba(102, 187, 106, 0.1);
    --danger-soft: rgba(239, 83, 80, 0.1);
    --topbar-bg: rgba(18, 18, 18, 0.93);
    --nav-bg: rgba(18, 18, 18, 0.96);
    --scrim: rgba(0, 0, 0, 0.6);
  }
}

/* KEYFRAMES */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

@keyframes splashBreathe {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* RESET */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==========================================================================
   WEB COMPONENTS FOUC PREVENTION 
   (Oculta componentes hijos como <app-filter-header> hasta que su JS cargue,
    pero NO oculta <app-skeleton> porque ese ya está pre-cargado)
   ========================================================================== */
:not(:defined) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  overscroll-behavior-y: contain;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--on);
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  transition: background var(--med) ease, color var(--med) ease;
}

#app-root,
app-error-boundary {
  flex: 1;
  height: 100%;
  width: 100%;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  transition: transform var(--fast) ease, opacity var(--fast) ease;
}

button:active {
  transform: scale(0.95);
}

a {
  text-decoration: none;
  color: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html:has(dialog[open]) {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes pulseGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 10px 25px rgba(241, 105, 34, 0.25);
  }

  50% {
    transform: scale(1.04);
    box-shadow: 0 15px 35px rgba(241, 105, 34, 0.5);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 10px 25px rgba(241, 105, 34, 0.25);
  }
}

/* Utilities */
.is-hidden {
  display: none !important;
}