/* ═══════════════════════════════════════════════════════════════════
   EmaTV — Dark-Cinema Design System (serie.emafausto.it)
   Clean Single-Source Stylesheet (Desktop + Mobile iOS/Android PWA)
═══════════════════════════════════════════════════════════════════ */

:root {
  --bg-obsidian: #07090e;
  --bg-surface: rgba(16, 21, 32, 0.78);
  --bg-surface-elevated: rgba(25, 33, 50, 0.88);
  --bg-glass: rgba(14, 19, 30, 0.72);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(245, 158, 11, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.35);
  --accent-crimson: #e11d48;
  --accent-emerald: #10b981;
  --accent-indigo: #6366f1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --font-display: "Outfit", system-ui, -apple-system, sans-serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ─── SFONDO AMBIENTALE DINAMICO ─── */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 12%, rgba(245, 158, 11, 0.11), transparent 42%),
    radial-gradient(circle at 82% 18%, rgba(225, 29, 72, 0.09), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(99, 102, 241, 0.08), transparent 50%),
    var(--bg-obsidian);
  transition: background-image 0.6s ease;
  pointer-events: none;
}

/* ─── GLASSMORPHISM PANELS ─── */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.glass-header {
  background: rgba(7, 9, 14, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════
   AUTH SCREEN (PASSKEY WEBAUTHN)
════════════════════════════════════════════ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 68px 1.25rem 2rem;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 2.25rem 1.85rem;
  text-align: center;
}

.brand-logo-lg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-crimson));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 12px 30px var(--accent-amber-glow);
}

.brand-logo-lg svg {
  width: 34px;
  height: 34px;
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-brand h1 span {
  color: var(--accent-amber);
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 1.75rem;
}

.auth-section {
  margin-bottom: 1.25rem;
}

.auth-hint,
.auth-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.setup-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-highlight);
  color: var(--accent-amber);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.35rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-fallback-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.4rem;
}

.fallback-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.auth-error {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fda4af;
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════
   TOPBAR & NAVIGATION
════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.8rem 1.75rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-crimson));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-amber-glow);
  flex-shrink: 0;
}

.brand-logo svg {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title em {
  font-style: normal;
  color: var(--accent-amber);
}

.brand-domain {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #fff;
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--border-highlight);
}

.nav-pill {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.global-search-wrap {
  position: relative;
  width: 240px;
  max-width: 100%;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0.48rem 0.85rem 0.48rem 2.2rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  outline: none;
  transition: all 0.2s ease;
}

.global-search-input:focus {
  border-color: var(--accent-amber);
  background: rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════
   BUTTONS & INPUTS
════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.58rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-amber), #ea580c);
  color: #fff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.28);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.28);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.16);
  border-color: rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

.btn-quick-mark {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  flex-shrink: 0;
}

.btn-quick-mark:hover {
  background: var(--accent-emerald);
  color: #fff;
}

.btn-lg {
  padding: 0.78rem 1.35rem;
  font-size: 0.96rem;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.input-field,
.select-field {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.62rem 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
}

.select-field option {
  background: #111827;
  color: #fff;
}

.input-sm {
  padding: 0.48rem 0.75rem;
  font-size: 0.85rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* ═══════════════════════════════════════════
   MAIN LAYOUT & SECTIONS
════════════════════════════════════════════ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 6rem;
}

.notifications-banner {
  max-width: 1400px;
  margin: 1rem auto 0;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(225, 29, 72, 0.15));
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.85rem 0 1rem;
}

.section-header.compact {
  margin: 0 0 0.85rem;
  display: block;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

.section-title-sm {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.section-subtitle,
.section-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ─── HERO SPOTLIGHT ─── */
.hero-spotlight {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
  background-size: cover;
  background-position: center 22%;
}

.hero-spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(7, 9, 14, 0.96) 0%,
    rgba(7, 9, 14, 0.82) 50%,
    rgba(7, 9, 14, 0.35) 100%
  ),
  linear-gradient(0deg, rgba(7, 9, 14, 0.96) 0%, transparent 65%);
}

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

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--border-highlight);
  color: #fde68a;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.65rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 0.45rem;
}

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

.ep-badge-lg {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 0.18rem 0.6rem;
  border-radius: 6px;
}

.hero-progress-wrap {
  margin-bottom: 1.15rem;
  max-width: 460px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-emerald));
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}

.hero-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-family: var(--font-mono);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* ─── STATS STRIP ─── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.85rem;
  margin-top: 1.15rem;
}

.stat-card {
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.15;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ─── WATCHING CARDS GRID ─── */
.watching-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
}

.watching-card {
  display: flex;
  gap: 0.95rem;
  padding: 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s ease, border-color 0.2s ease;
  min-width: 0;
}

.watching-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.35);
}

.watching-poster {
  width: 82px;
  height: 122px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  background: #121826;
}

.watching-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.watching-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.watching-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.ep-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-amber);
}

.watching-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

/* ─── HOME DUAL COLUMNS ─── */
.home-dual-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
  margin-top: 2rem;
}

.home-col {
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

.mini-shows-list,
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mini-show-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.18s;
  min-width: 0;
}

.mini-show-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mini-show-row img {
  width: 42px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.84rem;
  cursor: pointer;
}

/* ═══════════════════════════════════════════
   POSTER GRID & LA MIA LISTA (COMPACT TOOLBAR)
════════════════════════════════════════════ */
.list-toolbar {
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.85rem;
}

.toolbar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.status-tabs,
.provider-pills,
.mood-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tab-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.38rem 0.78rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.tab-pill.active {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
  color: #090c10;
  font-weight: 700;
}

.tab-pill.excluded {
  background: rgba(225, 29, 72, 0.22);
  border-color: var(--accent-crimson);
  color: #fda4af;
  text-decoration: line-through;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 280px;
  justify-content: flex-end;
}

.toolbar-controls .input-field {
  max-width: 240px;
}

.toolbar-selects-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-selects-row .select-field {
  width: auto;
  min-width: 165px;
  padding: 0.46rem 0.7rem;
  font-size: 0.83rem;
}

.list-summary-bar {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

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

.poster-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.poster-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(245, 158, 11, 0.45);
}

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

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

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

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

.badge-affinity {
  padding: 0.18rem 0.48rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(9, 12, 18, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fde047;
}

.badge-affinity.high {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  border-color: transparent;
}

.badge-affinity.voted {
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
}

.badge-tmdb {
  padding: 0.16rem 0.42rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(9, 12, 18, 0.84);
  color: #f8fafc;
}

.poster-status-ribbon {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.35rem 0.55rem;
  background: linear-gradient(0deg, rgba(7, 9, 14, 0.96) 20%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
}

.poster-info {
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  flex: 1;
}

.poster-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-meta {
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.poster-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.prov-chip {
  font-size: 0.66rem;
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

/* ═══════════════════════════════════════════
   DISCOVER (CONSIGLIAMI AI) & ROULETTE
════════════════════════════════════════════ */
.discover-hero {
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.discover-hero h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.2rem;
}

.discover-hero p {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.mood-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.provider-bar-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.rec-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  padding: 1rem;
  gap: 0.8rem;
}

.rec-top {
  display: flex;
  gap: 0.95rem;
}

.rec-poster {
  width: 88px;
  height: 132px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.rec-reason-box {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.8rem;
  color: #fde68a;
}

.rec-overview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rec-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

/* ─── ROULETTE ─── */
.roulette-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.35rem;
}

.roulette-config,
.roulette-stage {
  padding: 1.5rem;
}

.roulette-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.roulette-placeholder {
  text-align: center;
  color: var(--text-secondary);
}

.dice-anim {
  font-size: 3.5rem;
  margin-bottom: 0.6rem;
}

.roulette-prov-details {
  margin-bottom: 1.1rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.roulette-prov-details summary {
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.86rem;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.25s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-amber);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ═══════════════════════════════════════════
   DIARY & VOTES
════════════════════════════════════════════ */
.diary-header {
  padding: 0.9rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.votes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.9rem;
}

.vote-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.vote-card:hover {
  border-color: var(--border-highlight);
}

.vote-score-circle {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.score-high {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.score-mid {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.score-low {
  background: rgba(225, 29, 72, 0.18);
  border: 1px solid rgba(225, 29, 72, 0.45);
  color: #fb7185;
}

/* ═══════════════════════════════════════════
   MODALS (SHOW DETAIL, VOTE, SETTINGS)
════════════════════════════════════════════ */
body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 5, 9, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-container {
  position: relative;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: modalIn 0.22s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.show-modal-card {
  max-width: 960px;
}

.vote-modal-card {
  max-width: 540px;
  padding: 1.5rem;
}

.settings-modal-card {
  max-width: 580px;
  padding: 1.5rem;
}

.modal-close-btn {
  position: sticky;
  top: 0.75rem;
  float: right;
  margin: 0.75rem 0.75rem 0 0;
  z-index: 10;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(9, 12, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-modal-card .modal-close-btn,
.vote-modal-card .modal-close-btn {
  top: 0;
  margin: 0 0 0.35rem 0.5rem;
}

.modal-hero-banner {
  position: relative;
  min-height: 250px;
  background-size: cover;
  background-position: center;
  padding: 1.75rem;
  display: flex;
  align-items: flex-end;
  gap: 1.35rem;
}

.modal-hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #101520 5%, rgba(16, 21, 32, 0.45) 100%);
}

.modal-poster-lg {
  position: relative;
  z-index: 2;
  width: 125px;
  height: 188px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.modal-hero-info {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}

.modal-body-content {
  padding: 1.35rem 1.75rem 1.85rem;
}

/* ─── ACCORDION STAGIONI & EPISODI ─── */
.seasons-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.season-block {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.season-header {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.season-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.episodes-drawer {
  border-top: 1px solid var(--border-subtle);
  padding: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.45rem;
  background: rgba(7, 9, 14, 0.55);
}

.ep-pill-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.79rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.ep-pill-btn:hover {
  border-color: var(--accent-amber);
  color: #fff;
}

.ep-pill-btn.watched {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.35);
  color: #d1fae5;
}

.ep-pill-btn.current-pointer {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--accent-amber);
  color: #fff;
  font-weight: 700;
}

.cast-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.cast-item {
  width: 86px;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.74rem;
}

.cast-item img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.3rem;
  background: #1a2234;
}

/* ─── VOTE GRID 1..10 ─── */
.score-buttons-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin: 0.85rem 0 1.25rem;
}

.score-btn {
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.score-btn.selected {
  background: var(--accent-amber);
  color: #090c10;
  border-color: var(--accent-amber);
}

/* ─── SETTINGS ─── */
.settings-block {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-subtle);
}

.settings-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0.3rem 0 0.8rem;
}

.passkeys-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.84rem;
}

.passkey-add-row {
  display: flex;
  gap: 0.5rem;
}

.settings-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}

/* ─── TOAST NOTIFICATIONS (WITH UNDO) ─── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 400px;
}

.toast {
  padding: 0.85rem 1.05rem;
  border-radius: var(--radius-md);
  background: rgba(15, 21, 34, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  font-size: 0.86rem;
  animation: modalIn 0.2s ease-out;
}

/* ─── MOBILE BOTTOM NAV (Hidden on Desktop) ─── */
.mobile-bottom-nav {
  display: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE MOBILE & iOS STANDALONE PWA
════════════════════════════════════════════ */
@media (max-width: 960px) {
  .desktop-nav {
    display: none;
  }

  .brand-domain {
    display: none;
  }

  /* Topbar fissa: iOS sfoca i primi ~80px dall'alto, quindi partiamo a 86px così i bottoni sono 100% fuori dalla sfocatura */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 95;
    background: #07090e;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 86px 0.75rem 0.55rem 0.75rem;
    padding-top: max(86px, calc(env(safe-area-inset-top, 60px) + 26px));
    gap: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .topbar-left {
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .brand {
    gap: 0.35rem;
  }

  .brand-logo {
    width: 31px;
    height: 31px;
    border-radius: 8px;
    box-shadow: none;
  }

  .brand-logo svg {
    width: 17px;
    height: 17px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .topbar-right {
    flex: 1;
    min-width: 0;
    gap: 0.35rem;
    justify-content: flex-end;
  }

  .global-search-wrap {
    flex: 1;
    width: auto;
    min-width: 75px;
  }

  .global-search-input {
    padding: 0.38rem 0.6rem 0.38rem 1.85rem;
    font-size: 0.8rem;
  }

  .search-icon {
    left: 0.55rem;
    width: 14px;
    height: 14px;
  }

  .btn-quick-mark {
    padding: 0.38rem 0.6rem;
    font-size: 0.76rem;
    flex-shrink: 0;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  /* Contenuto principale distanziato dalla topbar fissa (86px + ~48px = 138px) e dalla bottom-nav */
  .main-content {
    padding: 138px 0.85rem calc(74px + env(safe-area-inset-bottom, 0px)) 0.85rem;
    padding-top: max(138px, calc(env(safe-area-inset-top, 60px) + 82px));
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .view-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .notifications-banner {
    margin: 138px 0.85rem -122px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-spotlight {
    padding: 1.15rem;
    min-height: 220px;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    flex: 1;
    padding: 0.6rem 0.7rem;
    font-size: 0.82rem;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .stat-card {
    padding: 0.7rem 0.75rem;
    gap: 0.55rem;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.08rem;
  }

  .watching-cards-grid,
  .recs-grid,
  .votes-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .watching-card {
    padding: 0.8rem;
    gap: 0.75rem;
  }

  .home-dual-columns,
  .roulette-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.35rem 0 0.75rem;
  }

  /* ─── LA MIA LISTA ULTRA-COMPATTA SU MOBILE (SENZA TAGLI A DESTRA) ─── */
  .list-toolbar {
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.65rem;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .toolbar-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Riga 1: tab stato scorrevoli in orizzontale dentro il contenitore largo 100% */
  #list-status-tabs,
  #archive-status-tabs,
  #discover-mood-pills {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  #list-status-tabs::-webkit-scrollbar,
  #archive-status-tabs::-webkit-scrollbar,
  #discover-mood-pills::-webkit-scrollbar {
    display: none;
  }

  .mood-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Riga 2 e 3: Ricerca + 2 menu a tendina affiancati esattamente 50%/50% */
  .toolbar-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 0.45rem;
  }

  .toolbar-controls .input-field,
  .toolbar-controls .select-field {
    width: 100%;
    max-width: 100% !important;
    min-width: 0;
    padding: 0.42rem 0.7rem;
    font-size: 0.82rem;
  }

  .toolbar-selects-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .toolbar-selects-row .select-field {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.42rem 0.5rem;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .discover-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  /* ─── BARRA INFERIORE A FILO BORDO SCHERMO ─── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 95;
    justify-content: space-around;
    align-items: center;
    background: #080b12;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    padding: 0.35rem 0.15rem max(0.35rem, env(safe-area-inset-bottom, 0px));
  }

  .mob-nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-family: var(--font-sans);
    font-size: 0.63rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.15rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
  }

  .mob-nav-item .mob-icon {
    font-size: 1.08rem;
  }

  .mob-nav-item.active {
    color: var(--accent-amber);
  }

  .toast-container {
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
  }

  .modal-backdrop {
    padding: max(88px, calc(env(safe-area-inset-top, 60px) + 22px)) 0.85rem max(24px, calc(env(safe-area-inset-bottom, 20px) + 12px)) 0.85rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .modal-container {
    width: 100%;
    max-height: calc(100dvh - 120px);
    border-radius: var(--radius-lg);
    margin: auto;
  }

  .settings-modal-card,
  .vote-modal-card {
    padding: 1.2rem;
  }

  .settings-content h2 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .passkey-add-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .passkey-add-row .btn {
    width: 100%;
  }

  .settings-footer .btn {
    width: 100%;
  }

  .modal-hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.15rem;
  }

  .modal-poster-lg {
    width: 88px;
    height: 132px;
  }

  .modal-body-content {
    padding: 1rem;
  }
}
