/* ══════════════════════════════════════════════════════════════════
   NOVA Streaming — NetFlop Design System
   ══════════════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────────────────────────── */
:root {
  /* NetFlop Colors */
  --bg: #0a0506;
  --bg-elevated: #120809;
  --surface: #1a0d0f;
  --surface-hover: #221214;
  --surface-light: #2a1d20;
  --border: #331a1d;
  --border-hover: #e50914;
  
  --primary: #e50914;
  --primary-hover: #ff252f;
  --primary-dim: rgba(229, 9, 20, 0.15);
  --primary-glow: rgba(229, 9, 20, 0.4);
  
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #808080;
  --text-dim: #555555;
  
  --success: #46d369;
  --warning: #ffcc00;
  --error: #f40612;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-xl: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
  
  /* Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  
  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 350ms;
  
  /* Layout */
  --header-h: 64px;
  --max-width: 1440px;
  --content-pad: 24px;
}

@media (min-width: 1024px) {
  :root {
    --header-h: 72px;
    --content-pad: 32px;
  }
}

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

html {
  background: var(--bg);
  height: 100%;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ── SCROLLBAR ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #331a1d; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
::-webkit-scrollbar-corner { background: transparent; }

html { scrollbar-width: thin; scrollbar-color: #331a1d transparent; }

/* ── SELECTION ─────────────────────────────────────────────────── */
::selection { background: var(--primary); color: #fff; }
::-moz-selection { background: var(--primary); color: #fff; }

/* ── FOCUS ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── TYPOGRAPHY ────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.1; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img, video { display: block; max-width: 100%; height: auto; }
input, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }

/* ── UTILITY CLASSES ───────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }

/* ── HEADER ────────────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: linear-gradient(180deg, rgba(10,5,6,0.95) 0%, rgba(10,5,6,0.8) 60%, transparent 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.header.scrolled {
  background: rgba(10,5,6,0.98);
  box-shadow: 0 1px 0 var(--border), 0 4px 20px rgba(0,0,0,0.4);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 32px;
  padding: 0 var(--content-pad);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-icon { width: 36px; height: 36px; flex-shrink: 0; }
.brand-text { font-size: clamp(18px, 2.5vw, 24px); font-weight: 900; letter-spacing: 0; color: var(--primary); }

.nav-main { display: none; gap: 4px; }
.nav-link {
  font-size: 14px; font-weight: 550; color: var(--text-secondary);
  padding: 8px 16px; border-radius: var(--radius);
  transition: color var(--dur-fast), background var(--dur-fast);
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); font-weight: 700; }
@media (min-width: 768px) { .nav-main { display: flex; } }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--text); background: var(--surface); transform: scale(1.05); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn[hidden] { display: none; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: -32px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 500; color: var(--text);
  background: var(--surface-light); padding: 4px 10px; border-radius: var(--radius-sm);
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
  z-index: 200;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ── OVERLAY BASE ──────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,5,6,0.96);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; padding: calc(var(--header-h) + 24px) var(--content-pad) 40px;
  overflow-y: auto;
  animation: overlayIn var(--dur-base) var(--ease-out);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.overlay .panel { width: 100%; max-width: 800px; }
.overlay .panel-wide { max-width: 1100px; }

.panel {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 24px; max-height: calc(100vh - var(--header-h) - 80px);
  overflow-y: auto;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-header h2 { font-size: 22px; font-weight: 800; letter-spacing: 0; }
.panel-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-muted);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.panel-close:hover { color: var(--text); background: var(--surface-hover); }
.panel-close svg { width: 20px; height: 20px; }

/* ── TAG CLOUD ─────────────────────────────────────────────────── */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 10px 20px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 550;
  background: var(--surface-hover); border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--dur-base) var(--ease-out);
  cursor: pointer;
}
.tag:hover { background: var(--primary); border-color: var(--primary); color: #fff; transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 20px var(--primary-glow); }
.tag:active { transform: scale(0.97); }

/* ── EMPTY STATE ───────────────────────────────────────────────── */
.empty-state {
  color: var(--text-dim); text-align: center; padding: 60px 20px;
  font-size: 14.5px; line-height: 1.6;
}

/* ── SEARCH ────────────────────────────────────────────────────── */
.search-container { width: 100%; max-width: 640px; animation: slideDown var(--dur-base) var(--ease-out); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: none; } }

.search-box {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 16px 20px;
  margin-bottom: 24px; transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.search-icon { flex-shrink: 0; color: var(--text-dim); width: 22px; height: 22px; }
.search-box input { flex: 1; font-size: 17px; color: var(--text); }
.search-box input::placeholder { color: var(--text-dim); }
.search-hint {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  background: var(--surface-light); padding: 3px 10px; border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.search-results { max-height: calc(100vh - 240px); overflow-y: auto; }
.search-result-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: var(--radius);
  transition: background var(--dur-fast);
  role: option;
}
.search-result-item:hover { background: var(--surface-hover); }
.search-result-item img { width: 48px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; background: var(--surface-light); }
.search-result-item .info { flex: 1; min-width: 0; }
.search-result-item .info b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-item .info small { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ── HERO ──────────────────────────────────────────────────────── */
.hero {
  position: relative; height: clamp(520px, 78vh, 860px); min-height: 520px;
  display: flex; align-items: flex-end; overflow: hidden;
  background: var(--bg);
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center 20%;
  filter: saturate(1.16) contrast(1.04);
  transition: opacity 0.8s var(--ease-out), transform 1.2s var(--ease-out);
}
.hero-bg::after { content: ''; position: absolute; inset: 0; background: inherit; filter: blur(80px); opacity: 0.3; z-index: -1; }
.hero-gradient {
  position: absolute; inset: 0; z-index: 1;
  background: 
    radial-gradient(circle at 70% 30%, rgba(229,9,20,0.12), transparent 28%),
    linear-gradient(180deg, rgba(0,0,0,0.08) 0%, rgba(10,5,6,0.35) 46%, var(--bg) 100%),
    linear-gradient(90deg, var(--bg) 0%, rgba(10,5,6,0.86) 34%, rgba(10,5,6,0.22) 72%, transparent 100%);
}
.hero-content {
  position: relative; z-index: 2; padding: 0 var(--content-pad) clamp(72px, 12vh, 112px);
  max-width: 680px; width: 100%;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: 16px;
}
.hero-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.hero-title {
  font-size: clamp(36px, 5.5vw, 72px); font-weight: 900; line-height: 0.95;
  letter-spacing: 0; margin-bottom: 14px;
  text-shadow: 0 4px 30px rgba(0,0,0,0.7);
}
.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text-secondary); margin-bottom: 16px;
}
.hero-meta .score { color: var(--success); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.hero-meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); }
.hero-desc {
  font-size: 15px; line-height: 1.7; color: #ccc;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--radius); font-weight: 600;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary {
  padding: 14px 32px; font-size: 15.5px;
  background: #fff; color: #000;
  box-shadow: 0 4px 20px rgba(255,255,255,0.1);
}
.btn-primary:hover { background: #f5f5f5; transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255,255,255,0.15); }
.btn-secondary {
  padding: 14px 28px; font-size: 15px;
  background: rgba(255,255,255,0.1); color: var(--text);
  backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.2); }
.btn-ghost { padding: 10px 20px; font-size: 14px; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn-icon svg { width: 22px; height: 22px; }

/* ── MAIN CONTENT ──────────────────────────────────────────────── */
.main-content { flex: 1; }
.content { max-width: var(--max-width); margin: -18px auto 0; padding: 0 var(--content-pad) 80px; position: relative; z-index: 5; }

.section { margin-bottom: 40px; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: 0; }
.section-link { font-size: 13px; color: var(--text-muted); transition: color var(--dur-fast); }
.section-link:hover { color: var(--primary); }

/* ── RAIL (Horizontal Scroll) ──────────────────────────────────── */
.rail {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-padding: 0 var(--content-pad);
  padding: 8px var(--content-pad) 16px; margin: -8px calc(-1 * var(--content-pad)) -8px;
  -webkit-overflow-scrolling: touch;
  contain: layout paint;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex-shrink: 0; scroll-snap-align: start; }

/* ── CARD ──────────────────────────────────────────────────────── */
.card {
  --card-w: 180px;
  width: var(--card-w); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
  position: relative; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03);
  transition: transform var(--dur-slow) var(--ease-spring), 
              box-shadow var(--dur-slow) var(--ease-out),
              z-index 0s;
  will-change: transform;
}
.card:hover { transform: scale(1.075) translateY(-8px); z-index: 20; box-shadow: var(--shadow-xl); }
@media (min-width: 768px) { .card { --card-w: 190px; } }
@media (min-width: 1024px) { .card { --card-w: 200px; } }
@media (min-width: 1440px) { .card { --card-w: 210px; } }

.card-poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  background: var(--surface-light); transition: filter var(--dur-slow) var(--ease-out);
}
.poster-fallback .card-poster { object-fit: cover; opacity: 0.72; }
.card:hover .card-poster { filter: brightness(0.55) saturate(1.2); }

.card-overlay {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(180deg, transparent 28%, rgba(0,0,0,0.42) 58%, rgba(0,0,0,0.96) 100%);
  opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 16px;
}
.card:hover .card-overlay { opacity: 1; }

.card-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.card-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card-actions { display: flex; gap: 8px; }
.card-action {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.12); backdrop-filter: blur(8px);
  display: grid; place-items: center; color: var(--text);
  transition: all var(--dur-fast) var(--ease-out);
  border: 1px solid rgba(255,255,255,0.05);
}
.card-action:hover { background: var(--primary); transform: scale(1.1); box-shadow: 0 4px 16px var(--primary-glow); }
.card-action:active { transform: scale(0.95); }
.card-action.saved { color: var(--primary); }
.card-action svg { width: 16px; height: 16px; }

.card-badge {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
}
.card-badge.episode { background: rgba(0,0,0,0.8); color: var(--text); backdrop-filter: blur(4px); }
.card-year {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  background: rgba(0,0,0,0.75); color: #ddd; border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

/* ── CARD GRID ─────────────────────────────────────────────────── */
.card-grid { display: grid; gap: 14px; }
@media (max-width: 480px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 481px) and (max-width: 768px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 769px) and (max-width: 1024px) { .card-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1025px) and (max-width: 1440px) { .card-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1441px) { .card-grid { grid-template-columns: repeat(7, 1fr); } }
.card-grid .card { width: 100%; --card-w: 100%; }

/* ── SKELETON ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-lg);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel-card { width: 100%; aspect-ratio: 2/3; border-radius: var(--radius-lg); }

/* ── MODAL ─────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); animation: fadeIn var(--dur-base); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 900px; max-height: 92vh;
  background: var(--bg); border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: var(--shadow-xl); animation: modalIn var(--dur-slow) var(--ease-out);
  display: flex; flex-direction: column;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 50;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: var(--text);
  display: grid; place-items: center; backdrop-filter: blur(8px);
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.modal-close:hover { background: var(--primary); transform: scale(1.04); }
.modal-close svg { width: 22px; height: 22px; }

.modal-banner { position: relative; height: 360px; overflow: hidden; }
@media (max-width: 768px) { .modal-banner { height: 240px; } }
.modal-banner img { width: 100%; height: 100%; object-fit: cover; }
.banner-gradient { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--bg) 100%); }

.modal-body { padding: 0 32px 32px; margin-top: -70px; position: relative; flex: 1; overflow-y: auto; max-height: calc(92vh - 360px); }
@media (max-width: 768px) { .modal-body { padding: 0 20px 24px; margin-top: -50px; max-height: calc(92vh - 240px); } }

.detail-title { font-size: clamp(24px, 3.5vw, 34px); font-weight: 900; margin-bottom: 12px; letter-spacing: 0; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; }
.detail-meta .score { color: var(--success); font-weight: 700; }
.detail-meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); }

.detail-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-content { font-size: 14.5px; line-height: 1.75; color: var(--text-secondary); max-height: 80px; overflow: hidden; transition: max-height var(--dur-slow) var(--ease-out); }
.detail-content.expanded { max-height: 1000px; }
.detail-more { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-top: 8px; cursor: pointer; transition: color var(--dur-fast); display: inline-flex; align-items: center; gap: 4px; }
.detail-more:hover { color: var(--primary); }
.detail-more::after { content: ''; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; transition: transform var(--dur-fast); }
.detail-more.open::after { transform: rotate(180deg); }

.detail-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; font-size: 13.5px; margin: 24px 0; padding-top: 24px; border-top: 1px solid var(--border); }
.detail-info dt { color: var(--text-muted); font-weight: 500; }
.detail-info dd { color: var(--text-secondary); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-episodes { border-top: 1px solid var(--border); padding-top: 24px; }
.episodes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.episodes-header h3 { font-size: 16px; font-weight: 700; }
.server-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.server-tab {
  padding: 8px 18px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all var(--dur-base) var(--ease-out);
}
.server-tab:hover { border-color: var(--primary); color: var(--text); }
.server-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.episode-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.episode-btn {
  min-width: 68px; padding: 10px 14px; border-radius: var(--radius);
  font-size: 12.5px; font-weight: 600; text-align: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-out);
}
.episode-btn:hover { border-color: var(--primary); color: var(--text); transform: translateY(-2px); }
.episode-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.episode-btn:active { transform: scale(0.97); }

/* ── CUSTOM PLAYER ─────────────────────────────────────────────── */
.player-modal { position: fixed; inset: 0; z-index: 400; background: #000; display: flex; flex-direction: column; }
.player-root { flex: 1; display: flex; flex-direction: column; background: #000; }

.player-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; min-height: 64px;
  padding: max(14px, env(safe-area-inset-top)) 24px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.34) 68%, transparent 100%);
  pointer-events: none;
}
.player-back { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 14.5px; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.12); transition: color var(--dur-fast), background var(--dur-fast); pointer-events: auto; }
.player-back:hover { color: var(--text); background: rgba(255,255,255,0.2); }
.player-back svg { width: 20px; height: 20px; }
.player-heading { min-width: 0; display: flex; align-items: baseline; gap: 8px; text-shadow: 0 2px 18px rgba(0,0,0,0.9); }
.player-title { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-episode { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.player-stage { flex: 1; position: relative; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; min-height: 100dvh; touch-action: manipulation; }
.player-video,
.player-embed { position: relative; z-index: 1; width: 100%; height: 100%; max-height: 100%; object-fit: contain; border: 0; background: #000; }
.player-stage:fullscreen,
.player-stage:-webkit-full-screen { width: 100vw; height: 100vh; min-height: 100vh; }
.player-stage:fullscreen .player-video,
.player-stage:fullscreen .player-embed,
.player-stage:-webkit-full-screen .player-video,
.player-stage:-webkit-full-screen .player-embed { width: 100vw; height: 100vh; max-width: none; max-height: none; }
.player-stage.is-embed .player-controls { opacity: 0; pointer-events: none; }
.player-stage.is-embed .progress-wrap,
.player-stage.is-embed [data-play-btn],
.player-stage.is-embed [data-rewind-btn],
.player-stage.is-embed [data-forward-btn],
.player-stage.is-embed [data-volume-group],
.player-stage.is-embed [data-speed-group],
.player-stage.is-embed [data-pip-btn] { display: none; }
.player-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.9); z-index: 10; transition: opacity var(--dur-base); }
.player-loading.hidden { opacity: 0; pointer-events: none; }
.loader-ring { width: 48px; height: 48px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 40;
  padding: 16px 24px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, transparent 100%);
  opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}
.player-stage:hover .player-controls,
.player-controls.visible { opacity: 1; pointer-events: auto; }

.controls-row { display: flex; align-items: center; gap: 12px; }
.progress-wrap { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; touch-action: none; }
.progress-bar { flex: 1; height: 5px; background: rgba(255,255,255,0.2); border-radius: 999px; position: relative; overflow: visible; }
.progress-bar::before { content: ''; position: absolute; left: 0; right: 0; top: -18px; bottom: -18px; }
.progress-buffer,
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 100%; transform: scaleX(0); transform-origin: left center; border-radius: inherit; will-change: transform; }
.progress-buffer { background: rgba(255,255,255,0.32); }
.progress-fill { background: var(--primary); }
.progress-handle { position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%) scale(0); width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.4); transition: transform var(--dur-fast); }
.progress-bar:hover .progress-handle { transform: translate(-50%, -50%) scale(1); }
.progress-bar:focus-within .progress-handle { transform: translate(-50%, -50%) scale(1); }
.time-display { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 90px; text-align: right; }

.controls-right { display: flex; align-items: center; gap: 8px; }
.control-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; background: rgba(255,255,255,0.1); display: grid; place-items: center; color: var(--text); transition: background var(--dur-fast), transform var(--dur-fast), color var(--dur-fast); touch-action: manipulation; }
.control-btn:hover { background: var(--primary); transform: scale(1.1); }
.control-btn svg { width: 20px; height: 20px; }
.control-btn .pause-icon { display: none; }
.control-btn.is-playing .play-icon { display: none; }
.control-btn.is-playing .pause-icon { display: block; }
.control-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.control-btn[disabled]:hover { background: rgba(255,255,255,0.1); transform: none; }

.volume-group { position: relative; display: flex; align-items: center; }
.volume-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.1); display: grid; place-items: center; }
.volume-slider { position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%); width: 112px; height: 24px; -webkit-appearance: none; appearance: none; background: transparent; border-radius: 2px; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast); z-index: 45; cursor: pointer; }
.volume-group:hover .volume-slider,
.volume-group:focus-within .volume-slider { opacity: 1; pointer-events: auto; }
.volume-slider::-webkit-slider-runnable-track { height: 4px; background: rgba(255,255,255,0.24); border-radius: 999px; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.3); margin-top: -5px; }
.volume-slider::-moz-range-track { height: 4px; background: rgba(255,255,255,0.24); border-radius: 999px; }
.volume-slider::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

.speed-group { position: relative; }
.speed-menu { position: absolute; bottom: 50px; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-width: 132px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: all var(--dur-fast); z-index: 30; box-shadow: var(--shadow-lg); }
.speed-group:hover .speed-menu,
.speed-menu:not([hidden]) { opacity: 1; pointer-events: auto; transform: translateY(0); }
.speed-item { display: block; width: 100%; padding: 10px 16px; font-size: 13px; text-align: left; border-radius: var(--radius-sm); color: var(--text-secondary); transition: background var(--dur-fast), color var(--dur-fast); }
.speed-item:hover, .speed-item.active { background: var(--primary); color: #fff; }

.player-embed-fullscreen {
  position: absolute;
  right: 24px;
  top: max(14px, env(safe-area-inset-top));
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.player-embed-fullscreen.visible {
  opacity: 1;
  pointer-events: auto;
}

.episode-nav { display: flex; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); overflow-x: auto; padding-bottom: 4px; }
.episode-nav-btn { flex-shrink: 0; padding: 8px 14px; border-radius: var(--radius); font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.08); border: 1px solid transparent; color: var(--text-secondary); transition: all var(--dur-fast); white-space: nowrap; }
.episode-nav-btn:hover { border-color: var(--primary); color: var(--text); }
.episode-nav-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Fullscreen */
.player-modal:fullscreen { background: #000; }
.player-modal:-webkit-full-screen { background: #000; }

/* ── FOOTER ────────────────────────────────────────────────────── */
footer { padding: 40px var(--content-pad) 30px; border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.footer-inner svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ── TOAST ─────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: toastIn var(--dur-base) var(--ease-out); max-width: 360px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: none; } }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-message { flex: 1; font-size: 13.5px; color: var(--text); }
.toast-close { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); }
.toast-close:hover { color: var(--text); background: var(--surface-hover); }

/* ── GLOBAL LOADER ─────────────────────────────────────────────── */
.global-loader { position: fixed; inset: 0; z-index: 999; background: var(--bg); display: grid; place-items: center; transition: opacity var(--dur-slow), visibility var(--dur-slow); }
.global-loader.done { opacity: 0; visibility: hidden; }
.global-loader .loader-ring { width: 60px; height: 60px; }

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .header-inner { gap: 16px; }
  .brand-text { font-size: 18px; }
  .hero-content { padding-bottom: 70px; }
  .hero-title { font-size: 34px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .modal-body { padding: 0 20px 24px; }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; }
  .detail-info { grid-template-columns: max-content 1fr; }
  .content { margin-top: -8px; }
  .card:hover { transform: none; }
  .player-header { padding: max(10px, env(safe-area-inset-top)) 12px 14px; min-height: 56px; }
  .player-back span { display: none; }
  .player-heading { display: block; }
  .player-title { display: block; max-width: 64vw; }
  .player-episode { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 64vw; }
  .player-controls { padding: 12px 12px max(14px, env(safe-area-inset-bottom)); }
  .controls-row { flex-wrap: wrap; gap: 8px; }
  .progress-wrap { order: 3; width: 100%; }
  .controls-right { width: 100%; justify-content: center; gap: 6px; }
  .time-display { min-width: 70px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* ── ACCESSIBILITY ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── PRINT ─────────────────────────────────────────────────────── */
@media print { .header, .player-modal, .modal, .overlay, footer { display: none !important; } .main-content { padding-top: 0; } }
