/* =====================================================================
   NetCast — midnight blue · studio amber
   Logical properties throughout so Arabic (RTL) mirrors automatically.
   ===================================================================== */

/* Self-hosted fonts (SIL Open Font License, see assets/fonts/OFL-*.txt): Latin subsets, WOFF2. */
@font-face {
  font-family: 'Manrope';
  src: url('../assets/fonts/manrope-latin-var.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-017F, U+0131, U+0152-0153, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+1E9E, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  src: url('../assets/fonts/sora-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-017F, U+0131, U+0152-0153, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+1E9E, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0a0f1c;
  --bg-deep: #060a14;
  --surface: #111829;
  --surface-2: #172036;
  --surface-3: #1e2943;
  --border: rgba(160, 180, 220, 0.11);
  --border-strong: rgba(160, 180, 220, 0.2);
  --text: #eef1f7;
  --text-soft: #bcc6d8;
  --muted: #8592ab;
  --accent: #f5b544;
  --accent-strong: #ffc861;
  --accent-ink: #241703;
  --accent-soft: rgba(245, 181, 68, 0.13);
  --accent-line: rgba(245, 181, 68, 0.4);
  --danger: #ff7a7a;
  --live: #ff5d6c;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --gap: 12px;
  --header-h: 56px;
  --font-display: 'Sora', 'Manrope', system-ui, sans-serif;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(245, 181, 68, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 10%, rgba(64, 120, 220, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 20px; height: 20px; flex: none; display: block; fill: currentColor; }
.icon-lg { width: 36px; height: 36px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: calc(8px + var(--safe-top)); }
main[tabindex="-1"]:focus { outline: none; }

/* ---------------------------------------------------------------- header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: rgba(8, 12, 24, 0.84);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.brand-sub {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.is-spinning .icon { animation: spin .9s linear infinite; color: var(--accent); }

.lang-select {
  position: relative;
  display: flex;
  align-items: center;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
}
.lang-select:hover { border-color: var(--border-strong); }
.lang-select:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.lang-select .icon { position: absolute; inset-inline-start: 10px; width: 18px; height: 18px; pointer-events: none; }
.lang-select select {
  appearance: none; -webkit-appearance: none;
  height: 100%;
  padding-inline: 34px 12px;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 132px;
}
.lang-select select:focus-visible { outline: none; }
.lang-select option, .select option { background: var(--surface); color: var(--text); }

.offline-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 122, 122, 0.12);
  border-bottom: 1px solid rgba(255, 122, 122, 0.25);
  color: #ffc9c9;
  font-size: 13px; font-weight: 600;
  text-align: center;
}
.offline-banner .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 0 20px;
}

.player-pane { min-width: 0; }
.browser { min-width: 0; padding-inline: 12px; }

/* ---------------------------------------------------------------- player */

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  isolation: isolate;
}
@supports not (aspect-ratio: 16 / 9) {
  .player { height: 0; padding-top: 56.25%; }
}

.player video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

.player-overlay {
  position: absolute; inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}
.player-overlay > * { pointer-events: auto; grid-area: 1 / 1; }

.overlay-idle, .overlay-error {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: 420px;
  padding: 16px 20px;
  text-align: center;
}
.player[data-state="idle"] {
  background:
    radial-gradient(420px 220px at 50% 40%, rgba(245, 181, 68, 0.12), transparent 70%),
    linear-gradient(160deg, #0f1b30, #08101d);
}
.overlay-idle img { width: 52px; height: 52px; opacity: .95; margin-bottom: 4px; }
.overlay-title { font-size: 15px; font-weight: 700; }
.overlay-hint { font-size: 12.5px; color: var(--muted); }

.player[data-state="error"] { background: linear-gradient(160deg, #1a1420, #0a0f1a); }
.overlay-error { color: var(--text); }
.overlay-error .icon { color: var(--danger); }
.overlay-error .btn { margin-top: 6px; }

.overlay-loading { display: grid; place-items: center; }

.overlay-play {
  display: grid; place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(8, 14, 26, .6);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overlay-play .icon { width: 28px; height: 28px; margin-inline-start: 3px; }

.spinner {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .14);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; }

.player-controls {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 26px 8px 6px;
  background: linear-gradient(to top, rgba(4, 8, 16, .9), rgba(4, 8, 16, .55) 55%, transparent);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.player[data-state="idle"] .player-controls { opacity: 0; pointer-events: none; }

/* Subtitles (CC) */
.cc-text {
  position: absolute; left: 50%; bottom: 64px; z-index: 2;
  transform: translateX(-50%);
  width: max-content; max-width: min(88%, 900px);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center; pointer-events: none;
  transition: bottom .25s var(--ease);
}
.cc-text span {
  padding: 2px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: clamp(14px, 2.2vw, 26px); font-weight: 600; line-height: 1.35;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.player.controls-hidden .cc-text { bottom: 18px; }
.player:fullscreen .cc-text span { font-size: clamp(20px, 2.6vw, 40px); }
.cc-wrap { position: relative; display: flex; }
.cc-menu {
  position: absolute; bottom: calc(100% + 10px); inset-inline-end: -40px; z-index: 5;
  min-width: 240px; max-width: min(320px, 86vw);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(14, 18, 30, .96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.cc-menu-title { margin: 4px 10px 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.cc-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: #fff;
  font: inherit; font-size: 14px; text-align: start;
  touch-action: manipulation;
}
.cc-item::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); }
.cc-item[aria-checked="true"]::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, transparent 5px); }
.cc-item:hover:not(:disabled), .cc-item:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.cc-item:disabled { color: rgba(255, 255, 255, .45); font-size: 12.5px; }
.cc-note { margin: 4px 10px; max-width: 34ch; font-size: 12.5px; line-height: 1.45; color: rgba(255, 255, 255, .75); }
.cc-note + .cc-note { margin-top: 0; }
a.cc-link { display: block; margin-top: 2px; color: var(--accent); text-decoration: none; }
a.cc-link:hover, a.cc-link:focus-visible { text-decoration: underline; outline: none; }
#ccBtn[aria-pressed="true"] { color: var(--accent); }
.player[data-state="error"] .player-controls { display: none; }
.player.controls-hidden .player-controls { opacity: 0; transform: translateY(6px); pointer-events: none; }
.player.controls-hidden { cursor: none; }

.ctrl-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: #fff;
  transition: transform .08s, background .12s;
}
.ctrl-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); }
.ctrl-btn:active:not(:disabled) { transform: scale(.9); background: rgba(255, 255, 255, .16); }
/* No double-tap-zoom wait on touch screens: taps respond immediately. */
.ctrl-btn, .overlay-play, .card-main, .card-fav, .now-panel .fav-btn { touch-action: manipulation; }
.ctrl-btn:disabled { opacity: .4; }
.ctrl-btn[aria-pressed="true"] { color: var(--accent); }
.ctrl-spacer { flex: 1; }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 93, 108, .16);
  color: #ffd1d6;
  font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }

.status-text {
  min-width: 0;
  padding-inline: 6px;
  font-size: 12.5px; font-weight: 600;
  color: rgba(255, 255, 255, .78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.volume {
  --fill: 100%;
  -webkit-appearance: none; appearance: none;
  width: 92px; height: 4px;
  margin-inline-end: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, .25) var(--fill));
  cursor: pointer;
}
[dir="rtl"] .volume { background: linear-gradient(to left, var(--accent) var(--fill), rgba(255, 255, 255, .25) var(--fill)); }
.volume::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.volume::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }

.player:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; }
.player:-webkit-full-screen { width: 100vw; height: 100vh; }

/* ---------------------------------------------------------------- now playing */

.now-panel {
  margin: 12px 12px 0;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.now-head { display: flex; align-items: center; gap: 12px; }
.now-logo {
  display: grid; place-items: center;
  width: 56px; height: 42px; flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  overflow: hidden;
}
.now-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.now-info { flex: 1; min-width: 0; }
.now-name {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.now-meta {
  margin-top: 2px; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.now-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 700;
}
.badge-muted { background: var(--surface-3); color: var(--text-soft); }

.fav-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  transition: color .15s, background .15s, border-color .15s;
}

.fav-btn:hover { color: var(--text); border-color: var(--border-strong); }
.fav-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* Stars render as an outline until the channel is a favorite. */
.fav-btn:not([aria-pressed="true"]) .icon, .card-fav:not([aria-pressed="true"]) .icon { fill: none; }

.epg { margin-top: 12px; display: grid; gap: 10px; }
.epg:empty { display: none; }
.epg-empty { font-size: 13px; color: var(--muted); }
.epg-row { min-width: 0; }
.epg-next { padding-top: 10px; border-top: 1px solid var(--border); }
.epg-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.epg-tag {
  padding: 1px 7px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
}
.epg-next .epg-tag { background: var(--surface-3); color: var(--text-soft); }
.epg-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.epg-title { margin-top: 4px; font-weight: 700; font-size: 14px; }
.epg-progress {
  height: 4px; margin-top: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.epg-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .6s var(--ease); }
.epg-left { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.epg-desc {
  margin-top: 6px; font-size: 13px; color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------------------------------------------------------- browser */

.browser-top {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 10;
  margin-inline: -12px;
  padding: 10px 12px 6px;
  background: linear-gradient(to bottom, var(--bg) 82%, rgba(10, 15, 28, 0));
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px;
  padding: 6px 10px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab .icon { width: 17px; height: 17px; }
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tab[aria-pressed="true"] .icon { color: var(--accent); }
.tab-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tab[aria-pressed="true"] .tab-count { background: var(--accent-soft); color: var(--accent); }

.toolbar { display: grid; gap: 8px; margin-top: 10px; }

.search {
  position: relative;
  display: flex; align-items: center;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search > .icon { position: absolute; inset-inline-start: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  padding-inline: 40px 8px;
  border: 0; background: transparent;
  font-size: 15px;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus-visible { outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear {
  display: grid; place-items: center;
  width: 36px; height: 36px; margin-inline-end: 4px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
}
.search-clear:hover { background: var(--surface-2); color: var(--text); }
.search-clear .icon { width: 18px; height: 18px; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.select { position: relative; min-width: 0; }
.select select {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  height: 40px;
  padding-inline: 12px 30px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%237f91ab' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  font-size: 13px; font-weight: 600;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
[dir="rtl"] .select select { background-position: left 11px center; }
.select select:hover { border-color: var(--border-strong); }
.select select:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.select.is-active select { border-color: var(--accent-line); color: var(--text); background-color: rgba(245, 181, 68, 0.06); }

.toggle {
  display: inline-flex; align-items: center; gap: 9px;
  justify-self: start;
  min-height: 32px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative;
  width: 32px; height: 18px; flex: none;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background .15s, border-color .15s;
}
.toggle-track::after {
  content: '';
  position: absolute; top: 2px; inset-inline-start: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted);
  transition: transform .18s var(--ease), background .15s;
}
.toggle input:checked + .toggle-track { background: var(--accent-soft); border-color: var(--accent-line); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); background: var(--accent); }
[dir="rtl"] .toggle input:checked + .toggle-track::after { transform: translateX(-14px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-count { margin-top: 4px; font-size: 12px; color: var(--muted); min-height: 18px; }
.plan-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-soft);
}
.plan-note .icon { width: 16px; height: 16px; color: var(--accent); }
.plan-note a { color: var(--accent); font-weight: 800; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- channel grid */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.channel-grid:focus { outline: none; }

.card {
  position: relative;
  min-width: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s var(--ease);
  contain: layout paint;
  content-visibility: auto;
  contain-intrinsic-size: auto 168px;
}
.card:hover { border-color: var(--border-strong); background: #152039; }
.card.is-playing { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(245, 181, 68, 0.08), var(--surface) 60%); }
.card.is-unavailable { opacity: .55; }

.card-main {
  display: flex; flex-direction: column;
  width: 100%;
  padding: 8px 8px 10px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  text-align: start;
}
.card-main:active { transform: scale(.985); }
.card-main:focus-visible { outline-offset: -2px; }

.card-logo {
  position: relative;
  display: grid; place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
  overflow: hidden;
}
.card-logo img { width: 100%; height: 100%; object-fit: contain; padding: 10px 14px; }
.card-initials {
  font-size: 22px; font-weight: 800; letter-spacing: .02em;
  color: var(--text-soft);
  opacity: .7;
}
.now-logo .card-initials { font-size: 15px; }
.card-quality {
  position: absolute; bottom: 6px; inset-inline-start: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(7, 13, 24, .78);
  color: var(--text-soft);
  font-size: 9.5px; font-weight: 800; letter-spacing: .04em;
}
/* «Sin cuenta»: only on the home page channels a visitor can watch without an account. */
.card-open { display: none; }
.card.is-open .card-open {
  display: block;
  position: absolute; bottom: 6px; inset-inline-end: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #1a1206;
  font-size: 9.5px; font-weight: 800; letter-spacing: .02em;
  line-height: 1.5;
  white-space: nowrap;
}
.card.is-playing .card-logo::after {
  content: '';
  position: absolute; top: 7px; inset-inline-start: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 181, 68, .25);
  animation: pulse 1.6s ease-in-out infinite;
}

.card-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; margin-top: 8px; padding-inline: 2px; }
.card-name {
  font-size: 13.5px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-sub, .card-epg {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-epg { color: var(--accent); opacity: .85; }

.card-fav {
  position: absolute; top: 12px; inset-inline-end: 12px;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 9px;
  background: rgba(7, 13, 24, .66);
  color: rgba(231, 238, 248, .75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: color .15s, background .15s, transform .15s var(--ease);
}
.card-fav .icon { width: 17px; height: 17px; }
.card-fav:hover { color: #fff; background: rgba(7, 13, 24, .85); }
.card-fav:active { transform: scale(.9); }
.card-fav[aria-pressed="true"] { color: var(--accent); }

.more-wrap { display: flex; justify-content: center; margin: 20px 0 8px; }
.more-wrap[hidden] { display: none; }
.more-btn { min-width: min(100%, 280px); }

/* Skeleton / states */
.load-state { margin-top: 6px; }
.load-text { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-height: 20px; }
.skeleton {
  border-radius: var(--radius);
  aspect-ratio: 4 / 3.6;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border: 1px solid var(--border);
}

.state-box {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 24px auto;
  max-width: 380px;
  padding: 28px 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.state-box .icon { color: var(--muted); margin-bottom: 4px; }
.state-box h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.state-box p { font-size: 13.5px; color: var(--muted); }
.state-box .btn { margin-top: 8px; }
#errorState .icon { color: var(--danger); }
#emptyState .fav-icon { display: none; color: var(--accent); }
#emptyState.is-favorites .fav-icon { display: block; }
#emptyState.is-favorites .empty-icon { display: none; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800; font-size: 14px;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(.97); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-3); }

/* ---------------------------------------------------------------- footer / toast / dialog */

.app-footer {
  max-width: 1680px;
  margin: 0 auto;
  padding: 8px 16px calc(24px + var(--safe-bottom));
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 60;
  max-width: min(92vw, 440px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(27, 42, 67, .96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  font-size: 13.5px; font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

.dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.dialog::backdrop { background: rgba(3, 7, 15, .7); backdrop-filter: blur(3px); }
.dialog form { display: grid; gap: 12px; padding: 20px; }
.dialog h2 { font-size: 17px; font-weight: 800; }
.dialog-hint { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 13px; font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr;
  resize: vertical;
}
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.noscript { padding: 24px; text-align: center; }

/* ---------------------------------------------------------------- accounts */

.auth-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: auto;
}
.auth-dialog::backdrop { background: rgba(4, 7, 15, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.auth-dialog[open] { animation: dialog-in .22s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-close {
  position: absolute; top: 10px; inset-inline-end: 10px;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
}
.auth-close:hover { background: var(--surface-2); color: var(--text); }
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 22px 22px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background:
    radial-gradient(360px 160px at 50% -20%, rgba(245, 181, 68, 0.12), transparent 70%),
    var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.auth-logo { width: 52px; height: 52px; align-self: center; }
.auth-title { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.02em; text-align: center; text-wrap: balance; }
.auth-intro { margin-top: -8px; font-size: 13.5px; color: var(--muted); text-align: center; text-wrap: balance; }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.auth-tab {
  min-height: 38px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 700;
}
.auth-tab:hover { color: var(--text); }
.auth-tab[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.auth-alt { display: flex; flex-direction: column; gap: 12px; }
.auth-provider { width: 100%; min-height: 46px; font-size: 15px; }
.auth-provider[aria-busy="true"] { opacity: .7; pointer-events: none; }
.auth-or { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.auth-field input {
  width: 100%;
  height: 46px;
  padding-inline: 13px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 15px;
}
.auth-field input:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-field input[aria-invalid="true"] { border-color: rgba(255, 122, 122, .6); }
.password-wrap { position: relative; }
.password-wrap input { padding-inline-end: 46px; }
.pw-toggle {
  position: absolute; top: 3px; inset-inline-end: 3px;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.field-hint { font-size: 12px; color: var(--muted); }

.auth-msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.auth-error { background: rgba(255, 122, 122, .1); border: 1px solid rgba(255, 122, 122, .3); color: #ffc9c9; }
.auth-notice { background: var(--accent-soft); border: 1px solid var(--accent-line); color: #ffe2ad; }
.auth-submit { width: 100%; min-height: 46px; font-size: 15px; }
.auth-submit[aria-busy="true"] { opacity: .75; pointer-events: none; }
.auth-submit[aria-busy="true"]::before {
  content: ''; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(36, 23, 3, .3); border-top-color: var(--accent-ink);
  animation: spin .8s linear infinite;
}

.auth-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.link-btn {
  padding: 6px 8px;
  border: 0; background: transparent;
  color: var(--accent);
  font-size: 13px; font-weight: 700;
  border-radius: 8px;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Account menu */
.account { position: relative; }
.account-btn { border-radius: 50%; background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.account-btn:hover { background: rgba(245, 181, 68, 0.2); color: var(--accent-strong); }
.account-initials { font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 40;
  width: min(280px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}
.account-name { font-weight: 800; font-size: 14px; overflow-wrap: anywhere; }
.account-name:empty { display: none; }
.account-email { margin-top: 2px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px; font-weight: 700;
  text-align: start;
}
.menu-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }

/* Premium */
.premium-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 13px; font-weight: 800;
  text-decoration: none;
}
.premium-link .icon { width: 17px; height: 17px; }
.premium-link:hover { background: var(--accent-soft); }
body[data-plan="premium"] .premium-link,
body[data-plan="premium"] .ad-slot { display: none !important; }
.account-plan { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--accent); }
.account-plan:empty { display: none; }
a.menu-item { color: var(--text); text-decoration: none; }
a.menu-item .icon { color: var(--accent); }

/* ---------------------------------------------------------------- public home */

.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 13px; border-radius: 10px; }
.sign-in-btn .icon { width: 18px; height: 18px; }
a.btn { text-decoration: none; }

.hero {
  padding: 22px max(16px, env(safe-area-inset-left, 0px)) 4px max(16px, env(safe-area-inset-right, 0px));
}
body[data-auth="in"] .hero { display: none; }
/* One main heading: the hero's for visitors, the guide's (screen readers only) once signed in. */
body:not([data-auth="in"]) .guide-title { display: none; }
.hero-inner {
  max-width: 1680px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}
.hero-title {
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(26px, 6.4vw, 44px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero-title::after {
  content: '';
  display: block;
  width: 48px; height: 4px;
  margin-top: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}
.hero-text { max-width: 62ch; color: var(--text-soft); font-size: 15px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 0; padding: 0; list-style: none; }
.hero-points li { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.hero-points .icon { width: 17px; height: 17px; color: var(--accent); }
.hero-points li:last-child .icon { fill: currentColor; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* Ads: clearly labelled, reserved height (no layout jumps), away from controls */
.ad-slot {
  display: grid;
  gap: 6px;
  margin: 28px 0 8px;
  padding: 12px;
  min-height: 140px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-deep);
}
.ad-slot.is-suppressed { display: none; }
.ad-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Footer */
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 8px; }
.footer-links a, .footer-link-btn {
  padding: 4px 0;
  border: 0; background: none;
  color: var(--text-soft);
  font-size: 12.5px; font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover, .footer-link-btn:hover { color: var(--accent); }
.footer-copy { margin-top: 6px; }

/* ---------------------------------------------------------------- content pages */

.page-header .brand { text-decoration: none; color: inherit; }
.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-left, 0px)) 24px max(16px, env(safe-area-inset-right, 0px));
}
.doc h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-wrap: balance;
}
.doc .doc-meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.doc h2 {
  margin-top: 30px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.doc p, .doc li { color: var(--text-soft); font-size: 15px; line-height: 1.65; }
.doc p { margin-top: 12px; }
.doc ul, .doc ol { margin: 12px 0 0; padding-inline-start: 22px; display: grid; gap: 6px; }
.doc li > ul { margin-top: 6px; }
/* Guides: breadcrumbs, cards and related links */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.crumbs li { color: var(--muted); font-size: 13px; line-height: 1.4; }
.crumbs li + li::before { content: "›"; margin-inline-end: 8px; color: var(--muted); }
.crumbs a { color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.guide-cards { list-style: none; padding: 0 !important; margin-top: 22px !important; display: grid; gap: 12px !important; }
@media (min-width: 640px) { .guide-cards { grid-template-columns: 1fr 1fr; } }
.guide-card { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); display: grid; gap: 6px; align-content: start; }
.guide-card:hover { border-color: var(--accent-line); }
.doc .guide-card h2 { margin: 0; font-size: 17px; }
.doc .guide-card h2 a { color: var(--text); text-decoration: none; }
.doc .guide-card h2 a::after { content: " →"; color: var(--accent); }
.doc .guide-card p { margin: 0; font-size: 14px; }
.guide-card-meta { font-size: 12px; color: var(--muted); }
.related { margin-top: 30px; padding-top: 4px; border-top: 1px solid var(--border); }
.doc .guide-links { list-style: none; padding: 0; gap: 10px; }
.doc .guide-links li { display: grid; gap: 2px; }
.doc .guide-links a { font-weight: 700; }
.doc .guide-links span { font-size: 13.5px; color: var(--muted); }
.doc a { color: var(--accent); text-underline-offset: 3px; }
.doc strong { color: var(--text); }
.doc .lead { font-size: 17px; color: var(--text); }
.doc .email {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-weight: 700;
  color: var(--text);
  user-select: all;
  overflow-wrap: anywhere;
}
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 13px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--accent); }

/* ---------------------------------------------------------------- premium page */

.pricing {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px max(16px, env(safe-area-inset-left, 0px)) 8px max(16px, env(safe-area-inset-right, 0px));
}
.pricing-head { display: grid; gap: 12px; justify-items: center; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow .icon { width: 16px; height: 16px; }
.pricing-head h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}
.pricing-head .lead { max-width: 52ch; color: var(--text-soft); font-size: 16px; }

.plan-status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px;
  margin-top: 4px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px; font-weight: 600;
}
.plan-status[data-kind="success"] { border-color: var(--accent-line); background: var(--accent-soft); }
.plan-status[data-kind="error"] { border-color: rgba(255, 122, 122, .35); background: rgba(255, 122, 122, .08); color: #ffc9c9; }

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 30px;
  align-items: stretch;
}
.plan {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 20px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.plan h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.plan-featured {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(245, 181, 68, 0.09), var(--surface) 55%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.plan-badge {
  position: absolute; top: -11px; inset-inline-end: 18px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.price { display: flex; align-items: baseline; gap: 4px; }
.price .amount { font-family: var(--font-display); font-size: 38px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.price .per { color: var(--muted); font-size: 15px; font-weight: 600; }
.price-note { margin-top: -6px; color: var(--muted); font-size: 13px; }
.trial-note {
  align-self: flex-start; margin-top: -2px; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.trial-banner {
  margin: 14px auto 0; max-width: 560px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font-size: 14.5px;
}
.trial-banner strong { color: var(--accent); }
.plan-list { display: grid; align-content: start; gap: 9px; margin: 6px 0 4px; padding: 0; list-style: none; flex: 1; }
.plan-list li { display: flex; gap: 9px; font-size: 14px; color: var(--text-soft); }
.plan-list .icon { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.plan-count {
  display: inline-flex; align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-height: 25px; line-height: 19px;
}
/* Space is kept while counting so the cards do not jump when the number arrives. */
.plan-count:empty { visibility: hidden; }
.plans-note { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }
.plan-btn { width: 100%; }
.paypal-slot { width: 100%; min-height: 50px; color-scheme: light; }
.plan-btn:disabled { opacity: .45; cursor: default; }

.doc-flush { padding-inline: 0; max-width: 760px; }
.doc h3 { margin-top: 20px; font-size: 15.5px; font-weight: 800; color: var(--text); }
.soon-list li { list-style: disc; }
.soon {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  vertical-align: 1px;
}

/* ---------------------------------------------------------------- responsive */

/* Small phones: compact header (hide subtitle), tighter controls */
@media (max-width: 480px) {
  .overlay-idle, .overlay-error { gap: 6px; padding: 10px 16px; }
  .overlay-title { font-size: 13.5px; }
  .overlay-hint { font-size: 12px; }
  .overlay-error .icon-lg { width: 28px; height: 28px; }
  .overlay-error .btn { min-height: 34px; padding: 5px 14px; font-size: 13px; }
}

/* Narrow phones: language picker shrinks to its globe icon */
@media (max-width: 430px) {
  /* Phones: logo + name, then language, Premium and sign-in (refresh moves to pull-to-refresh). */
  .brand-sub { display: none; }
  .sign-in-btn { width: 40px; min-height: 40px; padding: 0; }
  .sign-in-btn span { display: none; }
  .premium-link { width: 38px; padding: 0; justify-content: center; }
  .premium-link span { display: none; }
  .lang-select { width: 40px; }
  .lang-select select { width: 40px; max-width: 40px; padding-inline: 0; color: transparent; }
  .lang-select .icon { inset-inline-start: 10px; }
  .header-actions { gap: 6px; }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .brand { gap: 8px; }
  .brand-name { font-size: 16px; }
  .header-actions { gap: 4px; }
  .lang-select select { max-width: 96px; }
  .tab { font-size: 12.5px; gap: 5px; padding-inline: 6px; }
  .tab .icon { display: none; }
}

/* Phones: player sticks under the header while a channel is on */
@media (max-width: 899px) {
  /* No empty black box on phones: the player appears once a channel is chosen. */
  .player-pane:has(.player[data-state="idle"]) { display: none; }
  .hero { padding-top: 18px; }
  .hero-text { font-size: 14.5px; }
  .hero-points { flex-direction: column; gap: 8px; }
  .hero-actions .btn { flex: 1 1 auto; }
  /* display: contents lets the player stick for the whole channel list, not just its pane. */
  body:has(.player:not([data-state="idle"])) .player-pane { display: contents; }
  body:has(.player:not([data-state="idle"])) .player {
    position: sticky;
    top: calc(var(--header-h) + var(--safe-top));
    z-index: 20;
  }
  body:has(.player:not([data-state="idle"])) .browser-top { position: static; margin-inline: 0; padding-inline: 0; background: none; }
  /* On phones and tablets the search and filters scroll with the page: pinned, they covered most of
     the screen and the channels under them. */
  .browser-top { position: static; margin-inline: 0; padding-inline: 0; background: none; }
  .volume { display: none; }
}

/* Large phones / small tablets */
@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: center; }
}

/* Tablets */
@media (min-width: 700px) and (max-width: 899px) {
  .layout { padding-top: 14px; }
  .player-pane { padding-inline: 14px; }
  .player { border-radius: var(--radius-lg); border: 1px solid var(--border); }
  .now-panel { margin-inline: 0; }
  .browser { padding-inline: 14px; }
  .browser-top { margin-inline: -14px; padding-inline: 14px; }
}

/* Desktop: player column + channel browser */
@media (min-width: 900px) {
  :root { --header-h: 60px; }
  .app-header { padding-inline: 22px; }
  .hero { padding-inline: 22px; padding-top: 30px; }
  .layout {
    grid-template-columns: minmax(380px, 46%) minmax(0, 1fr);
    gap: 22px;
    padding: 18px 22px 24px;
    align-items: start;
  }
  .player-pane {
    position: sticky;
    top: calc(var(--header-h) + 18px);
    max-height: calc(100vh - var(--header-h) - 36px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
  .player { border-radius: var(--radius-lg); border: 1px solid var(--border); }
  .now-panel { margin: 14px 0 0; }
  .browser { padding-inline: 0; }
  .browser-top { margin-inline: 0; padding: 0 0 8px; top: calc(var(--header-h)); padding-top: 0; }
  .browser-top::before { content: ''; display: block; height: 0; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (min-width: 1680px) {
  .toolbar { grid-template-columns: minmax(260px, 1fr) minmax(0, 1.4fr); align-items: center; }
}

@media (min-width: 1440px) {
  .layout { grid-template-columns: minmax(520px, 44%) minmax(0, 1fr); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
}

/* Large / TV screens: bigger focus targets for remote navigation */
@media (min-width: 1800px) {
  body { font-size: 16px; }
  .card-main:focus-visible, .card-fav:focus-visible { outline-width: 3px; }
}

/* Landscape phones: player fills the height comfortably */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 500px) {
  .player-pane .player { max-height: calc(100vh - var(--header-h)); aspect-ratio: auto; height: calc(100vh - var(--header-h)); }
}

@media (hover: none) {
  .card:hover { border-color: var(--border); background: var(--surface); }
  .card.is-playing:hover { border-color: var(--accent-line); }
}

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

/* ---------------------------------------------------------------- keyframes */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Small players (phones): compact subtitles menu so it fits above the controls. */
@media (max-width: 600px) {
  .cc-menu { bottom: calc(100% + 4px); min-width: 210px; padding: 4px; }
  .cc-menu-title { display: none; }
  .cc-item { padding: 7px 8px; font-size: 13.5px; }
  .cc-item:disabled { font-size: 11.5px; line-height: 1.3; }
  .cc-text { bottom: 52px; }
  .cc-text span { font-size: 14px; padding: 1px 8px; }
}

/* Home: explanatory text below the guide (written in Spanish, so shown with the Spanish interface). */
.home-info { padding-top: 8px; }
.home-info h2 { margin-top: 18px; }
html:not([lang="es"]) .home-info { display: none; }

/* ================================================================ Home page (landing) */
/* Visitors: hero → quick picks → guide → screens → plans → ad → questions. Signed in: straight to the guide. */
body[data-auth="in"] .landing { display: none; }

.hero { padding-block: 26px 8px; }
.hero-inner { display: grid; gap: 28px; align-items: center; }
@media (min-width: 960px) { .hero-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; } }
.hero-copy { display: grid; gap: 14px; min-width: 0; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; width: max-content; max-width: 100%;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hero-title { font-size: clamp(30px, 6.2vw, 54px); max-width: 18ch; }
.hero-title::after { display: none; }
.hero-text { font-size: clamp(15px, 1.6vw, 17px); line-height: 1.6; }
.hero-search { display: flex; align-items: center; gap: 8px; max-width: 560px; padding: 6px 6px 6px 14px;
  border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); }
.hero-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.hero-search .icon { flex: none; width: 20px; height: 20px; color: var(--muted); }
.hero-search input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15.5px; outline: none; }
.hero-search input::placeholder { color: var(--muted); }
.hero-search input::-webkit-search-cancel-button { display: none; }
.hero-search .btn { flex: none; }
.hero-actions { align-items: center; gap: 14px; margin-top: 2px; }
.hero-link { color: var(--text-soft); font-weight: 700; font-size: 14px; text-underline-offset: 3px; }
.hero-link:hover { color: var(--accent); }
.hero-trust { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.hero-trust #heroCount { color: var(--accent); font-weight: 800; }

.hero-visual { display: grid; justify-items: center; min-width: 0; }
@media (max-width: 959px) { .hero-visual { display: none; } }
.hero-screen { width: 100%; max-width: 560px; aspect-ratio: 16 / 10; padding: 14px; border-radius: 18px;
  border: 1px solid var(--border-strong); background:
    radial-gradient(120% 90% at 80% 0%, rgba(245, 181, 68, .16), transparent 55%), linear-gradient(160deg, var(--surface-2), var(--bg-deep));
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), inset 0 0 0 6px rgba(0, 0, 0, .35);
  display: grid; grid-template-rows: auto 1fr; gap: 12px; }
.hero-screen-bar { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
.hero-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; min-height: 0; }
.hero-tile { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: stretch; align-items: center; gap: 5px;
  min-width: 0; min-height: 0; padding: 7px 7px 8px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--border);
  overflow: hidden; color: inherit; text-align: center; }
.hero-tile:empty { background: linear-gradient(100deg, rgba(255, 255, 255, .03) 30%, rgba(255, 255, 255, .07) 50%, rgba(255, 255, 255, .03) 70%) 0 0 / 300% 100%; }
@media (prefers-reduced-motion: no-preference) { .hero-tile:empty { animation: tile-shimmer 1.6s linear infinite; } }
@keyframes tile-shimmer { to { background-position: -150% 0; } }
.hero-tile-live { justify-self: start; display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-soft); }
.hero-tile-live .live-dot { width: 6px; height: 6px; }
/* The miniature: the channel's picture fills it once it plays; until then (or if it never starts) its logo. */
.hero-tile-screen { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; max-height: 92px;
  border-radius: 9px; overflow: hidden; background: linear-gradient(150deg, var(--surface-3), var(--surface-2)); }
.hero-tile-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000;
  opacity: 0; transition: opacity .4s; pointer-events: none; }
.hero-tile.is-live .hero-tile-screen video { opacity: 1; }
.hero-tile-logo { position: relative; display: grid; place-items: center; width: 86%; height: 82%; transition: opacity .4s; }
.hero-tile.is-live .hero-tile-logo { opacity: 0; }
.hero-tile-logo img { width: 100%; height: 100%; max-height: 64px; object-fit: contain; }
.hero-tile-logo .card-initials { font-size: 20px; }
.hero-tile-name { max-width: 100%; font-size: 12px; font-weight: 700; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-tile.is-live .hero-tile-live .live-dot { background: var(--live); }
.hero-tile-diag { font-size: 10.5px; line-height: 1.3; color: #ffd27a; white-space: normal; }
.hero-stand { width: 34%; height: 10px; margin-top: 10px; border-radius: 0 0 12px 12px; background: linear-gradient(var(--surface-3), var(--surface)); opacity: .8; }

.hero-steps { max-width: 1680px; margin: 26px auto 0; padding: 0; list-style: none; counter-reset: step;
  display: grid; gap: 10px; }
@media (min-width: 760px) { .hero-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.hero-steps li { counter-increment: step; position: relative; display: grid; gap: 4px; padding: 14px 16px 14px 56px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.hero-steps li::before { content: counter(step); position: absolute; inset-inline-start: 16px; top: 14px;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.hero-steps strong { font-size: 15px; color: var(--text); }
.hero-steps span { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; }
[dir="rtl"] .hero-steps li { padding: 14px 56px 14px 16px; }

/* Quick picks and recently watched, above the guide */
.quick, .recent { display: grid; gap: 8px; margin: 4px 0 12px; min-width: 0; }
.quick-title { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.quick-row, .recent-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.quick-row::-webkit-scrollbar, .recent-row::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .quick-row { flex-wrap: wrap; overflow: visible; } }
.chip { flex: none; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; white-space: nowrap; touch-action: manipulation; }
.chip:hover { border-color: var(--accent-line); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:focus-visible, .recent-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.recent-item { flex: none; width: 112px; display: grid; gap: 6px; padding: 8px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; text-align: center; touch-action: manipulation; }
.recent-item:hover { border-color: var(--accent-line); }
.recent-logo { display: grid; place-items: center; height: 54px; border-radius: 8px; background: rgba(255, 255, 255, .04); overflow: hidden; }
.recent-logo img { max-width: 80%; max-height: 40px; object-fit: contain; }
.recent-logo .card-initials { font-size: 16px; }
.recent-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Landing sections below the guide */
.landing { max-width: 1680px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 44px; }
.land-block { display: grid; gap: 14px; min-width: 0; }
.land-title { font-family: var(--font-display); font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; max-width: 28ch; }
.land-lead { color: var(--text-soft); font-size: 15.5px; max-width: 62ch; }
.land-grid { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.land-devices { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .land-devices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .land-devices { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.land-devices li { display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; padding: 18px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.land-devices .icon { width: 28px; height: 28px; color: var(--accent); }
.land-devices h3 { font-size: 16px; font-weight: 800; }
.land-devices p { font-size: 14px; color: var(--text-soft); line-height: 1.55; }
.land-devices a { font-size: 13.5px; font-weight: 700; color: var(--accent); text-underline-offset: 3px; }
.land-plans { grid-template-columns: minmax(0, 1fr); max-width: 920px; }
@media (min-width: 700px) { .land-plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.land-plan { display: grid; grid-template-rows: auto auto 1fr auto; gap: 12px; padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.land-plan.is-premium { border-color: var(--accent-line); background: linear-gradient(170deg, rgba(245, 181, 68, .09), var(--surface) 45%); }
.land-plan h3 { font-size: 17px; font-weight: 800; }
.land-price span { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.land-price small { font-size: 13.5px; color: var(--muted); }
.land-plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.land-plan li { position: relative; padding-inline-start: 24px; font-size: 14.5px; color: var(--text-soft); line-height: 1.5; }
.land-plan li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .45em; width: 12px; height: 7px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.land-plan .btn { justify-self: start; }
.land-ad { margin: 0; max-width: 920px; }
.land-faq { display: grid; gap: 8px; max-width: 820px; }
.land-faq details { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.land-faq summary { cursor: pointer; padding: 14px 16px; font-weight: 800; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.land-faq summary::-webkit-details-marker { display: none; }
.land-faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; }
.land-faq details[open] summary::after { content: "–"; }
.land-faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.land-faq p { padding: 0 16px 14px; color: var(--text-soft); font-size: 14.5px; line-height: 1.6; }
.land-more { font-size: 14px; color: var(--muted); }
.land-more a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
/* Phones: the three steps fit in one compact row so the channels stay close to the top. */
@media (max-width: 759px) {
  .hero-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
  .hero-steps li { padding: 40px 10px 10px; text-align: center; justify-items: center; }
  .hero-steps li::before { inset-inline-start: 50%; transform: translateX(-50%); top: 8px; width: 24px; height: 24px; font-size: 12.5px; }
  [dir="rtl"] .hero-steps li { padding: 40px 10px 10px; }
  [dir="rtl"] .hero-steps li::before { transform: translateX(50%); }
  .hero-steps strong { font-size: 13px; line-height: 1.3; }
  .hero-steps span { display: none; }
}
/* The explanatory text lines up with the landing sections above it. */
.home-info.doc { max-width: 1680px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.home-info.doc > * { max-width: 72ch; }
.landing h2, .landing h3, .landing p, .hero-steps strong, .hero-steps span { margin: 0; }
@media (max-width: 559px) { .land-devices li { grid-template-rows: none; } }
.hero-inner { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .hero-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }
.hero-copy { grid-template-columns: minmax(0, 1fr); }
.hero-title { font-size: clamp(24px, 7.4vw, 54px); hyphens: manual; overflow-wrap: break-word; }
/* Space for the quick picks is kept while the list loads, so the guide does not jump down when they appear. */
.quick { min-height: 70px; }
@media (min-width: 900px) { .quick { min-height: 114px; } }

/* ------------------------------------------------------------------ */
/* Quality menu (2.0)                                                  */
/* ------------------------------------------------------------------ */
.quality-btn { width: auto; min-width: 40px; padding: 0 6px; }
.quality-label {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; line-height: 1;
  padding: 3px 5px; border: 1.5px solid currentColor; border-radius: 5px;
}
.quality-btn.is-max .quality-label { color: var(--accent); }
.cc-item.is-locked { color: rgba(255, 255, 255, .55); }
.cc-item.is-locked::before { opacity: .5; }
.quality-lock {
  margin-inline-start: auto; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-line); border-radius: 5px; padding: 1px 5px;
}

/* ------------------------------------------------------------------ */
/* Multi-view (2.0, Premium)                                           */
/* ------------------------------------------------------------------ */
.mv {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: var(--bg-deep); color: var(--text);
  overflow: hidden;
}
.mv[open] { display: flex; flex-direction: column; }
.mv::backdrop { background: var(--bg-deep); }
.mv-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: calc(10px + var(--safe-top)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
}
.mv-title { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-display); font-size: 17px; }
.mv-title .icon { color: var(--accent); }
.mv-badge {
  font-family: var(--font); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent); border-radius: 6px; padding: 2px 6px;
}
.mv-layouts { display: flex; gap: 4px; margin-inline-start: auto; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; }
.mv-layout {
  min-height: 34px; padding: 4px 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-soft); font: inherit; font-size: 13px; font-weight: 700;
  touch-action: manipulation;
}
.mv-layout[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.mv-layout:focus-visible, .mv-close:focus-visible, .mv-btn:focus-visible, .mv-add:focus-visible, .mv-pick:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.mv-close {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text);
  touch-action: manipulation;
}
.mv-layouts[hidden] + .mv-close { margin-inline-start: auto; }

.mv-grid {
  flex: 1; min-height: 0; display: grid; gap: 6px; padding: 6px;
  padding-bottom: calc(6px + var(--safe-bottom));
}
.mv-grid[data-layout="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr); }
.mv-grid[data-layout="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
@media (orientation: portrait) and (max-width: 899px) {
  .mv-grid[data-layout="2"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
}
.mv-tile {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  border-radius: 10px; background: #000; border: 2px solid transparent;
}
.mv-tile.has-audio { border-color: var(--accent); }
.mv-tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.mv-tile-ui { position: absolute; inset: 0; pointer-events: none; }
.mv-tile-ui > * { pointer-events: auto; }
.mv-tile[data-state="empty"] { background: var(--surface); border: 2px dashed var(--border-strong); }
.mv-add {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text-soft); font: inherit; font-weight: 700; font-size: 14px;
  touch-action: manipulation;
}
.mv-add:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.mv-add-plus {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 28px; font-weight: 400; line-height: 1;
}
.mv-top {
  position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 18px 10px;
  background: linear-gradient(rgba(0, 0, 0, .72), transparent);
}
.mv-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.mv-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 8px; background: rgba(0, 0, 0, .45); color: #fff;
  touch-action: manipulation;
}
.mv-btn:hover { background: rgba(255, 255, 255, .18); }
.mv-btn .icon { width: 18px; height: 18px; }
.mv-audio[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); }
.mv-spinner { position: absolute; top: 50%; left: 50%; margin: -20px 0 0 -20px; pointer-events: none; }
.mv-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.mv-error {
  position: absolute; inset: 44px 10px 10px; display: grid; place-content: center; justify-items: center; gap: 10px;
  text-align: center; font-size: 13.5px; color: var(--text-soft);
}
.mv-error p { margin: 0; max-width: 34ch; }

.mv-locked {
  flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 24px 16px; text-align: center;
}
.mv-locked .icon-lg { color: var(--accent); width: 44px; height: 44px; }
.mv-locked h3 { margin: 0; font-family: var(--font-display); font-size: clamp(20px, 4vw, 26px); text-wrap: balance; }
.mv-locked p { margin: 0; max-width: 46ch; color: var(--text-soft); }

.mv-picker {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 16px;
  background: rgba(4, 7, 15, .72);
}
.mv-picker[hidden] { display: none; }
.mv-picker-box {
  display: flex; flex-direction: column; gap: 10px;
  width: min(460px, 100%); max-height: min(560px, calc(100dvh - 32px));
  padding: 14px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong);
  background: var(--surface); box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.mv-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mv-picker-head h3 { margin: 0; font-size: 17px; font-family: var(--font-display); }
.mv-search {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
.mv-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mv-pick-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; display: grid; gap: 2px; }
.mv-pick {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: start;
  touch-action: manipulation;
}
.mv-pick:hover, .mv-pick:focus-visible { background: var(--surface-3); }
.mv-pick-logo {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; overflow: hidden;
  border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 800; color: var(--text-soft);
}
.mv-pick-logo img { width: 100%; height: 100%; object-fit: contain; }
.mv-pick-text { display: grid; min-width: 0; }
.mv-pick-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-pick-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-pick-fav { margin-inline-start: auto; flex: none; color: var(--accent); width: 16px; height: 16px; }
.mv-pick-empty { padding: 18px 8px; text-align: center; color: var(--muted); }
@media (max-width: 600px) {
  .mv-bar > .mv-close { order: 2; margin-inline-start: auto; }
  .mv-layouts { order: 3; margin-inline-start: 0; }
}
@media (max-width: 480px) {
  .mv-title > span:not(.mv-badge) { font-size: 15px; }
  .mv-layout { padding: 4px 9px; }
  .mv-btn { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: no-preference) { .mv[open] { animation: dialog-in .2s var(--ease); } }
