/* ==========================================================================
   CREDO — Apple-Grade Editorial & Liquid Glass Design System
   Dual Mode: Dark OLED (#000000) & Light Editorial (#FAF9F6)
   ========================================================================== */

:root {
  color-scheme: light dark;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }

  /* Dynamic Type base (Safari iOS respects -apple-system-body below) */
  font-size: 106.25%; /* 17px iOS Body */

  /* Spacing scale (base 4pt) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Concentric Corner Radii: r_inner = r_outer - padding */
  --r-sm: 12px;
  --r-md: 18px;
  --r-card: 24px;
  --r-card-pad: 14px;
  --r-inner: calc(var(--r-card) - var(--r-card-pad));
  --r-xl: 32px;
  --r-pill: 999px;

  /* Apple-verified CSS linear() Spring Presets (40-stop, 0.1% settled) */
  --ease-smooth: linear(0, 0.0229, 0.0789, 0.1533, 0.2362, 0.3209, 0.4031, 0.4803, 0.5511, 0.6147, 0.6712, 0.7208, 0.7639, 0.8011, 0.833, 0.8602, 0.8833, 0.9028, 0.9192, 0.933, 0.9445, 0.9542, 0.9622, 0.9688, 0.9744, 0.9789, 0.9827, 0.9858, 0.9884, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9966, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
  --dur-smooth: 735ms;
  --ease-snappy: linear(0, 0.0212, 0.0748, 0.1486, 0.2335, 0.3225, 0.4109, 0.4953, 0.5736, 0.6446, 0.7076, 0.7628, 0.8102, 0.8505, 0.8842, 0.9121, 0.9348, 0.953, 0.9675, 0.9787, 0.9873, 0.9938, 0.9984, 1.0017, 1.0039, 1.0053, 1.006, 1.0063, 1.0062, 1.0059, 1.0055, 1.0049, 1.0044, 1.0038, 1.0033, 1.0028, 1.0023, 1.0019, 1.0016, 1.0013, 1);
  --dur-snappy: 697ms;
  --ease-bouncy: linear(0, 0.0293, 0.1034, 0.2047, 0.3193, 0.4368, 0.55, 0.6538, 0.7453, 0.8232, 0.8874, 0.9383, 0.9773, 1.0057, 1.0252, 1.0375, 1.0439, 1.046, 1.0449, 1.0416, 1.0371, 1.0318, 1.0264, 1.0212, 1.0164, 1.0121, 1.0084, 1.0054, 1.003, 1.0012, 0.9998, 0.9989, 0.9983, 0.998, 0.9979, 0.9979, 0.9981, 0.9983, 0.9985, 0.9988, 1);
  --dur-bouncy: 819ms;
  --ease-micro: linear(0, 0.0229, 0.0789, 0.1533, 0.2362, 0.3209, 0.4031, 0.4803, 0.5511, 0.6147, 0.6712, 0.7208, 0.7639, 0.8011, 0.833, 0.8602, 0.8833, 0.9028, 0.9192, 0.933, 0.9445, 0.9542, 0.9622, 0.9688, 0.9744, 0.9789, 0.9827, 0.9858, 0.9884, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9966, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
  --dur-micro: 320ms;
  --motion-scale: 1;

  /* Semantic Dual-Mode Palette (Light Editorial vs Dark OLED #000000) */
  --bg: light-dark(#FAF9F6, #000000);
  --surface: light-dark(#FFFFFF, #121215);
  --surface-2: light-dark(#F2EFE9, #1C1C1F);
  --surface-3: light-dark(#E8E4DB, #2A2A2E);
  --label: light-dark(#0B0D12, #FFFFFF);
  --label-2: light-dark(#4B4F5B, rgba(235, 235, 245, 0.72));
  --label-3: light-dark(#6F7380, rgba(235, 235, 245, 0.48));
  --sep: light-dark(rgba(15, 30, 54, 0.10), rgba(255, 255, 255, 0.11));
  --sep-strong: light-dark(rgba(15, 30, 54, 0.18), rgba(255, 255, 255, 0.2));

  /* Credo Liturgical Accents (WCAG AA checked in both schemes) */
  --gold: #C8A253;
  --gold-bright: #D4AF37;
  --gold-text: light-dark(#8A6211, #E5C158);
  --gold-soft: light-dark(rgba(200, 162, 83, 0.14), rgba(212, 175, 55, 0.16));
  --navy: #0F1E36;
  --navy-tint: light-dark(#0F1E36, #7CA7E8);
  --live-red: light-dark(#D70015, #FF453A);
  --live-soft: light-dark(rgba(215, 0, 21, 0.10), rgba(255, 69, 58, 0.16));
  --ok-green: light-dark(#1A7F37, #30D158);

  /* Elevation */
  --shadow-card: light-dark(
    0 2px 10px rgba(15, 30, 54, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.04) inset
  );
  --shadow-float: light-dark(
    0 12px 32px rgba(15, 30, 54, 0.14),
    0 14px 36px rgba(0, 0, 0, 0.65)
  );

  /* Liquid Glass Continuous User Opacity (iOS 27 slider: 0 = ultra clear, 1 = opaque) */
  --glass-user-opacity: 0.45;
  --lg-surface-light: rgba(255, 255, 255, calc(0.58 + var(--glass-user-opacity) * 0.36));
  --lg-surface-dark: rgba(24, 24, 28, calc(0.52 + var(--glass-user-opacity) * 0.42));
  --lg-bg: light-dark(var(--lg-surface-light), var(--lg-surface-dark));
  --lg-rim-top: light-dark(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.28));
  --lg-rim-bot: light-dark(rgba(15, 30, 54, 0.12), rgba(255, 255, 255, 0.07));
  --lg-blur: 22px;
  --lg-sat: 1.75;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-serif: "Lora", "New York", Georgia, "Times New Roman", serif;

  /* Dynamic layout offsets */
  --dock-height: 70px;
  --mini-height: 0px;
  --rail-width: 264px;
}

@supports (font: -apple-system-body) {
  :root {
    font: -apple-system-body;
  }
}

/* Accessibility text scale overrides (Profile setting) */
html[data-font-scale="large"] { font-size: 118%; }
html[data-font-scale="xl"] { font-size: 132%; }

/* High Contrast Mode */
@media (prefers-contrast: more) {
  :root {
    --gold-text: light-dark(#6B4A04, #FFE07D);
    --sep: light-dark(#000000, #FFFFFF);
    --lg-bg: light-dark(#FFFFFF, #000000);
    --lg-blur: 0px;
  }
  .lg__glass { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .lg__rim { background: var(--label) !important; }
}

/* Reduce Transparency */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass-user-opacity: 0.95;
    --lg-blur: 8px;
  }
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  :root { --motion-scale: 0; }
  *, *::before, *::after {
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .lg__glow { display: none !important; }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  overflow-x: hidden;
  min-height: 100dvh;
}

body.has-mini-player { --mini-height: 68px; }
body.sheet-locked { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Apple Editorial Typography Helpers */
.t-large-title { font-size: 1.88rem; line-height: 1.16; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.t-title-2 { font-size: 1.29rem; line-height: 1.24; font-weight: 700; letter-spacing: -0.018em; margin: 0; }
.t-title-3 { font-size: 1.12rem; line-height: 1.28; font-weight: 600; letter-spacing: -0.012em; margin: 0; }
.t-headline { font-size: 1rem; line-height: 1.3; font-weight: 600; margin: 0; }
.t-subhead { font-size: 0.88rem; line-height: 1.35; color: var(--label-2); margin: 0; }
.t-footnote { font-size: 0.78rem; line-height: 1.38; color: var(--label-2); margin: 0; }
.t-caption { font-size: 0.72rem; line-height: 1.3; color: var(--label-3); }
.t-serif { font-family: var(--font-serif); font-weight: 500; }

/* ==========================================================================
   LIQUID GLASS — Strictly Functional Layer Only (Dock, Rail, Mini-Player, FAB)
   Isolated .lg__shadow node prevents Chromium backdrop-filter: url() clipping.
   ========================================================================== */
.lg {
  position: relative;
  isolation: isolate;
  border-radius: var(--lg-radius, var(--r-pill));
  corner-shape: squircle;
  --glow: 0;
  --glow-x: 50%;
  --glow-y: 50%;
}
.lg > [aria-hidden="true"] {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  corner-shape: inherit;
  pointer-events: none;
}
.lg__shadow {
  box-shadow: var(--shadow-float);
}
.lg__glass {
  background: var(--lg-bg);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
}
.lg.has-refraction .lg__glass {
  backdrop-filter: blur(8px) var(--lg-filter) saturate(var(--lg-sat));
}
.lg__rim {
  padding: 1px;
  background: linear-gradient(180deg, var(--lg-rim-top), transparent 45%, var(--lg-rim-bot));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.lg__glow {
  opacity: var(--glow);
  background: radial-gradient(
    circle at var(--glow-x) var(--glow-y),
    rgba(255, 255, 255, 0.34),
    rgba(255, 255, 255, 0) 68%
  );
  mix-blend-mode: plus-lighter;
  transition: opacity var(--dur-micro) var(--ease-micro);
}
.lg__content { position: relative; z-index: 1; }

/* Top Progressive Soft Scroll Edge Effect */
.edge-soft {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(20px + env(safe-area-inset-top, 0px));
  pointer-events: none;
  z-index: 25;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent);
  mask-image: linear-gradient(to bottom, #000 35%, transparent);
}

/* ==========================================================================
   APP SHELL — Mobile-First 390x844 + Adaptive Desktop (>= 960px)
   ========================================================================== */
.app-shell {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.desktop-sidebar { display: none; }

.main-stage {
  width: 100%;
  max-width: 640px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--s-4)
           calc(var(--dock-height) + var(--mini-height) + 34px + env(safe-area-inset-bottom, 0px));
  outline: none;
}

.view-mount {
  animation: viewEnter 340ms var(--ease-smooth);
}
@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(calc(10px * var(--motion-scale)));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Desktop Adaptive Sidebar */
@media (min-width: 960px) {
  .app-shell {
    justify-content: flex-start;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--s-6);
    gap: var(--s-8);
  }
  .desktop-sidebar {
    display: block;
    width: var(--rail-width);
    flex-shrink: 0;
    position: sticky;
    top: var(--s-5);
    height: calc(100dvh - 40px);
    z-index: 30;
  }
  .lg-rail {
    --lg-radius: 28px;
    height: 100%;
  }
  .rail-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--s-5) var(--s-4);
    gap: var(--s-5);
  }
  .main-stage {
    flex: 1;
    max-width: 720px;
    padding: var(--s-6) 0 calc(var(--mini-height) + 48px);
  }
  .mobile-dock { display: none !important; }
}

/* Brand Lockup */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border-radius: var(--r-md);
}
.brand-crest {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  corner-shape: squircle;
  background: linear-gradient(145deg, var(--navy), #1A2F52);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  border: 1px solid rgba(212, 175, 55, 0.35);
  flex-shrink: 0;
}
.brand-wordmark { display: flex; flex-direction: column; }
.brand-wordmark strong { font-size: 1.18rem; letter-spacing: -0.02em; line-height: 1.1; }
.brand-wordmark small { font-size: 0.72rem; color: var(--label-2); }

.rail-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rail-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 46px;
  padding: 0 var(--s-3);
  border-radius: 15px;
  font-weight: 500;
  color: var(--label-2);
  transition: background var(--dur-micro) var(--ease-micro), color var(--dur-micro) var(--ease-micro), transform var(--dur-micro) var(--ease-micro);
}
.rail-link:hover { background: var(--gold-soft); color: var(--label); }
.rail-link:active { transform: scale(calc(1 - 0.025 * var(--motion-scale))); }
.rail-link.is-active {
  background: var(--gold-soft);
  color: var(--gold-text);
  font-weight: 600;
}
.rail-footer { display: flex; flex-direction: column; gap: var(--s-3); }
.rail-account-chip {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 48px;
  padding: var(--s-2);
  border: 1px solid var(--sep);
  border-radius: 16px;
  background: transparent;
  text-align: left;
  transition: background var(--dur-micro) var(--ease-micro);
}
.rail-account-chip:hover { background: var(--surface-2); }

/* ==========================================================================
   MOBILE FLOATING LIQUID GLASS BOTTOM TAB BAR (5 Tabs)
   ========================================================================== */
.mobile-dock {
  position: fixed;
  left: var(--s-3);
  right: var(--s-3);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  max-width: 520px;
  margin: 0 auto;
}
.lg-dock { --lg-radius: 30px; }
.dock-items {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 5px 6px;
  gap: 2px;
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  min-width: 44px;
  border: none;
  background: transparent;
  border-radius: 24px;
  color: var(--label-2);
  font-size: 0.65rem;
  font-weight: 500;
  position: relative;
  transition: color var(--dur-micro) var(--ease-micro), transform var(--dur-micro) var(--ease-snappy), background var(--dur-micro) var(--ease-micro);
}
.dock-btn:active { transform: scale(calc(1 - 0.06 * var(--motion-scale))); }
.dock-btn.is-active {
  color: var(--gold-text);
  background: var(--gold-soft);
  font-weight: 600;
}
.dock-btn .live-pip {
  position: absolute;
  top: 7px;
  right: calc(50% - 14px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-red);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ==========================================================================
   PERSISTENT FLOATING LIQUID GLASS MINI-PLAYER
   ========================================================================== */
.mini-player-anchor {
  position: fixed;
  left: var(--s-3);
  right: var(--s-3);
  bottom: calc(var(--dock-height) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: 39;
  max-width: 520px;
  margin: 0 auto;
  animation: miniSlideUp var(--dur-snappy) var(--ease-snappy);
}
@media (min-width: 960px) {
  .mini-player-anchor {
    left: auto;
    right: var(--s-6);
    bottom: var(--s-5);
    width: 360px;
    margin: 0;
  }
}
@keyframes miniSlideUp {
  from { opacity: 0; transform: translateY(calc(18px * var(--motion-scale))) scale(calc(1 - 0.04 * var(--motion-scale))); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.lg-mini {
  --lg-radius: 22px;
}
.lg-mini .lg__glass {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--mini-accent, #C8A253) 20%, var(--lg-bg)),
    var(--lg-bg)
  );
}
.mini-inner {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 8px;
}
.mini-expand-hit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: none;
  border: none;
  padding: 2px 4px;
  text-align: left;
  min-height: 44px;
}
.mini-art {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.mini-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mini-title-row { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; }
.mini-title-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-prog { font-size: 0.75rem; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-controls { display: flex; align-items: center; gap: 2px; }

/* Live Pulse Dot */
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-red);
  flex-shrink: 0;
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.84); }
}

/* ==========================================================================
   FULL-SCREEN APPLE MUSIC-STYLE PLAYER (1:1 Spring Drag Sheet)
   ========================================================================== */
.full-player-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 60;
  transition: opacity 280ms ease;
}
.full-player-sheet {
  position: fixed;
  inset: 0;
  z-index: 61;
  background: #08090C;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: calc(10px + env(safe-area-inset-top, 0px)) var(--s-6) calc(24px + env(safe-area-inset-bottom, 0px));
  will-change: transform;
}
@media (min-width: 720px) {
  .full-player-sheet {
    max-width: 460px;
    max-height: 780px;
    margin: auto;
    border-radius: 36px;
    corner-shape: squircle;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.14);
  }
}
.fp-bg-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle at 50% 24%, var(--fp-accent, #C8A253), transparent 68%);
  opacity: 0.34;
  filter: blur(48px);
  pointer-events: none;
}
.fp-drag-zone {
  position: relative;
  z-index: 2;
  padding-bottom: var(--s-2);
  cursor: grab;
}
.sheet-grabber {
  width: 38px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.34);
  margin: 0 auto var(--s-3);
}
.fp-top-row { display: flex; align-items: center; justify-content: space-between; }
.live-pill-lg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 69, 58, 0.18);
  border: 1px solid rgba(255, 69, 58, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #FF6961;
}
.fp-close-btn { color: #FFFFFF; background: rgba(255, 255, 255, 0.1); border-radius: 50%; }
.fp-body {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  text-align: center;
  gap: var(--s-4);
}
.fp-art-frame {
  width: min(270px, 68vw);
  aspect-ratio: 1;
  border-radius: 26px;
  corner-shape: squircle;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transform: scale(0.92);
  transition: transform var(--dur-bouncy) var(--ease-bouncy), box-shadow var(--dur-smooth) var(--ease-smooth);
}
.fp-art-frame.is-playing {
  transform: scale(1);
  box-shadow: 0 30px 72px rgba(0, 0, 0, 0.68);
}
.fp-art-frame img { width: 100%; height: 100%; object-fit: cover; }
.fp-info { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.fp-freq { font-size: 0.78rem; color: rgba(255, 255, 255, 0.65); text-transform: uppercase; letter-spacing: 0.08em; }
.fp-station { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.fp-program { margin: 0; font-size: 0.96rem; color: rgba(255, 255, 255, 0.78); }

.fp-visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 26px;
}
.fp-visualizer span {
  width: 4px;
  height: 6px;
  border-radius: 99px;
  background: var(--gold-bright);
  opacity: 0.45;
  transition: height 220ms ease;
}
.fp-visualizer.is-playing span {
  opacity: 0.95;
  animation: eqWave 1.1s ease-in-out infinite alternate;
}
.fp-visualizer span:nth-child(2) { animation-delay: 0.15s; }
.fp-visualizer span:nth-child(3) { animation-delay: 0.3s; }
.fp-visualizer span:nth-child(4) { animation-delay: 0.1s; }
.fp-visualizer span:nth-child(5) { animation-delay: 0.4s; }
.fp-visualizer span:nth-child(6) { animation-delay: 0.22s; }
.fp-visualizer span:nth-child(7) { animation-delay: 0.35s; }
@keyframes eqWave {
  0% { height: 6px; }
  100% { height: 24px; }
}

.fp-transport { display: flex; align-items: center; gap: 28px; }
.fp-side-btn { color: rgba(255, 255, 255, 0.85); background: none; border: none; }
.fp-play-main {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: #FFFFFF;
  color: #0B0D12;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transition: transform var(--dur-micro) var(--ease-snappy);
}
.fp-play-main:active { transform: scale(calc(1 - 0.08 * var(--motion-scale))); }

.fp-utility-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); }
.fp-util-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 500;
}
.fp-util-chip.is-active {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--gold-bright);
  color: #FFE07D;
}

/* ==========================================================================
   COMMON BUTTONS, CHIPS, CARDS (Content Layer — NO Glass on Content!)
   ========================================================================== */
.icon-btn-44 {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: inline-grid;
  place-items: center;
  color: var(--label);
  flex-shrink: 0;
  transition: background var(--dur-micro) var(--ease-micro), transform var(--dur-micro) var(--ease-snappy);
}
.icon-btn-44:hover { background: var(--surface-2); }
.icon-btn-44:active { transform: scale(calc(1 - 0.08 * var(--motion-scale))); }

.icon-btn-48 {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform var(--dur-micro) var(--ease-snappy), background var(--dur-micro) var(--ease-micro), opacity var(--dur-micro) var(--ease-micro);
}
.btn:active { transform: scale(calc(1 - 0.03 * var(--motion-scale))); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.btn-gold {
  background: linear-gradient(135deg, #D9B75A, #B98E34);
  color: #0B1220;
  box-shadow: 0 4px 14px rgba(200, 162, 83, 0.28);
}
.btn-navy {
  background: var(--navy);
  color: #FFFFFF;
}
.btn-soft {
  background: var(--surface-2);
  color: var(--label);
  border-color: var(--sep);
}
.btn-outline {
  background: transparent;
  color: var(--label);
  border-color: var(--sep-strong);
}

/* Content Card — Clean Editorial Surface (never Liquid Glass) */
.card {
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: var(--r-card);
  corner-shape: squircle;
  padding: var(--r-card-pad);
  box-shadow: var(--shadow-card);
}

/* Strictly for below-the-fold cards (index >= 2) per defer-rendering-heavy-content */
.deferred-card {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 460px;
}

/* Page Header */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.page-head-actions { display: flex; align-items: center; gap: 4px; }

/* Horizontal Chip Scroller */
.chip-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0 var(--s-3);
  -webkit-overflow-scrolling: touch;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--sep);
  background: var(--surface);
  color: var(--label-2);
  font-size: 0.84rem;
  font-weight: 500;
  transition: background var(--dur-micro) var(--ease-micro), color var(--dur-micro) var(--ease-micro), transform var(--dur-micro) var(--ease-snappy);
}
.chip:active { transform: scale(calc(1 - 0.04 * var(--motion-scale))); }
.chip.is-active {
  background: var(--label);
  color: var(--bg);
  border-color: transparent;
  font-weight: 600;
}

/* Apple Segmented Control */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 14px;
  gap: 3px;
  border: 1px solid var(--sep);
}
.seg-btn {
  min-height: 38px;
  border: none;
  background: transparent;
  border-radius: 11px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--label-2);
  transition: background var(--dur-micro) var(--ease-snappy), color var(--dur-micro) var(--ease-micro), box-shadow var(--dur-micro) var(--ease-micro);
}
.seg-btn.is-active {
  background: var(--surface);
  color: var(--label);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Verified Gold Check & Avatar */
.verified-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E2C15A, #B78B2E);
  color: #0B1220;
  flex-shrink: 0;
}
.avatar {
  width: var(--av-sz, 42px);
  height: var(--av-sz, 42px);
  border-radius: 50%;
  background: var(--av-bg, var(--navy));
  color: #FFFFFF;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: calc(var(--av-sz, 42px) * 0.36);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   VIEW 1: INICIO (CURATED FEED)
   ========================================================================== */
.stories-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px var(--s-4);
}
.stories-strip::-webkit-scrollbar { display: none; }
.story-item {
  width: 74px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  text-align: center;
}
.story-ring {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  padding: 2.5px;
  background: linear-gradient(145deg, #E5C158, #8B1E3F);
  position: relative;
  transition: transform var(--dur-micro) var(--ease-snappy);
}
.story-ring.is-live {
  background: linear-gradient(145deg, #FF453A, #D4AF37);
}
.story-item:active .story-ring { transform: scale(calc(1 - 0.06 * var(--motion-scale))); }
.story-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2.5px solid var(--bg);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.story-ring-inner img { width: 100%; height: 100%; object-fit: cover; }
.story-live-tag {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--live-red);
  color: #FFFFFF;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 6px;
  border: 2px solid var(--bg);
}
.story-name {
  font-size: 0.7rem;
  color: var(--label-2);
  max-width: 74px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact Gospel Card */
.gospel-mini-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #0F1E36, #1A2D4D 65%, #2B2418);
  color: #FFFFFF;
  border-radius: var(--r-card);
  corner-shape: squircle;
  padding: 16px 18px;
  margin-bottom: var(--s-4);
  border: 1px solid rgba(212, 175, 55, 0.28);
}
.gospel-mini-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #E8C766;
}
.gospel-mini-quote {
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.45;
  margin: 8px 0 12px;
  color: rgba(255, 255, 255, 0.95);
}
.gospel-mini-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.gospel-mini-ref { font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); }
.gospel-mini-btns { display: flex; gap: 8px; }
.gospel-mini-btns .btn-sm {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.18);
}
.gospel-mini-btns .btn-sm.is-primary {
  background: var(--gold-bright);
  color: #0B1220;
  border-color: transparent;
}

/* Curated Feed Post Card */
.feed-list { display: flex; flex-direction: column; gap: var(--s-4); }
.post-card { display: flex; flex-direction: column; gap: var(--s-3); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-author-info { flex: 1; min-width: 0; }
.post-author-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-author-name { font-weight: 600; font-size: 0.93rem; }
.post-meta-line {
  font-size: 0.76rem;
  color: var(--label-2);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.rank-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold-text);
  background: var(--gold-soft);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

/* Concentric Media Frame (r_inner = 24 - 14 = 10px -> clean 14px inside flush media) */
.post-media {
  position: relative;
  border-radius: 16px;
  corner-shape: squircle;
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 16 / 10;
}
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.post-media-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(11, 13, 18, 0.76);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.video-duration-pill {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #FFFFFF;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
}
.video-play-overlay {
  position: absolute;
  inset: 0;
  border: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 55%);
  display: grid;
  place-items: center;
  color: #FFFFFF;
}
.video-play-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(15, 30, 54, 0.82);
  border: 2px solid var(--gold-bright);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform var(--dur-micro) var(--ease-bouncy);
}
.video-play-overlay:hover .video-play-circle { transform: scale(1.06); }
.post-media iframe { width: 100%; height: 100%; border: 0; display: block; }

.post-quote-canvas {
  border-radius: 16px;
  padding: 24px 20px;
  background: linear-gradient(145deg, var(--navy), #251B28);
  color: #FFFFFF;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.5;
}
.post-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; line-height: 1.3; margin: 0; }
.post-excerpt {
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--label-2);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-scripture-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--gold-text);
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--sep);
  padding-top: 6px;
  margin-top: 2px;
}
.post-act-group { display: flex; align-items: center; gap: 4px; }
.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: none;
  background: transparent;
  color: var(--label-2);
  font-size: 0.84rem;
  font-weight: 500;
  transition: color var(--dur-micro) var(--ease-micro), background var(--dur-micro) var(--ease-micro), transform var(--dur-micro) var(--ease-bouncy);
}
.act-btn:hover { background: var(--surface-2); color: var(--label); }
.act-btn:active { transform: scale(calc(1 - 0.08 * var(--motion-scale))); }
.act-btn.is-active { color: var(--gold-text); background: var(--gold-soft); font-weight: 600; }

/* Native Sponsored Card (Free plan only) */
.sponsor-card {
  background: var(--surface-2);
  border: 1px dashed var(--sep-strong);
  border-radius: var(--r-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sponsor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sponsor-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--label-3);
}

/* ==========================================================================
   VIEW 2: EN VIVO (RADIO & TV HUB)
   ========================================================================== */
.hero-live-card {
  position: relative;
  border-radius: 26px;
  corner-shape: squircle;
  overflow: hidden;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  color: #FFFFFF;
  background: #0F1E36;
  margin-bottom: var(--s-6);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.hero-live-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-live-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6, 10, 18, 0.94) 15%, rgba(6, 10, 18, 0.42) 65%, rgba(6, 10, 18, 0.25));
}
.hero-live-content { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.hero-live-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--live-red);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.listeners-pill {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--s-5) 0 var(--s-3);
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
@media (min-width: 600px) {
  .radio-grid { grid-template-columns: repeat(3, 1fr); }
}
.station-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 22px;
  corner-shape: squircle;
  padding: 10px;
  text-align: left;
  transition: transform var(--dur-micro) var(--ease-snappy), border-color var(--dur-micro) var(--ease-micro);
}
.station-card:active { transform: scale(calc(1 - 0.03 * var(--motion-scale))); }
.station-card.is-playing { border-color: var(--gold-bright); box-shadow: 0 0 0 1px var(--gold-bright); }
.station-art-wrap {
  position: relative;
  border-radius: 13px; /* concentric: 22 - 10 + 1 */
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--st-accent, var(--navy));
}
.station-art-wrap img { width: 100%; height: 100%; object-fit: cover; }
.station-art-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent 55%);
}
.station-freq-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #FFFFFF;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 7px;
}
.station-play-fab {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-bright);
  color: #0B1220;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.station-name { font-size: 0.9rem; font-weight: 700; line-height: 1.2; }
.station-prog {
  font-size: 0.76rem;
  color: var(--label-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-list { display: flex; flex-direction: column; gap: var(--s-3); }
.tv-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 22px;
  overflow: hidden;
  text-align: left;
  padding: 0;
}
.tv-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0F1E36;
}
.tv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tv-card-body { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ==========================================================================
   VIEW 3: ORACIÓN (GOSPEL + PRAYER WALL)
   ========================================================================== */
.liturgy-card {
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 26px;
  corner-shape: squircle;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
}
.liturgy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.font-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--r-pill);
  border: 1px solid var(--sep);
}
.font-stepper button {
  min-width: 38px;
  min-height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  font-weight: 700;
}
.font-stepper button:hover { background: var(--surface); }

.gospel-prose {
  font-family: var(--font-serif);
  font-size: var(--gospel-size, 1.08rem);
  line-height: 1.68;
  color: var(--label);
  white-space: pre-line;
  margin: 0;
}
.liturgy-details {
  border-top: 1px solid var(--sep);
  padding-top: 12px;
}
.liturgy-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.liturgy-details summary::-webkit-details-marker { display: none; }

.prayer-list { display: flex; flex-direction: column; gap: var(--s-3); }
.prayer-card { display: flex; flex-direction: column; gap: 10px; }
.prayer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cat-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--label-2);
}
.cat-pill.is-urgent { background: var(--live-soft); color: var(--live-red); }
.prayer-body { font-size: 0.96rem; line-height: 1.52; margin: 0; }
.prayer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.pray-candle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--sep-strong);
  background: var(--surface-2);
  font-size: 0.86rem;
  font-weight: 600;
  transition: transform var(--dur-micro) var(--ease-bouncy), background var(--dur-micro) var(--ease-micro), border-color var(--dur-micro) var(--ease-micro), box-shadow var(--dur-micro) var(--ease-micro);
}
.pray-candle-btn:active { transform: scale(calc(1 - 0.06 * var(--motion-scale))); }
.pray-candle-btn.is-lit {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.24), rgba(200, 130, 40, 0.16));
  border-color: var(--gold-bright);
  color: var(--gold-text);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.26);
}
.pray-candle-btn.is-pop {
  animation: candlePop 460ms var(--ease-bouncy);
}
@keyframes candlePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.09); }
  100% { transform: scale(1); }
}

/* Floating Liquid Glass Prayer FAB */
.prayer-fab-anchor {
  position: fixed;
  right: var(--s-4);
  bottom: calc(var(--dock-height) + var(--mini-height) + 22px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
}
@media (min-width: 960px) {
  .prayer-fab-anchor {
    right: var(--s-8);
    bottom: calc(var(--mini-height) + 28px);
  }
}
.lg-fab { --lg-radius: 999px; }
.fab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: none;
  background: transparent;
  color: var(--gold-text);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ==========================================================================
   VIEW 4: PARROQUIAS, JERARQUÍA Y DIRECTORIO
   ========================================================================== */
.parish-hero {
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 26px;
  corner-shape: squircle;
  overflow: hidden;
  margin-bottom: var(--s-5);
  box-shadow: var(--shadow-card);
}
.parish-cover {
  position: relative;
  height: 170px;
  background: var(--navy);
}
.parish-cover img { width: 100%; height: 100%; object-fit: cover; }
.parish-cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 13, 18, 0.88), transparent 65%);
}
.parish-cover-meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  color: #FFFFFF;
}
.parish-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.schedule-group { display: flex; flex-direction: column; gap: 8px; }
.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.84rem;
}
.time-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.time-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--sep);
}

.offering-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 16px;
  background: var(--gold-soft);
  border: 1px solid rgba(200, 162, 83, 0.35);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: var(--r-pill);
  padding: 0 14px;
  min-height: 46px;
  margin: var(--s-3) 0;
}
.search-field input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.94rem;
}

.entity-list { display: flex; flex-direction: column; gap: var(--s-2); }
.entity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 18px;
  width: 100%;
  text-align: left;
  transition: transform var(--dur-micro) var(--ease-snappy), border-color var(--dur-micro) var(--ease-micro);
}
.entity-row:hover { border-color: var(--sep-strong); }
.entity-row:active { transform: scale(calc(1 - 0.015 * var(--motion-scale))); }
.entity-main { flex: 1; min-width: 0; }
.entity-title { font-weight: 600; font-size: 0.94rem; display: flex; align-items: center; gap: 6px; }
.entity-sub { font-size: 0.8rem; color: var(--label-2); margin-top: 2px; }

.lineage-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lineage-pill {
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--sep);
  color: var(--label-2);
}

/* ==========================================================================
   VIEW 5: PERFIL, AJUSTES Y CREDO PLUS
   ========================================================================== */
.plus-hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  corner-shape: squircle;
  background: linear-gradient(145deg, #0D1424, #171412 60%, #2C210C);
  color: #FFFFFF;
  padding: 22px;
  border: 1px solid rgba(212, 175, 55, 0.42);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plus-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.plus-compare th, .plus-compare td {
  padding: 9px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}
.plus-compare th:not(:first-child), .plus-compare td:not(:first-child) {
  text-align: center;
  width: 64px;
}
.plus-legal {
  font-size: 0.74rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.68);
  margin: 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.setting-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setting-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.range-slider {
  width: 100%;
  accent-color: var(--gold-bright);
  height: 28px;
}

/* ==========================================================================
   TOP-LAYER DIALOGS (@starting-style + allow-discrete + Safari data-closing)
   ========================================================================== */
dialog.credo-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: min(86dvh, 760px);
  border: 1px solid var(--sep-strong);
  border-radius: 28px;
  corner-shape: squircle;
  padding: 0;
  background: var(--surface);
  color: var(--label);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 280ms;
  transition-timing-function: var(--ease-snappy);
  transition-behavior: allow-discrete;
}
@media (prefers-reduced-motion: no-preference) {
  dialog.credo-dialog { transform: translateY(18px) scale(0.97); }
}
dialog.credo-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: 260ms;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

dialog.credo-dialog[open]:where(:not([data-closing])) {
  opacity: 1;
  @starting-style { opacity: 0; }

  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0) scale(1);
    @starting-style { transform: translateY(18px) scale(0.97); }
  }

  &::backdrop {
    background-color: rgba(0, 0, 0, 0.56);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    @starting-style {
      background-color: rgba(0, 0, 0, 0);
      -webkit-backdrop-filter: blur(0px);
      backdrop-filter: blur(0px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.credo-dialog, dialog.credo-dialog::backdrop { transition-duration: 120ms; }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--sep);
}
.dialog-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.dialog-body {
  padding: 18px;
  overflow-y: auto;
  max-height: calc(min(86dvh, 760px) - 68px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Story Dialog */
dialog.story-dialog {
  width: min(420px, 100vw);
  height: min(740px, 94dvh);
  border: none;
  border-radius: 26px;
  padding: 0;
  background: #08090C;
  color: #FFFFFF;
  overflow: hidden;
}
dialog.story-dialog::backdrop { background: rgba(0, 0, 0, 0.84); }
.story-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}
.story-stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.72; }
.story-stage-scrim { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 30%, rgba(0,0,0,0.88)); }
.story-bars { position: relative; z-index: 3; display: flex; gap: 4px; }
.story-bar { flex: 1; height: 3px; border-radius: 99px; background: rgba(255,255,255,0.3); overflow: hidden; }
.story-bar-fill { height: 100%; width: 0%; background: #FFFFFF; }
.story-bar.is-done .story-bar-fill { width: 100%; }
.story-bar.is-active .story-bar-fill { animation: storyProg 5.5s linear forwards; }
@keyframes storyProg { from { width: 0%; } to { width: 100%; } }
.story-top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.story-bottom { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.story-tap-zones { position: absolute; inset: 64px 0 90px; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; }

/* Pre-Roll Dialog */
.preroll-box {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.preroll-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--gold-soft);
  border-top-color: var(--gold-bright);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold-text);
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--label-2); }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--sep-strong);
  background: var(--surface-2);
  color: var(--label);
}
.field textarea { min-height: 96px; resize: vertical; }

/* Skeletons & Empty States */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 16px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty-box {
  padding: 36px 20px;
  text-align: center;
  color: var(--label-2);
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: var(--r-card);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -18px);
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  background: #14171F;
  color: #FFFFFF;
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 11px 18px;
  border-radius: var(--r-pill);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: opacity 220ms ease, transform 300ms var(--ease-snappy);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Messages (On-demand view) */
.dm-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface-2);
  align-self: flex-start;
  font-size: 0.92rem;
}
.dm-bubble.mine {
  background: var(--navy);
  color: #FFFFFF;
  align-self: flex-end;
}
