/* Home Ent — dark cinema UI */

:root {
  --bg: #0a0a0d;
  --bg-soft: #121218;
  --surface: #1a1a22;
  --surface-2: #23232d;
  --line: #2e2e3a;
  --text: #f2f2f5;
  --muted: #9a9aa8;
  --dim: #6c6c7c;
  --accent: #ff3b46;
  --accent-2: #ff7a3d;
  --gold: #e9b949;
  --radius: 10px;
  --radius-lg: 16px;
  --header-h: 64px;
  --tabbar-h: 62px;
  --shadow: 0 18px 40px -12px rgba(0, 0, 0, .75);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

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

body.he-noscroll { overflow: hidden; }

img { display: block; border-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #33333f; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.he-hidden { display: none !important; }
.he-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Boot / loading
   -------------------------------------------------------------------------- */

#he-boot {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .35s var(--ease);
}
#he-boot.he-gone { opacity: 0; pointer-events: none; }

.he-boot-mark {
  font-weight: 800; letter-spacing: .34em; font-size: 15px;
  text-transform: uppercase; color: var(--accent);
  animation: he-pulse 1.5s ease-in-out infinite;
}
@keyframes he-pulse { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }

.he-spinner {
  width: 34px; height: 34px; margin: 40px auto;
  border: 3px solid #ffffff1f; border-top-color: var(--accent);
  border-radius: 50%; animation: he-spin .8s linear infinite;
}
@keyframes he-spin { to { transform: rotate(360deg) } }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.he-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 22px;
  padding: 0 clamp(14px, 4vw, 52px);
  background: linear-gradient(180deg, rgba(8, 8, 11, .96) 12%, rgba(8, 8, 11, 0) 100%);
  transition: background .3s var(--ease);
}
.he-header.he-solid { background: rgba(10, 10, 13, .96); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }

.he-logo {
  display: flex; align-items: baseline; gap: 7px;
  font-weight: 800; font-size: 20px; letter-spacing: .02em; flex-shrink: 0;
}
.he-logo b { color: var(--accent); letter-spacing: -.02em; }
.he-logo span { font-weight: 300; color: var(--text); letter-spacing: .16em; font-size: 15px; text-transform: uppercase; }

.he-nav { display: flex; gap: 4px; }
.he-nav a {
  padding: 8px 13px; border-radius: 999px; font-size: 14px;
  color: var(--muted); transition: color .18s, background .18s;
}
.he-nav a:hover { color: var(--text); }
.he-nav a.he-on { color: var(--text); background: #ffffff14; font-weight: 600; }

.he-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.he-search {
  display: flex; align-items: center; gap: 8px;
  background: #ffffff12; border: 1px solid transparent;
  border-radius: 999px; padding: 7px 14px;
  transition: width .28s var(--ease), border-color .2s, background .2s;
  width: 210px;
}
.he-search:focus-within { border-color: #ffffff30; background: #00000080; width: 300px; }
.he-search input {
  border: 0; background: transparent; color: var(--text);
  outline: none; width: 100%; font-size: 14px;
}
.he-search input::placeholder { color: var(--dim); }
.he-search svg { flex-shrink: 0; opacity: .65; }

.he-avatar {
  width: 36px; height: 36px; border-radius: 9px; border: 0;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(140deg, hsl(var(--hue, 350) 70% 48%), hsl(calc(var(--hue, 350) + 40) 70% 38%));
}

.he-menu {
  position: absolute; top: calc(var(--header-h) - 6px); right: clamp(14px, 4vw, 52px);
  width: 232px; padding: 8px;
  background: #14141b; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); z-index: 70;
}
.he-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.he-menu-head strong { display: block; font-size: 15px; }
.he-menu-head small { color: var(--dim); font-size: 12.5px; }
.he-menu button, .he-menu a {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; background: transparent;
  border-radius: 9px; font-size: 14px; color: var(--muted);
}
.he-menu button:hover, .he-menu a:hover { background: #ffffff10; color: var(--text); }

/* --------------------------------------------------------------------------
   Mobile tab bar
   -------------------------------------------------------------------------- */

.he-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: none; align-items: center; justify-content: space-around;
  background: rgba(12, 12, 16, .97); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.he-tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--dim); padding: 6px 12px; flex: 1;
}
.he-tabbar a.he-on { color: var(--text); }
.he-tabbar a.he-on svg { color: var(--accent); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.he-main { min-height: 100vh; padding-bottom: 70px; }
.he-pad { padding: 0 clamp(14px, 4vw, 52px); }
.he-top-gap { padding-top: calc(var(--header-h) + 26px); }

.he-page-title { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; margin: 0 0 4px; letter-spacing: -.02em; }
.he-page-sub { color: var(--dim); font-size: 14px; margin: 0 0 22px; }

/* --------------------------------------------------------------------------
   Hero billboard
   -------------------------------------------------------------------------- */

.he-hero { position: relative; min-height: min(78vh, 660px); display: flex; align-items: flex-end; }
.he-hero-bg { position: absolute; inset: 0; overflow: hidden; }
.he-hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.he-hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 10, 13, .96) 0%, rgba(10, 10, 13, .72) 38%, rgba(10, 10, 13, .1) 72%),
    linear-gradient(0deg, var(--bg) 2%, rgba(10, 10, 13, .18) 46%);
}
/* The bottom padding keeps the copy clear of the row that overlaps the hero. */
.he-hero-body { position: relative; z-index: 2; padding: 0 clamp(14px, 4vw, 52px) clamp(92px, 11vw, 150px); max-width: 660px; }
.he-hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
}
.he-hero h1 {
  font-size: clamp(30px, 5.6vw, 60px); line-height: 1.03;
  margin: 0 0 14px; font-weight: 800; letter-spacing: -.03em;
  text-shadow: 0 3px 24px rgba(0, 0, 0, .6);
}
.he-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 14px; font-size: 13.5px; color: #d3d3de; }
.he-hero p { color: #c8c8d4; font-size: 15px; line-height: 1.6; margin: 0 0 22px; max-width: 560px; }
.he-hero-actions { display: flex; flex-wrap: wrap; gap: 11px; }

/* --------------------------------------------------------------------------
   Buttons / chips
   -------------------------------------------------------------------------- */

.he-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 24px; border: 0; border-radius: 8px;
  font-size: 15px; font-weight: 650; white-space: nowrap;
  transition: transform .14s var(--ease), background .18s, opacity .18s;
}
.he-btn:active { transform: scale(.97); }
.he-btn-primary { background: #fff; color: #0a0a0d; }
.he-btn-primary:hover { background: #dedee6; }
.he-btn-ghost { background: #ffffff1f; color: var(--text); backdrop-filter: blur(6px); }
.he-btn-ghost:hover { background: #ffffff30; }
.he-btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.he-btn-sm { padding: 9px 16px; font-size: 13.5px; }
.he-btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1.5px solid #ffffff40; background: #00000059; }
.he-btn-icon:hover { border-color: #fff; background: #ffffff26; }
.he-btn[disabled] { opacity: .5; pointer-events: none; }

.he-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: #ffffff14; font-size: 12px; color: #cfcfdb; white-space: nowrap;
}
.he-chip-rating { color: var(--gold); font-weight: 700; background: #e9b9491f; }
.he-chip-quality { color: #7fd4a0; background: #7fd4a01f; font-weight: 600; }
.he-chip-warn { color: #ffb27a; background: #ffb27a1f; font-weight: 600; }

/* --------------------------------------------------------------------------
   Rows / cards
   -------------------------------------------------------------------------- */

.he-row { margin: 0 0 clamp(26px, 3.6vw, 42px); position: relative; }
.he-row-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 0 clamp(14px, 4vw, 52px); margin-bottom: 12px;
}
.he-row-head h2 { font-size: clamp(16px, 1.7vw, 21px); font-weight: 700; margin: 0; letter-spacing: -.01em; }
.he-row-head a { font-size: 12.5px; color: var(--dim); opacity: 0; transition: opacity .2s; }
.he-row:hover .he-row-head a { opacity: 1; }
.he-row-head a:hover { color: var(--accent); }

.he-track {
  display: flex; gap: 10px; overflow-x: auto; scroll-behavior: smooth;
  padding: 4px clamp(14px, 4vw, 52px) 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.he-track::-webkit-scrollbar { display: none; }

.he-arrow {
  position: absolute; top: 0; bottom: 14px; width: 52px; z-index: 8;
  border: 0; background: linear-gradient(90deg, rgba(10, 10, 13, .88), rgba(10, 10, 13, 0));
  display: none; place-items: center; opacity: 0; transition: opacity .2s;
}
.he-arrow-next { right: 0; transform: scaleX(-1); }
.he-row:hover .he-arrow { opacity: 1; }
.he-arrow:disabled { opacity: 0 !important; pointer-events: none; }
@media (hover: hover) and (min-width: 900px) { .he-arrow { display: grid; } }

.he-card {
  flex: 0 0 auto; width: 152px; scroll-snap-align: start;
  cursor: pointer; position: relative;
  transition: transform .22s var(--ease);
}
.he-card-wide { width: 300px; }
@media (hover: hover) { .he-card:hover { transform: translateY(-5px); } }

.he-poster {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3C/svg%3E") center/cover;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .8);
}
.he-card-wide .he-poster { aspect-ratio: 16 / 9; }
/* The image is stacked above the placeholder, which shows through until it loads. */
.he-poster img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; transition: opacity .35s;
}
.he-poster img.he-loading { opacity: 0; }
.he-card:hover .he-poster { box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .9); }

.he-poster-fallback {
  position: absolute; inset: 0; z-index: 0; display: grid; place-items: center;
  padding: 12px; text-align: center; font-size: 12.5px; font-weight: 600;
  color: var(--dim); background: linear-gradient(150deg, #1c1c26, #121218);
}

.he-badge {
  position: absolute; top: 7px; left: 7px; z-index: 3;
  padding: 3px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px);
}
.he-badge-rating { color: var(--gold); }
.he-badge-type { left: auto; right: 7px; color: #cfcfdb; text-transform: uppercase; }

.he-progressbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 4px;
  background: rgba(255, 255, 255, .22);
}
.he-progressbar i { display: block; height: 100%; background: var(--accent); }

.he-card-title {
  margin-top: 7px; font-size: 13px; font-weight: 600; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.he-card-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }

.he-play-veil {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .2s;
}
@media (hover: hover) { .he-card:hover .he-play-veil { opacity: 1; } }
.he-play-veil span {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .94); color: #0a0a0d;
  display: grid; place-items: center;
}

.he-card-remove {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .74); color: #fff;
  display: grid; place-items: center; opacity: 0; transition: opacity .18s;
}
.he-card:hover .he-card-remove { opacity: 1; }
.he-card-remove:hover { background: var(--accent); }

/* --------------------------------------------------------------------------
   Grid (browse / search)
   -------------------------------------------------------------------------- */

.he-grid {
  display: grid; gap: 18px 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.he-grid .he-card { width: 100%; }
@media (max-width: 520px) { .he-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 15px 9px; } }

.he-filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 24px; align-items: center; }
.he-select {
  appearance: none; padding: 9px 34px 9px 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239a9aa8' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 13px center;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 13.5px; outline: none; cursor: pointer;
}
.he-select:focus { border-color: #ffffff40; }

.he-empty { text-align: center; padding: 74px 20px; color: var(--dim); }
.he-empty h3 { color: var(--text); font-size: 19px; margin: 0 0 8px; font-weight: 700; }
.he-empty p { margin: 0 0 20px; font-size: 14px; }

.he-sentinel { height: 40px; }

/* --------------------------------------------------------------------------
   Detail page
   -------------------------------------------------------------------------- */

.he-detail-hero { position: relative; min-height: min(72vh, 600px); display: flex; align-items: flex-end; }
.he-detail-body {
  position: relative; z-index: 2;
  padding: 0 clamp(14px, 4vw, 52px) 30px;
  display: flex; gap: 30px; align-items: flex-end; width: 100%;
}
.he-detail-poster {
  flex: 0 0 auto; width: 210px; aspect-ratio: 2/3;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid #ffffff1a;
}
.he-detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.he-detail-info { flex: 1; min-width: 0; }
.he-detail-info h1 { font-size: clamp(26px, 4.2vw, 46px); font-weight: 800; margin: 0 0 12px; letter-spacing: -.03em; line-height: 1.06; }
.he-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.he-detail-overview { color: #c4c4d2; font-size: 15px; line-height: 1.66; margin: 0 0 20px; max-width: 720px; }
.he-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.he-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 26px; margin: 34px 0; }
.he-fact strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); margin-bottom: 5px; }
.he-fact span { font-size: 14px; color: #dcdce6; line-height: 1.5; }

.he-section-title { font-size: 19px; font-weight: 700; margin: 34px 0 14px; letter-spacing: -.01em; }

/* Episodes */
.he-season-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; scrollbar-width: none; }
.he-season-tabs::-webkit-scrollbar { display: none; }
.he-season-tabs button {
  flex: 0 0 auto; padding: 8px 17px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.he-season-tabs button.he-on { background: var(--text); color: #0a0a0d; border-color: var(--text); font-weight: 650; }

.he-episodes { display: flex; flex-direction: column; gap: 9px; }
.he-episode {
  display: flex; gap: 15px; padding: 11px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
  transition: background .18s, border-color .18s;
}
.he-episode:hover { background: var(--surface-2); border-color: #3d3d4d; }
.he-episode.he-on { border-color: var(--accent); }
.he-episode-still {
  flex: 0 0 auto; width: 152px; aspect-ratio: 16/9;
  border-radius: 8px; overflow: hidden; background: #101017; position: relative;
}
.he-episode-still img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.he-episode-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 20px; font-weight: 800; color: #4a4a5c;
}
.he-episode-info { flex: 1; min-width: 0; }
.he-episode-info h4 { margin: 0 0 5px; font-size: 14.5px; font-weight: 650; }
.he-episode-info p {
  margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.he-episode-tag { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: .06em; margin-bottom: 4px; }
.he-episode-watched { color: #7fd4a0; }

/* Gaps in a season — visible but clearly not tappable. */
.he-episode-missing {
  border-style: dashed; background: transparent; cursor: default;
  opacity: .62;
}
.he-episode-missing:hover { background: transparent; border-color: var(--line); }
.he-episode-missing .he-episode-still { opacity: .45; }
.he-episode-gap { color: #ffb27a; }

.he-season-summary { font-size: 12.5px; color: var(--dim); margin: 0 0 12px; }
.he-season-summary-warn { color: #ffb27a; }

.he-season-dot {
  display: inline-block; width: 6px; height: 6px; margin-left: 7px;
  border-radius: 50%; background: #ffb27a; vertical-align: middle;
}
.he-season-tabs button.he-on .he-season-dot { background: #b06a2c; }

.he-cast { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.he-cast::-webkit-scrollbar { display: none; }
.he-cast-person { flex: 0 0 auto; width: 96px; text-align: center; }
.he-cast-person div {
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(150deg, #23232e, #16161d);
  display: grid; place-items: center; margin-bottom: 8px;
  font-size: 25px; font-weight: 700; color: #55556a;
}
.he-cast-person span { font-size: 12px; color: #c9c9d6; line-height: 1.35; display: block; }

/* --------------------------------------------------------------------------
   Player
   -------------------------------------------------------------------------- */

.he-player {
  position: fixed; inset: 0; z-index: 200;
  background: #000; display: flex; flex-direction: column;
}
.he-player video {
  width: 100%; height: 100%; object-fit: contain;
  background: #000; position: absolute; inset: 0;
}
.he-player.he-idle { cursor: none; }
.he-player.he-idle .he-pl-top, .he-player.he-idle .he-pl-bottom { opacity: 0; pointer-events: none; }

/* Above the unsupported-format panel, so Back is always reachable. */
.he-pl-top { z-index: 20 !important; }

.he-pl-top, .he-pl-bottom {
  position: absolute; left: 0; right: 0; z-index: 10;
  transition: opacity .28s var(--ease);
  padding: 0 clamp(12px, 3vw, 32px);
}
.he-pl-top {
  top: 0; padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 40px;
  display: flex; align-items: flex-start; gap: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .82), transparent);
}
.he-pl-bottom {
  bottom: 0; padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-top: 60px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .9) 12%, transparent);
}

.he-pl-back {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .48); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.he-pl-back:hover { background: rgba(255, 255, 255, .2); }
.he-pl-titles { min-width: 0; }
.he-pl-titles h3 { margin: 0; font-size: clamp(15px, 2vw, 20px); font-weight: 700; }
.he-pl-titles small { color: #b9b9c8; font-size: 12.5px; }

.he-pl-seek { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.he-pl-seek-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .26); transition: height .15s; }
.he-pl-seek:hover .he-pl-seek-rail { height: 6px; }
.he-pl-seek-buf { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .34); border-radius: 4px; }
.he-pl-seek-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 4px; }
.he-pl-seek-knob {
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%) scale(0);
  transition: transform .15s var(--ease);
}
.he-pl-seek:hover .he-pl-seek-knob, .he-pl-seek.he-dragging .he-pl-seek-knob { transform: translate(-50%, -50%) scale(1); }

.he-pl-controls { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.he-pl-controls .he-spacer { flex: 1; }
.he-pl-btn {
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: transparent; color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
  transition: background .16s, transform .12s;
}
.he-pl-btn:hover { background: rgba(255, 255, 255, .16); }
.he-pl-btn-on { color: var(--accent); }
.he-pl-btn-on::after {
  content: ''; position: absolute; bottom: 4px;
  width: 15px; height: 2px; border-radius: 2px; background: var(--accent);
}
.he-pl-controls .he-pl-btn { position: relative; }
.he-pl-btn:active { transform: scale(.9); }
.he-pl-btn.he-big { width: 54px; height: 54px; }
.he-pl-time { font-size: 13px; color: #d6d6e2; font-variant-numeric: tabular-nums; padding: 0 8px; white-space: nowrap; }

.he-pl-volume { display: flex; align-items: center; gap: 6px; }
.he-pl-volume input {
  width: 0; opacity: 0; transition: width .24s var(--ease), opacity .24s;
  accent-color: var(--accent); cursor: pointer;
}
.he-pl-volume:hover input { width: 82px; opacity: 1; }
@media (max-width: 780px) { .he-pl-volume input { display: none; } }

/* Phones: drop what the hardware already does and shrink the rest so the
   fullscreen button never gets pushed off the edge. */
@media (max-width: 430px) {
  .he-pl-controls { gap: 0; }
  .he-pl-volume, .he-pl-controls [data-pip] { display: none; }
  .he-pl-btn { width: 40px; height: 40px; }
  .he-pl-btn.he-big { width: 46px; height: 46px; }
  .he-pl-time { font-size: 12px; padding: 0 5px; }
}

.he-pl-next {
  position: absolute; right: clamp(12px, 3vw, 32px); bottom: 108px; z-index: 12;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border: 0; border-radius: 12px;
  background: rgba(16, 16, 22, .94); backdrop-filter: blur(10px);
  border: 1px solid #ffffff26; box-shadow: var(--shadow);
  animation: he-slide-in .34s var(--ease);
}
@keyframes he-slide-in { from { opacity: 0; transform: translateX(24px); } }
.he-pl-next strong { display: block; font-size: 14px; }
.he-pl-next small { color: var(--dim); font-size: 12px; }

.he-pl-toast {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 11; padding: 14px 22px; border-radius: 12px;
  background: rgba(0, 0, 0, .68); font-size: 16px; font-weight: 650;
  pointer-events: none; animation: he-fade-out 0.75s var(--ease) forwards;
}
@keyframes he-fade-out { 0%, 55% { opacity: 1 } 100% { opacity: 0 } }

.he-pl-center {
  position: absolute; inset: 0; z-index: 9;
  display: grid; place-items: center; pointer-events: none;
}
.he-pl-center .he-spinner { margin: 0; }

/* Subtitle cues. Native rendering is used on purpose so they keep working in
   iPhone fullscreen and over AirPlay, where an overlay of ours would vanish. */
.he-player video::cue {
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92em;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
}

/* Subtitle panel */
.he-cc-panel {
  position: absolute; right: clamp(10px, 3vw, 30px); bottom: 104px; z-index: 25;
  width: min(320px, calc(100vw - 24px));
  max-height: min(62vh, 460px); overflow-y: auto;
  padding: 16px; border-radius: 15px;
  background: rgba(16, 16, 22, .97); backdrop-filter: blur(16px);
  border: 1px solid #ffffff22; box-shadow: var(--shadow);
  animation: he-slide-in .22s var(--ease);
}
.he-cc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.he-cc-head strong { font-size: 15px; }
.he-cc-head .he-pl-btn { width: 30px; height: 30px; }

.he-cc-tracks { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.he-cc-track {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 13px; border: 1px solid transparent; border-radius: 9px;
  background: #ffffff0d; color: var(--muted); font-size: 14px; text-align: left;
}
.he-cc-track:hover { background: #ffffff17; color: var(--text); }
.he-cc-track.he-on { background: #ffffff1f; color: var(--text); border-color: var(--accent); font-weight: 650; }
.he-cc-track small { color: var(--dim); font-size: 11.5px; margin-left: auto; }
.he-cc-empty { color: var(--dim); font-size: 13px; margin: 4px 0 0; }

.he-cc-sync { border-top: 1px solid var(--line); padding-top: 13px; margin-bottom: 13px; }
.he-cc-sync-label { font-size: 12.5px; color: var(--muted); margin-bottom: 9px; }
.he-cc-sync-label span { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.he-cc-sync-buttons { display: flex; gap: 5px; }
.he-cc-sync-buttons button {
  flex: 1; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--muted); font-size: 12px;
}
.he-cc-sync-buttons button:hover { background: var(--surface-2); color: var(--text); }
.he-cc-sync small, .he-cc-add small { display: block; margin-top: 8px; font-size: 11.5px; color: var(--dim); line-height: 1.45; }

.he-cc-add { border-top: 1px solid var(--line); padding-top: 13px; }
.he-cc-link {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 10px 13px; margin-bottom: 5px; border-radius: 9px;
  background: #ffffff0d; color: var(--muted); font-size: 13.5px;
}
.he-cc-link:hover { background: #ffffff17; color: var(--text); }

/* Unsupported-format panel */
.he-unsupported {
  position: absolute; inset: 0; z-index: 15;
  display: grid; place-items: center; padding: 26px;
  background: radial-gradient(120% 90% at 50% 0%, #1a1a26, #08080c);
  overflow-y: auto;
}
.he-unsupported-inner { max-width: 480px; text-align: center; padding: 76px 0 30px; }
.he-unsupported h2 { font-size: 22px; margin: 0 0 10px; font-weight: 750; }
.he-unsupported p { color: var(--muted); font-size: 14.5px; line-height: 1.62; margin: 0 0 22px; }
.he-app-links { display: grid; gap: 9px; margin-bottom: 20px; }
.he-app-link {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  text-align: left; transition: background .18s, border-color .18s;
}
.he-app-link:hover { background: var(--surface-2); border-color: #444457; }
.he-app-link-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
}
.he-app-link strong { display: block; font-size: 14.5px; }
.he-app-link small { color: var(--dim); font-size: 12px; }

/* --------------------------------------------------------------------------
   Auth screen
   -------------------------------------------------------------------------- */

.he-auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    linear-gradient(rgba(8, 8, 11, .82), rgba(8, 8, 11, .97)),
    radial-gradient(90% 60% at 50% 0%, #2a1119, #08080c);
}
.he-auth-card {
  width: 100%; max-width: 400px;
  background: rgba(18, 18, 24, .9); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 34px 30px; box-shadow: var(--shadow);
}
.he-auth-card .he-logo { justify-content: center; font-size: 25px; margin-bottom: 6px; }
.he-auth-card > p { text-align: center; color: var(--dim); font-size: 13.5px; margin: 0 0 26px; }

.he-field { margin-bottom: 15px; }
.he-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.he-field input {
  width: 100%; padding: 13px 15px;
  background: #0e0e14; border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 15px; outline: none;
  transition: border-color .18s;
}
.he-field input:focus { border-color: var(--accent); }
.he-field small { display: block; margin-top: 6px; font-size: 12px; color: var(--dim); }
.he-field small.he-ok { color: #7fd4a0; }
.he-field small.he-bad { color: #ff8080; }

.he-auth-error {
  background: #ff3b4620; border: 1px solid #ff3b4650;
  color: #ffa8ad; padding: 11px 14px; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 16px;
}
.he-auth-switch { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--dim); }
.he-auth-switch button { background: none; border: 0; color: var(--accent); font-weight: 650; padding: 0; }

/* --------------------------------------------------------------------------
   Account page
   -------------------------------------------------------------------------- */

.he-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; margin-bottom: 16px; max-width: 560px;
}
.he-panel h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.he-panel > p { margin: 0 0 18px; color: var(--dim); font-size: 13.5px; }

.he-note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: 11px;
  background: #ffb27a12; border: 1px solid #ffb27a30;
  color: #e8cbb4; font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; max-width: 560px;
}

.he-toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.he-toast {
  padding: 11px 20px; border-radius: 999px;
  background: rgba(28, 28, 36, .97); border: 1px solid var(--line);
  font-size: 13.5px; box-shadow: var(--shadow);
  animation: he-toast-in .26s var(--ease);
}
@keyframes he-toast-in { from { opacity: 0; transform: translateY(12px); } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .he-nav, .he-search { display: none; }
  .he-tabbar { display: flex; }
  .he-main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }
  .he-header { background: linear-gradient(180deg, rgba(8, 8, 11, .97) 30%, transparent); }
  .he-detail-body { flex-direction: column; align-items: flex-start; gap: 18px; padding-top: calc(var(--header-h) + 16px); }
  .he-detail-poster { width: 122px; }
  .he-hero { min-height: 62vh; }
  .he-hero p { display: none; }
  .he-episode-still { width: 116px; }
  .he-card { width: 124px; }
  .he-card-wide { width: 232px; }
}

@media (max-width: 520px) {
  .he-hero-actions .he-btn { flex: 1; }
  .he-detail-actions { width: 100%; }
  .he-detail-actions .he-btn-primary { flex: 1; }
  .he-episode-info p { -webkit-line-clamp: 1; }
}
