/* ===== Tokens ===== */
@font-face {
  font-family: "Archivo Display";
  src: url("fonts/archivo-display.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* ground */
  --bg-0: #0a0a0c;
  --bg-1: #141317;
  --bg-2: #1d1c21;

  /* text */
  --text-1: #f4f2ee;
  --text-2: #a5a19b;
  --text-3: #66635e;

  /* lines & accent */
  --line: rgba(244, 242, 238, 0.09);
  --line-strong: rgba(244, 242, 238, 0.18);
  --accent: #e8b04b;
  --accent-strong: #ffc866;
  --ring: rgba(232, 176, 75, 0.9);
  --live: #e5484d;
  --ok: #46a758;

  /* elevation */
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 16px 48px rgba(0, 0, 0, 0.55);

  /* shape */
  --radius-s: 8px;
  --radius-m: 10px;
  --radius-l: 14px;

  /* motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 120ms;
  --t-med: 220ms;
  --t-slow: 360ms;
  --dur-s: 120ms;
  --dur-m: 220ms;

  /* type */
  --font-display: "Archivo Display", "Segoe UI Variable Display", "SF Pro Display", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", "Aptos", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-data: "Cascadia Code", "SFMono-Regular", ui-monospace, monospace;

  /* layout */
  --hero-title-max: 7.5rem;
  --tv-focus-size: 56px;
  --gutter: clamp(16px, 4vw, 48px);
  --topbar-h: 64px;

  /* legacy aliases — do not use in new code */
  --bg: var(--bg-0);
  --panel: var(--bg-1);
  --text: var(--text-1);
  --muted: var(--text-2);
  --danger: var(--live);
  --shadow: var(--shadow-1);
  --soft-border: var(--line);
  --card: var(--bg-1);
}

/* ===== Reset ===== */
* {
  box-sizing: border-box;
  letter-spacing: 0;
}


button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}





/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-0);
  overflow: hidden;
}

.login-overlay.hidden {
  display: none;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background-image:
    url("https://image.tmdb.org/t/p/w1280/xJHokMbljvjADYdit5fK5VQsXEG.jpg"),
    linear-gradient(160deg, #17161a 0%, #0a0a0c 62%);
  background-size: cover;
  background-position: center;
  animation: login-drift 40s var(--ease) infinite alternate;
  will-change: transform;
}

.login-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 88% at 50% 44%, rgba(10, 10, 12, 0.24) 0%, rgba(10, 10, 12, 0.68) 62%, rgba(10, 10, 12, 0.94) 100%),
    linear-gradient(180deg, rgba(10, 10, 12, 0.42) 0%, rgba(10, 10, 12, 0.16) 36%, rgba(10, 10, 12, 0.72) 100%);
}

@keyframes login-drift {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(392px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 40px 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: rgba(16, 15, 19, 0.66);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  animation: login-card-in 0.5s var(--ease-out) both;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.login-wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(2.4rem, 8vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text-1);
}

.login-tag {
  margin: 2px 0 12px;
  color: var(--text-2);
  font-family: var(--font-data);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.login-field {
  display: grid;
  gap: 6px;
}

.login-field span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.login-card input {
  width: 100%;
  min-height: 46px;
  background: rgba(244, 242, 238, 0.05);
  color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  outline: 0;
  padding: 0 14px;
  font-size: 0.95rem;
  transition: border-color var(--dur-s) var(--ease-out), background var(--dur-s) var(--ease-out);
}

.login-card input:hover {
  border-color: var(--line-strong);
}

.login-card input:focus {
  background: rgba(244, 242, 238, 0.07);
  border-color: var(--accent);
  outline: none;
}

.login-card button[type="submit"] {
  min-height: 48px;
  margin-top: 8px;
  border-radius: var(--radius-s);
  background: var(--text-1);
  color: #111013;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-card button[type="submit"]:not(:disabled):hover {
  background: #ffffff;
}

.login-mode-toggle {
  align-self: center;
  min-height: 40px;
  padding: 0 10px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 650;
}

.login-mode-toggle:hover,
.login-mode-toggle:focus-visible {
  color: var(--text-1);
}

.login-reset-toggle {
  margin-top: -10px;
  min-height: 30px;
}

.auth-honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.login-error {
  margin: 0;
  min-height: 1.2em;
  color: var(--live);
  font-size: 0.8rem;
  text-align: center;
}

.login-status {
  margin: 0;
  min-height: 1.2em;
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
}

.login-error:not(:empty) {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .login-overlay {
    padding: 16px;
  }

  .login-card {
    padding: 32px 24px 24px;
  }

  .login-backdrop::after {
    background: radial-gradient(120% 92% at 50% 40%, rgba(10, 10, 12, 0.3) 0%, rgba(10, 10, 12, 0.76) 60%, rgba(10, 10, 12, 0.96) 100%);
  }
}

/* ===== Profile button & dropdown ===== */
.profile-wrapper {
  position: relative;
  flex: 0 0 auto;
}

.profile-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(138, 135, 131, 0.22);
  border: 1px solid rgba(173, 170, 166, 0.38);
  box-shadow: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.profile-btn:hover {
  border-color: rgba(173, 170, 166, 0.68);
  background: rgba(138, 135, 131, 0.34);
}

.profile-avatar {
  color: var(--text);
  font-weight: 900;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 400;
  min-width: 184px;
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--bg-1);
  box-shadow: var(--shadow-1);
}

.profile-dropdown.hidden {
  display: none;
}

.profile-name {
  margin: 0 0 6px;
  padding: 6px 10px 10px;
  color: var(--text-1);
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.profile-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-s);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.profile-link:hover {
  background: rgba(244, 242, 238, 0.07);
  color: var(--text-1);
}

.profile-dropdown .ghost {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-2);
}

.profile-dropdown .ghost:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.07);
  color: var(--text-1);
}

/* ===== Layout ===== */
#app {
  width: min(1720px, calc(100% - clamp(16px, 4vw, 56px)));
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 14px) 0 48px;
}

/* ===== Topbar ===== */

.diagnostics {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ===== Navigation ===== */

/* ===== Search ===== */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 40px;
  background: rgba(244, 242, 238, 0.07);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0 4px 0 12px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.search:focus-within {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(232, 176, 75, 0.55);
}

.search input {
  flex: 1;
  min-width: 0;
  width: 190px;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-1);
  outline: 0;
  padding: 0;
  font-size: 0.88rem;
}

.search input::placeholder {
  color: var(--text-3);
}

/* ===== Session chip & popover ===== */
.session-wrap {
  position: relative;
  flex: 0 0 auto;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text-2);
  cursor: pointer;
}

.session-chip:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.06);
  border-color: rgba(244, 242, 238, 0.18);
}

.session-chip strong {
  display: flex;
  align-items: center;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  min-width: 4.1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-1);
  font-family: var(--font-data);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .13em;
}

.session-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  display: inline-block;
  border-radius: 50%;
  background: var(--text-3);
}

.session-dot.linked {
  background: var(--ok);
}

.session-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 400;
  width: 264px;
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
}

.session-popover.hidden {
  display: none;
}

.session-popover-title {
  margin: 0;
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#sessionDevices {
  display: block;
  color: var(--text-2);
  font-size: 0.8rem;
  min-height: 1em;
}

#sessionDevices:empty {
  display: none;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-actions input {
  flex: 1 1 70px;
  width: 70px;
  min-height: 38px;
  background: rgba(20, 19, 23, 0.85);
  color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0 10px;
  text-align: center;
  font-family: var(--font-data);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  transition: border-color var(--dur-s) var(--ease-out);
}

.session-actions input:focus {
  border-color: var(--accent);
  outline: none;
}

.session-actions button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.8rem;
}

/* ===== Player ===== *//* ===== Player ===== */
.player-section {
  display: block;
  width: 100%;
}

.details,
.status {
  border-radius: var(--radius-s);
  background: var(--bg-1);
  border: 1px solid var(--line);
  box-shadow: none;
}


/* ===== Source list ===== */
.source-list {
  display: grid;
  gap: 10px;
  margin: 10px 0 16px;
  max-height: 410px;
  overflow: auto;
  padding-right: 2px;
}

.source-button {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.06);
  text-align: left;
  box-shadow: none;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

.source-button:hover {
  border-color: var(--line-strong);
  background: rgba(244,242,238,.05);
  box-shadow: none;
  transform: none;
}

.source-button.active {
  border-color: var(--line-strong);
  background: rgba(244,242,238,.08);
  box-shadow: none;
}

.try-next-source {
  width: 100%;
  margin: 8px 0 2px;
}

.source-button.loading {
  border-color: rgba(157, 154, 150, 0.5);
}

.source-button.playing {
  border-color: rgba(232,176,75,.5);
  box-shadow: none;
}

.source-button.failed {
  opacity: 0.55;
  border-color: rgba(248, 113, 113, 0.35);
}

.source-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transition: opacity .2s;
}
.source-button.loading .source-icon,
.source-button.playing .source-icon,
.source-button.failed .source-icon { opacity: 1; }
.source-button.loading .source-icon { color: #9d9a96; animation: source-spin 1s linear infinite; }
.source-button.playing .source-icon { color: #4ade80; }
.source-button.failed .source-icon { color: #f87171; }
@keyframes source-spin { to { transform: rotate(360deg); } }

.source-rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(127, 124, 120,.2), rgba(136, 133, 129,.1));
  border: 1px solid rgba(127, 124, 120,.2);
  color: var(--text-1);
  font-weight: 800;
  font-size: .85rem;
}
.source-button.active .source-rank {
  background: rgba(138, 135, 131, 0.2);
  color: #c5c2be;
}

.source-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: .92rem;
  text-align: left;
}

.source-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.source-badge {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255,255,255,.5);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.source-badge.native {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
}
.source-badge.embed {
  background: rgba(251, 191, 36, 0.08);
  color: rgba(251, 191, 36, 0.7);
}

.source-ctx-menu {
  z-index: 9999;
  min-width: 160px;
  background: rgba(22, 22, 24, .96);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 6px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.source-ctx-title {
  padding: 6px 10px 4px;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  font-weight: 600;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-ctx-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-1, #e8e6e3);
  font-size: .85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.source-ctx-item:hover { background: rgba(255,255,255,.08); }
.source-ctx-item.good::before { content: '\2714\00a0'; color: #4ade80; }
.source-ctx-item.bad::before { content: '\2716\00a0'; color: #f87171;
}
.source-badge.lang {
  background: rgba(138, 135, 131, 0.08);
  color: rgba(163, 160, 156, 0.8);
}

/* ===== Selects ===== */
select {
  width: 100%;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem;
}

select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(232, 176, 75, 0.22);
  outline-offset: 2px;
}

select option {
  background: var(--bg-1);
  color: var(--text-1);
}

/* ===== Details ===== */
.details {
  margin-bottom: 18px;
  overflow: hidden;
  width: 100%;
}


.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-1);
  box-shadow: none;
}

.detail-copy p {
  color: var(--text-2);
  line-height: 1.55;
}

.actions,
.episode-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.episode-controls {
  margin: 14px 0;
}



/* ===== Dashboard ===== */
.dashboard {
  display: grid;
  gap: 28px;
  margin-bottom: 20px;
  width: 100%;
}

/* ===== Home hero ===== */

/* ===== Media rows / rails ===== */
.media-row,
.provider-section {
  display: grid;
  gap: 12px;
}

.row-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.row-heading h2 {
  margin: 0;
  font-size: clamp(1.22rem, 2vw, 1.7rem);
}

.row-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(142px, 12.5vw, 188px);
  gap: 13px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 16px;
  scrollbar-width: thin;
}

.provider-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(154px, 15vw, 212px);
  gap: 13px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 16px;
  scrollbar-width: thin;
}

/* ===== Media cards ===== */
.media-card {
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.media-card:hover {
  transform: none;
}

.media-copy {
  padding: 8px 2px 0;
}

.media-copy h3 {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.25;
}

.media-copy p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.rank-badge {
  position: absolute;
  left: 4px;
  bottom: -6px;
  z-index: 2;
  display: block;
  border: 0;
  background: none;
  color: var(--text-1);
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(3rem, 4.5vw, 4.4rem);
  line-height: 1;
  -webkit-text-stroke: 3px rgba(10, 10, 12, 0.85);
  paint-order: stroke fill;
  pointer-events: none;
}

/* ===== Provider chips ===== */
.provider-chip {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  display: grid;
  place-items: start;
  align-content: end;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text);
  text-align: left;
  box-shadow: none;
  transition: all .24s ease;
}

.provider-chip:hover {
  transform: none;
  border-color: var(--line-strong);
  background: var(--bg-2);
  box-shadow: none;
}

.provider-chip img,
.provider-logo-fallback {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  margin-bottom: 12px;
}

.provider-logo-fallback {
  background: rgba(138, 135, 131, 0.18);
  border: 1px solid rgba(138, 135, 131, 0.42);
}

.provider-chip strong,
.provider-chip small {
  position: relative;
}

.provider-chip strong {
  font-size: 0.98rem;
  font-family: var(--font-display);
}

.provider-chip small {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  width: 100%;
}

.card {
  border: 0;
  border-radius: 14px;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.card img,
.card .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-1);
  border-radius: 14px;
  box-shadow: none;
}

.card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.card p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ===== Status ===== */
.status {
  width: 100%;
  margin-bottom: 16px;
  padding: 56px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: none;
}

.status::before {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  margin: 0 auto 16px;
  background: var(--accent);
}

.status.inline-status {
  padding: 40px 20px;
}

.hidden {
  display: none !important;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-enter {
  animation: page-in .28s cubic-bezier(.4, 0, .2, 1) both;
}

.top-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.top-loader.active {
  opacity: 1;
}
.top-loader span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  box-shadow: none;
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
}
.top-loader.active span {
  animation: top-load 2.5s cubic-bezier(.1, .5, .2, 1) forwards;
}
.top-loader.done span {
  width: 100% !important;
  transition: width .15s ease-out;
}
@keyframes top-load {
  0% { width: 0; }
  30% { width: 45%; }
  60% { width: 72%; }
  100% { width: 92%; }
}

.player-section,
.details,
.dashboard,
.grid,
#detailsSection {
  will-change: opacity;
}

.topbar {
  will-change: transform, opacity;
}

/* ===== Provider directory ===== */
.provider-directory {
  display: grid;
  gap: 18px;
}

.directory-heading,
.provider-results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.directory-heading h2,
.provider-results-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.directory-heading p,
.provider-results-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.directory-heading > span {
  flex: 0 0 auto;
  padding: 0.5rem 0.8rem;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.provider-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 13px;
}

.provider-tile {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 5px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 20px;
  background: var(--bg-1);
  box-shadow: none;
  text-align: left;
}

.provider-tile.featured {
  border-color: rgba(232, 176, 75, 0.38);
  background: var(--bg-2);
}

.provider-tile:hover {
  transform: none;
  border-color: var(--line-strong);
}

.provider-tile img,
.provider-tile .provider-logo-fallback {
  position: relative;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 15px;
}

.provider-tile strong,
.provider-tile small {
  position: relative;
}

.provider-tile small {
  color: var(--muted);
}

.provider-results-heading {
  grid-column: 1 / -1;
  align-items: center;
  min-height: 120px;
  padding: 22px;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at 80% 0, rgba(138, 135, 131, 0.22), transparent 24rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(10, 7, 18, 0.82);
}

.provider-results-heading .ghost {
  order: -1;
}

/* ===== Catalog page ===== */
.catalog-page {
  display: grid;
  gap: 18px;
}

/* ===== Filter bar ===== */
.filter-bar {
  position: sticky;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg-1);
}

.filter-bar label {
  display: grid;
  gap: 5px;
}

.filter-bar span {
  padding-left: 2px;
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.filter-bar select {
  min-height: 42px;
  border-radius: var(--radius-s);
  background: rgba(244, 242, 238, 0.05);
  color: var(--text);
  color-scheme: dark;
  border-color: var(--line);
}

.filter-bar select:hover {
  border-color: var(--line-strong);
}

.filter-bar select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(232, 176, 75, 0.22);
  outline-offset: 2px;
}

/* ===== Catalog grid ===== */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.inline-status {
  grid-column: 1 / -1;
}

/* ===== Language grid ===== */
.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.language-tile {
  min-height: 132px;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 7px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: var(--bg-1);
  box-shadow: none;
  text-align: left;
}

.language-tile strong {
  font-size: 1.25rem;
}

.language-tile span {
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.08em;
}

/* ===== Related rows ===== */
.related-rows {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: transparent;
}

.details .media-row {
  min-width: 0;
}

/* ===== Provider filter & catalog ===== */
.provider-filter-bar,
.provider-catalog-grid {
  grid-column: 1 / -1;
}

/* ===== Skeleton loading ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.6s ease-in-out infinite;
  border-radius: 12px;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-hero {
  width: 100%;
  min-height: min(680px, 78vh);
  min-height: min(680px, 78svh);
  border-radius: 0;
  margin-bottom: 18px;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card .media-art {
  aspect-ratio: 2/3;
  border-radius: var(--radius-m);
}

.skeleton-text {
  height: 14px;
  width: 75%;
  border-radius: 6px;
  margin-top: 8px;
}

.skeleton-text-sm {
  height: 10px;
  width: 50%;
  border-radius: 5px;
  margin-top: 6px;
}

.skeleton-title {
  height: 20px;
  width: 140px;
  border-radius: 8px;
}

/* ===== Playback performance mode ===== */
body.player-performance-mode > *:not(#app),
body.player-performance-mode #app > *:not(#playerSection),
body.player-performance-mode .topbar,
body.player-performance-mode .details,
body.player-performance-mode .dashboard,
body.player-performance-mode .grid,
body.player-performance-mode .status,
body.player-performance-mode .home-hero,
body.player-performance-mode .watch-party-prompt,
body.player-performance-mode .disconnect-prompt,
body.player-performance-mode #detailsSection,
body.player-performance-mode #loginOverlay:not(.hidden ~ *) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.player-performance-mode {
  background: #000;
}

/* ===== Responsive: large screens ===== */
/* ===== Responsive: mobile ===== */
@media (max-width: 680px) {
  :root {
    --topbar-h: 56px;
  }

  #app {
    width: min(100% - 12px, 1720px);
  }

  .session-actions input,
  .session-actions button {
    flex: 1 1 auto;
  }

  .filter-bar {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
  }

  .poster {
    width: 150px;
    float: left;
    margin: 0 14px 10px 0;
  }
}

.sport-card-visual {
  min-height: 118px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 20px;
  background: rgba(244, 242, 238, 0.03);
  border-bottom: 1px solid var(--line);
}

.sport-team-crest {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.sport-team-crest-shell {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
}

.sport-team-crest-shell > * {
  grid-area: 1 / 1;
}

.sport-team-crest--fallback {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .05em;
}

.sport-card-versus {
  color: rgba(255,255,255,.5);
  font-family: var(--font-data);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.sport-matchup,
.sport-meta {
  margin-inline: 16px;
}

.sport-matchup {
  margin-top: 14px;
}

.sport-card .sport-watch-btn {
  margin: 0 16px 16px;
}

/* ===== History page ===== */
.history-group {
  display: grid;
  gap: 12px;
}

.history-group h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 0 2px;
}

.history-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(142px, 12.5vw, 188px);
  gap: 13px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 16px;
  scrollbar-width: thin;
}

/* ===== Touch device optimizations ===== */
@media (pointer: coarse) {
  button,
  input,
  select,
  .app-nav a,
  .media-card,
  .provider-tile,
  .language-tile {
    min-height: 44px;
  }

  .app-nav {
    justify-content: flex-start;
  }

  .filter-bar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-snap-type: x proximity;
  }

  .filter-bar label {
    min-width: min(72vw, 220px);
    scroll-snap-align: start;
  }

  .source-button {
    min-height: 50px;
  }
}

@media (min-width: 1500px) and (pointer: coarse) {
  .catalog-grid,
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .rail {
    grid-auto-columns: 210px;
  }

  .media-copy h3 {
    font-size: 1.04rem;
  }
}

/* ===== Live TV & Sports ===== */
.live-controls {
  padding: 0 2px;
}

.live-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.live-filters select,
.live-search {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  min-width: 140px;
}

.live-search {
  flex: 1;
  min-width: 200px;
}

.live-filters select:focus,
.live-search:focus {
  outline: none;
  border-color: var(--accent);
}

.live-section {
  padding: 0 2px;
}

.live-section h3 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.live-results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.sport-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--bg-1);
  border-radius: var(--radius-m);
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.sport-card:hover {
  transform: none;
  box-shadow: none;
}

.sport-card--live {
  border: 1px solid var(--live);
  box-shadow: none;
}

.sport-matchup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sport-team {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sport-team-name {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

.sport-team-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 24px;
  text-align: right;
}

.sport-vs {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 0;
}

.sport-live-badge {
  background: #e53e3e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.08em;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.sport-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sport-league-tag {
  font-size: 0.72rem;
  color: var(--text-2);
  font-family: var(--font-data);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.sport-status {
  font-size: 0.78rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.sport-card--watchable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.sport-card--watchable:hover {
  transform: none;
  box-shadow: none;
}

.sport-watch-btn {
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  pointer-events: none;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px 14px;
}

.channel-info h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.channel-info p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.channel-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
}

.channel-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--line);
  flex-shrink: 0;
}

.channel-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
}

.channel-badge.live {
  background: #e53935;
  color: #fff;
}

.live-filter-select {
  max-width: 180px;
}

.sport-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 2px;
  margin-bottom: 12px;
}

.sport-filter-btn {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}

.sport-filter-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}


/* ===== Spectra UI Revamp: Prism cinema system ===== */


html {
  background: var(--bg-0);
  scroll-behavior: smooth;
}

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-body);
  overflow-x: hidden;
}







button,
.ghost,
select,
input {
  border-radius: var(--radius-s);
}

button {
  min-height: 40px;
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid transparent;
  font-weight: 600;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

button:not(:disabled):hover {
  background: #26252b;
}

.ghost {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--line);
}

.ghost:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.06);
  border-color: rgba(244, 242, 238, 0.18);
}

.eyebrow {
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Topbar: invisible chrome — transparent over content, surfaces on scroll. */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  box-shadow: none;
  transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -28px 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.52), transparent);
  opacity: 1;
  transition: opacity var(--t-med) var(--ease);
}

.topbar.scrolled {
  background: rgba(10, 10, 12, 0.86);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.topbar.scrolled::before {
  opacity: 0;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0;
}

.brand h1,
.brand p {
  display: none;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: none;
  border: 0;
  box-shadow: none;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.app-nav::-webkit-scrollbar { display: none; }

.app-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.85rem;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: var(--radius-s);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.app-nav a:hover {
  color: var(--text-1);
  background: none;
}

.app-nav a.active {
  color: var(--text-1);
  background: none;
  box-shadow: none;
}

.app-nav a::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.35);
  transform-origin: center;
  transition: transform var(--dur-m) var(--ease-out), opacity var(--dur-m) var(--ease-out);
}

.app-nav a:hover::after {
  opacity: 0.45;
  transform: scaleX(0.7);
}

.app-nav a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.topbar .search {
  margin-left: auto;
  flex: 0 1 260px;
  transition: flex-basis var(--dur-m) var(--ease-out), background var(--dur-s) var(--ease-out), border-color var(--dur-s) var(--ease-out);
}

.topbar .search:focus-within {
  flex-basis: 328px;
}

.topbar .profile-wrapper {
  flex: 0 0 auto;
}

/* Home hero: full-bleed cinema key art with Spectra prism signature. */
.home-hero {
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
  min-height: min(790px, 100vh);
  min-height: min(790px, 100svh);
  margin-top: calc(-1 * (var(--topbar-h-real, var(--topbar-h)) + 14px));
  padding-top: calc(var(--topbar-h-real, var(--topbar-h)) + 24px);
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  border: 0;
  border-radius: 0;
  background-size: cover;
  background-position: center;
  box-shadow: none;
  isolation: isolate;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10,10,12,0.92) 0%, rgba(10,10,12,0.5) 36%, rgba(10,10,12,0.06) 64%, transparent 80%),
    linear-gradient(180deg, transparent 52%, rgba(10,10,12,0.6) 84%, var(--bg-0) 100%);
}

/* Ken Burns layer: inherits the inline backdrop so motion stays transform-only.
   Sits above the element background, below the scrim and copy. */
.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: inherit;
  background-size: inherit;
  background-position: inherit;
  background-repeat: inherit;
  transform: scale(1);
  animation: hero-kenburns 36s var(--ease) infinite alternate;
  will-change: transform;
  pointer-events: none;
}

@keyframes hero-kenburns {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

.home-hero-copy {
  width: min(760px, calc(100vw - 36px));
  margin-left: max(18px, calc((100vw - 1440px) / 2 + 18px));
  position: relative;
  padding: 0 0 clamp(62px, 9vw, 110px);
  z-index: 1;
}

.home-hero-copy h2,
.detail-copy h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: -0.01em;
}

.home-hero-copy h2 {
  max-width: 10ch;
  font-size: clamp(3rem, 8.5vw, var(--hero-title-max));
  line-height: .95;
}

.home-hero-copy p:not(.eyebrow) {
  max-width: 720px;
  margin-top: 1.1rem;
  color: var(--text-2);
  font-size: clamp(1rem, 1.3vw, 1.18rem);
}

.home-hero .eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--text-2);
  letter-spacing: 0.16em;
}

.home-hero .eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  flex: 0 0 auto;
  background: var(--accent);
}

.hero-meta-row,
.detail-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin: 14px 0 0;
}

.hero-meta-row span,
.detail-meta-strip span {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text-2);
  font-size: .9rem;
  font-weight: 450;
}

/* Meta rows: hairline separators + tabular figures */
.hero-meta-row span,
.detail-meta-strip span {
  font-variant-numeric: tabular-nums;
}

.hero-meta-row span + span::before,
.detail-meta-strip span + span::before {
  content: "";
  width: 1px;
  height: 11px;
  margin: 0 14px;
  background: rgba(244, 242, 238, 0.24);
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-actions button {
  min-height: 46px;
  padding: 0 24px;
  background: var(--text-1);
  color: #111013;
  font-weight: 600;
  font-size: .95rem;
}

.hero-actions button:not(:disabled):hover {
  background: #ffffff;
}

.hero-actions .ghost {
  background: transparent;
  border: 1px solid rgba(244, 242, 238, 0.26);
  padding: 0 22px;
  color: var(--text-1);
  transition: border-color var(--dur-s) var(--ease-out), background var(--dur-s) var(--ease-out), color var(--dur-s) var(--ease-out);
}

.hero-actions .ghost:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.07);
  border-color: rgba(244, 242, 238, 0.44);
  color: var(--text-1);
}

.hero-actions .ghost::after {
  content: " \2192";
}

/* Rails and grids use streaming-service landscape cards instead of cheap poster blocks. */
.media-row,
.provider-section,
.history-group {
  gap: 14px;
}

.row-heading {
  padding: 0 2px;
}

.row-heading h2,
.directory-heading h2,
.provider-results-heading h2 {
  font-family: var(--font-body);
  letter-spacing: 0;
}

.row-heading h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.rail,
.history-rail {
  grid-auto-columns: clamp(150px, 13vw, 200px);
  gap: 14px;
  padding-bottom: 18px;
}

.media-card,
.card {
  border-radius: 0;
  background: transparent;
}

.media-card:hover,
.card:hover {
  transform: none;
  box-shadow: none;
}

.media-art {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-m);
  aspect-ratio: 2 / 3;
  background: var(--bg-1);
  border: 0;
  box-shadow: none;
}

.media-card .media-art img,
.result-card .media-art img,
.card .media-art img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  transition: transform var(--t-med) var(--ease);
}

.lazy-img { filter: blur(12px); transform: scale(1.08); }
.lazy-img.lazy-loaded { filter: none; transform: scale(1); transition: filter .4s ease, transform .4s ease; }

.subtitle-overlay {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  font-size: clamp(14px, 2.2vw, 22px);
  line-height: 1.4;
  color: #fff;
}
.subtitle-overlay span {
  display: inline;
  background: rgba(0,0,0, var(--sub-bg-opacity, .7));
  padding: 2px 8px;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.subtitle-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin-top: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.subtitle-settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .8rem;
  color: rgba(255,255,255,.7);
}
.subtitle-settings input[type="range"] { flex: 1; max-width: 120px; }
.subtitle-settings input[type="color"] { width: 32px; height: 24px; border: 0; background: none; cursor: pointer; }
.sub-delay-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sub-delay-btn {
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--text-1, #e8e6e3);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.sub-delay-btn:hover { background: rgba(255,255,255,.12); }
.sub-delay-value {
  min-width: 44px;
  text-align: center;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #6e8efb);
  font-weight: 600;
}

.up-next-overlay {
  position: absolute;
  bottom: 80px;
  right: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-l);
  background: var(--bg-1);
  border: 1px solid var(--line);
  z-index: 15;
  min-width: 220px;
  max-width: 300px;
  box-shadow: var(--shadow-1);
  animation: up-next-in var(--t-slow) var(--ease);
}

@keyframes up-next-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.up-next-label { font-size: .68rem; font-family: var(--font-data); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); margin: 0 0 4px; }
.up-next-overlay h3 { font-size: 1rem; margin: 0 0 6px; color: #fff; }
.up-next-overlay #upNextCountdown { font-size: .85rem; color: rgba(255,255,255,.6); margin: 0 0 10px; }
.up-next-actions { display: flex; gap: 8px; }
.up-next-actions button { font-size: .8rem; padding: 6px 14px; }

.queue-page { padding: 0 var(--gutter); max-width: 900px; }
.queue-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.queue-tab { font-size: .85rem; padding: 8px 16px; border-radius: var(--radius-s); border: 1px solid var(--line); background: transparent; color: var(--text-2); }
.queue-tab.active { background: rgba(232, 176, 75, 0.08); border-color: rgba(232, 176, 75, 0.45); color: var(--text-1); }
.queue-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-s); border: 0;
  background: transparent; margin-bottom: 6px; cursor: pointer;
  transition: background .15s;
}
.queue-item:hover { background: rgba(244, 242, 238, 0.05); }
.queue-item.dragging { opacity: .4; }
.queue-item.drag-over { border-color: var(--accent); background: rgba(127, 124, 120,.08); }
.queue-drag-handle { cursor: grab; font-size: 1.1rem; color: rgba(255,255,255,.3); user-select: none; }
.queue-thumb { width: 46px; height: 68px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.queue-thumb-empty { width: 46px; height: 68px; border-radius: 6px; background: rgba(255,255,255,.06); flex-shrink: 0; }
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-info h4 { margin: 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-info p { margin: 2px 0 0; font-size: .75rem; color: rgba(255,255,255,.5); }
.queue-progress { height: 2px; background: rgba(244, 242, 238, 0.12); border-radius: 2px; margin-top: 4px; }
.queue-progress div { height: 100%; background: var(--accent); border-radius: 2px; }
.queue-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.queue-cat-select { font-size: .75rem; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 6px; color: #fff; padding: 4px 8px; }
.queue-remove { font-size: 1.2rem; padding: 2px 8px; color: rgba(255,255,255,.4); }

.search { position: relative; }
.search-suggestions {
  position: absolute; top: 100%; left: 0; right: 40px;
  max-height: 360px; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius-m); margin-top: 6px; z-index: 100;
  box-shadow: var(--shadow-1);
}
.search-suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer; transition: background .12s;
}
.search-suggestion:hover, .search-suggestion.active { background: rgba(255,255,255,.08); }
.search-suggestion img { width: 36px; height: 54px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.search-suggestion-empty { width: 36px; height: 54px; border-radius: 5px; background: rgba(255,255,255,.06); flex-shrink: 0; }
.search-suggestion-info { flex: 1; min-width: 0; }
.search-suggestion-info h4 { margin: 0; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-suggestion-info p { margin: 2px 0 0; font-size: .72rem; color: rgba(255,255,255,.45); }

.media-card:hover .media-art img,
.result-card:hover .media-art img,
.card:hover .media-art img,
.media-card:focus-visible .media-art img,
.card:focus-visible .media-art img {
  transform: scale(1.04);
}

.media-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 62%, rgba(10, 10, 12, 0.5));
  pointer-events: none;
}

.media-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  font-weight: 600;
  letter-spacing: .08em;
}

.queue-thumb-empty,
.search-suggestion-empty {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: .72rem;
  font-weight: 600;
  background: var(--bg-2);
}

.progress-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 3;
  background: rgba(244, 242, 238, 0.14);
}

.progress-strip span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0;
}

.media-card.is-watched .media-art img,
.card.is-watched .media-art img {
  opacity: 0.55;
}

.media-copy,
.card-copy {
  padding: 8px 2px 0;
}

.media-copy h3,
.card h3 {
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-copy p,
.card p {
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}

.grid,
.catalog-grid,
.provider-catalog-grid {
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 24px 16px;
}

/* Discover page: one destination, cinematic cards, compact filters. */
.catalog-page {
  gap: 24px;
}

.provider-results-heading {
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--bg-1);
  box-shadow: none;
}

.filter-bar,
.provider-filter-bar {
  top: 76px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: none;
}

.filter-bar select,
.provider-filter-bar select {
  background: rgba(244, 242, 238, 0.05);
  border-color: var(--line);
}

/* Detail pages now feel like real title pages, not a temporary card stuck to the page. */
.details {
  margin: -82px auto 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.detail-page {
  position: relative;
  width: 100vw;
  left: 50%;
  min-height: min(880px, 100vh);
  min-height: min(880px, 100svh);
  transform: translateX(-50%);
  padding: clamp(110px, 12vw, 148px) clamp(20px, 5vw, 72px) clamp(42px, 7vw, 86px);
  overflow: hidden;
  isolation: isolate;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--detail-backdrop);
  background-size: cover;
  background-position: center top;
}

.detail-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(10,10,12,0.95) 0%, rgba(10,10,12,0.78) 36%, rgba(10,10,12,0.3) 66%, rgba(10,10,12,0.6) 100%),
    linear-gradient(180deg, rgba(10,10,12,0.15) 0%, rgba(10,10,12,0.42) 66%, var(--bg-0) 100%);
}

.detail-layout {
  width: min(1360px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 58px);
  align-items: end;
}

.detail-poster-panel {
  display: grid;
  gap: 14px;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  box-shadow: none;
  background: var(--bg-1);
}

.trailer-button,
.trailer-unavailable {
  width: 100%;
  min-height: 46px;
  display: grid;
  place-items: center;
  text-align: center;
}

.trailer-unavailable {
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.detail-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  align-content: end;
  gap: 12px;
}

.detail-back {
  min-height: 34px;
  padding: 0 .82rem;
  margin-bottom: 10px;
  font-size: .78rem;
}

.detail-copy h2 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
  line-height: .95;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--text-2);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-style: italic;
}

.detail-overview {
  max-width: 68ch;
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: clamp(1rem, 1.18vw, 1.16rem);
  line-height: 1.65;
}

.credit-line {
  display: grid;
  gap: 6px;
  max-width: 900px;
  color: var(--text-2);
  font-size: .92rem;
}

.credit-line strong {
  color: var(--text-1);
  font-weight: 600;
}

.detail-episodes {
  width: min(640px, 100%);
  display: block;
  margin: 14px 0 0;
}

.detail-episodes .hidden-select {
  display: none;
}

.season-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 8px;
}

.season-tabs::-webkit-scrollbar { display: none; }

.season-tab {
  position: relative;
  min-height: 38px;
  padding: 0 14px;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  border-radius: var(--radius-s);
  flex: 0 0 auto;
}

.season-tab:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.06);
  color: var(--text-1);
}

.season-tab.active {
  background: none;
  color: var(--text-1);
}

.season-tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: var(--accent);
}

.episode-list {
  display: grid;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.episode-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--text-2);
  text-align: left;
}

.episode-row:not(:disabled):hover {
  background: rgba(244, 242, 238, 0.06);
}

.episode-row.active {
  background: var(--bg-2);
  color: var(--text-1);
}

.episode-num {
  min-width: 2.2ch;
  font-family: var(--font-data);
  font-size: .85rem;
  color: var(--text-3);
}

.episode-row.active .episode-num {
  color: var(--accent);
}

.episode-info {
  display: grid;
  min-width: 0;
}

.episode-name {
  font-weight: 600;
  font-size: .9rem;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-runtime {
  font-size: .75rem;
  color: var(--text-3);
}

.episode-list-loading {
  margin: 0;
  color: var(--text-3);
  font-size: .85rem;
}

.detail-actions {
  margin-top: 10px;
}

.detail-actions button {
  min-height: 48px;
  padding: 0 1.1rem;
}

.detail-actions #playButton {
  background: var(--text-1);
  color: #111013;
  padding: 0 26px;
}

.detail-actions #playButton:not(:disabled):hover {
  background: #ffffff;
}


.trailer-frame-wrap {
  width: min(760px, 100%);
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: none;
}

.trailer-frame-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.detail-related {
  width: min(1560px, calc(100% - clamp(18px, 4vw, 56px)));
  margin: 0 auto;
  padding: 20px 0 46px;
  background: transparent;
}

/* Player view: hide nav, fill viewport with player. */
body.player-performance-mode .topbar {
  display: none !important;
}

body.player-performance-mode {
  overflow: hidden;
  height: 100vh;
  height: 100svh;
}

body.player-performance-mode #app {
  width: 100%;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.player-performance-mode .player-section:not(.hidden) {
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
}

body.player-performance-mode .cp {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
}

body.player-performance-mode .cp-screen {
  flex: 1;
  min-height: 0;
  aspect-ratio: auto;
  max-height: none;
}

body.player-performance-mode .cp-diagnostics {
  display: none;
}

/* Provider and language tiles inherit the Spectra glass identity. */
.provider-tile,
.provider-chip,
.language-tile,
.sport-card,
.channel-card {
  border-radius: var(--radius-m);
  border-color: transparent;
  background: var(--bg-1);
}

.provider-directory-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.provider-tile {
  min-height: 166px;
}

/* Prompts */
.watch-party-prompt,
.disconnect-prompt {
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 250;
  width: min(760px, calc(100% - 24px));
  margin: 12px auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-l);
  background: var(--bg-1);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}

.watch-party-prompt strong,
.disconnect-prompt strong {
  display: block;
  color: var(--text-1);
  font-size: .95rem;
  font-weight: 600;
}

.watch-party-prompt > div > span,
.disconnect-prompt > div > span {
  color: var(--text-2);
  font-size: .85rem;
}

.watch-party-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.watch-party-actions button {
  min-height: 40px;
  padding: 0 16px;
  font-size: .85rem;
}

.watch-party-actions button:first-child {
  background: var(--text-1);
  color: #111013;
}

.watch-party-actions button:first-child:not(:disabled):hover {
  background: #ffffff;
}

/* Responsive cleanup */
@media (max-width: 1500px) and (min-width: 1181px) {
  .topbar .search {
    flex-basis: 220px;
  }
}

@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
    row-gap: 4px;
  }

  .app-nav {
    order: 5;
    width: 100%;
  }

  .topbar .search {
    flex: 1 1 200px;
  }

  .filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #app {
    width: min(100% - 18px, 1560px);
  }

  .home-hero {
    margin-top: calc(-1 * (var(--topbar-h-real, var(--topbar-h)) + 14px));
    min-height: 740px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .grid,
  .catalog-grid,
  .provider-catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px 12px;
  }

  .rail,
  .history-rail {
    grid-auto-columns: min(42vw, 176px);
  }

  .detail-page {
    padding-top: 170px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .detail-poster-panel {
    width: min(210px, 50vw);
  }

  .detail-copy h2 {
    max-width: 100%;
    font-size: clamp(2.2rem, 11vw, 4.2rem);
  }

  .detail-episodes {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .provider-filter-bar {
    position: static;
    display: flex;
    overflow-x: auto;
    border-radius: 20px;
  }

  .filter-bar label,
  .provider-filter-bar label {
    min-width: 210px;
  }
}

@media (max-width: 560px) {
  .app-nav {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 2px;
  }

  .app-nav a {
    padding: 0 .65rem;
    font-size: .78rem;
    scroll-snap-align: start;
  }

  .code-pill {
    min-width: 2.8rem;
    font-size: .68rem;
  }

  .home-hero {
    min-height: min(520px, 70vh);
    min-height: min(520px, 70svh);
    margin-top: calc(-1 * (var(--topbar-h-real, var(--topbar-h)) + 14px));
  }

  .home-hero-copy {
    width: calc(100vw - 28px);
    margin-left: 14px;
  }

  .home-hero-copy h2 {
    font-size: clamp(2.6rem, 14vw, 4rem);
    max-width: 9ch;
  }

  .home-hero-copy p:not(.eyebrow) {
    font-size: .92rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .detail-overview {
    font-size: .92rem;
  }

  .hero-meta-row span,
  .detail-meta-strip span {
    min-height: 26px;
    font-size: .72rem;
    padding: 0 .58rem;
  }

  .hero-actions {
    margin-top: 14px;
  }

  .hero-actions button,
  .actions button {
    min-height: 40px;
    font-size: .88rem;
  }

  .grid,
  .catalog-grid,
  .provider-catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 8px;
  }

  .rail,
  .history-rail {
    grid-auto-columns: min(40vw, 168px);
  }

  .detail-actions,
  .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .detail-actions button,
  .actions button {
    flex: 1 1 auto;
  }

  .search-suggestions {
    right: 0;
    left: 0;
    max-height: 280px;
  }

  .player-section:not(.hidden),
  body.player-performance-mode .player-section:not(.hidden) {
    display: flex;
    flex-direction: column;
  }

  .queue-page { padding: 0 10px; }
  .queue-item { padding: 8px; gap: 8px; }
  .queue-thumb { width: 38px; height: 56px; }
  .queue-item-info h4 { font-size: .82rem; }
  .queue-cat-select { font-size: .68rem; padding: 3px 6px; }

  .topbar {
    padding: 0 10px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .watch-party-prompt,
  .disconnect-prompt {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    font-size: .88rem;
  }

  .watch-party-actions {
    justify-content: stretch;
  }

  .watch-party-actions button {
    flex: 1;
    min-height: 38px;
    font-size: .82rem;
  }

  .up-next-overlay {
    left: 12px;
    right: 12px;
    bottom: 70px;
    max-width: none;
  }

  .login-card {
    padding: 24px 20px;
  }
}

/* ===== Spectra Polish Pass ===== */

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(244,242,238,.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(244,242,238,.24); }

/* Channel cards — elevated glass with hover glow */
.channel-card {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.channel-card:hover {
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.channel-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: var(--bg-1);
  border-radius: var(--radius-m);
  border-bottom: 0;
  overflow: hidden;
  transition: background var(--t-fast) var(--ease);
}

.channel-card:hover .channel-card-media {
  background: var(--bg-2);
}

.channel-card-media .channel-logo {
  width: min(58%, 130px);
  height: 52%;
  object-fit: contain;
  border-radius: 0;
  background: none;
}

.channel-thumbnail-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text-3);
  font-family: var(--font-data);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .1em;
}

.channel-card .channel-info {
  min-width: 0;
  width: 100%;
  padding: 8px 2px 0;
}

.channel-info h4 {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-info p {
  margin: 2px 0 0;
  font-size: .74rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-card .channel-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
  align-self: auto;
  font-family: var(--font-data);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(10, 10, 12, .72);
  color: var(--text-2);
}

.channel-card .channel-badge.live {
  background: var(--live);
  color: #fff;
}

/* Sports cards — more dramatic live state */
.sport-card--live {
  border-color: rgba(255,71,87,.44);
  box-shadow: none;
}
.sport-card--live:hover {
  box-shadow: none;
}
.sport-live-badge {
  background: var(--live);
  box-shadow: none;
}

/* Login overlay design lives in the base Login Overlay section above. */

/* Media cards: hover is img scale + title color shift only (no lift, no shadow) */
.media-copy h3,
.card h3 {
  color: rgba(244, 242, 238, 0.78);
  transition: color var(--dur-s) var(--ease-out);
}

.media-card:hover h3,
.card:hover h3,
.media-card:focus-visible h3,
.card:focus-visible h3 {
  color: var(--text-1);
}

/* Active filters: the label turns amber when a non-default value is selected.
   Progressive enhancement: engines without :has() simply skip the tint. */
.filter-bar label > span {
  transition: color var(--dur-s) var(--ease-out);
}

.filter-bar label:has(select[id$="Sort"] option:checked:not([value="trending"])) > span,
.filter-bar label:has(select[id$="Rating"] option:checked:not([value=""])) > span,
.filter-bar label:has(select[id$="Year"] option:checked:not([value=""])) > span,
.filter-bar label:has(select[id$="Genre"] option:checked:not([value=""])) > span,
.filter-bar label:has(select[id$="Language"] option:checked:not([value=""])) > span {
  color: var(--accent);
}

/* Live TV header section */
.live-controls {
  margin-bottom: 16px;
}

.live-feature {
  width: min(760px, 100%);
  min-height: 168px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--bg-1);
  color: #fff;
  text-align: left;
  box-shadow: none;
}

.live-feature-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
}

.live-feature-art img {
  width: min(72%, 150px);
  height: 72%;
  object-fit: contain;
  filter: none;
}

.live-feature-fallback {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-family: var(--font-data);
  font-size: 1.2rem;
  font-weight: 900;
}

.live-feature-copy {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 22px;
}

.live-feature-copy small,
.queue-up-next-label {
  color: rgba(201, 198, 194,.8);
  font-family: var(--font-data);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.live-feature-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-feature-copy > span { color: rgba(255,255,255,.58); font-size: .84rem; }

.live-feature-play {
  align-self: center;
  margin-right: 20px;
  padding: .72rem .94rem;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--text-1);
  color: #111013;
  font-size: .78rem;
  white-space: nowrap;
}

.live-feature:hover { transform: none; border-color: var(--line-strong); }

.queue-item--up-next {
  position: relative;
  padding: 14px;
  border: 1px solid rgba(232, 176, 75, 0.42);
  background: rgba(232, 176, 75, 0.06);
}

.queue-item--up-next .queue-thumb,
.queue-item--up-next .queue-thumb-empty { width: 60px; height: 88px; }

.queue-up-next-label { display: block; margin-bottom: 4px; }

body.compact-density .grid,
body.compact-density .catalog-grid,
body.compact-density .provider-catalog-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px 12px;
}

body.compact-density .rail,
body.compact-density .history-rail {
  grid-auto-columns: clamp(126px, 10vw, 164px);
}

body.compact-density .media-copy,
body.compact-density .card-copy {
  min-height: 0;
  padding-top: 7px;
}

body.compact-density .media-copy h3,
body.compact-density .card-copy h3 { font-size: .86rem; }

@media (max-width: 620px) {
  .live-feature { grid-template-columns: 112px minmax(0, 1fr); min-height: 126px; }
  .live-feature-copy { padding: 16px; }
  .live-feature-play { display: none; }
}
.live-filters select,
.live-search {
  border-radius: var(--radius-s);
  background: rgba(244,242,238,.05);
  border-color: var(--line);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.live-filters select:hover,
.live-search:hover {
  border-color: var(--line-strong);
}
.live-filters select:focus,
.live-search:focus {
  border-color: var(--accent);
  box-shadow: none;
}

/* Pagination — styled buttons */
.channel-pagination button {
  min-height: 38px;
  padding: 0 .9rem;
  font-size: .82rem;
}

/* Try next source button — more prominent */
.try-next-source {
  background: linear-gradient(135deg, rgba(176, 173, 169,.12), rgba(142, 139, 135,.1));
  border: 1px solid rgba(176, 173, 169,.22);
  color: rgba(227, 224, 220,.92);
  font-size: .84rem;
  transition: all .2s ease;
}
.try-next-source:hover {
  border-color: rgba(176, 173, 169,.48);
  background: linear-gradient(135deg, rgba(176, 173, 169,.2), rgba(142, 139, 135,.14));
  box-shadow: none;
}

/* Subtitle select — polished */
#subtitleSelect {
  border-radius: 14px;
  transition: border-color .18s ease;
}
#subtitleSelect:hover {
  border-color: rgba(184, 181, 177,.34);
}

/* Selection color */
::selection {
  background: rgba(232, 176, 75, 0.28);
  color: #fff;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Smooth transitions for interactive elements (scoped to avoid mobile perf overhead) */
button, input, select {
  transition-property: transform, border-color, box-shadow, background, color, opacity;
  transition-duration: .2s;
  transition-timing-function: ease;
}

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

.row-heading > div {
  min-width: 0;
}

.row-browse {
  min-height: 34px;
  padding: 0 4px;
  font-size: .8rem;
  white-space: nowrap;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-weight: 600;
}

.row-browse:not(:disabled):hover {
  background: transparent;
  color: var(--text-1);
}

.row-browse::after {
  content: " \203A";
}

/* -- Custom Player (cp-*) -- */
.cp {
  width: 100%;
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: none;
}

.cp-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.cp-screen video,
.cp-screen .iframe-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 0;
  aspect-ratio: auto;
}

.cp-screen .iframe-player { border: 0; clip-path: inset(0 0 46px 0); }
.cp-screen .iframe-player:not(.hidden) ~ .cp-gradient-bottom { height: 140px; }

.cp-gradient-top,
.cp-gradient-bottom {
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity .35s cubic-bezier(.4,0,.2,1);
}
.cp-gradient-top { top: 0; height: 140px; background: linear-gradient(to bottom, rgba(0,0,0,.75) 0%, rgba(0,0,0,.3) 50%, transparent 100%); }
.cp-gradient-bottom { bottom: 0; height: 200px; background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.4) 40%, transparent 100%); }

.cp.cp-show-controls .cp-gradient-top,
.cp.cp-show-controls .cp-gradient-bottom { opacity: 1; }

.cp-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  z-index: 10;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity .35s cubic-bezier(.4,0,.2,1), transform .35s cubic-bezier(.4,0,.2,1);
}
.cp.cp-show-controls .cp-top { opacity: 1; transform: translateY(0); }

.cp-back-btn {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s ease, border-color .2s ease;
}
.cp-back-btn:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.2); }
.cp-back-btn svg { width: 22px; height: 22px; }

.cp-now-playing { min-width: 0; }
.cp-eyebrow {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.45);
  margin: 0;
  font-weight: 500;
}
.cp-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 3px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-center-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.25);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  z-index: 8;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.4,0,.2,1), background .25s ease, box-shadow .25s ease;
  box-shadow: none;
}
.cp-center-play svg { width: 36px; height: 36px; margin-left: 4px; }
.cp-center-play:hover {
  background: rgba(255,255,255,.2);
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: none;
}

.cp-loader {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
}
.cp-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cp-spin .7s linear infinite;
  filter: none;
}
@keyframes cp-spin { to { transform: rotate(360deg); } }

.source-attempt-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  padding: 0;
  background: transparent;
  pointer-events: none;
  isolation: isolate;
}

.source-attempt-overlay::before,
.source-attempt-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.source-attempt-overlay::before {
  z-index: -2;
  background-image: var(--source-backdrop, linear-gradient(135deg, #121114, #08080a));
  background-size: cover;
  background-position: center 28%;
  opacity: .52;
  transform: scale(1.04);
  animation: source-backdrop-breathe 9s ease-in-out infinite alternate;
}

.source-attempt-overlay::after {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(3,2,7,.6), rgba(3,2,7,.08) 46%, rgba(3,2,7,.38)),
    linear-gradient(0deg, rgba(3,2,7,.58), transparent 54%, rgba(3,2,7,.18));
}

.source-attempt-overlay.hidden { display: none; }

.cp.source-searching .cp-now-playing {
  opacity: 0;
  transform: translateY(-6px);
}

.source-acquisition {
  width: min(1240px, calc(100vw - 64px));
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 31vw);
  align-items: center;
  gap: clamp(44px, 8vw, 150px);
  text-align: left;
}

.source-attempt-overlay:not(.hidden) ~ .cp-loader {
  display: none !important;
}

.source-acquisition-kicker {
  margin: 0 0 8px;
  color: rgba(213, 210, 206,.62);
  font-family: var(--font-data);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.source-acquisition h2 {
  max-width: 18ch;
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -.035em;
}

.source-acquisition-status {
  margin: 12px 0 24px;
  color: rgba(255,255,255,.64);
  font-size: clamp(.86rem, 1.4vw, 1rem);
}

.source-attempt-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.source-attempt-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .92);
  background: rgba(10, 10, 12, .82);
  border: 1px solid var(--line);
  font-size: .84rem;
  font-weight: 600;
  text-align: left;
}

.source-acquisition-rail {
  align-self: stretch;
  display: grid;
  align-content: center;
  padding: clamp(20px, 2.6vw, 34px);
  border-left: 1px solid rgba(255,255,255,.13);
  background: transparent;
}

.source-attempt-track {
  position: relative;
  padding-left: 20px;
}

.source-attempt-track::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 1px;
  background: linear-gradient(#a4a19d, rgba(255,255,255,.12));
}

.source-attempt-row::before {
  content: '';
  position: absolute;
  left: -21px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a4a19d;
  box-shadow: none;
}

.source-attempt-row.failed::before {
  background: #ef4444;
  box-shadow: none;
}

.source-attempt-row.trying::before {
  background: var(--accent);
}

.source-attempt-state {
  color: rgba(255,255,255,.5);
  font-family: var(--font-data);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.source-attempt-row.failed {
  color: rgba(255, 196, 196, .68);
  border-color: rgba(248, 113, 113, .16);
  background: rgba(28, 8, 15, .46);
}

.source-attempt-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.source-attempt-row.trying .source-attempt-icon {
  border: 2px solid rgba(194, 191, 187, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cp-spin .72s linear infinite;
  filter: none;
}

.source-attempt-row.failed .source-attempt-icon::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: none;
}

@keyframes source-backdrop-breathe {
  from { transform: scale(1.04); }
  to { transform: scale(1.09); }
}

body.tv-mode .source-acquisition {
  width: min(1320px, calc(100vw - 112px));
  grid-template-columns: minmax(0, 1fr) minmax(410px, 34vw);
}

body.tv-mode .source-attempt-overlay::before,
body.tv-mode .source-attempt-row {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.tv-mode .source-attempt-row {
  min-height: 56px;
  font-size: 1rem;
  background: rgba(8, 6, 14, .94);
}

@media (orientation: landscape) and (max-height: 540px) {
  .source-attempt-overlay { padding: 14px 24px; }
  .source-acquisition { grid-template-columns: minmax(0, 1fr) minmax(300px, 38vw); gap: 28px; }
  .source-acquisition-kicker { margin-top: 0; }
  .source-acquisition-status { margin: 6px 0 10px; }
  .source-attempt-list { width: 100%; }
  .source-attempt-row { min-height: 38px; padding: 7px 11px; }
}

@media (max-width: 760px), (orientation: portrait) and (max-height: 820px) {
  .source-attempt-overlay {
    align-items: end;
    padding: 14px;
  }

  .source-acquisition {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 14px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(8,6,16,.86);
  }

  .source-acquisition-copy {
    padding: 20px 20px 0;
  }

  .source-acquisition h2 { max-width: none; font-size: clamp(1.35rem, 7vw, 2rem); }
  .source-acquisition-status { margin: 7px 0 0; }

  .source-acquisition-rail {
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    border-left: 0;
    background: rgba(255,255,255,.025);
  }
}

/* Control bar */
.cp-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0 20px 14px;
  z-index: 10;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .35s cubic-bezier(.4,0,.2,1), transform .35s cubic-bezier(.4,0,.2,1);
}
.cp.cp-show-controls .cp-bar { opacity: 1; transform: translateY(0); }

.cp-progress-wrap {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,.16);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: height var(--t-fast) var(--ease);
}
.cp-progress-wrap:hover { height: 6px; }

.cp-progress-buf,
.cp-progress-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 3px;
  pointer-events: none;
}
.cp-progress-buf { background: rgba(255,255,255,.15); }
.cp-progress-fill {
  background: var(--accent);
  box-shadow: none;
}

.cp-progress-seek {
  position: absolute;
  top: -6px; left: 0;
  width: 100%;
  height: calc(100% + 12px);
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin: 0;
}
.cp-progress-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: transform .15s ease;
}
.cp-progress-seek::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.cp-progress-wrap:hover .cp-progress-seek { opacity: 1; }

.cp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.cp-left, .cp-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cp-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,255,255,.8);
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background .2s ease, color .2s ease, transform .15s ease;
  padding: 0;
}
.cp-btn:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.cp-btn svg { width: 22px; height: 22px; }
.cp-btn.active { color: var(--accent); }

.cp-4k-btn {
  width: 44px;
  color: rgba(255,255,255,.88);
  font-family: var(--font-data);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  border: 1px solid rgba(255,255,255,.12);
}
.cp-4k-btn:hover,
.cp-4k-btn.configured {
  color: #ffd47a;
  border-color: rgba(232,176,75,.5);
  background: rgba(232,176,75,.1);
}
.cp-4k-btn.active {
  color: #17120a;
  background: #e8b04b;
  border-color: #e8b04b;
}
.cp-4k-btn.hidden { display: none; }

#cpSpeedBtn {
  display: none;
}

.cp-next-ep-btn {
  width: auto;
  gap: 6px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  background: rgba(255,255,255,.12);
  border: 0;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}
.cp-next-ep-btn:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.25);
}
.cp-next-ep-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.cp-next-ep-label { color: rgba(255,255,255,.9); }
.cp-next-ep-btn.hidden { display: none; }

.cp-text-btn {
  width: auto;
  padding: 0 10px;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.cp-skip-label {
  position: absolute;
  bottom: 3px;
  font-size: .56rem;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  pointer-events: none;
}

.cp-time {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.cp-vol-btn { position: relative; }
.cp-vol-slider {
  width: 0;
  overflow: hidden;
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.cp-vol-btn:hover + .cp-vol-slider,
.cp-vol-slider:hover {
  width: 88px;
}
.cp-vol-slider input[type="range"] {
  width: 76px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,.15);
  border-radius: 3px;
  outline: none;
  margin: 0 6px;
  cursor: pointer;
}
.cp-vol-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,0,0,.3);
}

/* Panels (sources, subs, speed) */
.cp-panel {
  position: absolute;
  top: 0; right: 0;
  width: min(380px, 88%);
  height: 100%;
  background: rgba(12, 11, 15, .96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255,255,255,.06);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cp-panel-in .3s cubic-bezier(.4,0,.2,1);
}
.cp-panel.hidden { display: none; }
@keyframes cp-panel-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.cp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.cp-panel-head h3 { margin: 0; font-size: .95rem; font-weight: 600; color: rgba(255,255,255,.9); }

.cp-panel-x {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.6);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, color .2s ease;
}
.cp-panel-x:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.9); }

.cp-panel .source-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  max-height: none;
}

.cp-panel .try-next-source {
  margin: 10px 14px 0;
  width: calc(100% - 28px);
}

.cp-panel select {
  margin: 14px;
  width: calc(100% - 28px);
}

.cp-panel .subtitle-settings {
  margin: 0 14px 14px;
}

.cp-speed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
}
.cp-speed-opt {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.75);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
}
.cp-speed-opt:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.cp-speed-opt.active {
  background: rgba(232,176,75,.08);
  border-color: rgba(232,176,75,.45);
  color: var(--text-1);
}

.cp-settings-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: calc(100% - 52px);
}
.cp-setting-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  margin-bottom: 8px;
}
.cp-setting-hint {
  font-size: .72rem;
  color: rgba(255,255,255,.35);
  margin: 5px 0 0;
  line-height: 1.4;
}
.cp-setting-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.04);
}
.cp-toggle-opt {
  flex: 1;
  padding: 9px 8px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255,255,255,.5);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.cp-toggle-opt:hover { color: rgba(255,255,255,.75); background: rgba(255,255,255,.05); }
.cp-toggle-opt.active {
  background: rgba(232,176,75,.08);
  border-color: rgba(232,176,75,.45);
  color: var(--text-1);
  box-shadow: none;
}
.cp-quality-toggle { flex-wrap: wrap; }
.cp-quality-toggle .cp-toggle-opt { flex: 0 0 auto; min-width: 48px; }
.cp-setting-range {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
}

.cp-setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--radius-s);
  color: rgba(255,255,255,.85);
  font-size: .85rem;
  font-weight: 600;
}

.cp-setting-row span {
  color: var(--text-2);
  font-family: var(--font-data);
  font-size: .8rem;
}

.cp-setting-row:not(:disabled):hover {
  background: rgba(255,255,255,.07);
}
.cp-setting-color {
  width: 40px;
  height: 28px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.cp-4k-content {
  padding: clamp(20px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.cp-4k-kicker {
  margin: 0;
  color: #e8b04b;
  font-family: var(--font-data);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .18em;
}
.cp-4k-content h4 {
  margin: -4px 0 0;
  color: #fff;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.1;
}
.cp-4k-copy {
  margin: 0;
  color: rgba(255,255,255,.55);
  font-size: .84rem;
  line-height: 1.65;
}
.cp-4k-copy strong { color: rgba(255,255,255,.88); }
.cp-4k-field { display: grid; gap: 7px; margin-top: 4px; }
.cp-4k-field span {
  color: rgba(255,255,255,.72);
  font-size: .72rem;
  font-weight: 700;
}
.cp-4k-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(0,0,0,.32);
  color: #fff;
  padding: 0 13px;
  font-family: var(--font-data);
  font-size: .78rem;
  outline: none;
}
.cp-4k-field input:focus { border-color: rgba(232,176,75,.72); }
.cp-4k-connect {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: #e8b04b;
  color: #17120a;
  font-weight: 800;
  cursor: pointer;
}
.cp-4k-connect:hover { background: #f1c368; }
.cp-4k-connect:disabled { opacity: .55; cursor: wait; }
.cp-4k-status {
  min-height: 2.6em;
  margin: 0;
  color: rgba(255,255,255,.65);
  font-size: .76rem;
  line-height: 1.45;
}

.source-button .source-quality {
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  white-space: nowrap;
  letter-spacing: .03em;
  align-self: center;
}
.source-button .source-quality.q-4k {
  background: rgba(255,180,0,.14);
  color: #fbbf24;
  box-shadow: none;
}
.source-button .source-quality.q-1080 {
  background: rgba(136, 133, 129,.1);
  color: #a4a19d;
}
.source-button .source-quality.q-720 {
  background: rgba(127, 124, 120,.1);
  color: #a3a09c;
}
.source-button .source-quality.q-480 {
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.4);
}

.cp-diagnostics {
  padding: 8px 20px;
  font-size: .76rem;
  color: rgba(255,255,255,.35);
  min-height: 1.6em;
}

/* Fullscreen overrides */
.cp:fullscreen,
.cp:-webkit-full-screen {
  border-radius: 0;
  border: 0;
}
.cp:fullscreen .cp-screen,
.cp:-webkit-full-screen .cp-screen {
  aspect-ratio: auto;
  height: 100%;
  width: 100%;
  max-height: none;
}
.cp:fullscreen .cp-diagnostics,
.cp:-webkit-full-screen .cp-diagnostics { display: none; }

/* -- Subtitle overlay adjustments for custom player -- */
.cp-screen .subtitle-overlay {
  bottom: 80px;
  z-index: 12;
}
.cp:fullscreen .subtitle-overlay,
.cp:-webkit-full-screen .subtitle-overlay {
  bottom: 100px;
  font-size: clamp(16px, 2.5vw, 28px);
}

/* -- Up-next overlay inside custom player -- */
.cp-screen .up-next-overlay {
  z-index: 15;
}

/* -- Mobile custom player -- */
@media (max-width: 680px) {
  .cp { border-radius: 0; }
  .cp-top { padding: 10px 12px; }
  .cp-title { font-size: .88rem; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cp-bar { padding: 0 10px 8px; gap: 6px; }
  .cp-btn { width: 34px; height: 34px; }
  .cp-btn svg { width: 17px; height: 17px; }
  .cp-4k-btn { width: 38px; font-size: .66rem; }
  .cp-time { font-size: .68rem; min-width: 36px; }
  .cp-center-play { width: 58px; height: 58px; }
  .cp-center-play svg { width: 26px; height: 26px; }
  .cp-panel { width: 100% !important; height: auto !important; max-height: 55vh; border-left: none; border-top: 1px solid rgba(255,255,255,.08); top: auto !important; bottom: 0; right: 0; border-radius: 16px 16px 0 0; animation: cp-panel-slide-up .25s cubic-bezier(.4,0,.2,1); }
  .cp-panel-head { padding: 12px 14px; }
  .cp-panel-head h3 { font-size: .88rem; }
  .cp-panel-4k { max-height: min(72vh, 520px); }
  .cp-4k-content { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); gap: 12px; }
  .cp-vol-slider { display: none; }
  .cp-skip-label { font-size: .5rem; }
  .cp-next-ep-label { display: none; }
  .cp-next-ep-btn { padding: 0; width: 34px; background: transparent; border: none; }
  .cp-diagnostics { padding: 4px 12px; font-size: .68rem; }
  .source-button { min-height: 50px; padding: 8px 10px; gap: 7px; grid-template-columns: 28px minmax(0, 1fr) auto auto; }
  .source-button .source-quality { font-size: .6rem; padding: 2px 6px; }
  .source-rank { width: 28px; height: 28px; font-size: .75rem; border-radius: 8px; }
  .source-icon { width: 16px; height: 16px; }
  .source-main { font-size: .84rem; }
  .source-badges { gap: 3px; }
  .source-badge { font-size: .6rem; padding: 1px 5px; }
  .cp-speed-opt { padding: 10px 14px; font-size: .88rem; }
}

/* Touch devices: remove iframe clip-path so native fullscreen button is reachable */
@media (pointer: coarse) {
  .cp-screen .iframe-player,
  .cp-show-controls .cp-screen .iframe-player { clip-path: none; }
}

.cp--iframe-mode .cp-progress-wrap,
.cp--iframe-mode .cp-left,
.cp--iframe-mode .cp-vol-btn,
.cp--iframe-mode .cp-vol-slider,
.cp--iframe-mode #cpSpeedBtn,
.cp--iframe-mode #cpSubBtn,
.cp--iframe-mode #cpNextEpBtn,
.cp--iframe-mode #cpAutoNextBtn,
.cp--iframe-mode #cpSettingsBtn,
.cp--iframe-mode .cp-center-play,
.cp--iframe-mode .cp-loader,
.cp--iframe-mode .subtitle-overlay,
.cp--iframe-mode .source-attempt-overlay { display: none !important; }
.cp--iframe-mode .iframe-player { clip-path: none !important; }
.cp--iframe-mode .cp-gradient-top { pointer-events: none; }
.cp--iframe-mode .cp-top { pointer-events: auto; }
.cp--iframe-mode .cp-bar .cp-row { justify-content: flex-end; }

@keyframes cp-panel-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 420px) {
  .cp-top { padding: 8px 10px; }
  .cp-title { font-size: .82rem; max-width: 50vw; }
  .cp-bar { padding: 0 8px 6px; }
  .cp-btn { width: 30px; height: 30px; }
  .cp-btn svg { width: 15px; height: 15px; }
  .cp-4k-btn { width: 34px; font-size: .62rem; }
  .cp-right #cpAutoNextBtn,
  .cp-right #cpSettingsBtn { display: none; }
  .cp-time { font-size: .62rem; min-width: 32px; }
  .cp-center-play { width: 50px; height: 50px; }
  .cp-center-play svg { width: 22px; height: 22px; }
  .cp-panel { max-height: 50vh; }
  .source-button { min-height: 48px; grid-template-columns: 28px minmax(0, 1fr) auto; }
}

/* -- TV mode custom player -- */
body.tv-mode .cp-btn { width: 50px; height: 50px; }
body.tv-mode .cp-4k-btn { width: 60px; font-size: .86rem; }
body.tv-mode .cp-btn svg { width: 26px; height: 26px; }
body.tv-mode .cp-center-play { width: 92px; height: 92px; }
body.tv-mode .cp-time { font-size: .92rem; }
body.tv-mode .cp-speed-opt { padding: 16px; font-size: 1rem; }
body.tv-mode .cp-panel { width: min(440px, 90%); }
body.tv-mode .cp-4k-field input,
body.tv-mode .cp-4k-connect { min-height: var(--tv-focus-size); font-size: 1rem; }

/* -- TV / Low-end device mode -- */
body.tv-mode *,
body.tv-mode *::before,
body.tv-mode *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}

body.tv-mode .lazy-img {
  filter: none !important;
  transform: none !important;
}

body.tv-mode .topbar,
body.tv-mode .up-next-overlay,
body.tv-mode .search-suggestions,
body.tv-mode .profile-dropdown,
body.tv-mode .home-hero {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.tv-mode .media-card:hover,
body.tv-mode .card:hover,
body.tv-mode .provider-tile:hover,
body.tv-mode .language-tile:hover {
  transform: none !important;
  filter: none !important;
}

/* Ambient backdrop motion stays off on TV and during playback */
body.tv-mode .home-hero::after,
body.tv-mode .login-backdrop,
body.player-performance-mode .home-hero::after {
  animation: none !important;
}

body.tv-mode * {
  box-shadow: none !important;
  will-change: auto !important;
}

body.tv-mode .topbar {
  background: rgba(8, 6, 14, 0.98) !important;
}

body.tv-mode .media-card,
body.tv-mode .card {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

@media (min-width: 1800px) {
  .grid,
  .catalog-grid,
  .provider-catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .rail,
  .history-rail {
    grid-auto-columns: min(22vw, 380px);
  }

  .home-hero-copy h2 {
    font-size: 11rem;
  }

  .topbar {
    max-width: 1600px;
    margin-inline: auto;
  }

  #app {
    width: min(100% - 60px, 1800px);
  }
}

/* ===== Settings Modal ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}

/* ===== Cinematic responsive pass ===== */


html,
body {
  overflow-x: clip;
}

.app-nav a:focus-visible,
.search :focus-visible,
.profile-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

.home-hero-copy {
  width: min(690px, calc(100vw - 36px));
  padding-bottom: clamp(66px, 8vw, 104px);
}

.home-hero-copy h2 {
  max-width: 11ch;
  font-size: clamp(3rem, 7vw, var(--hero-title-max));
  line-height: .95;
  letter-spacing: -0.02em;
}

.home-hero-copy p:not(.eyebrow) {
  max-width: 62ch;
  color: var(--text-2);
  line-height: 1.55;
}

.hero-meta-row span,
.detail-meta-strip span {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: .9rem;
}

.media-card:focus-visible,
.card:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 4px;
  border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .media-card:hover,
  .card:hover {
    transform: none;
    border-color: transparent;
  }
}

body.player-performance-mode .cp,
body.player-performance-mode .cp-screen,
body.player-performance-mode .source-attempt-row {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.tv-mode .code-pill {
  min-width: 5.4rem;
  font-size: 1.1rem;
}

body.tv-mode .media-card:focus-visible,
body.tv-mode .card:focus-visible {
  outline-width: 5px;
  outline-offset: 6px;
}

@media (max-width: 760px) {
  .home-hero {
    min-height: min(760px, 100vh);
    min-height: min(760px, 100svh);
    background-position: 62% center;
  }

  .home-hero-copy {
    width: min(92vw, 560px);
    padding-bottom: 54px;
  }

  .home-hero-copy h2 {
    font-size: clamp(2.8rem, 13vw, 5.6rem);
  }
}

@media (max-width: 420px) {
  .home-hero-copy p:not(.eyebrow) {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }
}

/* ===== Full-screen source acquisition rail ===== */
.source-acquisition {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 58%) minmax(280px, 42%);
  align-items: stretch;
  text-align: left;
}

.source-acquisition-copy {
  align-self: end;
  justify-self: start;
  width: min(540px, 54vw);
  max-width: 100%;
  display: flex;
  align-items: end;
  gap: clamp(18px, 2.4vw, 32px);
  padding: clamp(34px, 5vw, 72px);
}

.source-acquisition-copy h2 {
  max-width: 16ch;
  margin: 8px 0 0;
  font-size: clamp(1.8rem, 3.4vw, 3.8rem);
  line-height: .94;
}

.source-acquisition-copy .source-acquisition-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0 0;
  color: rgba(255,255,255,.58);
  font-family: var(--font-data);
  font-size: clamp(.64rem, .9vw, .78rem);
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.source-acquisition-status > span {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: none;
}

.source-media-poster {
  width: clamp(72px, 8.5vw, 112px);
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--bg-1);
  box-shadow: none;
}

.source-media-poster img,
.source-media-poster > span {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.source-media-poster img {
  object-fit: cover;
}

.source-media-poster > span {
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.78);
  font-family: var(--font-data);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(145deg, rgba(142, 139, 135,.34), rgba(18, 17, 21,.62));
}

.source-media-identity {
  min-width: 0;
  padding-bottom: 4px;
}

.source-media-identity .source-acquisition-kicker {
  width: fit-content;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 5px;
  color: rgba(255,255,255,.86);
  background: rgba(255,255,255,.08);
  letter-spacing: .1em;
}

.source-acquisition-rail {
  position: relative;
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-height: 76%;
  padding: clamp(26px, 4vw, 58px);
  border: 0;
  background: transparent;
}

.source-attempt-track {
  position: relative;
}

.source-attempt-track::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: 1px;
  background: linear-gradient(rgba(189, 186, 182,.5), rgba(255,255,255,.08));
}

.source-attempt-list {
  width: 100%;
  gap: 0;
}

.source-attempt-row {
  grid-template-columns: 18px minmax(0, 1fr);
  min-height: 66px;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.source-attempt-row.failed {
  color: rgba(255,255,255,.34);
  border: 0;
  background: transparent;
}

.source-attempt-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(.88rem, 1.35vw, 1.08rem);
  font-weight: 700;
}

.source-attempt-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.source-attempt-state {
  display: block;
  color: rgba(255,255,255,.38);
  font-family: var(--font-data);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.source-attempt-row.trying .source-attempt-name {
  color: #fff;
}

.source-attempt-row.trying .source-attempt-state {
  color: #bdbab6;
}

@keyframes source-rail-pulse {
  0%, 100% { opacity: .55; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1); }
}

body.tv-mode .source-acquisition {
  width: 100%;
}

body.tv-mode .source-acquisition-rail {
  background: transparent;
}

@media (max-width: 680px) {
  .source-acquisition {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 56%) minmax(150px, 44%);
    gap: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }

  .source-acquisition-copy {
    position: absolute;
    right: 44%;
    bottom: 8%;
    left: 0;
    width: auto;
    max-width: none;
    display: flex;
    align-items: end;
    gap: 12px;
    padding: 16px 14px;
  }

  .source-acquisition-copy h2 {
    max-width: 13ch;
    margin-top: 6px;
    font-size: clamp(1.25rem, 6vw, 1.9rem);
  }

  .source-media-poster {
    width: clamp(52px, 16vw, 72px);
    border-radius: 8px;
  }

  .source-media-identity .source-acquisition-kicker {
    padding: 4px 7px;
    font-size: .56rem;
  }

  .source-acquisition-copy .source-acquisition-status {
    margin-top: 11px;
    font-size: .54rem;
    letter-spacing: .1em;
  }

  .source-acquisition-rail {
    position: absolute;
    right: 0;
    top: 28%;
    bottom: 12%;
    left: auto;
    width: 44%;
    max-height: none;
    padding: 0 14px 0 8px;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .source-attempt-track {
    width: 100%;
  }

  .source-attempt-row {
    grid-template-columns: 14px minmax(0, 1fr);
    min-height: 56px;
    gap: 7px;
    padding: 8px 0;
  }

  .source-attempt-name {
    font-size: .82rem;
  }

  .source-attempt-state {
    font-size: .52rem;
  }

  .source-attempt-track::before {
    left: 6px;
  }

  .source-attempt-row::before {
    left: -17px;
  }
}
.settings-modal.hidden { display: none; }
.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}
.settings-modal-content {
  position: relative;
  width: min(520px, 92vw);
  max-height: 85vh;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.settings-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.settings-modal-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.settings-modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
}
.settings-modal-close:hover { color: #fff; }
.settings-modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.settings-group-title {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin: 0 0 12px;
}
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.settings-row-info {
  flex: 1;
  min-width: 0;
}
.settings-row-info label {
  font-size: .88rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  display: block;
}
.settings-row-info p {
  font-size: .72rem;
  color: rgba(255,255,255,.38);
  margin: 2px 0 0;
  line-height: 1.35;
}

.settings-row-stack {
  align-items: stretch;
  flex-direction: column;
  gap: 12px;
}

.settings-secret-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  width: 100%;
}

.settings-secret-control input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-input, rgba(255, 255, 255, .04));
  color: var(--text-1);
  padding: 11px 13px;
  font: inherit;
}

.settings-secret-control input:focus {
  border-color: var(--accent);
  outline: none;
}

.settings-connection-status {
  min-height: 1.3em;
  margin: 0;
  color: var(--text-2);
  font-size: .84rem;
}

@media (max-width: 680px) {
  .settings-secret-control { grid-template-columns: 1fr 1fr; }
  .settings-secret-control input { grid-column: 1 / -1; }
}
.settings-toggle {
  display: flex;
  gap: 3px;
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  padding: 3px;
  flex-shrink: 0;
}
.settings-opt {
  padding: 7px 14px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255,255,255,.5);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.settings-opt:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.06); }
.settings-opt.active {
  background: rgba(232,176,75,.08);
  border-color: rgba(232,176,75,.45);
  color: var(--text-1);
}
.settings-quality-toggle { flex-wrap: wrap; }
.settings-quality-toggle .settings-opt { padding: 7px 10px; }
.settings-range {
  width: 140px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.settings-color-input {
  width: 40px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .settings-modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    height: 100%;
  }
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .settings-toggle { width: 100%; }
  .settings-opt { flex: 1; text-align: center; }
  .settings-range { width: 100%; }
}

/* ===== Bottom Tab Bar (mobile) ===== */
.bottom-tabs {
  display: none;
}

@media (max-width: 680px) {
  .bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: rgba(10, 10, 12, 0.96);
    border-top: 1px solid var(--line);
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
  }

  .bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    min-width: 56px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-tab svg {
    width: 22px;
    height: 22px;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .bottom-tab.active {
    color: var(--accent);
  }

  .bottom-tab.active svg {
    filter: none;
  }

  #app {
    padding-bottom: 68px;
  }

  body.player-performance-mode .bottom-tabs {
    display: none;
  }
}


/* ===== Mobile topbar (trails all base rules so it wins the cascade) ===== */
@media (max-width: 680px) {
  .app-nav {
    display: none;
  }

  .topbar {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 0 12px;
    min-height: 56px;
  }

  .topbar .search {
    flex: 1 1 auto;
    margin-left: 0;
  }

  .topbar .search:focus-within {
    flex-basis: auto;
  }

  .session-chip {
    min-height: 34px;
    padding: 0 10px;
  }

  .session-popover {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: 12px;
    right: 12px;
    width: auto;
  }
}


/* ===== Rails: no visible scrollbars ===== */
.rail,
.history-rail,
.provider-strip {
  scrollbar-width: none;
}

.rail::-webkit-scrollbar,
.history-rail::-webkit-scrollbar,
.provider-strip::-webkit-scrollbar {
  display: none;
}

/* Fine-pointer rails reveal a quiet scrollbar on hover as a scroll affordance */
@media (hover: hover) and (pointer: fine) {
  .rail:hover,
  .history-rail:hover,
  .provider-strip:hover {
    scrollbar-width: thin;
    scrollbar-color: rgba(244, 242, 238, 0.2) transparent;
  }

  .rail:hover::-webkit-scrollbar,
  .history-rail:hover::-webkit-scrollbar,
  .provider-strip:hover::-webkit-scrollbar {
    display: block;
    height: 4px;
  }

  .rail::-webkit-scrollbar-thumb,
  .history-rail::-webkit-scrollbar-thumb,
  .provider-strip::-webkit-scrollbar-thumb {
    background: rgba(244, 242, 238, 0.16);
    border-radius: 4px;
  }

  .rail::-webkit-scrollbar-track,
  .history-rail::-webkit-scrollbar-track,
  .provider-strip::-webkit-scrollbar-track {
    background: transparent;
  }
}


/* ===== Phase 7 polish (trails all base rules) ===== */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

body.tv-mode .session-chip {
  min-height: var(--tv-focus-size);
  padding: 0 16px;
}

body.tv-mode .session-popover input,
body.tv-mode .session-popover button {
  min-height: var(--tv-focus-size);
}


/* Title-mode sport events (fight cards, opens): the name is the content */
.sport-card-visual--title {
  grid-template-columns: 1fr;
  align-content: center;
  gap: 10px;
  min-height: 118px;
  padding: 18px 20px;
}

.sport-card-visual--title .sport-live-badge {
  justify-self: center;
}

.sport-event-title {
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text-1);
  text-align: center;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}


/* ===== Old-TV-engine fallbacks ===== */
/* 1) Engines without :focus-visible (TV Chromium < 86) still need a ring */
body.tv-mode :focus {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

/* 2) Engines without aspect-ratio (TV Chromium < 88): reserve tile heights */
@supports not (aspect-ratio: 1 / 1) {
  .media-art {
    height: 270px;
  }

  .channel-card-media {
    height: 112px;
  }

  .source-media-poster {
    height: 150px;
  }
}
