/* NccFlix — original stylesheet. No third-party UI kit, no ad markup, no
   remote CSS. Everything here is written for this app. */

:root {
  --bg: #0a0a0c;
  --bg-raised: #141417;
  --bg-card: #1b1b20;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f2f4;
  --muted: #9a9aa4;
  --accent: #e50914;
  --accent-soft: #ff4d55;
  --radius: 10px;
  --row-gap: 34px;
  --card-w: 220px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 4vw;
  z-index: 60;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
  transition: background 0.25s ease;
}
.topbar.solid {
  background: #0a0a0c;
  box-shadow: 0 1px 0 var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  border-radius: 5px;
}
.brand-word { font-weight: 800; letter-spacing: 0.14em; font-size: 17px; }

.nav { display: flex; gap: 20px; flex: 1 1 auto; }
.browse-wrap { position: relative; }
.browse-trigger { background: none; border: 0; padding: 6px 2px; cursor: pointer; }
.browse-menu {
  position: absolute;
  top: 34px; left: 0;
  min-width: 170px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  z-index: 100;
}
.browse-menu[hidden] { display: none; }
.browse-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
.browse-menu a:hover { background: rgba(255, 255, 255, 0.1); }
.nav-link {
  color: #d2d2d8;
  font-size: 14px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn svg {
  width: 21px; height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn svg path[d^="M8 5.5"], .btn svg path[d^="M8 5.5"] { fill: currentColor; stroke: none; }

.searchbox { display: flex; align-items: center; }
.searchbox input {
  width: 0;
  opacity: 0;
  padding: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 14px;
  transition: width 0.22s ease, opacity 0.18s ease, padding 0.22s ease;
}
.searchbox.open input { width: 230px; opacity: 1; padding: 0 12px; }
.searchbox input:focus { outline: none; border-color: rgba(255, 255, 255, 0.4); }

.ott-switch { position: relative; }
.popover {
  position: absolute;
  top: 46px; right: 0;
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: 6px;
  padding: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.popover[hidden] { display: none; }
.popover button {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #232329;
  font-weight: 700;
}
.popover button:hover { background: #32323a; }
.popover button[aria-pressed="true"] { border-color: var(--accent); }

.lang-switch select {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 13px;
}
.lang-switch select option { background: #1b1b20; }

/* ------------------------------------------------------------------ hero */
.app { padding-top: 0; }

.hero {
  position: relative;
  min-height: 76vh;
  display: flex;
  align-items: flex-end;
  padding: 0 4vw 8vh;
  /* The artwork is scaled slightly; without this the page gains a horizontal
     scrollbar. */
  overflow: hidden;
}
.hero-art {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 18%;
  transform: scale(1.02);
  filter: saturate(0.92);
}
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 10, 12, 0.96) 0%, rgba(10, 10, 12, 0.72) 34%, rgba(10, 10, 12, 0.06) 70%),
    linear-gradient(0deg, var(--bg) 2%, rgba(10, 10, 12, 0) 42%);
}
.hero-body { position: relative; max-width: 640px; }
.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent-soft);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}
.hero-title {
  margin: 0 0 14px;
  font-size: clamp(34px, 5.4vw, 68px);
  line-height: 1.02;
  font-weight: 800;
  text-shadow: 0 3px 26px rgba(0, 0, 0, 0.7);
}
.hero-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: #e2e2e8; font-size: 15px; margin-bottom: 14px; }
.hero-meta .pill {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 12px;
}
.hero-desc {
  margin: 0 0 26px;
  color: #dcdce2;
  font-size: 16px;
  line-height: 1.6;
  max-width: 560px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 12px; align-items: center; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: #fff; color: #0a0a0c; }
.btn-primary:hover { background: rgba(255, 255, 255, 0.82); }
.btn-ghost { background: rgba(109, 109, 110, 0.42); color: #fff; }
.btn-ghost:hover { background: rgba(109, 109, 110, 0.62); }
.btn-icon { width: 44px; padding: 0; justify-content: center; }
.btn-icon svg { fill: none; stroke: currentColor; }

/* ------------------------------------------------------------------ rows */
.rows { padding: 0 0 60px; margin-top: -6vh; position: relative; z-index: 2; }

.row { margin-bottom: var(--row-gap); }
.row-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 0 4vw;
  margin-bottom: 12px;
}
.row-title { font-size: 19px; font-weight: 700; margin: 0; }
.row-count { color: var(--muted); font-size: 13px; }
.row-nav { margin-left: auto; display: flex; gap: 6px; }
.row-nav button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 20, 23, 0.8);
  display: grid; place-items: center;
}
.row-nav button:hover { background: rgba(255, 255, 255, 0.12); }
.row-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  /* No CSS smooth scrolling here: it makes touch swipes feel laggy. The row
     arrows animate explicitly instead. */
  scrollbar-width: none;
  padding: 0 4vw;
}
.scroller::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: scale(1.045); box-shadow: var(--shadow); z-index: 3; }
/* On touch devices :hover can stick after a tap and shift the card under the
   finger, so the lift only applies where a real pointer can hover. */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
}
.card img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.card img.loaded { opacity: 1; }
.card-title {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 10px 9px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card:hover .card-title { opacity: 1; }
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.card-rank {
  position: absolute;
  left: 8px; bottom: 8px;
  min-width: 40px;
  font-size: 54px;
  font-weight: 800;
  line-height: 0.8;
  color: #0a0a0c;
  -webkit-text-stroke: 3px #fff;
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  z-index: 2;
  pointer-events: none;
}
.card.ranked .card-title { bottom: 30px; }

/* ---------------------------------------------------------------- footer */
.footer {
  padding: 40px 4vw 60px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.footer p { margin: 0 0 6px; }
.footer-note { color: #6f6f78; }

.empty { padding: 80px 4vw; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty pre {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
}

/* -------------------------------------------------------------- overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 3vh 2vw;
}
.overlay[hidden] { display: none; }
.overlay-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(3px); }

.modal {
  position: relative;
  width: min(1000px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 5;
  background: rgba(10, 10, 12, 0.7);
}

.detail-art { position: relative; }
.detail-art.no-art { min-height: 150px; background: linear-gradient(135deg, #17171c, #0e0e12); }
.detail-art.no-art .detail-art-scrim { display: none; }
.detail-art.no-art .detail-head { position: relative; padding-top: 30px; }
.detail-art img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #101014; }
.detail-art-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--bg-raised) 3%, rgba(20, 20, 23, 0.1) 55%);
}
.detail-head { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 34px; }
.detail-head h2 { margin: 0 0 8px; font-size: 32px; font-weight: 800; }
.detail-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: #dcdce2; font-size: 14px; margin-bottom: 16px; }
.detail-meta .pill { border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 4px; padding: 1px 7px; font-size: 12px; }
.detail-meta .match { color: #4ade80; font-weight: 700; }
.detail-actions { display: flex; gap: 10px; }

.detail-body { display: grid; grid-template-columns: 1.7fr 1fr; gap: 26px; padding: 22px 34px 8px; }
.detail-desc { margin: 0 0 18px; line-height: 1.65; color: #e3e3e9; font-size: 15px; }
.detail-block { margin-bottom: 16px; font-size: 14px; line-height: 1.6; }
.detail-block h4 { margin: 0 0 5px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.05em; }
.detail-block p { margin: 0; color: #d5d5dc; }

.episodes { padding: 6px 34px 4px; }
.episodes-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 14px 0 12px; }
.episodes h3 { font-size: 17px; margin: 14px 0 12px; }
.episodes-head h3 { margin: 0; }
.season-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.season-tab {
  min-width: 40px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 600;
}
.season-tab:hover { background: rgba(255, 255, 255, 0.12); }
.season-tab.active { background: #fff; color: #0a0a0c; border-color: #fff; }
.season-box {
  font-size: 13px;
  font-weight: 600;
  color: #e6e6ec;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
}
.ep-list { display: grid; gap: 10px; }
.ep {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 14px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 0;
  text-align: left;
  width: 100%;
}
.ep:hover { background: rgba(255, 255, 255, 0.08); }
.ep-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #0d0d10; }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800;
  color: #0a0a0c; -webkit-text-stroke: 2px #fff;
}
.ep-title-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.ep-duration { color: var(--muted); font-size: 12.5px; flex: 0 0 auto; }
.more-episodes {
  margin-top: 12px;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}
.more-episodes:hover { background: rgba(255, 255, 255, 0.09); }
.ep-title { font-weight: 600; margin-bottom: 4px; }
.ep-desc { color: var(--muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.detail-related { padding: 4px 34px 30px; }
.detail-related h3 { font-size: 17px; margin: 14px 0 12px; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.rel {
  border: 0; padding: 0; text-align: left; background: transparent;
  border-radius: 8px; overflow: hidden;
}
.rel img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--bg-card); }
.rel p { margin: 7px 2px 0; font-size: 13px; font-weight: 600; }
.rel span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- player */
.player-overlay { padding: 0; background: #000; display: block; }
.player-close {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 4;
  background: rgba(0, 0, 0, 0.45);
}
.player-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 60px 14px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
}
.player-badge {
  font-size: 13px;
  font-weight: 700;
  color: #0a0a0c;
  background: #fff;
  border-radius: 6px;
  padding: 4px 9px;
}
.player-badge[hidden] { display: none; }
.player-name { font-weight: 600; font-size: 15px; }
.player-name .ep-title { color: #35c759; font-weight: 700; }
.player-quality { color: var(--muted); font-size: 13px; }
.btn-next {
  margin-left: auto;
  height: 38px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(4px);
  font-size: 14px;
}
.btn-next[hidden] { display: none; }
.btn-next svg { fill: currentColor; stroke: none; width: 15px; height: 15px; }
.btn-next:hover { background: rgba(255, 255, 255, 0.28); }
.player-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.player-stage #jw { width: 100%; height: 100%; }
.player-stage video { width: 100%; height: 100%; max-height: 100vh; background: #000; }
.player-stage video[hidden] { display: none; }
.player-fallback { position: absolute; inset: auto 0 12% 0; text-align: center; padding: 40px; display: grid; gap: 16px; justify-items: center; color: var(--muted); }
.player-fallback[hidden] { display: none; }

/* ---------------------------------------------------------------- search */
.search-overlay { align-items: start; padding-top: 12vh; }
.search-panel {
  position: relative;
  width: min(900px, 94vw);
  max-height: 72vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px 26px;
  box-shadow: var(--shadow);
}
.search-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.search-head h2 { margin: 0; font-size: 18px; }
.search-results { display: grid; gap: 10px; }
.search-row { display: flex; gap: 14px; align-items: center; padding: 8px; border-radius: 8px; background: transparent; border: 0; width: 100%; text-align: left; }
.search-row:hover { background: rgba(255, 255, 255, 0.07); }
.search-row img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--bg-card); flex: 0 0 auto; }
.search-row h4 { margin: 0 0 4px; font-size: 15px; }
.search-row p { margin: 0; color: var(--muted); font-size: 13px; }
.search-empty { color: var(--muted); padding: 18px 4px; }

/* ------------------------------------------------------- hover preview */
.preview {
  position: fixed;
  z-index: 40;
  width: 300px;
  border-radius: 10px;
  overflow: hidden;
  background: #18181c;
  border: 1px solid var(--line);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.preview[hidden] { display: none; }
.preview.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.preview-art { position: relative; aspect-ratio: 16 / 9; background: #232328; }
.preview-art img { width: 100%; height: 100%; object-fit: cover; }
.preview-controls {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
}
.pv-expand { position: absolute; right: 10px; bottom: 10px; }
.pv-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(16, 16, 20, 0.78);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}
.pv-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pv-btn.pv-play { background: #fff; color: #111; border-color: #fff; }
.pv-btn.pv-play svg { fill: currentColor; stroke: none; }
.pv-btn:hover { background: rgba(255, 255, 255, 0.24); transform: scale(1.06); }
.pv-btn.pv-play:hover { background: #e9e9ec; }
.preview-meta {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  padding: 11px 12px 4px;
  font-size: 13px;
  color: #e2e2e8;
}
.preview-meta .match { color: #4ade80; font-weight: 700; }
.preview-meta .pill { border: 1px solid rgba(255, 255, 255, 0.42); border-radius: 4px; padding: 0 6px; font-size: 12px; }
.preview-genres { padding: 0 12px 12px; font-size: 13px; color: #b6b6c0; }

/* ------------------------------------------------------- header popovers */
.nav-element { position: relative; }
.notifications { position: relative; display: block; }
.notification-pill {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.popover.notifications-box,
.popover.account-box {
  top: 46px; right: 0;
  display: block;
  width: 300px;
  padding: 10px;
}
/* These rules set `display` explicitly, so they need their own [hidden] rule —
   otherwise the menus stay on screen and swallow taps on the page. */
.popover.notifications-box[hidden],
.popover.account-box[hidden] { display: none; }
.sub-menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sub-menu-item a,
.profile-link {
  display: block;
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 14px;
  color: #e4e4ea;
}
.sub-menu-item a:hover,
.profile-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.notification { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 8px; border-radius: 8px; }
.notification:hover { background: rgba(255, 255, 255, 0.06); }
.notification img { width: 46px; height: 26px; object-fit: cover; border-radius: 5px; background: #232328; }
.notification .header { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.notification .text { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: #1f1f25;
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

/* --------------------------------------------------------------- scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0d0d10; }
::-webkit-scrollbar-thumb { background: #2e2e36; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3d3d47; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  :root { --card-w: 160px; }
  .nav { gap: 14px; }
  .nav-link { font-size: 13px; }
  .detail-body { grid-template-columns: 1fr; }
  .ep { grid-template-columns: 140px 1fr; }
  .lang-switch { display: none; }
}

@media (max-width: 620px) {
  :root { --card-w: 140px; }
  .brand-word { display: none; }
  .hero { min-height: 62vh; }
  .detail-head { padding: 18px 20px; }
  .detail-body, .episodes, .detail-related { padding-left: 20px; padding-right: 20px; }
  .searchbox.open input { width: 150px; }
}

/* ------------------------------------------------------- loading states */
/* Anything that arrives asynchronously shows a shimmer until the data is
   there, so the page never sits on an empty black box while it loads. */
@keyframes ncc-shimmer {
  from { background-position: 140% 0; }
  to { background-position: -140% 0; }
}
@keyframes ncc-spin { to { transform: rotate(360deg); } }

.shimmer,
.media::before,
.sk-line,
.sk-card,
#detailOverlay.loading .detail-art {
  background-image: linear-gradient(100deg,
    rgba(255, 255, 255, 0.035) 20%,
    rgba(255, 255, 255, 0.10) 42%,
    rgba(255, 255, 255, 0.035) 64%);
  background-size: 240% 100%;
  animation: ncc-shimmer 1.45s linear infinite;
}

/* Poster placeholder ---------------------------------------------------- */
/* The wrapper carries the shimmer; the image fades in on top of it. */
.media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: opacity 0.3s ease;
}
.media.loaded::before { opacity: 0; animation: none; }
.media img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card .media { width: 100%; height: 100%; }
.ep-thumb .media { position: absolute; inset: 0; }
.rel .media { width: 100%; aspect-ratio: 16 / 9; }
.search-row .media { width: 120px; flex: 0 0 auto; aspect-ratio: 16 / 9; }
.preview-art .media { width: 100%; height: 100%; }

/* Rail skeletons -------------------------------------------------------- */
/* Shown while the catalog is on its way, in the shape of the rails that
   are about to arrive. */
.sk-row { margin-bottom: 26px; }
.sk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sk-line { display: block; height: 14px; border-radius: 4px; }
.sk-line-title { width: 170px; }
.sk-line-count { width: 62px; height: 10px; }
.sk-card {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

/* Detail artwork while it loads ----------------------------------------- */
#detailOverlay.loading .detail-art img { opacity: 0; }
#detailOverlay.loading .detail-art { background-color: #101014; }

/* Hero artwork: the wide image is large, so it gets a placeholder too. */
.hero-art.loading {
  background-image: linear-gradient(100deg,
    rgba(255, 255, 255, 0.03) 20%,
    rgba(255, 255, 255, 0.09) 42%,
    rgba(255, 255, 255, 0.03) 64%);
  background-size: 240% 100%;
  animation: ncc-shimmer 1.45s linear infinite;
}

/* Dynamic loading animation ---------------------------------------------- */
/* A ring that turns while a counter creeps towards 100% — the shape the
   origin's own site uses while it prepares a title. */
.ring-loader {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  background: #000;
}
.ring-loader[hidden] { display: none; }
.ring-loader.compact { background: rgba(6, 6, 8, 0.55); backdrop-filter: blur(2px); }
.ring-wrap { position: relative; width: 104px; height: 104px; }
.ring-loader.compact .ring-wrap { width: 72px; height: 72px; }
.ring {
  width: 100%;
  height: 100%;
  animation: ring-rotate 1.7s linear infinite;
}
.ring-track, .ring-arc { fill: none; stroke-width: 5; }
.ring-track { stroke: rgba(255, 255, 255, 0.14); }
.ring-arc {
  stroke: #e50914;
  stroke-linecap: round;
  stroke-dasharray: 90 327;
}
@keyframes ring-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.ring-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.ring-loader.compact .ring-pct { font-size: 16px; }
.ring-label { margin: 0; color: var(--muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .shimmer,
  .media::before,
  .sk-line,
  .sk-card,
  #detailOverlay.loading .detail-art { animation: none; }
  .ring { animation-duration: 3.4s; }
}
