:root {
  --bg: #0b0e13;
  --surface: #131821;
  --surface-2: #1a212c;
  --surface-3: #222b38;
  --line: #253041;
  --line-strong: #344256;
  --text: #e8edf4;
  --muted: #8d98a8;
  --faint: #5d6878;
  --accent: #4f9dff;
  --accent-strong: #2f86ff;
  --accent-text: #04111f;
  --live: #3fb950;
  --danger: #ff7b72;
  --focus: #ffd166;
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --tone-unknown: #232c39;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 500px at 10% -10%, rgba(79, 157, 255, .10), transparent 60%), var(--bg);
}
button, input, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent); }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- buttons ---------- */
.btn, .iconbtn {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; font-weight: 500;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover, .iconbtn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 10px; line-height: 1; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus) !important; outline-offset: 2px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  display: flex; gap: 16px; align-items: center; padding: 0 24px;
  background: rgba(11, 14, 19, .86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.searchbox {
  flex: 1; max-width: 560px; margin: 0 auto; position: relative; display: flex; align-items: center;
}
.searchbox svg { position: absolute; left: 13px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
#search {
  width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, background .15s;
}
#search:focus { border-color: var(--accent); background: var(--surface-2); }
#search::placeholder { color: var(--faint); }

/* ---------- player ---------- */
.player {
  position: relative; z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  background: #000; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.stage { position: relative; background: #000; }
.stage video { display: block; width: 100%; max-height: 62vh; aspect-ratio: 16 / 9; background: #000; }
.info { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border-left: 1px solid var(--line); min-width: 0; }
.infohead { display: flex; gap: 12px; align-items: center; min-width: 0; }
.now { min-width: 0; }
.nowname { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowmeta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowguide { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.prog { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.prog .when { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.prog .what { font-weight: 600; margin-top: 2px; }
.prog.current { background: linear-gradient(180deg, rgba(79,157,255,.16), rgba(79,157,255,.06)); border: 1px solid rgba(79,157,255,.3); }
.noguide { color: var(--muted); font-size: 14px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.osd {
  position: absolute; top: 18px; left: 18px; max-width: calc(100% - 36px); padding: 10px 16px; border-radius: 12px;
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(6px); font-size: 20px; font-weight: 700; pointer-events: none;
}
.osd small { display: block; font-size: 14px; font-weight: 500; color: #c9d1dc; margin-top: 2px; }
.playermsg {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; text-align: center; padding: 16px;
  background: rgba(0, 0, 0, .84);
}
.playermsg p { margin: 0; max-width: 460px; font-size: 16px; }
.playermsg a.btn { color: var(--text); text-decoration: none; }
.playermsg .row { justify-content: center; }
.bar { height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- layout ---------- */
.layout { display: flex; align-items: flex-start; }
.cats {
  position: sticky; top: var(--header-h); width: 230px; flex-shrink: 0; max-height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 18px 12px; border-right: 1px solid var(--line);
}
.cat {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 2px; cursor: pointer;
  color: #c3ccd8; font-weight: 500; transition: background .12s, color .12s;
}
.cat:hover { background: var(--surface); color: var(--text); }
.cat.active { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.cat .n { color: var(--faint); font-size: 12px; font-weight: 500; }
.catdiv { height: 1px; background: var(--line); margin: 10px 8px; }
.content { flex: 1; min-width: 0; padding: 18px 24px 56px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.select { position: relative; display: inline-flex; }
.select select {
  appearance: none; -webkit-appearance: none; height: 40px; padding: 0 38px 0 14px; min-width: 170px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d98a8' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500;
}
.select select:hover { border-color: var(--line-strong); }
.select option { background: var(--surface); color: var(--text); }
.cat-select { display: none; }
.seg { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-left: auto; }
.segbtn { background: none; border: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.segbtn.active { background: var(--surface-3); color: var(--text); }
.status { color: var(--muted); font-size: 13px; margin-bottom: 14px; min-height: 1.4em; }

/* ---------- channel grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 30px 12px 14px; min-height: 176px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line);
  border-radius: var(--radius); transition: transform .15s ease, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.tile:focus-visible { transform: scale(1.04); box-shadow: var(--shadow); }
.tile.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow); }
.tile.offline { opacity: .42; }
.tile.offline .sub { color: var(--danger); }
.tile .name { font-size: 14px; font-weight: 650; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .sub { color: var(--muted); font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .sub b { color: #c3ccd8; font-weight: 600; }
.tile .bar { width: 70%; margin-top: auto; }
.favtoggle {
  position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--faint); font-size: 18px; line-height: 1; transition: color .15s, background .15s, transform .15s;
}
.favtoggle:hover { background: var(--surface-3); color: var(--text); }
.favtoggle.on { color: var(--focus); }
.tile:not(:hover):not(:focus-visible) .favtoggle:not(.on) { opacity: .55; }
.badge {
  position: absolute; top: 10px; left: 11px; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--live);
}
.badge:not(:empty)::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%;
  background: var(--live); vertical-align: 1px; box-shadow: 0 0 0 3px rgba(63, 185, 80, .18);
}
.more { display: block; margin: 22px auto 0; }

/* Logo box: the background is picked per logo (see logoEl in app.js). */
.logo {
  width: 108px; height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: 10px; background: var(--tone-unknown); overflow: hidden;
}
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo.sm, .initials.sm { width: 64px; height: 40px; padding: 4px; font-size: 14px; border-radius: 8px; }
.logo.tone-light { background: #eef1f5; }
.logo.tone-dark { background: #283240; }
.logo.tone-opaque { background: transparent; padding: 0; }
.logo.tone-opaque img { border-radius: 6px; }
.logo.tone-halo { background: #4a5563; }
.logo.tone-halo img { filter: drop-shadow(0 0 1px rgba(255,255,255,.85)) drop-shadow(0 0 2px rgba(255,255,255,.35)); }
.initials {
  width: 108px; height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border-radius: 10px; font-weight: 800; color: var(--muted); font-size: 20px; letter-spacing: .02em;
}
.nowlogo { display: flex; }

/* ---------- guide view ---------- */
.guide { display: flex; flex-direction: column; gap: 8px; }
.ghead, .grow { display: grid; grid-template-columns: 240px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ghead { color: var(--faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
.grow {
  width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; border-radius: var(--radius-sm);
}
.grow > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; transition: background .12s, border-color .12s; }
.grow:hover > div { background: var(--surface-2); border-color: var(--line-strong); }
.grow.playing > div { border-color: rgba(79,157,255,.6); }
.gch { display: flex; gap: 10px; align-items: center; }
.gch .logo, .gch .initials { width: 64px; height: 38px; padding: 4px; font-size: 14px; border-radius: 8px; }
.gch .gname { font-weight: 650; font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gcell .t { font-size: 12px; color: var(--muted); font-weight: 600; }
.gcell .w { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcell.cur { background: linear-gradient(180deg, rgba(79,157,255,.13), rgba(79,157,255,.05)) !important; border-color: rgba(79,157,255,.28) !important; }

/* ---------- loading skeleton ---------- */
.skel { pointer-events: none; }
.skel .logo, .skel .ln { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel .ln { height: 12px; width: 70%; border-radius: 6px; }
.skel .ln.short { width: 45%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- toast & dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  background: var(--surface-3); border: 1px solid var(--line-strong); padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 600;
}
dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 0;
  width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow); overflow: auto;
}
dialog::backdrop { background: rgba(3, 6, 10, .7); backdrop-filter: blur(3px); }
.settings { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.sethead { display: flex; align-items: center; justify-content: space-between; }
.settings h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { color: var(--muted); padding: 0 6px; font-size: 13px; font-weight: 600; }
.settings label { display: flex; gap: 10px; align-items: flex-start; }
.settings label.custom { flex-direction: column; margin-top: 4px; gap: 6px; }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--muted); font-size: 12px; }
input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.settings input[type=url] { flex: 1; min-width: 0; height: 40px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sourcelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.srcrow { display: flex; align-items: center; gap: 8px; }
.srcrow label { flex: 1; align-items: center; }
.srcrow .btn { padding: 3px 10px; font-size: 13px; }
.copyrow { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.copyrow span { color: var(--muted); font-weight: 600; }
.copyrow code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- home (For You) ---------- */
.home { display: flex; flex-direction: column; gap: 26px; }
.hrowhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hrowhead h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.seeall { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 2px; white-space: nowrap; }
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 188px; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 4px 4px 12px; margin: -4px -4px 0; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.strip .tile { scroll-snap-align: start; }
.homecta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px;
  border-radius: var(--radius); border: 1px solid rgba(79,157,255,.35);
  background: linear-gradient(120deg, rgba(79,157,255,.18), rgba(79,157,255,.04));
}
.ctatext { font-weight: 600; font-size: 16px; }

/* ---------- YouTube ---------- */
.ytbox { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 62vh; background: #000; }
.ytbox iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.badge.yt { color: #ff4e45; }
.badge.yt:not(:empty)::before { background: #ff4e45; box-shadow: 0 0 0 3px rgba(255, 78, 69, .18); }
@media (max-width: 640px) { .ytbox { max-height: 34vh; } }

/* ---------- casting ---------- */
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.on { color: var(--accent); border-color: rgba(79,157,255,.5); }
.castoverlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(600px 300px at 50% 40%, rgba(79,157,255,.22), #000 70%); text-align: center; padding: 16px;
}
.castoverlay svg { width: 56px; height: 56px; color: var(--accent); }
#castText { font-size: 18px; font-weight: 700; }

/* ---------- bottom tab bar (phones/tablets) ---------- */
.tabbar { display: none; }
.sheetactions { display: flex; gap: 8px; flex-wrap: wrap; }
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; border-bottom: 0; }

/* ---------- onboarding ---------- */
dialog.onboard {
  width: min(720px, 100vw); max-width: 100vw; height: min(760px, 100dvh); max-height: 100dvh; padding: 0;
  border-radius: 20px; overflow: hidden;
  background: radial-gradient(900px 400px at 0% 0%, rgba(79,157,255,.16), transparent 60%), var(--surface);
}
.obwrap { display: flex; flex-direction: column; height: 100%; }
.obtop { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.obstep { color: var(--muted); font-size: 13px; font-weight: 600; }
.obskip { background: none; border: 0; color: var(--muted); font-weight: 600; cursor: pointer; padding: 6px; }
.obskip:hover { color: var(--text); }
.obdots { display: flex; gap: 6px; padding: 10px 22px 0; }
.obdots i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.obdots i.on { background: var(--accent); }
.obhead { padding: 18px 22px 4px; }
.obhead .obsub { margin-bottom: 8px; }
.obbody { flex: 1; overflow-y: auto; padding: 12px 22px 18px; }
.obfilterwrap { position: sticky; top: -12px; z-index: 2; padding: 12px 0 2px; margin-top: -12px; background: var(--surface); }
.obsechead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.obsechead .obsectitle { margin: 0; display: flex; align-items: center; gap: 8px; }
.obsechead .oblogo { width: 26px; height: 26px; }
.obselall { background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--accent); font-weight: 600; font-size: 13px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.obselall:hover { border-color: var(--accent); }
.oblogo { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.obchips.big .oblogo { width: 28px; height: 28px; }
.homelogos { display: inline-flex; gap: 4px; margin-left: 10px; vertical-align: -5px; }
.homelogos img { width: 24px; height: 24px; object-fit: contain; }
.obtitle { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.obsub { margin: 0 0 18px; color: var(--muted); }
.obchips { display: flex; flex-wrap: wrap; gap: 10px; }
.obchips.big { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.obchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; transition: background .12s, border-color .12s, transform .12s;
}
.obchips.big .obchip { border-radius: 14px; padding: 16px; flex-direction: column; align-items: flex-start; gap: 6px; }
.obicon { font-size: 24px; line-height: 1; }
.obchip:hover { border-color: var(--line-strong); }
.obchip.on { background: rgba(79,157,255,.18); border-color: var(--accent); color: #fff; }
.obchip.on::after { content: "✓"; margin-left: 2px; color: var(--accent); }
.obchip.mine::after { content: none; }
.obtitle:focus { outline: none; }
.obchips.big .obchip { position: relative; }
.obchips.big .obchip.on::after { position: absolute; top: 12px; right: 14px; }
.obsection { margin-bottom: 22px; }
.obsectitle { margin: 0 0 10px; font-size: 17px; }
.oblabel { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 8px; }
.obsection .obchips + .obchips, .obsection .obadd { margin-top: 12px; }
.obfilter, .obadd input {
  width: 100%; height: 42px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 16px;
}
.obadd { display: flex; gap: 8px; }
.obadd input { margin: 0; flex: 1; min-width: 0; }
.obfoot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.obfoot .btn { min-width: 110px; }

/* ---------- find channels ---------- */
.findbtn { display: inline-flex; align-items: center; gap: 6px; height: 42px; white-space: nowrap; }
.findbtn svg { width: 18px; height: 18px; }
.ghsearch { display: flex; gap: 8px; }
.ghsearch input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ghsearch input:focus { border-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--line-strong); background: var(--surface-3); }
.ghresults { display: flex; flex-direction: column; gap: 10px; }
.ghmsg { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.ghmsg.err { color: var(--danger); }
.repo { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.repohead { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.reponame { font-weight: 700; word-break: break-word; }
.reponame a { color: var(--text); text-decoration: none; }
.reponame a:hover { text-decoration: underline; }
.repometa { color: var(--muted); font-size: 12px; margin-top: 2px; }
.repodesc { color: #c3ccd8; font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.repo .btn { padding: 6px 12px; font-size: 13px; flex-shrink: 0; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.filehead { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.filename { font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.filename small { color: var(--faint); font-family: Inter, system-ui, sans-serif; margin-left: 6px; }
.report { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.report .big { font-size: 15px; font-weight: 700; }
.report .good { color: var(--live); }
.report .warn { color: var(--focus); }
.report .muted { color: var(--muted); }
.srcrow .srcname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .player { grid-template-columns: 1fr; }
  .info { border-left: 0; border-top: 1px solid var(--line); padding: 12px 16px; gap: 10px; }
  .nowguide { flex-direction: row; overflow-x: auto; }
  .nowguide .prog { flex: 1 0 200px; }
  .ghead, .grow { grid-template-columns: 200px minmax(0, 1.4fr) minmax(0, 1fr); }
  .ghead > :nth-child(4), .grow > :nth-child(4) { display: none; }
}
@media (max-width: 900px) {
  .cats { display: none; }
  .cat-select { display: inline-flex; }
  .content { padding: 14px 16px 96px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(14, 18, 25, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; color: var(--muted);
    font-size: 11px; font-weight: 600; padding: 6px 2px; cursor: pointer; border-radius: 10px;
  }
  .tab svg { width: 22px; height: 22px; }
  .tab.active { color: var(--accent); }
  .tab.active svg { stroke-width: 2.4; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .strip { grid-auto-columns: 158px; gap: 10px; }
}
@media (max-width: 640px) {
  :root { --header-h: 58px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand span { display: none; }
  .findbtn span { display: none; }
  .findbtn { width: 42px; padding: 0; justify-content: center; }
  .player { position: sticky; top: var(--header-h); }
  .stage video { max-height: 34vh; }
  .info { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .infohead { flex: 1 1 100%; }
  .nowguide { flex: 1 1 100%; }
  .nowguide .prog { flex: 1 0 70%; padding: 8px 10px; }
  .nowguide .prog:not(.current):not(:nth-child(2)) { display: none; }
  .controls { flex: 1 1 100%; justify-content: space-between; }
  .controls .iconbtn { flex: 1; }
  .toolbar { gap: 8px; }
  .toolbar .select { flex: 1 1 calc(50% - 4px); }
  .toolbar .select select { min-width: 0; width: 100%; }
  .seg { flex: 1 1 100%; margin-left: 0; }
  .segbtn { flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 158px; padding: 28px 8px 12px; }
  .logo, .initials { width: 92px; height: 52px; }
  .ghead { display: none; }
  .guide { gap: 10px; }
  .grow {
    grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .grow > div { border: 0; background: var(--surface-2); }
  .grow > .gch { grid-column: 1 / -1; background: none; padding: 2px 2px 0; }
  .grow:hover > .gch { background: none; }
  .grow > :nth-child(4) { display: none; }
  .copyrow { grid-template-columns: 1fr auto; }
  dialog.onboard { width: 100vw; height: 100dvh; border-radius: 0; }
  .obtitle { font-size: 22px; }
  .obchips.big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hrowhead h2 { font-size: 17px; }
  .strip .tile { min-height: 150px; }
  .copyrow span { grid-column: 1 / -1; }
}

/* ---------- TV-sized screens: bigger type for 10-foot viewing ---------- */
@media (min-width: 1600px) {
  body { font-size: 17px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
  .tile .name { font-size: 16px; }
  .tile .sub { font-size: 14px; }
}
