/* SmartMatchUSA Media — dark broadcast-dashboard UI. Accent amber + live red carry over
   from the SmartMatchUSA brand (#E8892B / #D8452F). */
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #131315;
  --panel-2: #1a1a1d;
  --panel-3: #222226;
  --line: #2a2a2f;
  --text: #ececef;
  --muted: #9a9aa3;
  --dim: #66666f;
  --accent: #e8892b;
  --accent-ink: #1a0f03;
  --live: #e0533c;
  --ok: #3fb27f;
  --focus: #f3a957;
  --radius: 10px;
  --rail: 84px;
  --top: 64px;
  --ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.ic { width: 20px; height: 20px; fill: none; flex: none; }
[hidden] { display: none !important; }
kbd { font: 500 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--panel-2); }

/* ---------------------------------------------------------------- shell ---------- */
.app {
  display: grid; height: 100dvh;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: var(--top) minmax(0, 1fr);
  grid-template-areas: "rail top" "rail main";
}

.rail {
  grid-area: rail; display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 12px 8px; background: var(--panel); border-right: 1px solid var(--line);
}
.rail a {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 9px; color: var(--muted);
  font-size: 11px; font-weight: 500; letter-spacing: .01em;
}
.rail a:hover { color: var(--text); background: var(--panel-2); }
.rail a[aria-current] { color: var(--text); background: var(--panel-3); }
.rail a[aria-current] .ic { color: var(--accent); }
.rail .rail-end { margin-top: auto; }
.rail .brand { padding: 4px 0 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); border-radius: 0; }
.rail .brand:hover { background: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--panel-3); position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 13px; top: 10px; border-left: 11px solid var(--accent); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.brand-text { font-size: 9.5px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.15; }
.brand-text b { display: block; color: var(--text); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.top { grid-area: top; display: flex; align-items: center; padding: 0 24px; gap: 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.search {
  flex: 1; max-width: 720px; display: flex; align-items: center; gap: 10px; height: 42px;
  padding: 0 6px 0 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 21px;
}
.search:focus-within { border-color: #4a4a52; background: var(--panel-3); }
.search .ic { color: var(--dim); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; color: var(--text); font: inherit; font-size: 15px; outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.search:focus-within .slash { display: none; }
.scope {
  height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--panel);
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.scope:hover { color: var(--text); border-color: #45454c; }

.main {
  grid-area: main; overflow-y: auto; overflow-x: hidden; padding: 20px 24px 40px;
  display: grid; gap: 20px 24px; align-content: start;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "stage side" "body body";
}
.view { display: contents; }
.v-side { grid-area: side; min-width: 0; }
.v-body { grid-area: body; min-width: 0; }
.stage { grid-area: stage; min-width: 0; }

.app[data-view="live"] .main { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "side stage" "side body"; }
.app[data-dock="mini"] .main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "body"; }
/* Nothing playing on YouTube: skip the empty screen so results/feed come first. */
.app[data-view="youtube"]:not([data-playing="1"]) .stage { display: none; }
@media (min-width: 1181px) { .app[data-view="youtube"]:not([data-playing="1"]) .main { grid-template-areas: "body side"; } }

/* ---------------------------------------------------------------- stage ---------- */
.screen { position: relative; aspect-ratio: 16 / 9; max-height: calc(100dvh - var(--top) - 150px); width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid #1d1d21; }
.screen .yt-wrap, .screen video { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; }
.screen video { background: #000; object-fit: contain; }
.screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.screen[data-kind="yt"] .yt-wrap, .screen[data-kind="tv"] video { visibility: visible; }
/* Canvas mode: the video keeps decoding parked off-screen; the canvas shows its frames. */
.screen[data-render="canvas"] video { position: fixed; inset: auto; top: -10000px; left: 0; width: 640px; height: 360px; }
.tv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; background: #000; cursor: pointer; }
.screen[data-kind="tv"][data-render="canvas"] .tv-canvas { display: block; }
.cc { position: absolute; left: 0; right: 0; bottom: 0; display: none; align-items: center; gap: 6px; padding: 28px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: 0; transition: opacity .2s; }
.screen[data-kind="tv"][data-render="canvas"] .cc { display: flex; }
.cc.show, .cc:focus-within { opacity: 1; }
.cc-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.cc-btn:hover { background: rgba(255,255,255,.22); }
.cc-vol { width: 110px; accent-color: var(--accent); }
.cc-live { margin-left: auto; font: 600 11px/1 var(--mono); letter-spacing: .08em; padding: 5px 7px; border-radius: 4px; background: var(--live); color: #fff; }
.idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--dim);
  background: radial-gradient(ellipse at 50% 120%, #1c1611 0%, transparent 60%), #070708; }
.idle p { margin: 0; font-size: 14px; }
.idle-mark { width: 54px; height: 54px; border-radius: 14px; border: 1px solid #2c2c31; position: relative; }
.idle-mark::after { content: ""; position: absolute; left: 21px; top: 17px; border-left: 16px solid #3a3a40; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.screen:not([data-kind=""]) .idle { display: none; }
.busy { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: rgba(0,0,0,.25); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen-msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; background: rgba(8,8,9,.92); }
.screen-msg p { margin: 0; max-width: 46ch; color: var(--text); }
.msg-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.now { display: flex; align-items: center; gap: 16px; padding: 12px 2px 0; }
.now-meta { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
.now-kind { grid-row: 1 / span 2; align-self: center; font: 600 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 7px; border-radius: 4px; }
.now-kind:empty { display: none; }
.now-kind[data-kind="tv"] { background: var(--live); color: #fff; }
.now-kind[data-kind="yt"] { background: var(--panel-3); color: var(--text); }
.now-title { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-actions { display: flex; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); cursor: pointer; }
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--panel-3); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.fav-toggle[aria-pressed="true"], .card-fav[aria-pressed="true"], .btn[aria-pressed="true"] { color: var(--accent); }
.fav-toggle[aria-pressed="true"] .ic, .card-fav[aria-pressed="true"] .ic, .btn[aria-pressed="true"] .ic { fill: currentColor; }
.dock-only { display: none; }

/* Mini dock: same DOM node pinned to a corner, so YouTube's iframe never reloads. */
.app[data-dock="mini"]:not([data-playing="1"]) .stage { display: none; }
.app[data-dock="mini"] .stage {
  position: fixed; right: 20px; bottom: 20px; width: 360px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.app[data-dock="mini"] .screen { border-radius: 7px; max-height: none; }
.app[data-dock="mini"] .now { padding: 8px 2px 0; gap: 8px; }
.app[data-dock="mini"] .now-title { font-size: 13.5px; }
.app[data-dock="mini"] .now-sub, .app[data-dock="mini"] #now-fav, .app[data-dock="mini"] #now-open { display: none; }
.app[data-dock="mini"] .dock-only { display: grid; }
.app[data-dock="mini"] .icon-btn { width: 32px; height: 32px; }

/* ---------------------------------------------------------------- content -------- */
.view-title { margin: 4px 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.lede { margin: 0 0 18px; color: var(--muted); }
.muted { color: var(--dim); font-size: 14px; }
.fine { color: var(--muted); font-size: 13px; max-width: 70ch; }
.side-title { margin: 2px 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 19px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--panel-3); border-color: #45454c; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f19a42; }
.btn.subtle { background: none; color: var(--muted); }
.btn .ic { width: 17px; height: 17px; }
.btn[disabled] { opacity: .45; cursor: default; }

.notice { padding: 16px 18px; border: 1px solid #4a3418; background: #1b140b; border-radius: var(--radius); margin: 8px 0 18px; max-width: 760px; }
.notice strong { color: #f3b46f; }
.notice p { margin: 6px 0 0; color: #cdbfae; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; color: var(--text); }
.chip:hover { border-color: var(--accent); }

.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--text); border-color: var(--accent); }
.tab:hover { color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 22px 18px; }
.card { position: relative; min-width: 0; }
.card-hit { display: block; width: 100%; text-align: left; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--radius); }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--panel-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card.channel .thumb img { width: 62%; height: auto; aspect-ratio: 1; border-radius: 50%; margin: 6% auto 0; }
.card-hit:hover .thumb::after, .card.is-playing .thumb::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius); }
.badge { position: absolute; right: 6px; bottom: 6px; font: 500 11.5px/1 var(--mono); padding: 4px 6px; border-radius: 4px; background: rgba(0,0,0,.82); color: #fff; }
.badge.live { background: var(--live); font-weight: 600; letter-spacing: .05em; }
.card-text { display: grid; gap: 3px; padding: 10px 34px 0 2px; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-fav { position: absolute; right: -4px; top: calc(100% - 52px); width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; color: var(--dim); cursor: pointer; border-radius: 50%; }
.card-fav:hover { color: var(--text); background: var(--panel-2); }
.card.unavailable { opacity: .45; }
.card.is-playing .card-title { color: var(--accent); }
img.broken { visibility: hidden; }

.more { display: flex; justify-content: center; padding: 26px 0 8px; }
.state { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.state p { margin: 0; }
.state.error { color: #f0a090; }
.account { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; color: var(--muted); font-size: 13.5px; }
.account .btn { height: 30px; padding: 0 10px; font-size: 13px; }
.feed-title { margin: 22px 0 12px; font-size: 17px; }
.notice .row { margin-top: 12px; }
.coll-head { display: flex; gap: 10px; margin: 4px 0 20px; }

.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: calc(100dvh - var(--top) - 120px); overflow-y: auto; }
.q-item { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; padding: 6px; border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.q-item:hover:not(:disabled) { background: var(--panel-2); }
.q-item:disabled { opacity: .4; cursor: default; }
.q-item img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--panel-2); }
.q-item span { font-size: 13.5px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.quick { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; }
.quick a { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.quick a:hover { border-color: #45454c; background: var(--panel-2); }
.quick .ic { color: var(--accent); width: 22px; height: 22px; }
.quick span { display: grid; }
.quick small { color: var(--muted); font-size: 12.5px; }
.keys { color: var(--dim); font-size: 12.5px; line-height: 2.2; }

.shelf { margin: 6px 0 26px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.shelf-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.more-link { color: var(--muted); font-size: 13px; }
.more-link:hover { color: var(--accent); }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: 200px; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { display: grid; grid-template-rows: auto auto auto; gap: 2px; padding: 0 0 4px; text-align: left; border: 0; background: none; cursor: pointer; min-width: 0; border-radius: 8px; }
.tile-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--panel-2); margin-bottom: 6px; }
.tile-art { position: relative; display: grid; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 6px; overflow: hidden; }
.tile-art::before, .logo-box::before { content: attr(data-i); position: absolute; inset: 0; display: grid; place-items: center; font: 600 22px/1 var(--mono); color: var(--dim); }
.tile-logo { position: relative; width: 100%; height: 100%; object-fit: contain; padding: 14% 22%; background: var(--panel-2); }
.tile-logo.broken, .row-logo.broken { visibility: hidden; }
.tile:hover .tile-thumb, .tile:hover .tile-art { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.missing { opacity: .55; }
.history { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 14px; }
.history li { display: grid; }
.when { font: 400 11.5px var(--mono); color: var(--dim); }

/* ---------------------------------------------------------------- live tv -------- */
.live-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; height: calc(100dvh - var(--top) - 60px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.live-filters { display: grid; gap: 8px; }
.field { height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; min-width: 0; width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.count { margin: 0; font: 500 12px var(--mono); color: var(--muted); }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }
.vlist { flex: 1; min-height: 0; overflow-y: auto; position: relative; border-radius: 8px; contain: strict; }
.vlist-spacer { position: relative; width: 100%; }
.row-num, .row-name, .row-group { pointer-events: none; }
.vlist .row {
  position: absolute; left: 0; right: 0; top: 0; height: 56px; padding: 0 8px; gap: 10px; cursor: pointer;
  display: grid; grid-template-columns: 42px 44px minmax(0, 1fr) 28px; align-items: center; border-radius: 7px; contain: layout paint;
}
.vlist .row:hover { background: var(--panel-2); }
.vlist .row.is-active { background: var(--panel-3); }
.vlist:focus-visible .row.is-active { box-shadow: inset 0 0 0 2px var(--focus); }
.vlist:focus-visible { outline: none; }
.row-num { font: 500 11.5px var(--mono); color: var(--dim); text-align: right; }
.logo-box { position: relative; width: 44px; height: 32px; border-radius: 4px; background: #0e0e10; overflow: hidden; }
.logo-box::before { font-size: 11px; }
.row-logo { position: relative; width: 100%; height: 100%; object-fit: contain; background: #0e0e10; }
.row-text { display: grid; min-width: 0; }
.row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-group { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-fav { color: var(--dim); opacity: 0; display: grid; place-items: center; height: 100%; }
.row-fav .ic { width: 16px; height: 16px; }
.row:hover .row-fav, .row.is-fav .row-fav { opacity: 1; }
.row.is-fav .row-fav { color: var(--accent); }
.row.is-fav .row-fav .ic { fill: currentColor; }
.row.is-playing .row-name { color: var(--accent); }
.row.is-playing .row-num { color: var(--live); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cat { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.cat:hover { border-color: var(--accent); }
.cat-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-n { font: 500 12px var(--mono); color: var(--muted); }

.import { display: grid; gap: 14px; max-width: 620px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.import input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import input[type="file"]:focus-visible + .import-url, .file-btn:focus-within { outline: 2px solid var(--focus); }
.file-btn { justify-self: start; }
.import-url { display: grid; gap: 6px; }
.import-url label { font-size: 13px; color: var(--muted); }
.import-status { margin: 0; font-size: 14px; min-height: 1.4em; }
.import-status[data-kind="ok"] { color: var(--ok); }
.import-status[data-kind="error"] { color: #f0a090; }

.settings .panel { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 16px; max-width: 760px; }
.settings .panel h2 { margin: 0 0 10px; font-size: 16px; }
.settings .panel > p { display: flex; align-items: center; gap: 8px; }
.settings .import { background: none; border: 0; padding: 12px 0 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.off { background: var(--dim); }
.settings .warn { color: #f3b46f; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  padding: 10px 16px; border-radius: 8px; background: #f2f2f4; color: #111; font-weight: 600; font-size: 14px; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive ----- */
@media (max-width: 1180px) {
  .main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "body" "side"; }
  .app[data-view="live"] .main { grid-template-columns: 300px minmax(0, 1fr); }
  .queue { max-height: none; }
}

/* Short landscape screens (Tesla in motion is ~804x638): keep the channel list beside the player. */
@media (max-width: 1000px) and (orientation: landscape) and (min-width: 700px) {
  :root { --rail: 64px; --top: 54px; }
  .rail { padding: 8px 4px; }
  .rail a { padding: 7px 2px; font-size: 10px; gap: 3px; }
  .rail .brand { display: none; }
  .top { padding: 0 12px; }
  .main, .app[data-view="live"] .main { padding: 12px 12px 24px; gap: 12px; }
  .app[data-view="live"] .main { grid-template-columns: 230px minmax(0, 1fr); }
  .live-side { height: calc(100dvh - var(--top) - 24px); padding: 8px; }
  .vlist .row { grid-template-columns: 40px minmax(0, 1fr) 22px; gap: 8px; padding: 0 6px; }
  .row-num { display: none; }
  .screen { max-height: calc(100dvh - var(--top) - 90px); }
  .now { padding-top: 8px; }
  .now-title { font-size: 15px; }
  .icon-btn { width: 34px; height: 34px; }
}

@media (max-width: 820px) and (orientation: portrait), (max-width: 699px) {
  :root { --top: 58px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top) minmax(0, 1fr) auto; grid-template-areas: "top" "main" "rail"; }
  .rail { flex-direction: row; justify-content: space-around; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .rail a { padding: 7px 2px; font-size: 10px; flex: 1; gap: 3px; }
  .rail .brand { display: none; }
  .rail .rail-end { margin-top: 0; }
  .top { padding: 0 12px; }
  .search .slash { display: none; }
  .main, .app[data-view="live"] .main { padding: 0 12px 28px; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "side" "body"; }
  .app[data-view="youtube"] .main, .app[data-view="home"] .main { grid-template-areas: "stage" "body" "side"; }
  .app:not([data-playing="1"]) .stage { display: none; }
  .stage { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: 12px; margin: 0 -12px; padding-inline: 12px; }
  .screen { border-radius: 8px; }
  .now { padding-top: 8px; }
  .now-title { font-size: 15px; }
  .app[data-dock="mini"] .stage { left: 12px; right: 12px; bottom: calc(64px + env(safe-area-inset-bottom)); width: auto; margin: 0; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: center; }
  .app[data-dock="mini"] .now { padding: 0; }
  .live-side { position: static; height: 62dvh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px 12px; }
  .card-title { font-size: 13.5px; }
  .view-title { font-size: 20px; }
  .toast { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
}
