/* =========================================================
   Teleora — style.css  (v5)
   Studio-dark guide layout. Test-card colour bars are the one
   decorative element: logo and the tuning screen.
   ========================================================= */

/* Windows has no flag emoji: this font draws only the flag characters */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("../fonts/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  font-display: swap;
}

:root {
  /* Ink: backgrounds and rules */
  --bg:        #0D1016;
  --panel:     #151A22;
  --raise:     #1C222C;
  --line:      #262D38;
  --line-hi:   #343C49;
  /* Neutral: text */
  --text:      #EEF1F5;
  --dim:       #9AA3B2;
  --faint:     #6B7482;
  /* Accent: the only colour. Buttons, active states, live */
  --accent:    #F0483E;
  --accent-hi: #FF5E54;
  --accent-bg: rgba(240, 72, 62, .12);
  --on-accent: #FFFFFF;

  /* Old names kept so every rule maps onto the three colours */
  --signal: var(--accent); --signal-hi: var(--accent-hi); --on-signal: var(--on-accent);
  --live: var(--accent); --ok: var(--accent); --warn: var(--dim);

  --font:      "Twemoji Country Flags", "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-cond: "Twemoji Country Flags", "Barlow Semi Condensed", "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-lg: 12px;
  --r:    8px;
  --r-sm: 6px;
  --top-h: 68px;
  --wrap: 1760px;
  --gutter: clamp(16px, 3.2vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-cond); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -0.005em; }
p { margin: 0; }
code, kbd {
  font: 500 0.85em/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--raise); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px;
}
.flag { font-size: 1.05em; margin-right: 6px; line-height: 1; }
.i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

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

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding-inline: var(--gutter); }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--signal); color: var(--on-signal); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--raise); color: var(--text);
  font-weight: 600; font-size: 0.95rem; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #232A35; border-color: var(--line-hi); }
.btn-signal { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn-signal:hover { background: var(--signal-hi); border-color: var(--signal-hi); }
.btn-icon { width: 40px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Header: logo | centred menu | search ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 16, 22, 0.9);
  backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  height: var(--top-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
}

.logo { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
/* Logo: red "t" monogram + lowercase wordmark */
.logo-mark { display: block; width: 36px; height: 36px; flex: none; }
.logo-mark svg { display: block; width: 100%; height: 100%; }
.logo-word { font: 700 1.55rem/1 var(--font); letter-spacing: -0.035em; color: var(--text); padding-bottom: 2px; }
.logo.small .logo-mark { width: 30px; height: 30px; }
.logo.small .logo-word { font-size: 1.3rem; }

.nav {
  display: flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
}
.nav a {
  padding: 7px 16px; border-radius: 999px;
  color: var(--dim); font-weight: 500; font-size: .96rem; white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current] { background: var(--raise); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi), inset 0 -2px 0 var(--accent); }

.top-end { justify-self: end; display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-end; }

.search { position: relative; display: flex; align-items: center; width: 100%; max-width: 300px; }
.search .i { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  outline: none;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(240, 72, 62, .18); }

.menu-btn {
  display: none;
  width: 42px; height: 42px; border-radius: var(--r);
  background: transparent; border: 1px solid var(--line); cursor: pointer;
  align-items: center; justify-content: center; flex: none;
}
.drawer { border-top: 1px solid var(--line); padding: 14px 0 18px; background: var(--bg); }
.drawer .search { max-width: none; margin: 0 0 10px; }
.drawer-nav { display: grid; }
.drawer-nav a { padding: 12px 4px; border-bottom: 1px solid var(--line); font-weight: 500; }
.drawer-nav a[aria-current] { color: var(--signal); }

@media (max-width: 1180px) {
  .top-in { gap: 16px; }
  .nav a { padding: 7px 12px; }
  .search { max-width: 210px; }
}
@media (max-width: 960px) {
  .top-in { grid-template-columns: 1fr auto; }
  .nav, .top-end .search { display: none; }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 960px) {
  .top-in { grid-template-columns: 1fr auto; }
}

/* ---------- Footer ---------- */
.foot { margin-top: 72px; border-top: 1px solid var(--line); background: #0A0D12; color: var(--dim); font-size: .94rem; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 32px; padding-block: 48px 36px; }
.foot-about p { margin-top: 14px; max-width: 46ch; line-height: 1.6; }
.foot-about p a { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.foot-col { display: grid; gap: 10px; align-content: start; }
.foot-col h2 { font: 600 1rem/1.2 var(--font-cond); color: var(--text); margin-bottom: 4px; }
.foot-col a:hover { color: var(--text); }
.foot-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 18px 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: .86rem; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

/* ---------- Hero band (every page) ----------
   A raised band under the header. Its bottom edge is the test-card strip,
   the one decorative element the site repeats. */
.hero {
  position: relative;
  background: #11151C;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: min(240px, 30%); height: 2px;
  background: var(--accent);
  left: max(var(--gutter), calc((100% - var(--wrap)) / 2));
}
.hero h1 { font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.06; letter-spacing: -0.015em; }
.hero h1 .flag { font-size: .8em; margin-right: .35em; vertical-align: .06em; }
.hero-sub { margin-top: 10px; color: var(--dim); font-size: 1.08rem; max-width: 70ch; }

.hero-page { padding: 22px 0 26px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 14px; }

.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; color: var(--faint); }
.crumbs li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: ""; width: 5px; height: 5px; border-top: 1.5px solid var(--faint); border-right: 1.5px solid var(--faint); transform: rotate(45deg); margin-right: 4px; }
.crumbs a { color: var(--dim); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch; }

/* Toolbar: filters that sit on the hero's lower edge */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.toolbar-note { color: var(--faint); font-size: .9rem; }

/* ---------- Home hero ---------- */
.hero-home { padding: clamp(36px, 5vw, 72px) 0 clamp(36px, 4.5vw, 64px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(28px, 4vw, 72px); align-items: center; }
.hero-home h1 { font-size: clamp(2.3rem, 4.4vw, 4rem); max-width: 16ch; }
.hero-home .hero-sub { font-size: 1.15rem; max-width: 52ch; margin-top: 16px; }
.hero-live { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--dim); font-weight: 500; }
.hero-live i { width: 9px; height: 9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(240, 72, 62, .18); }

.search-hero { max-width: 640px; margin-top: 28px; }
.search-hero .i { left: 18px; }
.search-hero input { height: 60px; padding-left: 52px; padding-right: 124px; font-size: 1.06rem; border-radius: var(--r-lg); background: var(--bg); }
.search-hero .btn { position: absolute; right: 9px; height: 42px; }

.hero-cats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px; }
.hero-cats a { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); font-weight: 500; padding: 2px 0; border-bottom: 1px solid transparent; }
.hero-cats a .ic { color: var(--accent); }
.hero-cats a:hover { color: var(--text); border-bottom-color: var(--accent); }
.hero-cats a.more { color: var(--text); }

.wall { border: 1px solid var(--line); border-radius: 16px; background: var(--bg); padding: 16px; }
.wall-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 14px; }
.wall-title { font: 600 1.05rem/1 var(--font-cond); display: inline-flex; align-items: center; gap: 8px; }
.wall-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.wall-head a { color: var(--dim); font-weight: 600; font-size: .9rem; }
.wall-head a:hover { color: var(--text); }
.wall-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.wall-tile { display: grid; gap: 8px; padding: 10px; border-radius: var(--r); background: var(--panel); border: 1px solid transparent; transition: border-color .15s, background .15s; min-width: 0; }
.wall-tile:hover { border-color: var(--line-hi); background: var(--raise); }
.wall-logo { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r-sm); background: #0A0D12; display: grid; place-items: center; overflow: hidden; }
.wall-logo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 12%; }
.wall-logo b { position: absolute; font: 700 1.6rem/1 var(--font-cond); color: var(--faint); }
.wall-name { font: 600 .92rem/1.2 var(--font-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }

@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .wall-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .wall-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wall-tile:nth-child(n+7) { display: none; }
  .country-flag { font-size: 1.5rem; }
  .search-hero input { padding-right: 14px; height: 54px; }
  .search-hero .btn { display: none; }
}

/* ---------- Sections ---------- */
.section { padding-top: 40px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.head h2 { font-size: clamp(1.35rem, 1.8vw, 1.65rem); display: flex; align-items: baseline; }
.head h2 .flag { align-self: center; }
.head h2 small { font: 500 .95rem/1 var(--font); color: var(--faint); margin-left: 10px; }
.head-link { color: var(--text); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.head-link:hover { color: var(--accent); }

/* Country strip on the homepage */
.country-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1400px) { .country-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .country-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.country-card {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.country-card:hover { background: var(--raise); border-color: var(--line-hi); }
.country-flag { font-size: 1.9rem; line-height: 1; flex: none; }
.country-text { display: grid; min-width: 0; }
.country-text b { font: 600 1.02rem/1.2 var(--font-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-text small { color: var(--dim); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Channel list: guide grid with hairline rules ---------- */
.list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.ch {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-width: 0; padding: 12px 16px;
  background: var(--panel);
  transition: background .12s;
}
.ch:hover { background: var(--raise); }
.ch:focus-visible { outline: none; background: var(--raise); box-shadow: inset 3px 0 0 var(--signal); }
.ch.is-current { background: var(--raise); box-shadow: inset 3px 0 0 var(--signal); }
.ch.is-current .ch-name { color: var(--text); }
.ch-logo {
  position: relative; flex: none;
  width: 52px; height: 52px; border-radius: var(--r-sm);
  background: #0A0D12;
  display: grid; place-items: center; overflow: hidden;
}
.ch-logo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.ch-logo b { position: absolute; font: 700 1.25rem/1 var(--font-cond); color: var(--faint); }
.ch-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.ch-name { font: 600 1.06rem/1.25 var(--font-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-meta { display: flex; align-items: center; min-width: 0; color: var(--dim); font-size: .85rem; white-space: nowrap; overflow: hidden; }
.ch-meta > span:not(.flag) { overflow: hidden; text-overflow: ellipsis; }
.ch-cat { color: var(--faint); flex: none; }
.ch-cat::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 7px; vertical-align: middle; }
.ch-ok { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(240, 72, 62, .16); }

/* ---------- Browse ---------- */
.browse { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; padding-top: 28px; align-items: start; }
.cats {
  position: sticky; top: calc(var(--top-h) + 20px);
  max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
  padding: 10px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.side-title { font: 600 .95rem/1 var(--font-cond); color: var(--dim); padding: 8px 10px 10px; }
.cats-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.cats-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--dim); }
.cats-list a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cats-list .ic { color: var(--faint); }
.cats-list a:hover .ic { color: var(--text); }
.cats-list a[aria-current] .ic { color: var(--accent); }
.cats-list a small { color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.cats-list a:hover { background: var(--raise); color: var(--text); }
.cats-list a[aria-current] { background: var(--raise); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }

.field { position: relative; display: flex; align-items: center; }
.field .i { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.field input, .field select {
  height: 44px; min-width: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 0 12px; outline: none;
}
.field input { padding-left: 36px; width: 300px; }
.field select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 36px; width: 240px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239AA6B8' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.field select option { background: var(--panel); }
.field input:focus, .field select:focus { border-color: var(--signal); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--dim); font-size: .95rem; padding: 0 6px; height: 44px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); transition: background .15s; flex: none; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.toggle input:checked + .toggle-ui { background: var(--accent-bg); border-color: var(--ok); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); background: var(--ok); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--signal); outline-offset: 2px; }
.toggle:hover { color: var(--text); }
.active-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px 0 14px;
  border-radius: var(--r); border: 1px solid var(--signal); background: var(--accent-bg);
  color: var(--signal); font-weight: 600; font-size: .92rem;
}
.active-chip:hover { background: rgba(240, 72, 62, .2); }
.clear { color: var(--signal); font-weight: 600; font-size: .94rem; margin-left: auto; }
.feed-end { display: flex; justify-content: center; padding: 28px 0 0; }

@media (max-width: 1000px) {
  .browse { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .cats { position: static; max-height: none; overflow: visible; border: 0; background: none; padding: 0; }
  .cats-list { grid-template-columns: none; }
  .side-title { display: none; }
  .cats-list { display: flex; gap: 8px; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; scrollbar-width: none; }
  .cats-list::-webkit-scrollbar { display: none; }
  .cats-list a { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: var(--panel); }
  .cats-list a[aria-current] { box-shadow: none; border-color: var(--signal); }
  .toolbar .field-q { flex: 1 1 100%; }
  .toolbar .field-q input { width: 100%; }
  .toolbar .field:not(.field-q) { flex: 1 1 40%; }
  .toolbar .field select { width: 100%; }
  .clear { margin-left: 0; }
}
@media (max-width: 560px) { .list { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Empty states ---------- */
.empty { border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 56px 24px; text-align: center; }
.empty h2 { font-size: 1.5rem; }
.empty p { color: var(--dim); margin: 8px 0 18px; }
.empty-inline { color: var(--dim); padding: 24px 0; }

/* ---------- Watch ---------- */
.watch-top { padding-top: 18px; }
.watch { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 420px); gap: 28px; padding-top: 14px; align-items: start; }

.player {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #000; border-radius: var(--r-lg); overflow: hidden;
}
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player:fullscreen { border-radius: 0; }

.p-state {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px; text-align: center;
  background: #07090C;
}
.p-state p { color: var(--dim); max-width: 46ch; }

/* The tuning screen: a live dot with a ring that grows out of it */
.p-bars { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.p-bars i { display: none; }
.p-bars::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); }
.p-bars::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); animation: tune 1.6s ease-out infinite; }
@keyframes tune { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

.p-error h2 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); max-width: 28ch; }
.p-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.p-unmute {
  position: absolute; z-index: 3; top: 14px; left: 14px;
  height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--signal); color: var(--on-signal); font-weight: 600; cursor: pointer;
}

.p-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  padding: 36px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  opacity: 0; transition: opacity .2s;
}
.player:not(.is-playing) .p-bar, .player.is-awake .p-bar, .player:hover .p-bar { opacity: 1; }
.player:not(.is-playing) .p-bar { pointer-events: none; opacity: 0; }
.p-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm); border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: #fff;
}
.p-btn:hover { background: rgba(255, 255, 255, .12); }
.p-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.p-vol { width: 90px; accent-color: var(--signal); }
.p-live { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font: 600 .82rem/1 var(--font); color: #fff; }
.p-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.p-space { flex: 1; }
.p-quality { height: 32px; background: rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--r-sm); padding: 0 8px; color: #fff; }
@media (max-width: 560px) { .p-vol { display: none; } }

.info { display: flex; align-items: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.info-logo { position: relative; flex: none; width: 64px; height: 64px; border-radius: var(--r); background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.info-logo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 7px; }
.info-logo b { position: absolute; font: 700 1.6rem/1 var(--font-cond); color: var(--faint); }
.info-text { flex: 1; min-width: 220px; }
.info-text h1 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
.info-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--line); font-size: .87rem; color: var(--dim); }
a.tag:hover { color: var(--text); border-color: var(--line-hi); }
.tag-warn { color: var(--text); border-color: var(--line-hi); }
.info-epg { color: var(--dim); margin-top: 8px; }
.info-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.hint-box { margin-top: 16px; padding: 12px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--dim); font-size: .94rem; }

.about { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); max-width: 74ch; }
.about h2 { font-size: 1.2rem; margin-bottom: 8px; }
.about p { color: var(--dim); line-height: 1.65; }

.zap { position: sticky; top: calc(var(--top-h) + 22px); }
.zap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.zap-head h2 { font-size: 1.1rem; }
.zap-head h2 small { font: 500 .85rem/1 var(--font); color: var(--faint); margin-left: 6px; }
.zap-head a { color: var(--dim); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.zap-head a:hover { color: var(--text); }
.zap-list {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto;
  max-height: calc(100vh - var(--top-h) - 90px);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.zap-list .ch { padding: 8px 12px; }
.zap-list .ch-logo { width: 42px; height: 42px; }

@media (max-width: 1100px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .zap { position: static; }
  .zap-list { max-height: none; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
}
@media (max-width: 640px) {
  .watch { padding-top: 10px; }
  .watch .player { margin-inline: calc(var(--gutter) * -1); width: calc(100% + var(--gutter) * 2); border-radius: 0; }
  .info-actions { width: 100%; }
  .info-actions .btn { flex: 1; }
  .kbd-help { display: none; }
}

/* ---------- Countries / categories / languages ---------- */
.tax { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tax-item {
  position: relative; display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 14px 16px 20px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.tax-item:hover { background: var(--raise); border-color: var(--line-hi); }
.tax-flag { font-size: 1.9rem; line-height: 1; flex: none; }
.tax-icon { flex: none; width: 44px; height: 44px; border-radius: var(--r); background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; }
.tax-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tax-native { color: var(--faint); margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line-hi); }
.tax-text { display: grid; gap: 2px; min-width: 0; }
.tax-name { font: 600 1.06rem/1.2 var(--font-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tax-count { color: var(--dim); font-size: .86rem; }
.tax-bar { position: absolute; left: 16px; right: 16px; bottom: 9px; height: 3px; border-radius: 2px; background: var(--raise); }
.tax-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 2px; background: var(--accent); }

/* ---------- Prose ---------- */
.prose { max-width: 72ch; }
.prose h2 { font-size: 1.4rem; margin: 30px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--dim); line-height: 1.7; }
.prose p + p { margin-top: 12px; }
.prose ul { padding-left: 20px; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.page-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.page-head p { color: var(--dim); margin-top: 6px; }
.page { padding-top: 32px; }

/* ---------- Admin + setup (legacy markup) ---------- */
.adminbody .topbar { border-bottom: 1px solid var(--line); }
.topbar-inner { height: var(--top-h); display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-dot { display: none; }
.brand-text { font: 700 1.3rem/1 var(--font); letter-spacing: -0.03em; }
.brand-text em { font-style: normal; }
.mainnav a { color: var(--dim); }
.topbar-actions { margin-left: auto; }
.iconbtn { height: 38px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.adminmain { padding: 32px 20px 60px; }
.adminmain h1 { font-size: 2rem; margin-bottom: 20px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat { background: var(--panel); padding: 14px 16px; display: grid; gap: 2px; }
.stat b { font: 700 1.5rem/1.1 var(--font-cond); }
.stat span { color: var(--dim); font-size: .86rem; }
.adminsec { margin-top: 28px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.adminsec h2 { font-size: 1.3rem; margin-bottom: 6px; }
.hint { color: var(--dim); font-size: .92rem; margin: 8px 0; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn-primary:hover { background: var(--signal-hi); }
.btn-ghost { background: transparent; }
.taskbox { margin-top: 12px; }
.taskbar { height: 6px; background: var(--raise); border-radius: 3px; overflow: hidden; }
.taskbar span { display: block; height: 100%; width: 0; background: var(--signal); transition: width .3s; }
.taskmsg { margin-top: 8px; color: var(--dim); }
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.loginbox { width: 100%; max-width: 340px; display: grid; gap: 12px; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.loginbox h1 { font-size: 1.6rem; }
.loginbox input { height: 44px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); }
.loginerr { color: var(--live); }
.narrow { max-width: 760px; }
.subhead { font-size: 1.3rem; margin: 28px 0 6px; }
.tiles { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-top: 16px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); }
.tile > span:last-child { display: grid; }
.tile > span:last-child span { color: var(--dim); font-size: .88rem; }
.tile-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--raise); }
.tile-icon.good { color: var(--ok); }
.tile-icon.bad { color: var(--live); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .p-bars::after { opacity: .5; }
}

/* ---------- VLC dialog ---------- */
.vlc-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 28px 24px 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel); color: var(--text);
  text-align: center;
}
.vlc-dialog::backdrop { background: rgba(5, 7, 10, .72); }
.vlc-close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.vlc-x { width: 38px; height: 38px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; }
.vlc-x:hover { background: var(--raise); color: var(--text); }
.vlc-step h2 { font-size: 1.5rem; margin-top: 14px; }
.vlc-step p { color: var(--dim); margin-top: 8px; }
.vlc-step p b { color: var(--text); }

/* VLC's traffic cone, drawn in CSS */
.vlc-cone {
  position: relative; width: 48px; height: 48px; margin: 0 auto;
  border-radius: 13px; background: var(--accent);
}
.vlc-cone::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 18px;
  transform: translate(-38%, -50%); background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.vlc-step[data-step="opening"] .vlc-cone { animation: vlc-bob 1s ease-in-out infinite; }
@keyframes vlc-bob { 50% { transform: translateY(-5px); } }

.vlc-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.vlc-tip {
  margin-top: 20px; padding: 16px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg);
}
.vlc-tip h3 { font: 600 1.05rem/1.2 var(--font-cond); }
.vlc-tip ol { margin: 10px 0 8px; padding-left: 20px; color: var(--dim); font-size: .94rem; display: grid; gap: 4px; }
.vlc-tip ol b, .vlc-tip p b { color: var(--text); }
.vlc-step .vlc-tip p { margin-top: 0; font-size: .94rem; }
.vlc-skip { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--dim); font-size: .9rem; cursor: pointer; }
.vlc-skip input { width: 16px; height: 16px; accent-color: var(--signal); }
.vlc-step .vlc-foot { margin-top: 16px; font-size: .9rem; }
.vlc-foot a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: var(--signal); color: var(--on-signal); font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
@media (prefers-reduced-motion: reduce) { .vlc-step[data-step="opening"] .vlc-cone { animation: none; } }

/* Windows one-time setup: compact, fits without scrolling */
.vlc-dialog:has(.vlc-win:not([hidden])) { width: min(620px, calc(100vw - 32px)); padding: 22px 22px 18px; text-align: left; }
.vlc-head { display: flex; gap: 16px; align-items: center; padding-right: 36px; }
.vlc-head .vlc-cone { flex: none; width: 42px; height: 42px; margin: 0; border-radius: 11px; }
.vlc-win .vlc-head h2 { margin: 0; font-size: 1.35rem; }
.vlc-win .vlc-head p { margin-top: 4px; font-size: .93rem; }

.vlc-setup { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.vlc-setup li {
  counter-increment: s;
  display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg);
}
.vlc-setup li::before {
  content: counter(s);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--raise); color: var(--text); font-weight: 600; font-size: .82rem;
  display: grid; place-items: center;
}
.vlc-setup li > div { display: grid; gap: 1px; min-width: 0; }
.vlc-setup li > div b { font: 600 1rem/1.25 var(--font-cond); }
.vlc-setup li > div span { color: var(--dim); font-size: .87rem; line-height: 1.4; }
.vlc-setup li > div span b { font: inherit; font-weight: 600; color: var(--text); }
.vlc-setup .btn { height: 36px; padding: 0 12px; font-size: .9rem; }
.vlc-win .vlc-foot { margin-top: 12px; font-size: .85rem; }
.vlc-cmd {
  display: block; margin-top: 8px; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font: 500 .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: normal; word-break: break-all;
  user-select: all;
}
@media (max-width: 560px) {
  .vlc-setup li { grid-template-columns: 26px 1fr; }
  .vlc-setup .btn { grid-column: 2; justify-self: start; }
}

.toast { display: flex; align-items: center; gap: 12px; }
.toast button {
  border: 0; background: rgba(0, 0, 0, .14); color: inherit; font-weight: 600;
  height: 28px; padding: 0 10px; border-radius: 999px; cursor: pointer;
}
.toast button:hover { background: rgba(0, 0, 0, .24); }


/* =========================================================
   Mobile and touch
   ========================================================= */

/* Notches and rounded corners */
@supports (padding: max(0px)) {
  .wrap { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
  .foot-meta { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
html { -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; }

/* Finger-sized targets on touch screens */
@media (pointer: coarse) {
  .crumbs a, .crumbs [aria-current] { display: inline-flex; align-items: center; min-height: 40px; }
  .foot-col a { display: inline-flex; align-items: center; min-height: 40px; }
  .foot-col { gap: 0; }
  .hero-cats a { min-height: 40px; }
  .tag { height: 36px; padding: 0 12px; }
  .clear, .head-link, .zap-head a, .wall-head a { display: inline-flex; align-items: center; min-height: 40px; }
  .btn { height: 44px; }
  .cats-list a { min-height: 42px; }
  .toggle { min-height: 44px; }
  .p-btn { width: 44px; height: 44px; }
}

/* Tablets */
@media (max-width: 1100px) {
  .country-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-home h1 { max-width: 20ch; }
  .zap-list.is-short .ch.zap-hide { display: none; }
  .zap-more { width: 100%; margin-top: 10px; }
}

/* Phones */
@media (max-width: 720px) {
  :root { --top-h: 60px; }
  .logo-mark { width: 32px; height: 32px; }
  .logo-word { font-size: 1.4rem; }
  .menu-btn { width: 44px; height: 44px; }
  .drawer-nav a { padding: 14px 4px; font-size: 1.05rem; }

  .hero-page { padding: 14px 0 20px; }
  .hero-row { margin-top: 8px; }
  .hero h1 { font-size: clamp(1.7rem, 7.4vw, 2.2rem); }
  .hero-sub { font-size: 1rem; margin-top: 6px; }
  .hero-home { padding: 24px 0 28px; }
  .hero-home h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .hero-home .hero-sub { font-size: 1.02rem; margin-top: 12px; }
  .hero-live { margin-bottom: 12px; font-size: .92rem; }
  .search-hero { margin-top: 20px; }
  .hero-cats { gap: 2px 16px; margin-top: 14px; }
  .toolbar { margin-top: 16px; gap: 8px; }
  .toolbar-note { font-size: .85rem; }

  .section { padding-top: 28px; }
  .head { margin-bottom: 10px; }
  .head h2 { font-size: 1.3rem; }

  /* Country cards: two per row, names may wrap */
  .country-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .country-card { padding: 10px 12px; gap: 10px; align-items: flex-start; }
  .country-text b { white-space: normal; line-height: 1.15; }

  /* Channel rows */
  .ch { padding: 10px 12px; }
  .ch-logo { width: 46px; height: 46px; }

  /* Countries / categories / languages: two compact columns */
  .tax { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tax-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 12px 18px; }
  .tax-flag { font-size: 1.6rem; }
  .tax-icon { width: 38px; height: 38px; }
  .tax-icon svg { width: 21px; height: 21px; }
  .tax-text { width: 100%; }
  .tax-name { white-space: normal; line-height: 1.15; }
  .tax-count { display: flex; flex-wrap: wrap; gap: 0 6px; font-size: .82rem; }
  .tax-native { margin-left: 0; padding-left: 0; border-left: 0; display: block; width: 100%; }
  .tax-bar { left: 12px; right: 12px; bottom: 8px; }
  .tax-filter, .toolbar .field-q { width: 100%; max-width: none; }
  .toolbar .field-q input { width: 100%; }

  /* Watch: the player stays in view while you scroll the channel list */
  .watch-top { padding-top: 6px; }
  .watch-main { display: contents; }
  .watch .player { position: sticky; top: var(--top-h); z-index: 20; align-self: start; box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
  .info { margin-top: 14px; gap: 12px; }
  .info-logo { width: 52px; height: 52px; }
  .info-text { min-width: 0; }
  .info-text h1 { font-size: 1.5rem; }
  .info-actions { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; }
  .info-actions .btn { padding: 0 10px; }
  .about { margin-top: 18px; padding-top: 16px; }
  .about p { font-size: .95rem; }
  .zap { margin-top: 8px; }
  .p-state { gap: 12px; padding: 16px; }
  .p-error h2 { font-size: 1.05rem; }
  .p-error p { font-size: .88rem; }
  .p-actions { gap: 6px; }
  .p-actions .btn { height: 38px; padding: 0 12px; font-size: .88rem; }

  /* Footer: link groups side by side */
  .foot { margin-top: 48px; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; padding-block: 32px 20px; }
  .foot-about { grid-column: 1 / -1; }
  .foot-meta { flex-direction: column; gap: 4px; }

  /* Pop-ups */
  .toast { left: 12px; right: 12px; transform: none; bottom: max(12px, env(safe-area-inset-bottom)); border-radius: var(--r-lg); flex-wrap: wrap; justify-content: space-between; padding: 10px 14px; }
  .vlc-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 20px 16px 16px; }
  .vlc-head { padding-right: 32px; }
  .empty { padding: 36px 16px; }
}

/* Small phones */
@media (max-width: 380px) {
  .hero-cats a:nth-child(n+5):not(.more) { display: none; }
  .info-actions { grid-template-columns: auto 1fr 1fr; }
  .info-actions .btn:last-child { grid-column: 1 / -1; }
  .p-actions .btn:nth-child(3) { display: none; }
  .tax { grid-template-columns: minmax(0, 1fr); }
  .tax-item { flex-direction: row; align-items: center; }
}

/* Phones held sideways: player fills the height */
@media (max-height: 500px) and (orientation: landscape) {
  .watch .player { position: static; max-height: calc(100vh - var(--top-h) - 16px); }
  .player video { object-fit: contain; }
}
@media (min-width: 1101px) { .zap-more { display: none; } }
