/* Layout: TV-first 10-foot screen designed on a 1920 x 1080 canvas. On TV-shaped screens
   1rem equals 28 design pixels scaled to the viewport width; phones use a touch layout
   with a bottom tab bar. Single dark theme by design: it does not glare in a dark room. */
:root {
  color-scheme: dark;
  --room: #0a0d13;
  --panel: #121722;
  --panel-2: #1a2130;
  --panel-3: #22304a;
  --line: #2a3346;
  --ink: #eef1f6;
  --ink-2: #a7b0c2;
  --accent: #4f8cff;
  --accent-ink: #ffffff;
  --live: #ff5a5f;
  --ok: #7fe0a6;
  --warn: #ffcf5a;
  --danger: #ff8a8d;
  --ui: "Heebo", "Arial Hebrew", "Noto Sans Hebrew", system-ui, sans-serif;
  --display: "Rubik", "Heebo", "Arial Hebrew", "Noto Sans Hebrew", system-ui, sans-serif;
  --safe-x: 1.25rem;
  --safe-y: 1rem;
  --radius: 0.75rem;
  --tile-w: 10rem;
  --tile-h: 5.625rem;
  --gap: 0.75rem;
  --motion: 170ms;
  --frame: #e6eaf2;
  --frame-glow: rgba(214, 222, 238, 0.3);
}

html { font-size: 16px; height: 100%; background: var(--room); }
body.tv { --safe-x: 3.43rem; --safe-y: 1.93rem; --tile-w: 11.43rem; --tile-h: 6.43rem; --gap: 0.857rem; }
html.tv { font-size: calc(100vw / 1920 * 28); }
@media (min-width: 760px) { html:not(.tv) { font-size: 17px; } }

* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100%;
  background: var(--room);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--ink-2); }
.error { color: var(--danger); }
.ok { color: var(--ok); }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: radial-gradient(120% 90% at 85% 0%, #1d2a44 0%, var(--room) 60%);
}
[dir="ltr"]#app { background: radial-gradient(120% 90% at 15% 0%, #1d2a44 0%, var(--room) 60%); }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding-block: var(--safe-y) 0.6rem;
  padding-inline: max(var(--safe-x), env(safe-area-inset-left, 0px)) max(var(--safe-x), env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 0.5rem; font: 700 1.25rem var(--display); white-space: nowrap; }
.brand i { width: 1.3rem; height: 1.3rem; border-radius: 0.35rem; background: linear-gradient(135deg, var(--accent), #8fb4ff); display: block; }
#nav { display: flex; gap: 0.4rem; flex: 1; justify-content: center; }
.nav-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: none; border: 0; border-radius: 99rem; padding: 0.35rem 0.9rem;
  color: var(--ink-2); cursor: pointer; font-size: 0.95rem;
  transition: background var(--motion), color var(--motion), transform var(--motion);
}
.nav-item svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.on { color: var(--ink); background: var(--panel-2); }
.clock { text-align: end; color: var(--ink-2); font-size: 0.86rem; white-space: nowrap; line-height: 1.25; }
.clock strong { display: block; font: 700 1.3rem var(--display); color: var(--ink); font-variant-numeric: tabular-nums; direction: ltr; }

.preview-banner {
  margin-inline: max(var(--safe-x), env(safe-area-inset-left, 0px)) max(var(--safe-x), env(safe-area-inset-right, 0px));
  padding: 0.35rem 0.8rem; border-radius: 0.5rem; font-size: 0.86rem;
  background: rgba(255, 207, 90, 0.12); color: var(--warn); border: 1px solid rgba(255, 207, 90, 0.35);
}

main {
  overflow-y: auto;
  overflow-x: hidden;
  padding-block: 0.6rem var(--safe-y);
  padding-inline: max(var(--safe-x), env(safe-area-inset-left, 0px)) max(var(--safe-x), env(safe-area-inset-right, 0px));
  scroll-padding-block: 2rem;
  min-width: 0;
}
main > * + * { margin-top: 1.1rem; }
.home > * + * { margin-top: 1.1rem; }

/* Focus: ring, scale and lift, never color alone */
[data-nav]:focus { outline: none; }
[data-nav]:focus-visible, body.tv [data-nav]:focus {
  outline: 0.143rem solid #ffffff;
  outline-offset: 0.18rem;
}
.tile:focus, .tile:focus-visible { transform: scale(1.06); box-shadow: 0 0.8rem 1.6rem rgba(0, 0, 0, 0.5); background: var(--panel-3); z-index: 2; }
.nav-item:focus, .btn:focus, .group:focus, .guide-row:focus, .zap-row:focus, .ctrl:focus, .seg-btn:focus, .chip-btn:focus { transform: scale(1.04); }

/* Remote modes. Highlight frame: a silver frame always marks the selected item.
   Mouse pointer: the same frame follows the pointer as it hovers. */
html.remote-frame [data-nav]:focus,
html.remote-pointer [data-nav]:focus,
html.remote-pointer [data-nav]:hover {
  outline: 0.18rem solid var(--frame);
  outline-offset: 0.2rem;
  box-shadow: 0 0 0 0.45rem var(--frame-glow);
}
html.remote-frame .tile:focus, html.remote-pointer .tile:focus, html.remote-pointer .tile:hover,
html.remote-frame .fb-card:focus, html.remote-pointer .fb-card:focus, html.remote-pointer .fb-card:hover {
  box-shadow: 0 0 0 0.45rem var(--frame-glow), 0 0.8rem 1.6rem rgba(0, 0, 0, 0.5);
}
html.remote-pointer .tile:hover, html.remote-pointer .fb-card:hover { transform: scale(1.06); }

/* Hero */
.hero {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; justify-content: space-between;
  padding: 1rem 1.4rem; border-radius: var(--radius);
  background: linear-gradient(to left, rgba(79, 140, 255, 0.18), rgba(18, 23, 34, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.06);
}
[dir="ltr"] .hero { background: linear-gradient(to right, rgba(79, 140, 255, 0.18), rgba(18, 23, 34, 0.4)); }
.hero-main { min-width: 0; flex: 1 1 18rem; }
.kicker { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-2); font-size: 0.9rem; flex-wrap: wrap; }
.live { color: #fff; background: var(--live); font: 700 0.75rem var(--ui); padding: 0.1rem 0.5rem; border-radius: 0.3rem; }
.hero-title { font: 700 2rem/1.2 var(--display); margin: 0.2rem 0 0.3rem; text-wrap: balance; }
.hero-meta { color: var(--ink-2); font-size: 0.95rem; }
.bar { height: 0.32rem; border-radius: 1rem; background: rgba(255, 255, 255, 0.14); margin-top: 0.6rem; overflow: hidden; max-width: 30rem; }
.bar span { display: block; height: 100%; background: var(--accent); }
.hero-side { display: grid; gap: 0.7rem; justify-items: start; }
.hero-next { color: var(--ink-2); font-size: 0.9rem; display: grid; }
.hero-next b { color: var(--ink); font-weight: 500; font-size: 1rem; }

/* Rails and tiles */
.rail-title { font: 500 1.43rem var(--ui); margin: 0 0 0.5rem; display: flex; gap: 0.8rem; align-items: baseline; }
.rail-title small { font-size: 0.86rem; color: var(--ink-2); font-weight: 400; }
.row {
  display: flex; gap: var(--gap); overflow-x: auto; overflow-y: visible;
  padding: 0.5rem 0.4rem 0.9rem; margin-inline: -0.4rem;
  scrollbar-width: none; scroll-behavior: auto;
}
.row::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 var(--tile-w);
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: 0.65rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0.45rem 0.6rem 0.55rem;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  text-align: start;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--motion) ease, box-shadow var(--motion) ease, background var(--motion);
}
.tile-top { display: flex; justify-content: space-between; align-items: center; }
.num { font: 700 0.8rem var(--display); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.star { color: var(--warn); font-size: 0.8rem; }
.logo { display: grid; place-items: center; min-height: 0; }
.logo img { max-height: 2.2rem; max-width: 70%; object-fit: contain; }
.initials { font: 700 1.25rem var(--display); color: var(--ink); }
.tile-name { font-size: 0.86rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-now { font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.1em; }
.prog { position: absolute; inset-inline: 0; bottom: 0; height: 0.2rem; background: rgba(255, 255, 255, 0.12); }
.prog span { display: block; height: 100%; background: var(--accent); }

/* Channels view */
.channels { display: grid; grid-template-columns: minmax(11rem, 15rem) 1fr; gap: 1.2rem; align-items: start; }
.group-list { display: grid; gap: 0.3rem; position: sticky; top: 0; max-height: calc(100vh - 8rem); overflow-y: auto; padding: 0.3rem; }
.group {
  display: flex; justify-content: space-between; gap: 0.6rem; align-items: center;
  background: none; border: 1px solid transparent; border-radius: 0.6rem; padding: 0.45rem 0.8rem;
  color: var(--ink-2); text-align: start; cursor: pointer; transition: transform var(--motion), background var(--motion);
}
.group small { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.group.on { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.group bdi { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-wrap { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-w), 1fr)); gap: var(--gap); padding: 0.4rem; }
.grid .tile { width: auto; }
.btn.more { margin: 1rem 0.4rem; }

/* Guide */
.view-head h1 { font: 700 1.43rem var(--display); margin: 0; }
.view-head p { margin: 0.2rem 0 0; }
.guide-head, .guide-row { display: grid; grid-template-columns: minmax(10rem, 1.1fr) 1.4fr 1.2fr; gap: 0.6rem; }
.guide-head { color: var(--ink-2); font-size: 0.86rem; padding-inline: 0.6rem; }
.guide-list { display: grid; gap: 0.35rem; padding: 0.3rem; }
.guide-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.45rem 0.6rem;
  text-align: start; cursor: pointer; align-items: center; transition: transform var(--motion), background var(--motion);
}
.guide-row:focus { background: var(--panel-3); }
.g-ch { display: flex; gap: 0.5rem; align-items: center; min-width: 0; }
.g-logo { width: 2.4rem; height: 1.4rem; flex: none; display: grid; place-items: center; }
.g-logo img { max-height: 1.4rem; }
.g-logo .initials { font-size: 0.75rem; }
.g-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-slot { position: relative; display: grid; min-width: 0; padding-bottom: 0.3rem; }
.g-slot .prog { inset-inline: 0; bottom: 0; border-radius: 1rem; }
.g-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-time { color: var(--ink-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; color: var(--ink-2); max-width: 44rem; }

/* Search */
.search-box { display: flex; align-items: center; gap: 0.6rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 0.8rem; padding: 0 0.9rem; max-width: 40rem; }
.search-box svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: var(--ink-2); stroke-width: 2; flex: none; }
.search-input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 0.7rem 0; font-size: 1.1rem; }
.search-box:focus-within { outline: 0.143rem solid #fff; outline-offset: 0.18rem; }

/* Cards, forms and buttons */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; max-width: 52rem; }
.card h2 { font: 500 1.1rem var(--ui); margin: 0 0 0.6rem; }
.card p { margin: 0.3rem 0; }
.card.narrow { max-width: 34rem; }
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; max-width: 72rem; }
.form { display: grid; gap: 0.7rem; align-content: start; }
.field { display: grid; gap: 0.25rem; }
.field > span { font-size: 0.86rem; color: var(--ink-2); }
.input {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.55rem 0.75rem;
  min-height: 2.6rem; width: 100%; min-width: 0; text-align: left;
}
.input[dir="auto"] { text-align: start; }
.input:focus { outline: 0.143rem solid #fff; outline-offset: 0.12rem; }
.code-input { font: 700 1.4rem var(--display); letter-spacing: 0.2em; text-align: center; max-width: 12rem; }
.form-msg { min-height: 1.2em; margin: 0; font-size: 0.9rem; color: var(--ink-2); }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.6rem; padding: 0.45rem 1.1rem; border-radius: 0.7rem;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; text-decoration: none; font-weight: 500;
  transition: transform var(--motion), background var(--motion);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 2.1rem; padding: 0.25rem 0.7rem; font-size: 0.86rem; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0.3rem 0; text-align: start; justify-self: start; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99rem; padding: 0.2rem; background: var(--panel-2); gap: 0.2rem; }
.seg-btn { border: 0; background: none; border-radius: 99rem; padding: 0.35rem 1rem; cursor: pointer; color: var(--ink-2); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }

.source { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; justify-content: space-between; align-items: center; }
.source-main { display: grid; min-width: 0; flex: 1 1 18rem; }
.source-main .ltr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; text-align: start; }

.fav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.fav-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.fav-name { display: flex; gap: 0.6rem; align-items: baseline; min-width: 0; }

.empty-state { max-width: 40rem; padding: 2rem 0; }
.empty-state h1 { font: 700 2rem var(--display); margin: 0 0 0.5rem; }
.empty-state p { color: var(--ink-2); margin: 0 0 1.2rem; }

/* Sign-in */
.signin { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.2rem; max-width: 64rem; align-items: start; }
.signin .card { max-width: none; }
.site-addr { font: 500 1.1rem var(--display); }
.code-qr { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; margin: 0.6rem 0; }
.code { display: flex; gap: 0.35rem; direction: ltr; }
.code span { width: 2.3rem; height: 3rem; border-radius: 0.5rem; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font: 700 1.6rem var(--display); }
.code span.gap { width: 0.5rem; background: none; border: 0; }
.qr { width: 7.5rem; height: 7.5rem; border-radius: 0.5rem; overflow: hidden; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.preview-box { border: 1px dashed rgba(255, 207, 90, 0.45); border-radius: 0.6rem; padding: 0.6rem 0.8rem; margin: 0.6rem 0; display: grid; gap: 0.4rem; justify-items: start; }
.lock h1 { font: 700 1.6rem var(--display); margin: 0 0 0.4rem; }

/* Player */
#player { position: fixed; inset: 0; background: #000; z-index: 20; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#player.buffering::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem;
  border-radius: 50%; border: 0.3rem solid rgba(255, 255, 255, 0.2); border-top-color: #fff; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#banner {
  position: absolute; inset-inline: var(--safe-x); bottom: var(--safe-y);
  display: flex; gap: 1rem; align-items: center;
  padding: 0.8rem 1.1rem; border-radius: var(--radius);
  background: linear-gradient(to top, rgba(10, 13, 19, 0.95), rgba(18, 23, 34, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0; transform: translateY(0.6rem); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none;
}
#banner.show { opacity: 1; transform: none; }
.b-logo { width: 4.6rem; height: 2.6rem; flex: none; display: grid; place-items: center; background: var(--panel-2); border-radius: 0.5rem; }
.b-logo img { max-height: 2.2rem; }
.b-main { flex: 1; min-width: 0; }
.b-ch { display: flex; align-items: baseline; gap: 0.6rem; }
.b-name { font: 700 1.43rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-now { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-next { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-clock { font: 700 1.3rem var(--display); font-variant-numeric: tabular-nums; align-self: start; }
#controls {
  position: absolute; top: var(--safe-y); inset-inline: var(--safe-x);
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 160ms ease;
}
#controls.show { opacity: 1; pointer-events: auto; }
.ctrl {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.6rem; padding: 0.35rem 0.9rem;
  border-radius: 99rem; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(18, 23, 34, 0.85); cursor: pointer;
  transition: transform var(--motion), background var(--motion);
}
.ctrl svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctrl[aria-pressed="true"] svg { fill: var(--warn); stroke: var(--warn); }
.ctrl:focus { background: var(--panel-3); }
/* Playback icons keep the tape convention and are not mirrored. */
#zap {
  position: absolute; inset-block: var(--safe-y); inset-inline-start: var(--safe-x); width: min(26rem, 80vw);
  background: rgba(10, 13, 19, 0.94); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-rows: auto 1fr; padding: 0.8rem; gap: 0.5rem;
}
#zap h2 { margin: 0; font: 500 1.1rem var(--ui); }
.zap-list { overflow-y: auto; display: grid; gap: 0.2rem; align-content: start; padding: 0.2rem; }
.zap-row { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.5rem; align-items: center; text-align: start; background: none; border: 0; border-radius: 0.5rem; padding: 0.4rem 0.5rem; cursor: pointer; }
.zap-row.on { background: var(--panel-2); }
.zap-row:focus { background: var(--panel-3); }
.zap-name { display: grid; min-width: 0; }
.zap-name bdi, .zap-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zap-name small { color: var(--ink-2); }
#player-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(34rem, calc(100vw - 2rem)); text-align: center;
  background: rgba(18, 23, 34, 0.95); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem;
}
#player-msg .actions { justify-content: center; margin-top: 0.8rem; }
.msg-title { font: 500 1.1rem var(--ui); margin: 0; }
#player-hint {
  position: absolute; top: var(--safe-y); inset-inline-end: var(--safe-x);
  background: rgba(18, 23, 34, 0.9); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.9rem;
  font: 700 1.2rem var(--display);
}

/* Facebook videos: list */
.view-head p { margin: 0.2rem 0 0; }
.small { font-size: 0.86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 99rem;
  padding: 0.35rem 1rem; cursor: pointer; font: inherit; transition: transform var(--motion), background var(--motion);
}
.chip-btn.on { background: var(--panel-3); color: var(--ink); border-color: transparent; }
.chip-example {
  display: inline-block; font-size: 0.72rem; color: var(--warn); border: 1px dashed rgba(255, 207, 90, 0.55);
  border-radius: 0.35rem; padding: 0 0.35rem; margin-inline-start: 0.4rem; vertical-align: middle;
}
.fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.fb-card {
  display: grid; grid-template-rows: auto auto; text-align: start; padding: 0; border: 0; border-radius: var(--radius);
  background: var(--panel); color: var(--ink); cursor: pointer; overflow: hidden; font: inherit; min-width: 0;
  transition: transform var(--motion), background var(--motion);
}
.fb-card:focus { transform: scale(1.06); background: var(--panel-3); z-index: 2; }
.fb-thumb {
  position: relative; aspect-ratio: 16 / 9; max-width: 100%; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--hue, 220) 45% 26%), hsl(calc(var(--hue, 220) + 40) 40% 14%));
}
.fb-initials { font: 700 1.8rem var(--display); color: rgba(255, 255, 255, 0.85); letter-spacing: 0.04em; }
.fb-play {
  position: absolute; inset-block-end: 0.5rem; inset-inline-end: 0.5rem; width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, 0.55);
}
.fb-play svg { width: 1rem; height: 1rem; fill: #fff; }
.fb-meta { display: grid; gap: 0.15rem; padding: 0.55rem 0.75rem 0.7rem; min-width: 0; }
.fb-card-title { font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fb-meta small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Facebook videos: full screen viewer */
#fbview { position: fixed; inset: 0; background: #000; z-index: 22; }
#fb-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
#fb-local { width: 100%; height: 100%; object-fit: contain; background: #000; }
.fb-embed { display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.fb-embed iframe { border: 0; max-width: 100vw; max-height: 100vh; background: #000; }
.fb-note {
  position: absolute; inset-block-start: var(--safe-y); inset-inline-start: var(--safe-x); margin: 0;
  max-width: 28rem; font-size: 0.86rem; color: var(--warn);
  background: rgba(10, 13, 19, 0.85); border: 1px dashed rgba(255, 207, 90, 0.5); border-radius: 0.6rem; padding: 0.4rem 0.8rem;
}
#fb-info {
  position: absolute; inset-inline: var(--safe-x); bottom: calc(var(--safe-y) + 4.2rem);
  display: flex; gap: 1rem; align-items: end; justify-content: space-between;
  opacity: 0; transform: translateY(0.6rem); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#fb-info.show { opacity: 1; transform: none; }
.fb-info-main { display: grid; gap: 0.2rem; min-width: 0; }
.fb-info-title { font: 700 1.43rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-info-page { color: var(--ink-2); }
.fb-info-pos { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
#fb-bar {
  position: absolute; inset-inline: var(--safe-x); bottom: var(--safe-y);
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 160ms ease;
}
#fb-bar.show { opacity: 1; pointer-events: auto; }
.ctrl.accent { background: rgba(79, 140, 255, 0.28); border-color: rgba(79, 140, 255, 0.6); }
#fb-hint {
  position: absolute; top: var(--safe-y); inset-inline-end: var(--safe-x);
  max-width: min(30rem, calc(100vw - 2rem));
  background: rgba(18, 23, 34, 0.92); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.4rem 0.9rem;
  font: 500 1.05rem var(--ui);
}
#fb-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(34rem, calc(100vw - 2rem)); text-align: center;
  background: rgba(18, 23, 34, 0.95); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem;
}
#fb-msg .actions { justify-content: center; margin-top: 0.8rem; }
#fb-panel { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); padding: 1rem; }
.fb-panel-card { width: min(40rem, 100%); }
.fb-panel-body { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; }
.fb-panel-body > div { flex: 1 1 14rem; min-width: 0; }
.qr.big { width: 10rem; height: 10rem; flex: none; }
.fb-url { overflow-wrap: anywhere; font-size: 0.86rem; }

/* Exit prompt and toast */
#exit { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); padding: 1rem; }
#exit .card { width: 100%; }
#toast {
  position: fixed; z-index: 50; bottom: calc(var(--safe-y) + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.55rem 1rem;
  max-width: calc(100vw - 2rem); box-shadow: 0 0.6rem 1.4rem rgba(0, 0, 0, 0.45);
}

/* Phone layout: bottom tab bar, touch-size targets, rails swipe */
@media (max-width: 759px) {
  html { font-size: 15px; }
  .topbar { padding-block: 0.6rem 0.4rem; justify-content: space-between; }
  #nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; justify-content: space-around; gap: 0;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 0.3rem max(0.3rem, env(safe-area-inset-left, 0px)) calc(0.3rem + env(safe-area-inset-bottom, 0px)) max(0.3rem, env(safe-area-inset-right, 0px));
  }
  main { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }
  #toast { bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .nav-item { flex-direction: column; gap: 0.1rem; font-size: 0.72rem; padding: 0.3rem 0.4rem; min-height: 48px; border-radius: 0.6rem; }
  .nav-item svg { width: 1.3rem; height: 1.3rem; }
  .clock strong { font-size: 1.1rem; }
  .row { overflow-x: auto; scroll-snap-type: x proximity; }
  .tile { scroll-snap-align: start; --tile-w: 9.5rem; --tile-h: 5.4rem; }
  .channels { grid-template-columns: 1fr; }
  .group-list { position: static; display: flex; overflow-x: auto; max-height: none; padding-bottom: 0.4rem; }
  .group { flex: none; border-color: var(--line); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
  .guide-head { display: none; }
  .guide-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .hero-title { font-size: 1.5rem; }
  .btn, .ctrl, .seg-btn { min-height: 48px; }
  #controls { inset-inline: 0.6rem; }
  .ctrl span { display: none; }
  #banner { inset-inline: 0.6rem; bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
  .b-clock { display: none; }
  .fb-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.7rem; }
  #fb-bar { inset-inline: 0.6rem; bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
  #fb-info { inset-inline: 0.6rem; bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); }
  .fb-info-title { font-size: 1.15rem; }
  .qr.big { width: 8rem; height: 8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}

/* Silverline TV app: video plays in the system player under the page. */
html.native-video.playing,
html.native-video body.playing,
html.native-video body.playing #player { background: transparent; }
html.native-video #video { visibility: hidden; }
html.native-video body.playing #app { visibility: hidden; }
.dc-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; }
.dc-table th, .dc-table td { padding: 0.55rem 0.7rem; text-align: start; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.dc-table thead th { color: var(--ink-2); font-weight: 500; }
.dc-table td.pass { color: #7ad79a; }
.dc-table td.miss { color: #ffb86b; }
