/* ============ TAVLET+ — dark cinematic theme ============ */
:root {
  --bg: #0a0a0e;
  --bg2: #101018;
  --card: #15151f;
  --card2: #1c1c29;
  --line: #23232f;
  --text: #f2f2f5;
  --muted: #8f8f9d;
  --accent: #e50914;
  --accent2: #ff3d47;
  --gold: #f5c518;
  --radius: 12px;
  --header-h: 60px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  background:
    radial-gradient(72rem 38rem at 86% -8%, rgba(229, 9, 20, .16), rgba(102, 14, 36, .075) 48%, transparent 74%),
    radial-gradient(58rem 34rem at 2% 104%, rgba(66, 84, 154, .065), transparent 72%);
}
body.film-ambient::before {
  background:
    radial-gradient(82rem 46rem at 84% -8%, rgba(var(--film-color-1, 35, 91, 78), .42) 0%, rgba(var(--film-color-1, 35, 91, 78), .18) 44%, transparent 75%),
    radial-gradient(70rem 48rem at -10% 42%, rgba(var(--film-color-2, 97, 64, 45), .3) 0%, rgba(var(--film-color-2, 97, 64, 45), .12) 47%, transparent 76%),
    linear-gradient(180deg, rgba(7, 8, 12, .18) 0%, rgba(10, 10, 14, .64) 64%, var(--bg) 100%);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; }
::selection { background: rgba(229, 9, 20, .4); }
:is(a, button, input, select):focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ header ============ */
#header {
  position: sticky; top: 0; z-index: 50;
  flex: 0 0 auto;
  background: linear-gradient(to bottom, rgba(0, 0, 3, .68) 0%, rgba(7, 7, 10, .30) 62%, rgba(8, 8, 11, 0) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  box-shadow: none;
  transition: background .2s ease, box-shadow .2s ease, backdrop-filter .2s ease, -webkit-backdrop-filter .2s ease;
}
#header.is-scrolled {
  background: linear-gradient(to bottom, rgba(4, 5, 9, .92), rgba(7, 8, 12, .78));
  backdrop-filter: blur(24px) saturate(125%);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.header-inner {
  max-width: 1500px; margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
  padding: 0 20px; min-height: 68px;
}
.logo {
  font-weight: 800; font-size: 20px; letter-spacing: 1px;
  color: var(--text); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  justify-self: start;
}
.logo-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  object-fit: contain;
}
.logo-wordmark { color: var(--text); }
.logo-wordmark span { color: var(--accent); }
#nav {
  display: flex; gap: 0; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
#nav::-webkit-scrollbar { display: none; }
#nav a {
  min-height: 44px; padding: 0 10px; border-radius: 0;
  color: #b8b8c0; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center;
  transition: color .15s;
  flex: 0 0 auto;
}
#nav a:hover { color: var(--text); }
#nav a.active { color: #fff; background: transparent; }
.header-actions {
  display: grid;
  grid-template-columns: 240px 44px 44px 72px;
  align-items: center; gap: 4px;
  justify-self: end;
}
.searchbox {
  width: 240px; height: 44px; min-width: 240px;
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  background: rgba(0, 0, 0, .48); border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 0; padding: 0 12px;
  color: #b8b8c0; font-size: 13px; text-align: left;
  transition: background .15s, border-color .15s, color .15s;
  cursor: pointer;
}
.searchbox:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .65);
  color: #fff;
}
.searchbox svg { flex: 0 0 auto; }
.searchbox-label {
  min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  background: transparent; border: 0;
  color: #d8d8de; border-radius: 50%;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s, transform .1s;
}
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.icon-btn:active { transform: scale(.96); }
.lang-switch {
  width: 70px; height: 34px; padding: 3px;
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}
.lang-option {
  height: 26px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: #858590;
  font-size: 10px; font-weight: 750; letter-spacing: .45px;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}
.lang-option:hover { color: #fff; }
.lang-option.active {
  background: #f2f2f5; color: #111114;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

/* ============ layout ============ */
.view {
  width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px 20px 40px;
  flex: 1 0 auto;
  position: relative; z-index: 1;
}
.section { margin-bottom: 36px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 18px; font-weight: 700; margin: 0; }
.section-sub { color: var(--muted); font-size: 13px; }
#footer {
  width: 100%; max-width: 1500px; margin: auto auto 0;
  padding: 18px 20px 28px;
  color: var(--muted); font-size: 12px;
  display: flex; gap: 6px; align-items: center;
  flex: 0 0 auto; position: relative; z-index: 1;
}
#footer a:hover { color: var(--text); }

/* ============ rows & grids ============ */
.row {
  display: flex; gap: 14px; overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
}
.row .card { flex: 0 0 auto; width: 158px; scroll-snap-align: start; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.grid .card { width: auto; }
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ============ cards ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; position: relative;
  container-type: inline-size;
  transition: transform .18s steps(4, end), box-shadow .18s ease;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
  z-index: 2;
}
.card-poster { position: relative; aspect-ratio: 2/3; background: var(--card2); overflow: hidden; }
.card-poster img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1);
  transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}
.card:hover .card-poster img { transform: scale(1.05); }
.card-wide .card-poster { aspect-ratio: 16/9; }
.card-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #3a3a4a; font-size: 32px;
}
.card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .15) 55%, transparent 100%);
  opacity: 0; transition: opacity .18s;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 10px;
}
.card:hover .card-overlay { opacity: 1; }
.card-overlay .ov-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.card-actions { display: flex; gap: 6px; }
.mini-btn {
  border: 0;
  background: rgba(0,0,0,.45); color: #fff;
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.mini-btn:hover { background: rgba(255, 255, 255, .18); }
.mini-btn.play { background: #fff; color: #111114; }
.mini-btn.play:hover { background: rgba(255, 255, 255, .84); }
.card-heart {
  position: absolute; top: 8px; left: 8px; z-index: 4;
  width: 32px; height: 32px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
  opacity: 0;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .18s ease, transform .25s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s, border-color .2s;
}
.card:hover .card-heart, .card-heart:focus-visible { opacity: 1; }
.card-heart:hover { transform: scale(1.12); background: rgba(0, 0, 0, .8); }
.card-list .card-heart { opacity: 1; }
.card-list .card-overlay { display: none; }
.card-list:hover { box-shadow: none; }
.list-item { display: flex; flex-direction: column; min-width: 0; }
.list-item .card { width: 100%; }
.list-title {
  margin-top: 8px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-heart.liked { color: var(--accent); border-color: rgba(229, 9, 20, .65); }
.card-heart.liked:hover { background: rgba(0, 0, 0, .8); }
.card-progress {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--accent); width: 0%;
}
.card-label {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0, 0, 0, .75); color: #fff;
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
}
.card-info { padding: 10px; display: flex; flex-direction: column; }
.card-title {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 8px; min-width: 0;
  min-height: 30px;
}
.card-meta-left {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.card-type {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; line-height: 1.2;
}
.card-type.tv { color: var(--accent2); background: rgba(229, 9, 20, .16); }
.card-type.movie { color: #9cc3ff; background: rgba(120, 165, 255, .14); }
.card-year {
  flex-shrink: 0;
  color: var(--muted); font-size: 14px; font-weight: 500;
}
.card-badge {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .12);
  color: var(--gold); font-size: 13px; font-weight: 700;
  padding: 5px 8px; border-radius: 999px;
}

/* ============ card metadata: size-aware ============ */
@container (max-width: 240px) {
  .card-meta { gap: 8px; min-height: 26px; }
  .card-meta-left { gap: 6px; }
  .card-type { font-size: 9px; padding: 2px 6px; letter-spacing: .2px; }
  .card-year { font-size: 12px; }
  .card-badge { font-size: 11.5px; padding: 3px 5px; }
}
@container (max-width: 150px) {
  .card-meta .card-badge { display: none; }
}

/* ============ buttons ============ */
.btn {
  border: 0; background: rgba(109, 109, 110, .72); color: #fff;
  border-radius: 6px; padding: 10px 18px; min-height: 40px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s, filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.14); }
.btn:active { transform: scale(.98); }
.btn-primary { background: #fff; color: #111114; }
.btn-primary:hover { background: #fff; }
.btn-ghost { background: transparent; color: #d0d0d5; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; filter: none; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 12.5px; border-radius: 5px; }
.btn-danger { color: #ff8087; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* shared single-select control */
select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  min-height: 40px;
  padding: 0 38px 0 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23aaaab5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  color: var(--text);
  color-scheme: dark;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
select:not([multiple]):hover {
  background-color: var(--card2);
  border-color: rgba(255, 255, 255, .3);
}
select:not([multiple]):focus { border-color: rgba(255, 255, 255, .42); }
select:not([multiple]):disabled { opacity: .55; cursor: not-allowed; }

/* ============ detail ============ */
.detail-hero {
  position: relative; border-radius: 16px; overflow: hidden;
  margin-bottom: 28px; min-height: 380px;
  display: flex; align-items: flex-end;
  background: var(--card2);
}
.detail-hero .hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: brightness(.55) saturate(1.1);
}
.detail-hero .hero-grad {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,10,14,.96) 8%, rgba(10,10,14,.35) 55%, transparent 100%);
}
.detail-hero .hero-content { position: relative; padding: 32px; width: 100%; }
.detail-title { font-size: 34px; font-weight: 800; margin: 0 0 10px; line-height: 1.1; }
.detail-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.rating { color: var(--gold); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--muted);
}
.chips .chip {
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chips .chip:hover { color: var(--text); border-color: #34344a; }
.chips .chip.active {
  background: var(--accent); border-color: transparent;
  color: #fff;
}
.overview { color: #c9c9d4; font-size: 14.5px; line-height: 1.65; max-width: 780px; margin: 0 0 20px; }

/* ============ tabs ============ */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 0;
  color: var(--muted); border-radius: 6px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.tab.active { background: rgba(255, 255, 255, .12); color: #fff; }
.tab:hover { background: rgba(255, 255, 255, .07); color: var(--text); }

/* ============ player ============ */
.player-view { max-width: 1100px; margin: 0 auto; }
.player-source {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.src-tabs {
  display: flex; gap: 6px;
  background: rgba(255, 255, 255, .05); border: 0;
  border-radius: 7px; padding: 4px;
}
.src-tab {
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 5px;
  cursor: pointer; transition: background .15s, color .15s;
}
.src-tab:hover { color: var(--text); }
.src-tab.active { background: #fff; color: #111114; }
.src-select {
  max-width: 260px; font-size: 13px;
}
.src-status {
  font-size: 12.5px; color: var(--muted);
  flex: 1; min-width: 0;
}
.src-status a { color: var(--accent2); }
.src-notice { font-size: 12.5px; margin-bottom: 6px; }
.src-link { margin-top: 4px; }
.src-link-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: inline-block; }
.src-link a.src-link-title:hover { color: var(--text); }
.player-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.player-head h1 { font-size: 20px; font-weight: 700; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head .sub { color: var(--muted); font-size: 13px; }
.player-box {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: #000; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
}
.player-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
  background: #000; z-index: 1;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #2a2a38; border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; }

/* ============ collections ============ */
.col-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}
.col-tile {
  position: relative;
  aspect-ratio: 1.4 / 1;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #10101a;
}
.col-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: var(--col-focus, 50% 50%);
  opacity: 0;
  transition: opacity .5s ease, transform .35s ease;
}
.col-tile:hover .col-bg { transform: scale(1.03); }
.col-bg.loaded { opacity: 1; }
.col-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 12, .55) 0%, rgba(5, 7, 12, 0) 55%),
    linear-gradient(to top, rgba(5, 7, 12, 1) 0%, rgba(5, 7, 12, .96) 30%, rgba(5, 7, 12, .72) 55%, rgba(5, 7, 12, .18) 100%);
}
.col-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 20px;
  min-width: 0;
}
.col-mark {
  position: relative;
  color: var(--col-accent);
  width: 110px;
  max-width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.col-mark svg {
  display: block;
  width: 28px; height: 28px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55));
}
.col-logo {
  position: absolute; inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  opacity: 0;
  transition: opacity .35s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6));
}
.col-logo.ok { opacity: 1; }
.col-name {
  margin-top: auto;
  padding-top: 12px;
  font-weight: 800;
  font-size: clamp(15px, 1.15vw, 19px);
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--text);
  max-width: 96%;
}
.col-desc {
  margin-top: 4px;
  margin-bottom: 0;
  color: #a9a9b4;
  font-size: clamp(11.5px, .85vw, 13px);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 95%;
}
.col-count {
  margin-top: 7px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--col-accent) 70%, #ffffff 30%);
  border: 1px solid color-mix(in srgb, var(--col-accent) 32%, transparent);
  background: color-mix(in srgb, var(--col-accent) 5%, transparent);
  padding: 2px 9px; border-radius: 999px;
}
@media (max-width: 1280px) {
  .col-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .col-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .col-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-content { padding: 16px; }
  .col-mark { width: 130px; height: 42px; }
  .col-logo { max-height: 42px; max-width: 92%; }
}
@media (max-width: 620px) {
  .col-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(8px, 2.5vw, 12px);
  }
  .col-tile {
    aspect-ratio: 4 / 3;
    border-radius: 13px;
  }
  .col-tile:active { border-color: color-mix(in srgb, var(--col-accent) 55%, #ffffff 15%); }
  .col-shade {
    background:
      linear-gradient(to bottom, rgba(5, 7, 12, .52) 0%, rgba(5, 7, 12, 0) 48%),
      linear-gradient(to top, rgba(5, 7, 12, .98) 0%, rgba(5, 7, 12, .68) 38%, rgba(5, 7, 12, .06) 74%);
  }
  .col-content { padding: clamp(10px, 3vw, 12px); }
  .col-mark {
    width: min(100%, 160px);
    height: clamp(36px, 11vw, 48px);
  }
  .col-logo { max-width: none; max-height: none; }
  .col-name {
    padding-top: 6px;
    max-width: 100%;
    font-size: clamp(13px, 3.7vw, 15px);
    line-height: 1.12;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .col-desc,
  .col-count { display: none; }
}
@media (max-width: 299px) {
  .col-row { grid-template-columns: minmax(0, 1fr); }
  .col-tile { aspect-ratio: 1.7 / 1; }
}
.col-item { position: relative; }
.col-num {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(0, 0, 0, .55);
  color: rgba(255, 255, 255, .85);
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.col-grid-posters { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ============ collection hero ============ */
.col-hero {
  position: relative;
  height: clamp(240px, 32vw, 300px);
  margin: -24px -20px 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.col-hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background-position: center;
}
.col-hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(10, 10, 14, .72) 38%, rgba(10, 10, 14, .30) 78%, rgba(10, 10, 14, .22) 100%),
    linear-gradient(90deg, rgba(10, 10, 14, .40), rgba(10, 10, 14, .12));
}
.col-hero-content {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 0 20px 26px;
  max-width: 720px;
}
.col-hero-logo {
  width: clamp(180px, 24vw, 235px);
  max-height: 96px;
  object-fit: contain;
  opacity: 0;
  transition: opacity .45s ease;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, .65));
}
.col-hero-logo.loaded { opacity: 1; }
.col-hero-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.col-hero-brand .col-mark svg { width: 44px; height: 44px; }
.col-hero-brand h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.col-hero-meta {
  margin-top: 14px;
  font-size: 12.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #b9b9c4;
}
.col-hero-desc {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #8f8f9d;
  max-width: 520px;
}
.section .col-grid-posters { margin-top: 34px; }
@media (max-width: 540px) {
  .col-hero { height: 220px; margin: -16px -14px 0; }
  .col-hero-logo { width: 62vw; max-height: 74px; }
  .col-hero-meta { font-size: 11px; }
}

/* ============ episodes ============ */
.episode-section { margin-bottom: 42px; }
.episode-section-head { align-items: center; margin-bottom: 16px; }
.episode-title-group { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.episode-season-progress { color: var(--muted); font-size: 13px; white-space: nowrap; }
.season-select {
  min-width: 188px; font-size: 14px;
}
.episode-deck-host { min-height: 260px; }
.episode-deck { display: grid; gap: 12px; }
.episode-spotlight-card {
  height: clamp(228px, 17.5vw, 242px); min-height: 228px;
  display: grid; grid-template-columns: minmax(0, 11fr) minmax(300px, 9fr);
  overflow: hidden;
  background: rgba(21, 21, 31, .82);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.episode-spotlight-media { position: relative; min-height: 0; overflow: hidden; background: var(--card2); }
.episode-spotlight-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.episode-still-empty {
  width: 100%; height: 100%; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card2); color: var(--muted); font-size: 12px;
}
.episode-spotlight-copy {
  min-width: 0; padding: 18px 24px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
}
.episode-code { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .45px; text-transform: uppercase; }
.episode-spotlight-copy h3 { margin: 4px 0 4px; font-size: 23px; line-height: 1.18; }
.episode-spotlight-meta { display: flex; flex-wrap: wrap; gap: 0; color: var(--muted); font-size: 13px; }
.episode-spotlight-meta span + span::before { content: "·"; margin: 0 8px; color: #5f5f6d; }
.episode-spotlight-copy p {
  max-width: 58ch; margin: 8px 0 10px;
  color: #b9b9c3; font-size: 13.5px; line-height: 1.48;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.episode-watch-state { width: min(100%, 360px); margin-bottom: 10px; color: var(--muted); font-size: 12.5px; }
.episode-state-label { display: inline-flex; align-items: center; gap: 5px; }
.episode-watch-state.is-progress { color: #f0f0f4; }
.episode-watch-state.is-watched, .episode-card.is-watched .episode-card-state { color: #8fc69a; }
.episode-watch-state.is-next { color: #ff6f77; }
.episode-progress-track { display: block; height: 3px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #30303b; }
.episode-progress-track i { display: block; height: 100%; background: var(--accent); }
.episode-watch-state.is-watched .episode-progress-track i { background: #5eae70; }
.episode-spotlight-play { min-width: 112px; min-height: 38px; justify-content: center; }
.episode-rail-shell { position: relative; min-width: 0; }
.episode-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(216px, 18vw, 256px);
  gap: 10px; overflow-x: auto; overscroll-behavior-inline: contain;
  padding: 2px 2px 6px; scroll-snap-type: x proximity; scroll-behavior: smooth;
  scrollbar-width: none;
}
.episode-rail::-webkit-scrollbar { display: none; }
.episode-rail-arrow {
  position: absolute; top: 50%; z-index: 4; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%;
  background: rgba(10, 10, 14, .9); color: #f2f2f5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .34);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity .15s, background .15s, color .15s, transform .15s;
}
.episode-rail-arrow:hover { background: #f2f2f5; color: #111114; transform: translateY(-50%) scale(1.04); }
.episode-rail-arrow:active { transform: translateY(-50%) scale(.97); }
.episode-rail-arrow:disabled { opacity: 0; pointer-events: none; }
.episode-rail-arrow-prev { left: -12px; }
.episode-rail-arrow-next { right: -12px; }
.episode-card {
  appearance: none; position: relative; min-width: 0; padding: 0; overflow: hidden;
  color: var(--text); text-align: left; font: inherit;
  background: rgba(21, 21, 31, .86); border: 1px solid var(--line); border-radius: 10px;
  scroll-snap-align: start; cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.episode-card:hover { background: rgba(28, 28, 41, .96); box-shadow: 0 7px 18px rgba(0, 0, 0, .2); transform: translateY(-1px); }
.episode-card:active { transform: scale(.99); }
.episode-card:focus-visible { outline: none; }
html.keyboard-input .episode-card:focus-visible { outline: 2px solid rgba(242, 242, 245, .5); outline-offset: -3px; }
.episode-card.is-selected { background: rgba(28, 28, 41, .92); border-color: var(--line); box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
.episode-card-media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--card2); }
.episode-card-media img { width: 100%; height: 100%; object-fit: cover; }
.episode-card-copy { min-width: 0; min-height: 94px; padding: 8px 10px 11px; display: flex; flex-direction: column; align-items: flex-start; }
.episode-card .episode-code { color: #7f7f8d; font-size: 10.5px; letter-spacing: .5px; }
.episode-card-copy strong {
  width: 100%; margin-top: 3px; font-size: 13.5px; line-height: 1.25;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.episode-card-meta { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.episode-card-state { margin-top: auto; padding-top: 6px; color: var(--muted); font-size: 11.5px; }
.episode-card.is-progress .episode-card-state { color: #d2d2d9; }
.episode-card.is-next .episode-card-state { color: #ff6f77; }
.episode-card-check { margin-right: 4px; font-weight: 800; }
.episode-card-line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; pointer-events: none; }
.episode-card-line i { display: block; width: 0; height: 100%; background: transparent; transition: width .2s ease; }
.episode-card.is-selected:not(.is-progress):not(.is-watched) .episode-card-line i,
.episode-card.is-next:not(.is-progress):not(.is-watched) .episode-card-line i { width: 100%; background: var(--accent); }
.episode-card.is-progress .episode-card-line i { width: var(--episode-progress); background: var(--accent); }
.episode-card.is-watched .episode-card-line i { width: 100%; background: #5eae70; }

@media (max-width: 900px) {
  .episode-spotlight-card { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); }
  .episode-spotlight-media { min-height: 0; aspect-ratio: 2 / 1; }
  .episode-spotlight-copy { padding: 18px 20px; }
  .episode-rail { grid-auto-columns: clamp(200px, 38vw, 240px); }
}

@media (max-width: 600px) {
  .episode-section-head { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .episode-title-group { width: 100%; justify-content: space-between; }
  .season-select { width: 100%; min-width: 0; }
  .episode-spotlight-card { min-height: 0; border-radius: 12px; }
  .episode-spotlight-copy { padding: 16px; }
  .episode-spotlight-copy h3 { font-size: 22px; }
  .episode-spotlight-copy p { margin: 8px 0 10px; -webkit-line-clamp: 2; }
  .episode-watch-state { width: 100%; }
  .episode-spotlight-play { width: 100%; }
  .episode-rail { grid-auto-columns: min(78vw, 286px); }
}

@media (max-width: 720px), (hover: none), (pointer: coarse) {
  .episode-rail-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .episode-rail { scroll-behavior: auto; }
  .episode-card,
  .episode-card-media img,
  .episode-card-line i,
  .episode-rail-arrow { transition: none; }
  .episode-card:hover .episode-card-media img { transform: none; }
}

/* ============ history list ============ */
.hist-row {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 10px;
}
.hist-thumb { position: relative; width: 96px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--card2); }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-title { font-weight: 600; font-size: 14.5px; }
.hist-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.hist-sub .hist-state { font-weight: 600; }
.hist-watched .hist-state { color: #4caf50; }
.hist-progress { height: 4px; background: #26262f; border-radius: 2px; margin-top: 8px; max-width: 340px; overflow: hidden; }
.hist-progress i { display: block; height: 100%; background: var(--accent); }
.hist-watched .hist-progress i { background: #4caf50; }
/* grouped history — minimal horizontal row: preview | info | episodes */
.hist-section { margin-bottom: 24px; }
.hist-section-title {
  margin: 0 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.hist-group { margin-bottom: 14px; }

.hist-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(230px, 28fr) minmax(220px, 30fr) minmax(0, 42fr);
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  align-items: center;
}
.hc-corner { position: absolute; top: 10px; right: 10px; z-index: 6; }
.hist-group.no-recent .hist-card { grid-template-columns: minmax(260px, 34fr) minmax(0, 66fr); }

/* zone 1: main preview */
.hist-hero {
  display: block; width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px; overflow: hidden;
  background: var(--card2);
}
.hist-hero img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.hist-hero:hover img { opacity: .88; }

/* zone 2: series info */
.hist-body { min-width: 0; }
.hc-infoline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hc-title {
  font-size: 18.5px; font-weight: 800; letter-spacing: -.01em;
  color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hc-title:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hc-epline {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 7px;
  max-width: 100%; font-size: 13.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-decoration: none;
}
.hc-epline:hover b { text-decoration: underline; text-underline-offset: 3px; }
.hc-epline b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.hc-progressrow { display: flex; align-items: center; gap: 12px; margin-top: 11px; max-width: 340px; }
.hc-progressrow .hist-progress { flex: 1; height: 4px; margin: 0; background: #23232e; border-radius: 2px; min-width: 120px; }
.hc-pct { font-size: 12.5px; font-weight: 600; color: var(--text); min-width: 30px; text-align: right; }
.hc-sub {
  margin-top: 9px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.hc-dot { color: #3a3a4a; }

/* zone 3: episode history strip */
.hist-recent { min-width: 0; }
.hist-strip { display: flex; gap: 12px; align-items: stretch; justify-content: flex-end; }
.hp {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 210px;
  display: block; text-decoration: none;
}
.hp-img {
  position: relative; display: block;
  aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden;
  background: var(--card2); border: 1px solid rgba(255, 255, 255, .07);
  transition: transform .15s, border-color .15s;
}
.hp:hover .hp-img { transform: scale(1.03); border-color: rgba(255, 255, 255, .3); }
.hp-img img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.hp.done .hp-img img { opacity: .5; }
.hp-tag {
  position: absolute; left: 6px; top: 6px;
  background: rgba(0, 0, 0, .78); border: 1px solid rgba(255, 255, 255, .12);
  color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px; letter-spacing: .04em;
}
.hp-check {
  position: absolute; right: 6px; top: 6px;
  background: rgba(76, 175, 80, .92); color: #06130a;
  width: 17px; height: 17px; border-radius: 50%;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.hp-prog {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--accent); display: block;
}
.hp-prog.g { background: #4caf50; }
.hp-arrow {
  flex: 0 0 auto; width: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, .04); border: 1px dashed #2b2b38;
  border-radius: 8px; color: var(--muted); cursor: pointer;
  font-size: 15px; font-weight: 700;
}
.hp-arrow:hover { color: var(--text); border-color: rgba(255, 255, 255, .25); }
.hp-arrow-num { font-size: 15px; }

/* confirm mini dialog */
.confirm-box { max-width: 400px; }
.confirm-box p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

/* view-all modal grid */
.hm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin-top: 14px; max-height: 62vh; overflow-y: auto;
}

/* ••• popover */
.he-wrap { position: relative; display: inline-flex; }
.he-more {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer;
  letter-spacing: .05em; text-indent: .05em;
  overflow: visible; flex-shrink: 0;
  border-radius: 50%;
}
.he-more:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.he-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #17171f; border: 1px solid #2c2c40; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
  overflow: hidden; white-space: nowrap;
}
.he-pop button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text);
  font-size: 13px; padding: 9px 14px; cursor: pointer;
}
.he-pop button:hover { background: rgba(229, 9, 20, .14); color: #ff6b6b; }

/* ============ misc ============ */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(229, 9, 20, .08); border: 1px solid rgba(229, 9, 20, .3);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 24px;
  font-size: 13.5px; line-height: 1.5;
}
.banner .x { margin-left: auto; color: var(--muted); background: none; border: 0; font-size: 16px; }
.empty {
  text-align: center; color: var(--muted); padding: 60px 20px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.empty .big { font-size: 40px; }
.empty h3 { margin: 0; color: var(--text); font-size: 17px; }
.error-view,
.not-found-view {
  grid-column: 1 / -1;
  width: 100%; min-width: 0;
  min-height: clamp(300px, 52vh, 520px);
  padding: 48px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted);
}
.error-view .state-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid #464653; border-radius: 50%;
  color: #b6b6c0; font-size: 18px; font-weight: 700;
}
.error-view h3,
.not-found-view h1 { margin: 14px 0 0; color: var(--text); font-size: 19px; }
.error-view p,
.not-found-view p { max-width: 440px; margin: 8px 0 22px; line-height: 1.5; overflow-wrap: anywhere; }
.not-found-view .not-found-code {
  color: rgba(255, 255, 255, .12);
  font-size: clamp(72px, 10vw, 116px); font-weight: 800; line-height: .8;
  letter-spacing: -.06em;
}
.not-found-view h1 { font-size: 24px; }
.load-more-wrap { text-align: center; margin-top: 18px; }

/* cast */
.cast-row { display: flex; gap: 14px; overflow-x: auto; overflow-y: visible; padding: 14px 8px 16px; }
.cast-item {
  flex: 0 0 auto; width: 92px; text-align: center; transform: translateY(0);
  cursor: pointer;
  transition: transform .35s cubic-bezier(.22, .61, .36, 1);
}
.cast-item:hover { transform: translateY(-3px); }
.cast-item .av {
  width: 92px; height: 92px; border-radius: 50%; overflow: hidden;
  background: var(--card2); margin: 0 auto 8px;
  border: 2px solid var(--line);
  transform: scale(1);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), border-color .3s, box-shadow .3s;
}
.cast-item:hover .av {
  transform: scale(1.12);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, .18), 0 8px 18px rgba(0, 0, 0, .5);
}
.cast-item .av img { width: 100%; height: 100%; object-fit: cover; }
.cast-item .av-ph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: 28px; font-weight: 700; color: var(--muted);
  background: linear-gradient(135deg, var(--card2), rgba(255, 255, 255, .04));
}
.cast-item .cn {
  font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .25s;
}
.cast-item:hover .cn { color: var(--accent2); }
.cast-item .cr {
  font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .cast-item, .cast-item .av, .cast-item .cn { transition: none; }
  .cast-item:hover, .cast-item:hover .av { transform: none; }
  .card-poster img, .card:hover .card-poster img { transition: none; transform: none; }
}

/* ============ person page ============ */
.person-hero {
  display: flex; gap: 28px; align-items: flex-start;
  padding: 10px 0 8px;
}
.person-photo {
  width: 220px; flex-shrink: 0;
  border-radius: 16px; overflow: hidden;
  background: var(--card2);
}
.person-photo img { width: 100%; display: block; }
.person-ph {
  width: 220px; height: 300px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 700; color: var(--muted);
  background: linear-gradient(135deg, var(--card), var(--card2));
  border-radius: 16px;
}
.person-head { flex: 1; min-width: 0; }
.person-head h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: .3px; }
.person-meta { color: var(--muted); font-size: 13.5px; line-height: 1.8; }
.person-meta b { color: var(--text); font-weight: 600; }
.person-bio {
  margin-top: 14px; color: var(--text); font-size: 14px; line-height: 1.65;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
}
.person-bio.expanded { -webkit-line-clamp: unset; }
.cred-row {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px; border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.cred-row:hover { background: var(--card); }
.cred-thumb {
  width: 60px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden;
  background: var(--card2); flex-shrink: 0;
}
.cred-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cred-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #3a3a4a; font-size: 18px;
}
.cred-info { flex: 1; min-width: 0; }
.cred-title {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cred-sub {
  display: flex; align-items: center; gap: 10px; margin-top: 3px;
  font-size: 12.5px; color: var(--muted);
}
.cred-char {
  color: var(--text); opacity: .72;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cred-year { flex-shrink: 0; }
.cred-arrow { color: var(--muted); font-size: 20px; flex-shrink: 0; }
@media (max-width: 640px) {
  .person-hero { flex-direction: column; align-items: center; text-align: center; }
  .person-photo, .person-ph { width: 180px; }
  .person-ph { height: 250px; }
  .person-head h1 { font-size: 22px; }
}

/* ============ modal ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in .25s ease;
}
.modal-backdrop.closing { animation: fade-out .24s ease forwards; pointer-events: none; }
.modal-backdrop.closing .modal,
.modal-backdrop.closing .search-modal,
.modal-backdrop.closing .trailer-modal { animation: modal-out .24s ease forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
}
@keyframes modal-out {
  to { opacity: 0; transform: scale(.96) translateY(10px); }
}
.modal {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; width: 100%; max-width: 460px;
  padding: 24px; position: relative;
  max-height: 86vh; overflow-y: auto;
  animation: modal-in .25s cubic-bezier(.22, .61, .36, 1);
}
.modal h3 { margin: 0 0 18px; font-size: 17px; }
.modal .close {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: 0; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; font-size: 15px;
  transition: background .15s, color .15s;
}
.modal .close:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.field input {
  width: 100%; background: var(--card); border: 1px solid rgba(255, 255, 255, .18); color: var(--text);
  border-radius: 6px; padding: 10px 12px; font-size: 14px; outline: none;
}
.field select { width: 100%; font-size: 14px; }
.field input:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.pwa-installed {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border-radius: 7px; color: #8ed6a2; background: rgba(78, 176, 105, .1);
  font-size: 13px; font-weight: 600;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
/* search modal */
.search-backdrop { padding: 24px; }
.search-modal {
  max-width: 780px; width: 100%;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px;
  animation: trailer-in .3s cubic-bezier(.22, .61, .36, 1);
}
.search-head {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line); padding: 2px 0 14px;
}
.search-head > svg { color: var(--muted); flex-shrink: 0; }
.search-head input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: var(--text); font-size: 17px;
}
.search-head input::placeholder { color: var(--muted); }
.search-modal .close {
  position: static;
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: 0;
  color: var(--muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, transform .2s;
}
.search-modal .close:hover { background: rgba(255, 255, 255, .1); color: var(--text); transform: scale(1.06); }
.search-body {
  max-height: 58vh; overflow-y: auto; margin-top: 14px;
  scrollbar-width: none;
}
.search-body::-webkit-scrollbar { display: none; }
.search-hint { text-align: center; padding: 36px 10px; color: var(--muted); }
.search-hint .big { font-size: 42px; margin-bottom: 10px; }
.search-hint p { margin: 0; font-size: 13.5px; }
.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 14px;
}
.search-results .card { width: 100%; }
.search-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px;
}
.search-count { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .search-backdrop { padding: 12px; }
  .search-modal { padding: 12px; }
  .search-results { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
}
/* skeleton loaders */
@keyframes skel-shimmer { from { background-position: -220px 0 } to { background-position: calc(220px + 100%) 0 } }
.skel {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--card2) 25%, rgba(255, 255, 255, .055) 37%, var(--card2) 63%);
  background-size: 440px 100%;
  animation: skel-shimmer 1.35s ease-in-out infinite;
  border-radius: 9px;
}
.skel-card { cursor: default; }
.skel-card:hover { transform: none; box-shadow: none; }
.skel-card .skel-poster {
  aspect-ratio: 2 / 3;
  border-radius: 0 !important; /* .card already rounds and clips */
  width: 100%;
}
.skel-card.card-wide .skel-poster { aspect-ratio: 16 / 9; }
.skel-card .skel-info { padding: 10px; display: flex; flex-direction: column; }
.skel-line { height: 18px; margin-top: 0; width: 82%; }
.skel-card .skel-line + .skel-line { height: 23px; width: 46%; margin-top: 9px; }
.skel-line.short { width: 46%; }
.skel-block { aspect-ratio: 2 / 3; max-width: 320px; }
/* hover trailer previews removed */
.trailer-backdrop { padding: 24px; }
.trailer-modal {
  max-width: 880px; width: 100%;
  background: #000; border: 1px solid var(--line);
  border-radius: 16px; padding: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .75);
  animation: trailer-in .3s cubic-bezier(.22, .61, .36, 1);
}
@keyframes trailer-in {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.trailer-frame {
  position: relative; aspect-ratio: 16/9;
  border-radius: 10px; overflow: hidden; background: #000;
}
.trailer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .72), transparent);
  pointer-events: none;
}
.trailer-topbar > * { pointer-events: auto; }
.trailer-youtube {
  display: inline-flex; align-items: center;
  padding: 8px 13px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .2s, border-color .2s;
}
.trailer-youtube:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .42); }
.trailer-modal .close {
  position: static;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .2s, transform .2s, border-color .2s;
}
.trailer-modal .close:hover {
  background: rgba(229, 9, 20, .85); border-color: transparent;
  color: #fff; transform: scale(1.08);
}
@media (max-width: 640px) {
  .trailer-backdrop { padding: 10px; }
  .trailer-topbar { padding: 10px 12px; }
  .trailer-youtube { padding: 7px 11px; font-size: 11.5px; }
  .trailer-modal .close { width: 30px; height: 30px; }
}

/* ============ gate ============ */
.gate {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate-lang-switch { position: fixed; top: 22px; right: 24px; z-index: 1; }
.gate.hidden { display: none; }
.gate-loader { display: none; min-height: 92px; align-items: center; justify-content: center; }
.gate.gate-pending .gate-loader { display: flex; }
.gate.gate-pending :is(h1, p, form, .gate-error) { display: none; }
.gate-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 18px;
  padding: 36px; width: 100%; max-width: 380px; text-align: center;
}
.gate-logo {
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 24px; font-weight: 800; letter-spacing: 1px;
}
.gate-logo img { width: 38px; height: 38px; object-fit: contain; }
.gate-wordmark { color: var(--text); }
.gate-wordmark span { color: var(--accent); }
.gate-card h1 { margin: 14px 0 6px; font-size: 22px; }
.gate-card p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.gate-card form { display: grid; gap: 10px; }
.gate-card input {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px 13px; font-size: 14px; outline: none; min-width: 0;
}
.gate-card .btn { width: 100%; justify-content: center; min-height: 44px; margin-top: 2px; }
.gate-card .hidden { display: none; }
.gate-card input:focus { border-color: var(--accent); }
.gate-error { color: var(--accent2); font-size: 13px; margin-top: 12px; min-height: 16px; }
.account-summary { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.account-summary strong { color: var(--text); }
.account-list { display: grid; gap: 8px; margin-bottom: 20px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.account-row div { min-width: 0; display: grid; gap: 2px; }
.account-row small { color: var(--muted); }

/* ============ toast ============ */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--card2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============ responsive ============ */
@media (max-width: 1040px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    min-height: 0; padding: 10px 14px 8px; gap: 4px 14px;
  }
  .logo { grid-column: 1; grid-row: 1; }
  .header-actions { grid-column: 2; grid-row: 1; }
  #nav {
    grid-column: 1 / -1; grid-row: 2;
    width: 100%; max-width: 100%; padding-bottom: 2px;
    scroll-snap-type: x proximity; scrollbar-width: none;
  }
  #nav::-webkit-scrollbar { display: none; }
  #nav a { scroll-snap-align: center; }
  .view { padding: 16px 14px 30px; }
  .detail-title { font-size: 24px; }
  .detail-hero .hero-content { padding: 20px; }
  .hist-row { grid-template-columns: 76px 1fr; }
  .hist-row .hist-actions { grid-column: 2; }
  .player-head h1 { font-size: 16px; }
  .row .card { width: 132px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
}

@media (max-width: 720px) {
  .searchbox { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  .card-heart { width: 44px; height: 44px; opacity: 1; }
  .btn-sm, .src-tab, .season-select { min-height: 44px; }
  .hist-card,
  .hist-group.no-recent .hist-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 12px;
  }
  .hist-body { min-width: 0; padding-right: 34px; }
  .hc-title { max-width: 100%; }
  .hc-progressrow { max-width: none; }
  .hist-recent { width: 100%; min-width: 0; }
  .hist-strip {
    justify-content: flex-start; overflow-x: auto; overflow-y: hidden;
    padding: 2px 0 8px; scroll-snap-type: x proximity;
  }
  .hp { flex: 0 0 148px; max-width: 148px; scroll-snap-align: start; }
  .hp-arrow { flex-basis: 58px; max-width: 58px; min-height: 84px; }
  .he-more { width: 44px; height: 44px; }
  .he-pop button { min-height: 44px; }
  .hc-corner { top: 7px; right: 7px; }
}

@media (max-width: 620px) {
  .error-view,
  .not-found-view { min-height: clamp(260px, 46vh, 420px); padding-inline: 14px; }
  .header-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 8px;
  }
  .logo { grid-column: 1; grid-row: 1; }
  .header-actions {
    grid-column: 1; grid-row: 2;
    justify-self: start;
  }
  #nav { grid-column: 1; grid-row: 3; }
  .logo-mark { width: 28px; height: 28px; flex-basis: 28px; }
}

@media (max-width: 440px) {
  .header-actions { grid-template-columns: 44px 44px 44px 68px; }
  .lang-switch { width: 66px; }
  .searchbox {
    width: 44px; min-width: 44px; padding: 0;
    justify-content: center; gap: 0;
  }
  .searchbox-label { display: none; }
}

@media (hover: none), (pointer: coarse) {
  .card:hover, .card:hover .card-poster img, .hp:hover .hp-img { transform: none; }
  .col-tile:hover .col-bg { transform: none; }
  .card-overlay { opacity: 0; pointer-events: none; }
  .card-heart { width: 44px; height: 44px; opacity: 1; }
  .btn-sm, .src-tab, .season-select { min-height: 44px; }
  .he-pop button { min-height: 44px; }
}

/* ============ continue watching hero ============ */
.cw-hero {
  position: relative; overflow: hidden; cursor: pointer;
  min-height: 210px; border-radius: var(--radius);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 26px; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--line);
  transform: translateY(0);
  transition: border-color .25s, transform .3s cubic-bezier(.22, .61, .36, 1), box-shadow .3s;
}
.cw-hero:hover {
  border-color: rgba(229, 9, 20, .55);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.cw-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5;
  transform: scale(1);
  transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}
.cw-hero:hover .cw-bg { transform: scale(1.04); }
.cw-grad {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10, 10, 14, .94) 0%, rgba(10, 10, 14, .6) 55%, rgba(10, 10, 14, .22) 100%);
}
.cw-info { position: relative; z-index: 1; min-width: 0; padding-right: 12px; }
.cw-label {
  display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.6px;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  padding: 5px 14px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(229, 9, 20, .35);
  width: fit-content;
}
.cw-title { font-size: 24px; font-weight: 800; margin: 4px 0 12px; }
.cw-progress { width: min(340px, 55vw); height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.cw-progress span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.cw-sub { font-size: 12px; color: var(--muted); margin-top: 7px; }
.cw-play { position: relative; z-index: 2; flex-shrink: 0; }
@media (max-width: 640px) {
  .cw-hero { flex-direction: column; align-items: flex-start; padding: 20px; min-height: 0; }
  .cw-title { font-size: 19px; }
  .cw-progress { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cw-hero { transition: none; }
  .cw-hero:hover { transform: none; }
  .cw-bg, .cw-hero:hover .cw-bg { transition: none; transform: none; }
}
