/* =========================================================
   Wholley — design system
   ========================================================= */
:root {
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-soft: #eef0f3;
  --text: #14161a;
  --text-muted: #6b7280;
  --border: #e4e7ec;
  --accent: #e50914;
  --accent-hover: #ff1f2b;
  --accent-contrast: #ffffff;
  --shadow: 0 8px 24px rgba(15, 18, 25, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 18, 25, 0.18);
  --overlay-bg: rgba(15, 18, 25, 0.55);

  --nav-h: 64px;
  --tabbar-h: 60px;
  --card-w: clamp(120px, 30vw, 168px);
  --page-max: 1440px;
  --gutter: clamp(14px, 3.2vw, 32px);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

html[data-theme="dark"] {
  --bg: #0d0f14;
  --bg-elevated: #161a22;
  --bg-soft: #1e232d;
  --text: #f2f4f8;
  --text-muted: #98a0ad;
  --border: #262c38;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --overlay-bg: rgba(5, 6, 9, 0.72);
}

* { margin: 0; padding: 0; box-sizing: border-box; min-width: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* fallback for older browsers */
  overflow-x: clip;
  overflow-wrap: anywhere;
}

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 999px;
  border: 3px solid var(--bg);
}
body::-webkit-scrollbar-thumb:hover { background: var(--accent); }

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
}

body.no-scroll { overflow: hidden; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
img { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.skip-link:focus { left: 12px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- Navbar ---------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.28s ease;
}
.navbar.nav-hidden { transform: translateY(-100%); }

.navbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 calc(var(--gutter) + var(--safe-l)) 0 calc(var(--gutter) + var(--safe-r));
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: clamp(17px, 2vw, 20px);
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}
.logo:hover { color: var(--accent); }

.logo-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: var(--accent-contrast);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.logo:hover .logo-mark {
  transform: scale(1.06);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.logo-mark i { font-size: 12px; transform: translateX(1px); }

.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.nav-tab i { font-size: 13px; }
.nav-tab:hover { color: var(--text); background: var(--bg-soft); }
.nav-tab.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.navbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

/* ---------------- Search (navbar popup) ---------------- */
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--text); background: var(--bg-soft); }
.search-clear svg { width: 14px; height: 14px; }

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--overlay-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.search-backdrop.open { opacity: 1; visibility: visible; }

.search-popup {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  left: 50%;
  z-index: 910;
  width: min(720px, calc(100% - 24px));
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%) translateY(-8px) scale(0.99);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}
.search-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

.search-popup-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.search-popup-input {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.search-popup-input .search-icon {
  left: 15px;
  width: 18px;
  height: 18px;
  transition: color 0.15s ease;
}
.search-popup-input:focus-within .search-icon { color: var(--accent); }
.search-popup-input input {
  width: 100%;
  min-width: 0;
  padding: 12px 46px 12px 46px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: clamp(15px, 2vw, 17px);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.search-popup-input input::placeholder { color: var(--text-muted); }
.search-popup-input input::-webkit-search-cancel-button { display: none; }
.search-popup-input input:focus {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search-popup-input .search-clear {
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.search-popup-input .search-clear:hover { background: var(--accent); color: #fff; }
.search-popup-input .search-clear:active { transform: scale(0.9); }

.search-popup-close { color: var(--text); }
.search-popup-close:hover { color: var(--accent); }

.search-popup-body {
  max-height: min(62vh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.search-popup-body::-webkit-scrollbar { width: 8px; }
.search-popup-body::-webkit-scrollbar-track { background: transparent; }
.search-popup-body::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }

.search-suggest { display: flex; flex-direction: column; gap: 22px; padding-top: 16px; }
.search-section { display: flex; flex-direction: column; gap: 14px; }
.search-suggest-head { display: flex; align-items: center; gap: 10px; }
.search-popup-body > .search-suggest-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -16px 12px;
  padding: 12px 16px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.search-popup-body > .search-suggest-head::after { display: none; }
.search-suggest-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.search-suggest-head::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

.search-popup-body .grid { padding-top: 0; }

.icon-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--bg-elevated);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.icon-btn svg { width: 18px; height: 18px; }

.discord-btn { text-decoration: none; }
.discord-btn i { font-size: 18px; color: #5865F2; }
.discord-btn:hover i { color: #7b88ff; }

.search-toggle { display: grid; }

.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle svg {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -9px 0 0 -9px;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
}
html[data-theme="dark"] .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
html[data-theme="dark"] .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.4); }
html[data-theme="light"] .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.4); }
html[data-theme="light"] .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ---------------- Bottom tab bar (small screens) ---------------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  padding: 6px calc(6px + var(--safe-l)) calc(6px + var(--safe-b)) calc(6px + var(--safe-r));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.tabbar-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.tabbar-item i { font-size: 17px; }
.tabbar-item span { white-space: nowrap; }
.tabbar-item.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---------------- Footer ---------------- */
/* ---------------- Layout ---------------- */
#main { min-height: 60vh; flex: 1 1 auto; }

.view {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 calc(var(--gutter) + var(--safe-l)) 72px calc(var(--gutter) + var(--safe-r));
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  min-height: 46px;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: var(--accent-contrast);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 52%, transparent);
  transform: translateY(-1px);
}
.btn-primary.disabled,
.btn-primary[disabled] {
  background: var(--text-muted);
  color: var(--bg);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover {
  background: var(--text-muted);
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}

/* ================= Branded loading screen ================= */
.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background-color: var(--bg);
  background-image:
    radial-gradient(60% 55% at 18% 12%, rgba(229, 9, 20, 0.14), transparent 62%),
    radial-gradient(50% 50% at 85% 88%, rgba(59, 130, 246, 0.1), transparent 62%),
    radial-gradient(120% 130% at 50% 50%, rgba(229, 9, 20, 0.08), transparent 55%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.boot-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 20%;
  background: linear-gradient(90deg, transparent, var(--accent-hover), var(--accent), transparent);
  box-shadow: 0 0 12px rgba(229, 9, 20, 0.5);
  animation: loaderBar 1.4s ease-in-out infinite;
}
.boot-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-loader.hidden .brand-loader { transform: scale(1.06); }

.brand-loader {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text);
  transition: transform 0.5s ease;
}
.brand-loader > * {
  opacity: 0;
  animation: loaderUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.brand-loader-name { animation-delay: 0.05s; }
.brand-loader-dots { animation-delay: 0.18s; }

.brand-loader-name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .brand-loader-name {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}
.brand-loader-dots {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}
.brand-loader-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: loaderDot 1.2s ease-in-out infinite;
}
.brand-loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.brand-loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes loaderDot {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes loaderBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(520%); }
}

/* ================= Adblock warning ================= */
.adblock-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.adblock-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}
.adblock-icon { font-size: 48px; margin-bottom: 12px; color: var(--accent); }
.adblock-modal h2 { margin: 0 0 12px; font-size: 22px; color: var(--text); }
.adblock-modal p { margin: 0 0 16px; color: var(--text-muted); line-height: 1.5; font-size: 15px; }
.adblock-modal p:last-of-type { margin-bottom: 24px; }
.adblock-modal .btn { width: 100%; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  width: 100%;
  height: clamp(340px, 56vh, 600px);
  overflow: hidden;
  border-radius: 20px;
  margin: 18px 0 8px;
  background: var(--bg-soft);
  box-shadow: var(--shadow-lg), 0 24px 60px rgba(0, 0, 0, 0.28);
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 25%;
  animation: heroZoom 26s ease-in-out infinite alternate;
}
.hero-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 40%, rgba(0, 0, 0, 0.08) 100%),
    linear-gradient(to right, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.28) 42%, rgba(0, 0, 0, 0.02) 72%);
}
.hero-fallback { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }

.hero-carousel { position: absolute; inset: 0; }
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.hero-slide.active { opacity: 1; visibility: visible; }

.hero-carousel,
.hero-slide { cursor: pointer; }

.hero-content {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  width: 100%;
  max-width: min(760px, 100%);
  padding: clamp(20px, 3.5vw, 48px) clamp(18px, 3.5vw, 44px) 54px;
  color: #fff;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease 0.15s, transform 0.7s ease 0.15s;
}
.hero-slide.active .hero-content { opacity: 1; transform: none; }

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  transition: background 0.25s ease, width 0.25s ease, transform 0.25s ease;
}
.hero-dot:hover { background: rgba(255, 255, 255, 0.85); }
.hero-dot.active { background: var(--accent); width: 18px; transform: none; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 13px;
  box-shadow: 0 6px 18px rgba(229, 9, 20, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.hero-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: badgePulse 1.6s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(26px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.6);
}

.hero-overview {
  font-size: clamp(13px, 1.5vw, 15px);
  color: rgba(255, 255, 255, 0.86);
  max-width: 62ch;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@keyframes heroZoom {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}
@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------- Rows ---------------- */
.rows {
  display: flex;
  flex-direction: column;
  gap: clamp(26px, 3.5vw, 42px);
  padding-top: 26px;
}

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

.row-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(17px, 2.2vw, 21px);
  font-weight: 800;
  letter-spacing: -0.02em;
  min-width: 0;
}
.row-title::before {
  content: '';
  flex: 0 0 auto;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
}

.row-viewport { position: relative; }

.row-scroller {
  display: flex;
  align-items: stretch;
  gap: clamp(10px, 1.4vw, 16px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.row-scroller::-webkit-scrollbar { height: 6px; }
.row-scroller::-webkit-scrollbar-track { background: transparent; }
.row-scroller::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
}

.row-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.scroll-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  font-size: 14px;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.15s ease;
}
.scroll-arrow:hover { transform: scale(1.08); }
.scroll-arrow.disabled { opacity: 0; visibility: hidden; pointer-events: none; }
@media (hover: none), (max-width: 720px) { .scroll-arrow { display: none; } }

/* ---------------- Sports ---------------- */
.sport-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sport-chips::-webkit-scrollbar { display: none; }

.sport-chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sport-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.sport-chip.active {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: var(--accent-contrast);
  border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.sport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
}
.sport-card-skeleton { min-height: 148px; border-radius: var(--radius); }

.sport-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.sport-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.sport-card-top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 18px; }
.sport-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.sport-live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: badgePulse 1.3s ease-in-out infinite;
}
.sport-detail { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.sport-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.sport-team { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.sport-team img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; }
.sport-badge-fallback {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 16px;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-soft), color-mix(in srgb, var(--accent) 12%, var(--bg-soft)));
}
.sport-team-name { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2; color: var(--text); }
.sport-vs { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sport-vs-label { color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sport-score { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.sport-time { font-size: 11px; color: var(--accent); font-weight: 600; white-space: nowrap; }

.player-source-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.player-source-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-soft));
}
.player-source-toggle-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-source-toggle-hint {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.source-grid { grid-template-columns: 1fr; }
.source-grid .filter-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 0; }
.source-grid .filter-option > i:first-child { font-size: 15px; color: var(--text-muted); flex: 0 0 auto; }
.source-grid .filter-option.active > i:first-child { color: var(--accent); }
.filter-option-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.4;
  white-space: normal;
}
.source-grid .filter-option-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.source-grid .filter-option-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}
.source-grid .filter-option > i.fa-check {
  flex: 0 0 auto;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.source-grid .filter-option.active > i.fa-check { opacity: 1; transform: scale(1); color: var(--accent); }
.filter-popup-sub { margin: -6px 0 14px; font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Cards ---------------- */
.card {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.18s ease;
  text-align: left;
  padding: 0;
}
.card:hover { transform: translateY(-6px); }
.card:active { transform: scale(0.98); }

img {
  -webkit-user-drag: none;
  user-drag: none;
}
.card,
.card * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.grid .card { flex: 1 1 auto; width: 100%; }

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}
.card:hover .card-poster {
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 14px 30px rgba(15, 18, 25, 0.18);
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.card:hover .card-poster img { transform: scale(1.07); }

.card-poster .placeholder,
.detail-poster .placeholder,
.episode-card-top .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-soft), color-mix(in srgb, var(--accent) 12%, var(--bg-soft)));
}

.card-vote, .card-type {
  position: absolute;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.card-vote { top: 8px; left: 8px; font-size: 11px; }
.card-vote .rating-star { color: #ffd700; }
.card-type { bottom: 8px; right: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.card-type.movie { background: var(--accent); }
.card-type.tv { background: #8b5cf6; }

.card-progress {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: #f59e0b;
  color: #1a1403;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.card-progress i { font-size: 8px; }

.detail-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f59e0b;
  color: #1a1403;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.detail-progress i { font-size: 9px; }

.card-title {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------------- Page header + grid ---------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 26px 0 16px;
}

.page-title {
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  min-width: 0;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.filter-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.filter-btn i { font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: clamp(10px, 1.6vw, 18px);
  align-items: stretch;
}

.grid-sentinel { height: 1px; }

/* ---------------- Skeletons ---------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  border-radius: var(--radius);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-poster { aspect-ratio: 2 / 3; width: 100%; }
.row-scroller .skeleton-poster { flex: 0 0 var(--card-w); width: var(--card-w); }

/* ---------------- Modals ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(0px, 2vw, 24px);
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  position: relative;
  width: min(960px, 100%);
  max-height: min(92dvh, 1000px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.985);
  transition: transform 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.modal-overlay.open .modal { transform: none; }
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 18, 25, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.modal-close:hover { background: var(--accent); border-color: transparent; transform: scale(1.08); }
.modal-close:active { transform: scale(0.94); }
.modal-close svg { width: 17px; height: 17px; stroke-width: 2.5; }

.modal-body { position: relative; }

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(220px, 42vw, 480px);
  background-size: cover;
  background-position: center 20%;
  border-radius: 18px 18px 0 0;
  pointer-events: none;
}
.modal-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-elevated) 0%, color-mix(in srgb, var(--bg-elevated) 70%, transparent) 45%, color-mix(in srgb, var(--bg-elevated) 25%, transparent) 100%);
}
.modal-fallback { background: linear-gradient(135deg, #1a1a2e, #0f3460); }

.modal-content {
  position: relative;
  z-index: 1;
  padding: clamp(120px, 26vw, 280px) clamp(16px, 3vw, 32px) clamp(24px, 3vw, 32px);
}

/* ---------------- Detail ---------------- */
.detail-head {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
  align-items: start;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  background: var(--bg-soft);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-info { min-width: 0; }

.detail-title {
  font-size: clamp(21px, 3.4vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.detail-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.rating-star {
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.9), 0 0 14px rgba(255, 215, 0, 0.5);
}
.detail-rating { color: var(--accent); font-weight: 700; }

.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.genre-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  color: var(--text-muted);
}

.detail-overview {
  color: var(--text);
  font-size: 15px;
  max-width: 72ch;
  line-height: 1.65;
  margin-bottom: 20px;
}

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

.detail-section { margin-top: clamp(24px, 3vw, 36px); }

.section-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent);
  flex: 0 0 auto;
}

/* ---------------- Seasons / episodes ---------------- */
.season-select {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  min-height: 34px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 30vw, 200px), 1fr));
  gap: 10px;
  align-items: stretch;
}

.episode-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.episode-card:hover {
  background: var(--bg-elevated);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-2px);
}

.episode-card-top {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.episode-card-top img { width: 100%; height: 100%; object-fit: cover; }

.episode-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.episode-play::before {
  content: '';
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.episode-continue {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 6px;
  background: #f59e0b;
  color: #1a1403;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.episode-card:hover .episode-play { opacity: 1; }
.episode-play svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  fill: #fff;
  margin-left: 3px;
  transition: transform 0.15s ease;
}
.episode-card:hover .episode-play svg { transform: scale(1.15); }
@media (hover: none) { .episode-play { opacity: 1; background: rgba(0, 0, 0, 0.22); } }

.episode-num { font-size: 12px; font-weight: 700; color: var(--accent); }
.episode-name {
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- Filter popup ---------------- */
.filter-popup {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 24px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.filter-popup.open { opacity: 1; visibility: visible; pointer-events: auto; }
.filter-popup.high-z { z-index: 2000; }

.filter-popup-panel {
  width: min(600px, 100%);
  max-height: min(80dvh, 660px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: clamp(16px, 2.5vw, 24px);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.2s ease;
}
.filter-popup-panel::-webkit-scrollbar { width: 6px; }
.filter-popup-panel::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.filter-popup.open .filter-popup-panel { transform: none; }

.filter-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.filter-popup-head h2 {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.filter-popup-head h2 i { color: var(--accent); font-size: 15px; }

.filter-popup-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.filter-popup-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-popup-close svg { width: 16px; height: 16px; stroke-width: 2.5; }

.filter-popup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.filter-option {
  text-align: left;
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.filter-option:hover { background: var(--bg-soft); border-color: var(--border); }
.filter-option.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 700;
}

/* ---------------- Player ---------------- */
.modal-player {
  width: min(1200px, 100%);
  max-height: min(94dvh, 1000px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(94dvh - 92px);
  background: #000;
  flex: 0 1 auto;
}

.player-container { position: absolute; inset: 0; background: #000; }
.player-container iframe { width: 100%; height: 100%; border: 0; display: block; }

.player-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #000;
  color: #fff;
  font-size: 14px;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player-info { padding: 14px clamp(16px, 3vw, 24px) 18px; flex: 0 0 auto; }
.player-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: #e11d48;
}
.player-live[hidden] { display: none; }
.player-live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
.player-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.player-meta { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* ---------------- Empty / error state ---------------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 8vw, 80px) 24px;
  text-align: center;
  color: var(--text-muted);
  animation: stateIn 0.35s ease;
}
.state[hidden] { display: none; }
@keyframes stateIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.state-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 18px;
  font-size: 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #ff7a00));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.state-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; color: var(--text); }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 860px) {
  .nav-tab span { display: none; }
  .nav-tab { padding: 10px 12px; }
  .nav-tab i { font-size: 15px; }
}

@media (max-width: 720px) {
  :root { --nav-h: 58px; }

  .nav-tabs { display: none; }
  .tabbar { display: flex; }

  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }

  .search-toggle { display: grid; }

  .hero { border-radius: 16px; margin-top: 12px; height: clamp(300px, 60vh, 480px); }
  .hero-title { font-size: clamp(24px, 7.5vw, 34px); }
  .hero-overview { -webkit-line-clamp: 3; line-clamp: 3; }
  .hero-content { padding-bottom: 48px; }
  .modal-overlay { padding: 0; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .modal-backdrop { border-radius: 0; }
  .modal-content { padding-bottom: calc(32px + var(--safe-b)); }
  .detail-head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .detail-poster { width: min(180px, 46vw); }
  .detail-meta, .genres, .detail-actions { justify-content: center; }
  .detail-overview { text-align: left; }
  .detail-section { text-align: left; }

  .modal-player { height: auto; max-height: 100dvh; justify-content: center; border-radius: 0; }
  .player-wrap { max-height: none; }
}

@media (max-width: 420px) {
  .logo-text { display: none; }
  .btn { flex: 1 1 auto; padding: 12px 16px; }
}

/* Landscape phones: keep the player usable */
@media (max-height: 520px) and (orientation: landscape) {
  .modal-player .player-info { display: none; }
  .player-wrap { max-height: 100dvh; }
  .hero { height: 78dvh; }
}

/* Large desktop / TV */
@media (min-width: 1600px) {
  :root { --page-max: 1600px; }
}
