:root {
  --bg: #0a0c12;
  --bg2: #0e1119;
  --panel: #131722;
  --panel2: #1a1f2d;
  --panel3: #222839;
  --line: #242b3b;
  --line2: #2f374a;
  --text: #eef0f5;
  --muted: #8d95a6;
  --dim: #5f6779;
  --accent: #ff4d6d;
  --accent2: #7c5cff;
  --live: #ff3b4e;
  --star: #ffc94d;
  --ok: #43d17a;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 140ms;
  --t-med: 240ms;
  --topbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .10), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(255, 77, 109, .07), transparent 60%),
              var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px;
  background: rgba(10, 12, 18, .78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand-mark { width: 32px; height: 32px; display: block; flex: none; filter: drop-shadow(0 6px 14px rgba(227, 23, 47, .45)); }
.brand-name { font-size: 17px; letter-spacing: -.02em; font-weight: 500; }
.brand-name b { font-weight: 800; }

.search {
  flex: 1; max-width: 620px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.search:focus-within { border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 4px rgba(124, 92, 255, .15); background: var(--panel2); }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.kbd-hint { font: 600 11px/1 Inter, sans-serif; color: var(--muted); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 7px; }
.search:focus-within .kbd-hint { display: none; }
.search-clear { background: none; border: 0; padding: 4px; color: var(--muted); display: grid; border-radius: 6px; }
.search-clear:hover { color: var(--text); background: var(--panel3); }
.search-clear svg { width: 16px; height: 16px; }
.topbar-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; flex: none; }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255, 59, 78, .6); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 78, .55); } 70% { box-shadow: 0 0 0 7px rgba(255, 59, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 78, 0); } }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  padding: 24px;
  max-width: 1800px; margin: 0 auto;
  align-items: start;
}
.stage-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Player ---------- */
/* The stage holds one player pane, or two in split screen. */
.stage {
  position: relative;
  display: grid; grid-template: 1fr / 1fr; gap: 3px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .06);
  isolation: isolate;
}
.stage[data-mode="split"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; aspect-ratio: 32 / 9; }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.stage:-webkit-full-screen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.stage.is-idle { display: block; aspect-ratio: auto; }
.stage.is-idle .player { display: none; }
.stage:not(.is-idle) .idle { display: none; }
.player { position: relative; min-width: 0; min-height: 0; background: #000; overflow: hidden; outline: none; isolation: isolate; container-type: inline-size; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

/* idle home */
.idle {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(124, 92, 255, .35), transparent 60%),
    radial-gradient(600px 320px at 90% 100%, rgba(255, 77, 109, .28), transparent 60%),
    linear-gradient(180deg, #121624, #0b0d14);
  transition: opacity var(--t-med) var(--ease);
}
.idle-inner { width: 100%; max-width: 760px; text-align: center; }
.idle-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #ffd0d7; background: rgba(255, 59, 78, .14); border: 1px solid rgba(255, 59, 78, .3); padding: 6px 12px; border-radius: 99px; }
.idle h1 { font-size: clamp(20px, 3vw, 34px); letter-spacing: -.03em; line-height: 1.15; margin: 14px 0 8px; font-weight: 800; }
.idle p { color: var(--muted); margin: 0 0 22px; font-size: clamp(13px, 1.4vw, 15px); }
.idle-rows { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.idle-row-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.idle-cards { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.idle-cards::-webkit-scrollbar { display: none; }

/* spinner */
.spinner {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: rgba(255, 255, 255, .85); font-weight: 500; font-size: 13px;
  background: radial-gradient(circle at center, rgba(0, 0, 0, .35), transparent 70%);
  opacity: 0; pointer-events: none; transition: opacity var(--t-med);
}
.player[data-state="loading"] .spinner, .player.buffering .spinner { opacity: 1; }
.ring { width: 48px; height: 48px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* error */
.err { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 20px; background: rgba(6, 8, 12, .82); backdrop-filter: blur(6px); }
.err-card { text-align: center; max-width: 380px; }
.err-card svg { width: 40px; height: 40px; color: var(--star); }
.err-card h3 { margin: 10px 0 6px; font-size: 18px; }
.err-card p { margin: 0 0 18px; color: var(--muted); }
.err-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.unmute {
  position: absolute; z-index: 7; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: #fff; color: #111; border: 0; border-radius: 99px; padding: 10px 16px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: drop var(--t-med) var(--ease);
}
.unmute svg { width: 18px; height: 18px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

.osd {
  position: absolute; z-index: 8; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.96);
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(8px); color: #fff;
  padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity var(--t-med), transform var(--t-med) var(--ease);
}
.osd.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* overlays */
.ctrl-top, .controls { position: absolute; left: 0; right: 0; z-index: 5; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
.ctrl-top { top: 0; padding: 16px 18px 40px; background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent); pointer-events: none; }
.controls { bottom: 0; padding: 50px 12px 12px; background: linear-gradient(0deg, rgba(0, 0, 0, .8), rgba(0, 0, 0, .35) 60%, transparent); }
.player[data-state="idle"] .ctrl-top, .player[data-state="idle"] .controls { opacity: 0; pointer-events: none; }
.player.hide-ui .ctrl-top { opacity: 0; transform: translateY(-8px); }
.player.hide-ui .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player.hide-ui { cursor: none; }

.now { display: flex; align-items: center; gap: 12px; }
.now-tile, .info-tile, .tile { display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: -.02em; flex: none; position: relative; overflow: hidden; }
.now-tile { width: 38px; height: 38px; border-radius: 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.now-name { font-weight: 700; font-size: 16px; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.now-meta { font-size: 12px; color: rgba(255, 255, 255, .75); }

.ctrl-row { display: flex; align-items: center; gap: 4px; }
.grow { flex: 1; }
.cbtn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: #fff;
  display: grid; place-items: center;
  transition: background var(--t-fast), transform var(--t-fast);
}
.cbtn:hover { background: rgba(255, 255, 255, .14); }
.cbtn:active { transform: scale(.92); }
.cbtn.big svg { width: 24px; height: 24px; }
.cbtn .fill { fill: currentColor; stroke: none; }
.cbtn.txt { width: auto; padding: 0 10px; font-size: 13px; font-weight: 600; }
.b-play .i-play, .b-play .i-pause { fill: currentColor; stroke: none; }
.player.paused .b-play .i-pause, .player:not(.paused) .b-play .i-play { display: none; }
.player.muted .b-mute .i-vol, .player:not(.muted) .b-mute .i-muted { display: none; }
.b-fs .i-exitfs { display: none; }
.stage.fs .b-fs .i-fs { display: none; }
.stage.fs .b-fs .i-exitfs { display: block; }
.b-fav.on svg, #infoFav.on svg { fill: var(--star); stroke: var(--star); }

.vol { display: flex; align-items: center; }
.vol-slider {
  -webkit-appearance: none; appearance: none; width: 0; opacity: 0; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, #fff var(--v, 100%), rgba(255, 255, 255, .25) var(--v, 100%));
  transition: width var(--t-med) var(--ease), opacity var(--t-med), margin var(--t-med);
  cursor: pointer; visibility: hidden;
}
.vol:hover .vol-slider, .vol:focus-within .vol-slider { visibility: visible; width: 86px; opacity: 1; margin: 0 10px 0 4px; }
.vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
.vol-slider::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px; margin-left: 6px;
  height: 28px; padding: 0 11px; border-radius: 99px; border: 0;
  font-size: 12px; font-weight: 800; letter-spacing: .06em;
  background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .7);
  transition: background var(--t-fast), color var(--t-fast);
}
.live-pill .live-dot { background: rgba(255, 255, 255, .5); animation: none; }
.live-pill.at-edge { background: var(--live); color: #fff; cursor: default; }
.live-pill.at-edge .live-dot { background: #fff; animation: pulse 1.8s infinite; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 150px;
  background: rgba(20, 24, 34, .96); backdrop-filter: blur(12px);
  border: 1px solid var(--line2); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  animation: pop var(--t-fast) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.menu button { display: flex; justify-content: space-between; gap: 16px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.menu button:hover { background: rgba(255, 255, 255, .08); }
.menu button.sel { color: var(--accent); font-weight: 700; }
.menu .menu-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 6px 10px 4px; }

/* ---------- Info bar ---------- */
.info {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  animation: fadeUp var(--t-med) var(--ease);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
.info-tile { width: 56px; height: 56px; border-radius: 14px; font-size: 16px; }
.info-main { flex: 1; min-width: 0; }
.info-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info-title h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: var(--panel3); color: #cdd2dd; border: 1px solid var(--line2); }
.tag.live { background: rgba(255, 59, 78, .15); color: #ff9aa5; border-color: rgba(255, 59, 78, .35); }
.tag.live .live-dot { width: 6px; height: 6px; }
.tag.via { color: var(--muted); font-weight: 500; }
.info-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--panel3); border-color: #3b4560; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #e8456a 50%, var(--accent2)); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -10px rgba(255, 77, 109, .8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 18px; height: 18px; }

/* ---------- Up next ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.sec-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }

.card {
  display: flex; flex-direction: column; gap: 10px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-width: 0;
  transition: transform var(--t-med) var(--ease), border-color var(--t-fast), background var(--t-fast);
}
.card:hover { transform: translateY(-3px); border-color: var(--line2); background: var(--panel2); }
.card .tile { width: 100%; aspect-ratio: 16/9; border-radius: 10px; font-size: 22px; }
.card .c-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-meta { font-size: 12px; color: var(--muted); margin-top: -6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idle .card { width: 150px; flex: none; background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .08); backdrop-filter: blur(6px); }
.idle .card .tile { font-size: 18px; }

.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 255, 255, .22), transparent 45%); pointer-events: none; }
.tile .flag { position: absolute; right: 6px; bottom: 4px; font-size: 13px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }

/* ---------- Guide (sidebar) ---------- */
.guide {
  position: sticky; top: calc(var(--topbar-h) + 24px);
  height: calc(100vh - var(--topbar-h) - 48px);
  height: calc(100dvh - var(--topbar-h) - 48px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin: 10px; padding: 4px; background: var(--bg2); border-radius: 12px; border: 1px solid var(--line); }
.tab { position: relative; z-index: 1; border: 0; background: none; height: 34px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; transition: color var(--t-fast); white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); }
.tab-glider { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 9px; background: var(--panel3); box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .05); transition: transform var(--t-med) var(--ease); }
.badge { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--line2); color: var(--text); display: inline-grid; place-items: center; }

.filters { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cat {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  height: 34px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg2); color: #c9cfdb;
  font-size: 12.5px; font-weight: 600; text-align: left;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.cat svg { width: 16px; height: 16px; color: var(--muted); transition: color var(--t-fast); }
.cat .cat-name { white-space: nowrap; }
.cat .n { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cat:hover { border-color: var(--line2); color: #fff; background: var(--panel2); }
.cat:hover svg { color: #fff; }
.cat:active { transform: scale(.97); }
.cat.on { background: linear-gradient(135deg, rgba(255, 77, 109, .22), rgba(124, 92, 255, .22)); border-color: rgba(255, 77, 109, .55); color: #fff; }
.cat.on svg { color: var(--accent); }
.cat.on .n { color: #ffd0d7; }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.select { position: relative; }
.select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select { appearance: none; -webkit-appearance: none; width: 100%; height: 36px; padding: 0 30px 0 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.select select:hover { border-color: var(--line2); }

.list-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: 0; padding: 2px 4px; border-radius: 6px; }
.link-btn:hover { color: var(--accent); }

.list { list-style: none; margin: 0; padding: 4px 8px 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 2px solid var(--panel); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px;
  cursor: pointer; position: relative;
  transition: background var(--t-fast);
}
.row:hover { background: var(--panel2); }
.row.active { background: linear-gradient(90deg, rgba(255, 77, 109, .16), rgba(124, 92, 255, .10)); box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .28); }
.row.kbd { box-shadow: inset 0 0 0 2px var(--accent2); }
.row .tile { width: 52px; height: 40px; border-radius: 9px; font-size: 12.5px; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name mark { background: rgba(255, 201, 77, .25); color: inherit; border-radius: 3px; padding: 0 1px; }
.row-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-fav { width: 34px; height: 34px; border: 0; background: none; border-radius: 9px; display: grid; place-items: center; color: var(--dim); opacity: 0; transition: opacity var(--t-fast), color var(--t-fast), background var(--t-fast); }
.row:hover .row-fav, .row-fav.on, .row-fav:focus-visible { opacity: 1; }
.row-fav:hover { background: var(--panel3); color: var(--text); }
.row-fav svg { width: 18px; height: 18px; }
.row-fav.on { color: var(--star); }
.row-fav.on svg { fill: var(--star); }
.row-fav.pop svg { animation: starpop 380ms var(--ease); }
@keyframes starpop { 40% { transform: scale(1.35); } }
.eq { display: none; gap: 2px; align-items: flex-end; height: 14px; margin-right: 2px; }
.eq i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.player-paused-global .eq i { animation-play-state: paused; }
.ago { font-size: 11px; color: var(--dim); white-space: nowrap; }

.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0;
  background: #f4f5f8; color: #111; font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  transition: opacity var(--t-med), transform var(--t-med) var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px; }
  .guide { top: calc(var(--topbar-h) + 16px); height: calc(100dvh - var(--topbar-h) - 32px); }
}
@media (max-width: 860px) {
  :root { --topbar-h: 58px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .brand-name, .topbar-meta, .kbd-hint { display: none; }
  .layout { grid-template-columns: 1fr; padding: 0 0 24px; gap: 0; }
  .stage-col { gap: 0; }
  .stage { position: sticky; top: var(--topbar-h); z-index: 30; border-radius: 0; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .9); }
  .stage.is-idle { position: relative; top: 0; }
  .idle { padding: 22px 16px; }
  .info { margin: 12px 16px 0; padding: 12px; gap: 12px; }
  .info-tile { width: 44px; height: 44px; font-size: 13px; border-radius: 11px; }
  .info-title h2 { font-size: 17px; }
  .info-actions .btn span { display: none; }
  .info-actions .btn { width: 40px; padding: 0; }
  .upnext { margin: 16px 16px 0; }
  .hscroll { grid-auto-columns: 150px; }
  .guide { position: static; height: auto; margin: 16px 16px 0; border-radius: 16px; }
  .list { overflow: visible; }
  .row-fav { opacity: 1; }
  .vol-slider { display: none; }
  .cbtn { width: 38px; height: 38px; }
  .b-prev, .b-next { display: none; }
  .controls { padding: 40px 6px 6px; }
  .ctrl-top { padding: 10px 12px 30px; }
  .now-tile { display: none; }
  .now-name { font-size: 14px; }
}
@media (max-width: 380px) {
  .b-pip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- logos ---------- */
.tile b { font-weight: 800; }
.tile.logo { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.tile.logo::after { background: linear-gradient(160deg, rgba(255, 255, 255, .12), transparent 40%); }
.tile.logo img { position: absolute; inset: 12%; width: 76%; height: 76%; object-fit: contain; z-index: 1; user-select: none; }
.tile.logo b { color: #6b7385; font-size: .9em; }
.tile.logo img + b { visibility: hidden; }
.row .tile.logo img { inset: 10%; width: 80%; height: 80%; }
.card .tile.logo img { inset: 16% 18%; width: 64%; height: 68%; }

/* ---------- row play button ---------- */
.row-play {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 32px; padding: 0 12px 0 10px; border-radius: 99px;
  border: 1px solid rgba(255, 77, 109, .45); background: rgba(255, 77, 109, .1); color: #ffb3c0;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.row-play svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.row:hover .row-play, .row-play:focus-visible { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(255, 77, 109, .9); }
.row-play:active { transform: scale(.94); }
.row.active .row-play { background: var(--live); border-color: transparent; color: #fff; }
.row.active .row-play svg { display: none; }
.row-play .eq { display: none; height: 12px; }
.row.active .row-play .eq { display: flex; }
.row-play .eq i { background: #fff; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }

/* ---------- cards ---------- */
.card { cursor: pointer; }
.card-art { position: relative; display: block; border-radius: 10px; overflow: hidden; }
.card-art .tile { width: 100%; aspect-ratio: 16/9; border-radius: 10px; font-size: 22px; }
.card-play {
  position: absolute; z-index: 2; right: 8px; bottom: 8px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(6px) scale(.9);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.card-play svg { width: 14px; height: 14px; fill: #fff; stroke: none; margin-left: 2px; }
.card:hover .card-play, .card:focus-visible .card-play { opacity: 1; transform: none; }
@media (hover: none) { .card-play { opacity: 1; transform: none; width: 28px; height: 28px; } }
.c-name, .c-meta { display: block; }

.idle-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 8px; }
.idle-cat {
  display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); color: #fff; font-weight: 600; font-size: 13px;
  backdrop-filter: blur(6px); transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.idle-cat svg { width: 18px; height: 18px; color: #ff9aa9; }
.idle-cat span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idle-cat small { color: rgba(255, 255, 255, .5); font-weight: 600; }
.idle-cat:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); transform: translateY(-2px); }
.tag svg { width: 13px; height: 13px; }

@media (max-width: 860px) {
  .row-play { height: 34px; padding: 0 12px; }
  .row-play .rp-label { display: inline; }
  .row-fav { width: 32px; }
  .idle .card { width: 132px; }
  .idle-cats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .idle-browse { display: none; }
  .idle h1 { margin-top: 10px; }
  .info-title .tag.live { display: none; }
}

/* idle home grows with its content instead of clipping inside 16:9 */
.stage.is-idle .idle { position: relative; min-height: min(56.25vw, 560px); padding: 40px 28px; }
.cbtn.txt { white-space: nowrap; }
@media (max-width: 860px) {
  .stage.is-idle .idle { min-height: 0; padding: 22px 16px; }
  .cbtn.txt { font-size: 12px; padding: 0 6px; }
  .live-pill { margin-left: 2px; padding: 0 9px; }
}
@media (max-width: 430px) {
  .b-pip { display: none; }
}

/* ===================== Navigation ===================== */
.topbar { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.topnav { display: none; align-items: center; gap: 2px; flex: none; }
.topnav > a, .topnav summary {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13.5px; cursor: pointer; list-style: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.topnav summary::-webkit-details-marker { display: none; }
.topnav summary svg { width: 15px; height: 15px; transition: rotate var(--t-med) var(--ease); }
.topnav details[open] summary svg { rotate: 180deg; }
.topnav > a:hover, .topnav summary:hover, .topnav details[open] summary { color: var(--text); background: var(--panel2); }
.topnav > a[aria-current="page"], .topnav summary.current { color: var(--text); background: var(--panel3); box-shadow: inset 0 0 0 1px var(--line2); }
.topnav-cats { position: relative; }
.cat-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 250px; padding: 6px;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  animation: pop var(--t-med) var(--ease);
}
.cat-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.cat-menu a svg { width: 17px; height: 17px; color: var(--muted); }
.cat-menu a span { flex: 1; }
.cat-menu a small { color: var(--dim); font-weight: 600; }
.cat-menu a:hover { background: var(--panel3); }
.cat-menu a:hover svg { color: var(--text); }
.cat-menu a[aria-current="page"] { background: linear-gradient(135deg, rgba(255, 77, 109, .2), rgba(124, 92, 255, .2)); }
.cat-menu a[aria-current="page"] svg { color: var(--accent); }
@media (min-width: 1024px) { .topnav { display: flex; } }
@media (min-width: 1024px) and (max-width: 1240px) { .topbar-meta { display: none; } .topnav > a, .topnav summary { padding: 0 9px; } }

@media (max-width: 1023px) {
  .toast { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
}

/* desktop guide flash when picked from the nav */
.guide.flash { animation: guideFlash 900ms var(--ease); }
@keyframes guideFlash { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } 25% { box-shadow: 0 0 0 3px rgba(255, 77, 109, .55); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } }

/* player close button */
.ctrl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ctrl-top .close { pointer-events: auto; flex: none; margin: -6px -8px 0 0; background: rgba(0, 0, 0, .35); }
.ctrl-top .close:hover { background: rgba(255, 255, 255, .18); }
.now { min-width: 0; }
.now-name, .now-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player.hide-ui .ctrl-top .close, .player.hide-ui .ctrl-top .sound-chip { pointer-events: none; }

/* when scrolling to the list on a phone, stop below the sticky player */
@media (max-width: 860px) {
  .guide { scroll-margin-top: calc(var(--topbar-h) + 12px); }
  .layout:has(.stage:not(.is-idle)) .guide { scroll-margin-top: calc(var(--topbar-h) + 56.25vw + 12px); }
  .controls { padding-bottom: max(6px, env(safe-area-inset-bottom) * 0); }
}

/* fullscreen: respect notches */
.stage.fs .controls { padding: 50px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.stage.fs .ctrl-top { padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 40px max(18px, env(safe-area-inset-left)); }

/* ===================== Landscape phones (short screens) ===================== */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --topbar-h: 52px; }
    main.layout { padding-bottom: 24px; }
  .toast { bottom: 16px; }
  .topnav { display: flex; }
  .topnav > a, .topnav summary { height: 32px; padding: 0 8px; font-size: 12.5px; }
  .topnav > a[data-nav="home"] { display: none; }
  .topbar { gap: 10px; }
  .brand-name, .topbar-meta, .kbd-hint { display: none; }
  .search { height: 36px; }
  /* the player fits the screen height instead of overflowing it */
  .stage:not(.is-idle) {
    position: relative; top: 0; aspect-ratio: auto;
    height: calc(100svh - var(--topbar-h) - 16px);
    width: min(100%, calc((100svh - var(--topbar-h) - 16px) * 16 / 9));
    margin: 8px auto 0;
  }
  .stage-col { align-items: stretch; }
  .guide { position: static; height: auto; }
  .layout { grid-template-columns: 1fr; padding: 0 max(12px, env(safe-area-inset-right)) 24px max(12px, env(safe-area-inset-left)); gap: 12px; }
  .list { overflow: visible; }
  .info { margin: 12px 0 0; }
  .upnext { margin: 16px 0 0; }
  .guide { margin: 16px 0 0; }
  .stage.is-idle .idle { min-height: 0; padding: 20px; }
  .stage[data-mode="split"]:not(.is-idle) {
    grid-template-columns: 1fr 1fr; grid-template-rows: 1fr;
    height: auto; aspect-ratio: 32 / 9;
    width: min(100%, calc((100svh - var(--topbar-h) - 16px) * 32 / 9));
  }
  .idle-browse { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
  .topnav summary { display: none; }
}
@media (min-width: 861px) and (max-width: 1023px) and (min-height: 521px) {
  .guide { height: calc(100dvh - var(--topbar-h) - 32px - 92px - env(safe-area-inset-bottom, 0px)); }
}
.search { min-width: 0; }
.search input { width: 100%; }

/* ===================== Split screen ===================== */
/* picker shown in an empty screen */
.pick { display: none; position: absolute; inset: 0; z-index: 3; align-items: center; justify-content: center; padding: 14px;
  background: radial-gradient(400px 220px at 20% 0%, rgba(124, 92, 255, .28), transparent 65%), radial-gradient(400px 220px at 100% 100%, rgba(255, 77, 109, .22), transparent 65%), #0d1018; }
.stage[data-mode="split"] .player[data-state="idle"] .pick { display: flex; }
.pick-inner { width: 100%; max-width: 520px; text-align: center; }
.pick-badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: rgba(255, 77, 109, .16); color: #ffb3c0; border: 1px solid rgba(255, 77, 109, .35); }
.pick h3 { margin: 8px 0 4px; font-size: clamp(14px, 2.2cqw + 6px, 20px); letter-spacing: -.02em; }
.pick-hint { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }
.pick-cards { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pick-card { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 84px; padding: 6px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .04); transition: background var(--t-fast), transform var(--t-fast); }
.pick-card:hover { background: rgba(255, 255, 255, .09); transform: translateY(-2px); }
.pick-card .tile { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; font-size: 13px; }
.pick-card span { font-size: 11px; font-weight: 600; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 460px) {
  .pick-hint { display: none; }
  .pick-cards { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding-bottom: 2px; }
  .pick-cards::-webkit-scrollbar { display: none; }
  .pick-card { width: 74px; flex: none; }
}

/* the selected screen (where list picks and keys go) */
.stage[data-mode="split"] .player::after { content: ""; position: absolute; inset: 0; z-index: 9; pointer-events: none; border: 2px solid transparent; transition: border-color var(--t-med); }
.stage[data-mode="split"] .player.active::after { border-color: rgba(255, 77, 109, .9); box-shadow: inset 0 0 24px rgba(255, 77, 109, .25); }

/* per-screen sound chip: always visible in split screen */
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sound-chip { display: none; pointer-events: auto; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; border-radius: 99px; border: 0;
  background: rgba(0, 0, 0, .55); color: rgba(255, 255, 255, .78); font-size: 12px; font-weight: 700; backdrop-filter: blur(6px); }
.sound-chip svg { width: 16px; height: 16px; }
.sound-chip .i-vol { display: none; }
.sound-chip.on { background: rgba(255, 255, 255, .92); color: #111; }
.sound-chip.on .i-vol { display: block; }
.sound-chip.on .i-muted { display: none; }
.stage[data-mode="split"] .player:not([data-state="idle"]) .sound-chip { display: inline-flex; }
.stage[data-mode="split"] .player.hide-ui .ctrl-top { opacity: 1; transform: none; background: none; }
.stage[data-mode="split"] .player.hide-ui .ctrl-top .now, .stage[data-mode="split"] .player.hide-ui .ctrl-top .close { opacity: 0; transition: opacity var(--t-med); }
.stage[data-mode="split"] .player.hide-ui .ctrl-top .sound-chip { pointer-events: auto; }
.stage[data-mode="split"] .player[data-state="idle"] .ctrl-top { opacity: 1; pointer-events: none; background: none; }
.stage[data-mode="split"] .player[data-state="idle"] .ctrl-top .now { display: none; }
.stage[data-mode="split"] .player[data-state="idle"] .ctrl-top .close { pointer-events: auto; position: relative; z-index: 4; }

/* split toggle icon */
.b-split .i-single { display: none; }
.stage[data-mode="split"] .b-split .i-split { display: none; }
.stage[data-mode="split"] .b-split .i-single { display: block; }
#infoSplit.on { border-color: rgba(255, 77, 109, .5); background: rgba(255, 77, 109, .12); }
.screen-tag { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: #fff; }

/* compact controls when a screen is narrow (split screen, small windows) */
@container (max-width: 560px) {
  .b-prev, .b-next { display: none; }
  .vol-slider { display: none; }
  .cbtn { width: 36px; height: 36px; }
  .controls { padding: 36px 6px 6px; }
  .ctrl-top { padding: 10px 10px 28px; }
  .now-tile { display: none; }
  .now-name { font-size: 13.5px; }
  .now-meta { display: none; }
  .cbtn.txt { font-size: 11.5px; padding: 0 5px; }
}
@container (max-width: 400px) {
  .b-pip, .b-fav { display: none; }
  .live-pill { padding: 0 8px; font-size: 11px; }
  .b-quality { max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
}
@container (max-width: 300px) {
  .b-quality { display: none; }
  .unmute { font-size: 12px; padding: 8px 12px; }
}

/* phones: screens stacked top and bottom */
@media (max-width: 860px) {
  .stage[data-mode="split"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 8 / 9; }
  .layout:has(.stage[data-mode="split"]) .guide { scroll-margin-top: calc(var(--topbar-h) + 112.5vw + 12px); }
}
/* short phones: don't pin a double-height stage over the list */
@media (max-width: 860px) and (max-height: 759px) and (orientation: portrait) {
  .stage[data-mode="split"] { position: relative; top: 0; }
  .layout:has(.stage[data-mode="split"]) .guide { scroll-margin-top: calc(var(--topbar-h) + 12px); }
}
/* fullscreen: side by side in landscape, stacked in portrait */
.stage.fs[data-mode="split"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
@media (orientation: portrait) {
  .stage.fs[data-mode="split"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

/* ===================== Phone category grid ===================== */
@media (max-width: 860px) {
  .cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cat { flex-direction: column; justify-content: center; gap: 4px; height: auto; min-height: 64px; padding: 10px 6px; border-radius: 14px; text-align: center; }
  .cat svg { width: 20px; height: 20px; }
  .cat .cat-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .cat .n { font-size: 10.5px; }
  .cat[data-cat="All"] { grid-column: 1 / -1; flex-direction: row; min-height: 42px; gap: 8px; }
  .cat[data-cat="All"] .cat-name::after { content: " channels"; }
}
@media (max-width: 350px) {
  .cat .cat-name { font-size: 10.5px; letter-spacing: -.01em; }
  .cat { padding: 10px 3px; }
}

.ctrl-top .top-actions { margin-left: auto; }
#infoSplit.on svg { color: var(--accent); }
.info-hint { color: var(--muted); font-size: 13px; }

/* split screen: no "Muted" banner or unmute pill; the chip only marks the screen whose sound is on */
.stage[data-mode="split"] .player:not([data-state="idle"]) .sound-chip:not(.on) { display: none; }
.stage[data-mode="split"] .unmute { display: none !important; }

/* ===================== Phone tab bar ===================== */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .tabbar {
    position: fixed; z-index: 40; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); translate: -50% 0;
    display: grid; grid-template-columns: repeat(5, 1fr); width: min(400px, calc(100vw - 20px)); padding: 5px; border-radius: 26px;
    background: #1a1f2d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .09), 0 2px 4px rgba(0, 0, 0, .35), 0 16px 36px rgba(0, 0, 0, .6);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; border-radius: 21px;
    color: rgb(238 240 245 / 72%); text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
    -webkit-tap-highlight-color: transparent; transition: color var(--t-fast), background var(--t-fast), scale 100ms;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a:active { scale: .94; }
  .tabbar a[aria-current="page"] { color: #ff6b85; background: rgba(255, 255, 255, .06); }
  .tabbar a[aria-current="page"] span { font-weight: 800; }
  main.layout { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .tabbar { display: none !important; }
}
/* phones: stop the category jump below the sticky player */
@media (max-width: 860px) {
  .list-head { scroll-margin-top: calc(var(--topbar-h) + 8px); }
  .layout:has(.stage:not(.is-idle)) .list-head { scroll-margin-top: calc(var(--topbar-h) + 56.25vw + 8px); }
  .layout:has(.stage[data-mode="split"]:not(.is-idle)) .list-head { scroll-margin-top: calc(var(--topbar-h) + 112.5vw + 8px); }
}
@media (max-width: 860px) and (max-height: 759px) and (orientation: portrait) {
  .layout:has(.stage[data-mode="split"]) .list-head { scroll-margin-top: calc(var(--topbar-h) + 8px); }
}

/* Sticky top bar and player must be able to stay pinned for the whole page:
   the body may not be capped at one screen height, and on phones the player's column
   dissolves so the player is pinned against the whole page, not just its own column. */
body { height: auto; min-height: 100%; }
@media (max-width: 860px) {
  .stage-col { display: contents; }
}
/* Anything scrolled into view (focus, jumps) stops below the pinned top bar and player. */
html { scroll-padding-top: calc(var(--topbar-h) + 8px); }
@media (max-width: 860px) and (orientation: portrait) {
  html:has(.stage:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 56.25vw + 8px); }
  html:has(.stage[data-mode="split"]:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 112.5vw + 8px); }
}
/* 768-860px wide in landscape (tablets): the player is pinned and single-height */
@media (max-width: 860px) and (orientation: landscape) and (min-height: 521px) {
  html:has(.stage:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 56.25vw + 8px); }
  html:has(.stage[data-mode="split"]:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 8px); }
  .stage[data-mode="split"] { position: relative; top: 0; } /* two stacked screens would be taller than the window */
}
@media (max-width: 860px) and (max-height: 759px) and (orientation: portrait) {
  html:has(.stage[data-mode="split"]:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 8px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  html, html:has(.stage:not(.is-idle)), html:has(.stage[data-mode="split"]:not(.is-idle)) { scroll-padding-top: calc(var(--topbar-h) + 8px); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout > *, .layout > .stage-col > * { min-width: 0; }
}
/* the page-wide scroll-padding above already accounts for the pinned bar and player */
.guide, .list-head, .layout .guide, .layout .list-head { scroll-margin-top: 0 !important; }

/* quality label: never collides with the buttons next to it */
.menu-wrap { min-width: 0; flex-shrink: 1; }
.cbtn.b-quality { display: inline-flex; align-items: center; max-width: 100%; overflow: hidden; white-space: nowrap; }
@container (max-width: 560px) {
  .b-quality .q-mode { display: none; }
  .cbtn.b-quality { max-width: none; }
}
@container (max-width: 400px) {
  .cbtn.b-quality { max-width: none; overflow: visible; }
}

/* logo on phones: pinned left, comfortable tap target */
@media (max-width: 860px) {
  .brand { margin-left: -4px; padding: 4px; border-radius: 12px; }
  .brand:active { scale: .94; }
}

/* guide tabs: sized to their labels, never overlapping */
.tabs { display: flex; gap: 2px; container-type: inline-size; }
.tab { flex: 1 1 auto; min-width: 0; padding: 0 10px; overflow: hidden; }
.tab-glider { width: 0; }
@container (max-width: 330px) { .tab-long { display: none; } .tab { padding: 0 6px; } }

/* paged channel list: the marker that loads the next page */
.list-more { height: 1px; list-style: none; }
.tab-long { margin-left: -2px; }

/* ===================== Channel names never cut off ===================== */
/* long names wrap onto a second line instead of ending in "…" */
.row-name, .card .c-name, .pick-card span, .info-title h2, .now-name {
  white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25;
}
.row-main { min-width: 0; }
.cat .cat-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.2; }
@media (max-width: 860px) {
  .cat .cat-name { max-width: 100%; overflow: visible; text-overflow: clip; }
}

/* ===================== Country tabs: national flags ===================== */
svg.flag { stroke: none; width: 21px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); overflow: hidden; }
.cat svg.flag { width: 21px; height: 14px; }
@media (max-width: 860px) { .cat svg.flag { width: 27px; height: 18px; } }

/* ===================== Player: play / pause in the middle ===================== */
.center-ctrl {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none;
  transition: opacity var(--t-med) var(--ease);
}
.b-center {
  pointer-events: auto; width: 76px; height: 76px; border-radius: 50%; border: 0; color: #fff;
  display: grid; place-items: center; background: rgba(0, 0, 0, .5);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .18);
  transition: transform var(--t-fast), background var(--t-fast);
}
.b-center svg { width: 34px; height: 34px; }
.b-center .i-play { transform: translateX(2px); }
.b-center:hover { background: rgba(0, 0, 0, .65); }
.b-center:active { transform: scale(.92); }
.b-center:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.player.hide-ui .center-ctrl { opacity: 0; }
.player.hide-ui .b-center { pointer-events: none; }
/* only once a stream is on screen (the spinner / error / picker own the middle otherwise) */
.player:not([data-state="playing"]) .center-ctrl { display: none; }
@container (max-width: 400px) { .b-center { width: 60px; height: 60px; } .b-center svg { width: 28px; height: 28px; } }

/* ===================== Player: bigger bottom buttons on phones ===================== */
@media (max-width: 860px), (pointer: coarse) {
  .controls .cbtn { width: 46px; height: 46px; border-radius: 12px; }
  .controls .cbtn svg { width: 24px; height: 24px; }
  .controls .cbtn.txt { width: auto; min-width: 46px; padding: 0 10px; font-size: 14px; }
  .controls .live-pill { height: 36px; padding: 0 14px; font-size: 13px; }
  .controls .ctrl-row { gap: 6px; }
  .controls { padding-top: 40px; }
  .ctrl-top .close, .ctrl-top .sound-chip { min-height: 40px; }
}
/* short messages ("Paused", "Live") sit above the centre button, not on it */
.player .osd { top: 24%; }

/* ===================== Colour category icons ===================== */
img.ci { width: 20px; height: 20px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); user-select: none; }
.cat img.ci { width: 19px; height: 19px; transition: transform var(--t-fast); }
.cat:hover img.ci, .cat.on img.ci { transform: scale(1.12); }
.idle-cat img.ci { width: 22px; height: 22px; }
.tag img.ci { width: 15px; height: 15px; }
@media (max-width: 860px) {
  .cat img.ci { width: 30px; height: 30px; }
  .cat[data-cat="All"] img.ci { width: 24px; height: 24px; }
}
@media (max-width: 860px) { .cat svg.flag { width: 33px; height: 22px; margin: 4px 0; } }

/* split screen: the sound chip shows only with the controls (tap a screen to see which one has
   sound), never over the picture on its own */
.stage[data-mode="split"] .player:not([data-state="idle"]):not(.hide-ui) .sound-chip { display: inline-flex; }
.stage[data-mode="split"] .player.hide-ui .ctrl-top .sound-chip { display: none; pointer-events: none; }

/* ===================== Quality menu above every overlay ===================== */
/* The open menu sits in .controls (z 5); lift it over the "Tap for sound" pill (z 7) and the centre
   play button (z 6) so a tap on a quality never lands on them. */
.player .controls:has(.menu:not([hidden])) { z-index: 9; }
/* While the menu is open nothing else floats over the picture. */
.player:has(.menu:not([hidden])) :is(.unmute, .center-ctrl, .osd) { visibility: hidden; }
/* Small players (phones in portrait): the list in two columns, never taller than the space above the bar. */
@container (max-width: 640px) {
  .menu:not([hidden]) {
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; min-width: 200px;
    max-height: calc(56.25cqw - 62px); overflow-y: auto; overscroll-behavior: contain;
    padding: 4px; bottom: calc(100% + 4px);
  }
  .menu .menu-title { grid-column: 1 / -1; padding: 4px 10px 2px; }
  .menu button { padding: 7px 10px; min-height: 30px; align-items: center; }
}
