/* ==========================================================================
   EMAFILM — GRAND CINEMA VELVET & NEON ROSE/CYAN THEME
   Distinctive visual identity for film.emafausto.it
   ========================================================================== */

:root {
  --bg-obsidian: #09060c;
  --bg-deep: #100a16;
  --bg-card: #150e1f;
  --bg-card-hover: #1d142b;
  --bg-surface: rgba(21, 14, 31, 0.88);
  --bg-glass: rgba(15, 9, 23, 0.78);

  --accent: #f43f5e;
  --accent-bright: #fb7185;
  --accent-deep: #be123c;
  --accent-glow: rgba(244, 63, 94, 0.32);

  --cyan: #06b6d4;
  --cyan-bright: #22d3ee;
  --cyan-glow: rgba(6, 182, 212, 0.25);

  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.25);

  --emerald: #10b981;
  --purple: #a855f7;
  --danger: #ef4444;

  --text-primary: #faf5ff;
  --text-secondary: #cbbdd9;
  --text-muted: #8b799e;

  --border-subtle: rgba(244, 63, 94, 0.14);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(244, 63, 94, 0.45);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --font-display: 'Syne', 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-sans: 'Plus Jakarta Sans', 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-cinema: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 30px rgba(244, 63, 94, 0.08);
}

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

html {
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background-color: var(--bg-obsidian);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(244, 63, 94, 0.14) 0%, transparent 40%),
    radial-gradient(circle at 88% 15%, rgba(6, 182, 212, 0.10) 0%, transparent 38%),
    radial-gradient(circle at 50% 90%, rgba(168, 85, 247, 0.09) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  overflow-x: hidden;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOP NAVIGATION BAR (CINEMA MARQUEE HEADER)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 12px;
  background: rgba(11, 7, 16, 0.86);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 10%, #fb7185 60%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.05;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-bright);
  opacity: 0.9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  padding: 5px;
  border-radius: 999px;
}

.nav-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(244, 63, 94, 0.1);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 390px;
  justify-content: flex-end;
}

.global-search-wrap {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.global-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  border-radius: 999px;
  padding: 9px 36px 9px 15px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.global-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.07);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.14);
  transform: translateY(-1px);
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(420px, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  background: #140c1e;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  z-index: 250;
  padding: 8px;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.16s ease;
}

.search-item:hover {
  background: rgba(244, 63, 94, 0.14);
}

.search-item img {
  width: 42px;
  height: 62px;
  object-fit: cover;
  border-radius: 7px;
  background: #221630;
  flex-shrink: 0;
}

.search-item-info {
  flex: 1;
  min-width: 0;
}

.search-item-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   MAIN CONTAINER & VIEWS
   ========================================================================== */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.view-section {
  animation: fadeInView 0.26s ease-out;
}

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

/* ==========================================================================
   HERO SPOTLIGHT BANNER (WIDESCREEN CINEMASCOPE)
   ========================================================================== */
.hero-banner {
  position: relative;
  min-height: 350px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #130b1c;
  box-shadow: var(--shadow-cinema);
  display: flex;
  align-items: flex-end;
  padding: 32px;
  margin-bottom: 22px;
  background-size: cover;
  background-position: center 22%;
}

.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 6, 12, 0.96) 0%, rgba(9, 6, 12, 0.78) 52%, rgba(9, 6, 12, 0.25) 100%),
    linear-gradient(0deg, rgba(9, 6, 12, 0.96) 0%, rgba(9, 6, 12, 0.2) 60%, transparent 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hero-overview {
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   KPI STRIP (CINEMA TICKETS STYLE)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  position: relative;
  background: linear-gradient(145deg, rgba(26, 17, 38, 0.92), rgba(16, 10, 24, 0.92));
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.kpi-card:nth-child(2) { border-left-color: var(--cyan); }
.kpi-card:nth-child(3) { border-left-color: var(--gold); }
.kpi-card:nth-child(4) { border-left-color: var(--purple); }

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.kpi-label {
  font-size: 0.74rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   SECTION HEADERS & HORIZONTAL RAILS
   ========================================================================== */
.section-block {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-link {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.28);
  color: var(--accent-bright);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.section-link:hover {
  background: var(--accent);
  color: #fff;
}

.poster-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 185px;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
}

/* ==========================================================================
   MOVIE POSTER CARD
   ========================================================================== */
.movie-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.movie-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-bright);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.6), 0 0 18px rgba(244, 63, 94, 0.16);
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #1a1026;
  overflow: hidden;
}

.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.movie-card:hover .poster-wrap img {
  transform: scale(1.04);
}

.card-badges-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

.badge-affinity {
  background: rgba(6, 182, 212, 0.92);
  color: #041318;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.badge-score {
  background: rgba(9, 6, 12, 0.86);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.card-badges-bottom {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
}

.badge-runtime {
  background: rgba(9, 6, 12, 0.86);
  color: #e9d5ff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
}

.badge-provider {
  background: rgba(244, 63, 94, 0.92);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-provider.is-nas {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #fff;
}

.badge-paused-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
}

.badge-paused-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}

.movie-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.movie-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.28;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-card-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

/* ==========================================================================
   SAGA / COLLECTION CARDS
   ========================================================================== */
.saga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.saga-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 14px;
  align-items: center;
}

.saga-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.saga-poster {
  width: 66px;
  height: 98px;
  border-radius: 10px;
  object-fit: cover;
  background: #221531;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.saga-info {
  flex: 1;
  min-width: 0;
}

.saga-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.saga-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.saga-progress-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.saga-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 999px;
}

/* ==========================================================================
   FILTER BAR, SUBTABS & PILLS
   ========================================================================== */
.subtabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
  scrollbar-width: none;
}

.subtabs-bar::-webkit-scrollbar {
  display: none;
}

.subtab-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.subtab-pill.active,
.subtab-pill:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: var(--accent);
  color: #fff;
}

.filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 12px 15px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.filter-input,
.filter-select {
  background: rgba(9, 6, 12, 0.75);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: var(--font-sans);
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan) 0%, #0284c7 100%);
  color: #fff;
  box-shadow: 0 6px 20px var(--cyan-glow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-card);
  color: var(--text-primary);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.12);
}

/* ==========================================================================
   ROULETTE / MOVIE NIGHT SORTEGGIO
   ========================================================================== */
.roulette-panel {
  background: linear-gradient(155deg, rgba(25, 14, 36, 0.94), rgba(12, 8, 19, 0.96));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-cinema);
}

.duration-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dur-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.dur-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.roulette-winner-card {
  margin-top: 24px;
  background: rgba(9, 6, 12, 0.78);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  align-items: center;
}

/* ==========================================================================
   DNA & STATS CARDS
   ========================================================================== */
.dna-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 18px;
}

.dna-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px;
}

.dna-card h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin-bottom: 14px;
  color: var(--accent-bright);
}

.dna-bar-row {
  margin-bottom: 10px;
}

.dna-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.dna-bar-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.dna-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 999px;
}

/* ==========================================================================
   MODALS (CENTERED, NO TOP-CUTOFF, SIDE-BY-SIDE POSTER + TITLE)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(5, 3, 8, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 16px)) 14px max(16px, env(safe-area-inset-bottom, 16px));
  overflow-y: auto;
}

.modal-sheet {
  position: relative;
  width: min(860px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  background: #120b1b;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9);
  color: var(--text-primary);
}

.modal-close-btn {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px 0 0;
  z-index: 30;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 6, 12, 0.82);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-hero-backdrop {
  position: relative;
  min-height: 220px;
  background-size: cover;
  background-position: center 20%;
  padding: 28px 24px 18px;
  display: flex;
  align-items: flex-end;
}

.modal-hero-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 11, 27, 0.25) 0%, rgba(18, 11, 27, 0.88) 70%, #120b1b 100%);
}

.modal-header-row {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 18px;
  align-items: flex-end;
  width: 100%;
}

.modal-poster {
  width: 118px;
  height: 176px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  background: #1e132c;
}

.modal-title-col {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 6px;
}

.modal-tagline {
  font-style: italic;
  color: var(--accent-bright);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.modal-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.meta-pill {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.modal-body {
  padding: 18px 24px 28px;
}

.action-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 9px;
  margin: 14px 0 18px;
}

.action-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.18s ease;
  text-decoration: none;
}

.action-tile:hover {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.13);
}

.paused-box {
  background: rgba(6, 182, 212, 0.09);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.saga-box {
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.09), rgba(168, 85, 247, 0.08));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 18px 0;
}

.saga-parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.saga-part-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(9, 6, 12, 0.65);
  border: 1px solid var(--border-card);
  padding: 7px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.saga-part-item:hover,
.saga-part-item.current {
  border-color: var(--accent);
}

.saga-part-item img {
  width: 36px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & SAFE AREAS
   ========================================================================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(11, 7, 16, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
}

.bnav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 10px;
}

.bnav-item .bnav-icon {
  font-size: 1.18rem;
}

.bnav-item.active {
  color: var(--accent-bright);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #191026;
  border: 1px solid var(--accent);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 960px) {
  .nav-links {
    display: none;
  }
  .bottom-nav {
    display: flex;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar {
    padding: max(14px, calc(env(safe-area-inset-top, 20px) + 10px)) 14px 10px;
  }
  .main-container {
    padding: 14px 14px 32px;
  }
  .hero-banner {
    min-height: 290px;
    padding: 20px;
  }
  .roulette-winner-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
}

@media (max-width: 520px) {
  .poster-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .poster-rail {
    grid-auto-columns: 148px;
    gap: 11px;
  }
  .modal-poster {
    width: 92px;
    height: 138px;
  }
  .modal-body {
    padding: 14px 16px 24px;
  }
}
