/* ===== PAGE SHELL ===== */
.page { padding-top: calc(var(--header-h) + var(--s5)); padding-bottom: var(--s10); min-height: 60vh; }
.page--flush { padding-top: var(--header-h); }

.page-head { padding-inline: var(--gutter); margin-bottom: var(--s6); }
.page-head h1 { font-size: clamp(var(--fs-2xl), .9rem + 2.4vw, 3rem); font-weight: var(--w-black); letter-spacing: -.03em; }
.page-head p { color: var(--tx-3); margin-top: 6px; max-width: 640px; }

/* ===== BROWSE / CATALOG ===== */
.browse-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding-inline: var(--gutter); margin-bottom: var(--s5);
}
.chip-scroller {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  flex: 1; min-width: 0; padding-block: 4px;
}
.chip-scroller::-webkit-scrollbar { display: none; }
.sort-select {
  appearance: none; -webkit-appearance: none;
  background: var(--bg-200) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e8e99' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); color: var(--tx-1);
  border-radius: var(--r-full); padding: 8px 38px 8px 16px;
  font-size: var(--fs-sm); font-weight: var(--w-semi); cursor: pointer;
}
.sort-select:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--gcols), minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 26px) var(--rail-gap);
  padding-inline: var(--gutter);
}
.grid .pcard { width: auto; }
.result-count { padding-inline: var(--gutter); color: var(--tx-3); font-size: var(--fs-sm); margin-bottom: var(--s4); }

/* ===== DETAIL PAGE ===== */
.detail-hero { position: relative; min-height: clamp(420px, 62vh, 760px); display: flex; align-items: flex-end; overflow: hidden; }
.detail-hero__bg { position: absolute; inset: 0; }
.detail-hero__bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.detail-hero__shade { position: absolute; inset: 0; background:
  linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.06) 30%, rgba(0,0,0,.25) 62%, rgba(0,0,0,.94) 92%, var(--bg-0) 100%),
  linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 55%);
}
html[data-theme="light"] .detail-hero__shade { background:
  linear-gradient(180deg, rgba(10,10,12,.5) 0%, rgba(10,10,12,.05) 32%, rgba(10,10,12,.22) 60%, rgba(244,244,246,.95) 94%, var(--bg-0) 100%),
  linear-gradient(90deg, rgba(10,10,12,.5) 0%, rgba(10,10,12,0) 55%);
}
.detail-wrap {
  position: relative; z-index: 2;
  width: 100%; padding: 0 var(--gutter) var(--s8);
  display: grid; grid-template-columns: 1fr; gap: var(--s6); align-items: end;
}
.detail-poster {
  width: clamp(150px, 22vw, 260px); aspect-ratio: 2/3;
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--sh-3), 0 0 0 1px rgba(255,255,255,.09);
  background: var(--bg-300);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-main { max-width: 720px; padding-bottom: 4px; }
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); font-weight: var(--w-semi); color: var(--tx-2);
  margin-bottom: var(--s4); transition: color var(--t-fast);
}
.back-link:hover { color: var(--tx-1); }
.back-link svg { width: 17px; height: 17px; }
.detail-title { font-size: clamp(var(--fs-2xl), 1rem + 3.4vw, 3.6rem); font-weight: var(--w-black); letter-spacing: -.028em; line-height: 1.02; text-shadow: 0 3px 28px rgba(0,0,0,.6); margin-bottom: var(--s3); }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; font-size: var(--fs-sm); font-weight: var(--w-semi); color: #dcdce2; margin-bottom: var(--s4); }
html[data-theme="light"] .detail-meta { color: #33333c; }
.detail-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--s4); }
.genre-pill {
  font-size: var(--fs-xs); font-weight: var(--w-semibold); color: #e4e4ea;
  padding: 5px 13px; border-radius: var(--r-full);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(4px);
  transition: all var(--t-fast);
}
.genre-pill:hover { background: rgba(255,255,255,.2); }
.detail-desc {
  font-size: clamp(var(--fs-sm), .85rem + .3vw, var(--fs-lg));
  line-height: 1.6; color: #e9e9ef; max-width: 640px;
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  margin-bottom: var(--s5);
}
html[data-theme="light"] .detail-desc { color: #232329; }
.detail-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s5); }
.list-btn.is-in { background: rgba(70,211,105,.18); border-color: rgba(70,211,105,.5); color: #7dedA0; }
.cast-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.cast-chip { font-size: var(--fs-xs); color: var(--tx-3); padding: 5px 11px; border-radius: var(--r-full); background: var(--bg-100); border: 1px solid var(--line-subtle); }

.detail-body { padding: var(--s6) var(--gutter) 0; display: grid; gap: var(--s10); max-width: 1100px; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s5); }
.fact b { display: block; font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--tx-3); margin-bottom: 5px; }
.fact span { font-size: var(--fs-sm); color: var(--tx-1); font-weight: var(--w-medium); }

/* Seasons & episodes */
.seasons-bar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: var(--s5); }
.episodes { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
.ep-card {
  display: grid; grid-template-columns: minmax(150px, 240px) 1fr; gap: var(--s4);
  background: var(--bg-50); border: 1px solid var(--line-subtle);
  border-radius: var(--r-lg); overflow: hidden;
  transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med);
}
.ep-thumb { position: relative; aspect-ratio: 16/9; background: var(--bg-300); }
.ep-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow); }
.ep-num {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: var(--fs-xs); font-weight: var(--w-bold);
  padding: 3px 9px; border-radius: var(--r-sm); backdrop-filter: blur(4px);
}
.ep-info { padding: var(--s4) var(--s4) var(--s4) 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.ep-title { font-size: var(--fs-md); font-weight: var(--w-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-overview {
  font-size: var(--fs-sm); color: var(--tx-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep-runtime { font-size: var(--fs-xs); color: var(--tx-3); display: flex; align-items: center; gap: 8px; }
@media (hover:hover) and (pointer:fine) {
  .ep-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--sh-2); }
  .ep-card:hover .ep-thumb img { transform: scale(1.06); }
}

/* ===== PLAYER ===== */
.player-layer { position: fixed; inset: 0; z-index: var(--z-player); background: #000; display: none; }
.player-layer.is-open { display: block; }
.player-stage { position: absolute; inset: 0; }
.player-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-error {
  position: absolute; inset: 0; display: none; place-content: center; justify-items: center; gap: var(--s4);
  text-align: center; padding: var(--s5); color: var(--tx-2);
}
.player-error.is-shown { display: grid; }
.player-ui {
  position: absolute; inset: 0; z-index: 2;
  opacity: 1; transition: opacity var(--t-med);
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, transparent 22%, transparent 74%, rgba(0,0,0,.78) 100%);
}
.player-ui.is-hidden { opacity: 0; cursor: none; }
.player-top { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--gutter); }
.player-tit b { display: block; font-size: var(--fs-md); font-weight: var(--w-bold); color: #fff; }
.player-tit span { font-size: var(--fs-xs); color: #b9b9c2; }
.player-bottom { padding: 0 var(--gutter) var(--s5); display: grid; gap: 10px; }
.seek { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek__track { position: relative; width: 100%; height: 5px; border-radius: var(--r-full); background: rgba(255,255,255,.22); overflow: visible; transition: height var(--t-fast); }
.seek:hover .seek__track { height: 8px; }
.seek__buf { position: absolute; inset: 0 auto 0 0; height: 100%; border-radius: inherit; background: rgba(255,255,255,.35); width: 0%; }
.seek__fill { position: absolute; inset: 0 auto 0 0; height: 100%; border-radius: inherit; background: var(--brand-500); width: 0%; }
.seek__knob {
  position: absolute; top: 50%; left: 0%;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--brand-500); transform: translate(-50%, -50%) scale(0);
  transition: transform var(--t-fast); box-shadow: 0 0 12px var(--brand-glow);
}
.seek:hover .seek__knob, .seek:focus-within .seek__knob { transform: translate(-50%, -50%) scale(1); }
.player-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pbtn {
  width: 46px; height: 46px; border-radius: var(--r-full);
  display: grid; place-items: center; color: #fff;
  transition: background var(--t-fast), transform var(--t-fast);
}
.pbtn svg { width: 23px; height: 23px; }
.pbtn:hover, .pbtn:focus-visible { background: rgba(255,255,255,.14); }
.pbtn--play { width: 58px; height: 58px; background: #fff; color: #000; }
.pbtn--play svg { width: 27px; height: 27px; }
.pbtn--play:hover { background: #f0f0f0; }
.pbtn--back { margin-right: 4px; }
.p-time { font-size: var(--fs-sm); color: #d5d5dc; font-variant-numeric: tabular-nums; padding-inline: 8px; white-space: nowrap; }
.player-spacer { flex: 1; }
.vol-group { display: flex; align-items: center; }
.vol-range { width: 0; opacity: 0; transition: all var(--t-med); accent-color: var(--brand-500); height: 4px; cursor: pointer; }
.vol-group:hover .vol-range, .vol-range:focus-visible { width: 88px; opacity: 1; margin-inline: 8px; }

/* ===== SEARCH RESULTS PAGE / MY LIST / 404 reuse grid ===== */
.kv-note { padding-inline: var(--gutter); color: var(--tx-3); font-size: var(--fs-sm); margin-bottom: var(--s5); }
