/* Drive-In — flagship automotive theater UI built for Tesla center screens & phones. */
:root {
  --bg: #05070c;
  --rail: #090c13;
  --panel: #10141f;
  --panel-2: #171d2c;
  --panel-hover: #1e2639;
  --line: rgb(255 255 255 / .075);
  --line-strong: rgb(255 255 255 / .14);
  --text: #f3f5fa;
  --text-2: #a8b1c6;
  --text-3: #6c768e;
  --accent: #ffb020;
  --accent-soft: rgb(255 176 32 / .14);
  --accent-ink: #1a1100;
  --live: #ff4757;
  --good: #3ddc84;
  --bad: #ff6b73;
  --r: 18px;
  --tap: 52px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font: 1rem/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.ic { display: inline-grid; place-items: center; flex: none; }
.ic svg { display: block; }
.grow { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---- shell -------------------------------------------------------------------------------------------------- */
#app { height: 100%; display: grid; grid-template-columns: 92px 1fr; }
body.watching #app { visibility: hidden; }

.rail {
  background: linear-gradient(180deg, #0b0f18 0%, #07090f 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0 max(18px, env(safe-area-inset-bottom));
}
.brand {
  color: var(--accent);
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, #1a2132, #0f131f);
  border: 1px solid rgb(255 176 32 / .34);
  box-shadow: 0 8px 24px rgb(0 0 0 / .48), 0 0 28px rgb(255 176 32 / .14), inset 0 1px 0 rgb(255 255 255 / .12);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.brand svg { width: 30px; height: 30px; display: block; }
.brand.big { width: 76px; height: 76px; border-radius: 22px; margin-bottom: 0; }
.brand.big svg { width: 46px; height: 46px; }

.nav {
  position: relative;
  width: 72px;
  height: 66px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--text-3);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .015em;
  transition: background .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease;
}
.nav:hover { color: var(--text-2); background: rgb(255 255 255 / .05); }
.nav:active { transform: scale(.94); }
.nav.on {
  color: var(--accent);
  background: linear-gradient(160deg, rgb(255 176 32 / .18), rgb(255 176 32 / .08));
  box-shadow: inset 0 0 0 1px rgb(255 176 32 / .28), 0 8px 20px rgb(0 0 0 / .32);
}
.nav.on::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 18px;
  bottom: 18px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

#view {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 38px 72px;
  scroll-behavior: auto;
  background:
    radial-gradient(960px 420px at 22% -120px, rgb(255 176 32 / .075), transparent 70%),
    radial-gradient(840px 480px at 92% 95%, rgb(56 120 255 / .05), transparent 72%),
    var(--bg);
}
.boot { grid-column: 1 / -1; display: grid; place-items: center; }

/* ---- common controls ---------------------------------------------------------------------------------------- */
.btn {
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--panel-hover); border-color: rgb(255 255 255 / .22); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 20px rgb(255 176 32 / .24);
}
.btn.primary:hover { background: #ffbe42; }
.btn.small { min-height: 38px; padding: 0 15px; font-size: .88rem; }
.btn.busy { opacity: .6; pointer-events: none; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  flex: none;
  transition: background .14s ease, color .14s ease, transform .1s ease;
}
.icon-btn:hover { background: rgb(255 255 255 / .08); color: var(--text); }
.icon-btn:active { background: rgb(255 255 255 / .14); transform: scale(.94); }
.icon-btn.on { color: var(--accent); }

.chips { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.chip {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgb(255 255 255 / .045);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .1s ease;
}
.chip:hover { background: rgb(255 255 255 / .09); color: var(--text); }
.chip:active { transform: scale(.97); }
.chip.on {
  background: var(--text);
  color: #090b10;
  border-color: transparent;
  box-shadow: 0 4px 14px rgb(0 0 0 / .32);
}
.chip.ghost { background: transparent; border-style: dashed; border-color: var(--line-strong); }

.note { color: var(--text-2); padding: 12px 0; }
.note.bad { color: var(--bad); }
.note.wide { grid-column: 1 / -1; padding: 64px 0; text-align: center; font-size: 1.05rem; color: var(--text-3); }

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgb(7 9 14 / .82);
  backdrop-filter: blur(8px);
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: 7px;
  padding: 2px 7px;
  font-size: .74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge.live { background: var(--live); border-color: transparent; letter-spacing: .05em; }

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgb(255 255 255 / .12);
  border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sentinel { grid-column: 1 / -1; height: 70px; display: grid; place-items: center; }
.sentinel.busy::after { content: ""; width: 30px; height: 30px; border-radius: 50%; border: 3.5px solid rgb(255 255 255 / .12); border-top-color: var(--accent); animation: spin .75s linear infinite; }
.sentinel.done { height: 0; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 24px);
  background: #f3f5fa;
  color: #090b10;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .94rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  max-width: 86vw;
  text-align: center;
  box-shadow: 0 12px 36px rgb(0 0 0 / .55);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #2a0608; }
#toast.good { background: var(--good); color: #042410; }

/* ---- lists & media grids ------------------------------------------------------------------------------------ */
.view-top { display: grid; gap: 16px; margin-bottom: 24px; }
.view-top.inline { grid-template-columns: 1fr minmax(240px, 360px); align-items: center; }
.page-title { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: 22px; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgb(18 22 33 / .9);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 8px 0 20px;
  height: 56px;
  color: var(--text-3);
  max-width: 760px;
  box-shadow: 0 4px 18px rgb(0 0 0 / .24);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.search.slim { height: 46px; }
.search:focus-within {
  border-color: rgb(255 176 32 / .65);
  background: var(--panel);
  box-shadow: 0 0 0 4px rgb(255 176 32 / .12), 0 6px 20px rgb(0 0 0 / .3);
}
.search-in { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 1.02rem; color: var(--text); height: 100%; }
.search-in::placeholder { color: var(--text-3); }
.search-in::-webkit-search-cancel-button { display: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 26px 20px; align-items: start; }
.card {
  display: block;
  width: 100%;
  border-radius: var(--r);
  transition: transform .16s ease;
}
.card:hover { transform: translateY(-2px); }
.card:active { transform: scale(.98); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgb(0 0 0 / .32);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.meta { padding: 11px 4px 0; }
.t { font-weight: 600; font-size: .97rem; line-height: 1.32; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s { color: var(--text-3); font-size: .85rem; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card.chan {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.card.chan:hover { background: var(--panel-2); border-color: var(--line-strong); }
.card.chan .meta { padding: 0; min-width: 0; }
.avatar { width: 78px; height: 78px; border-radius: 50%; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; flex: none; color: var(--text-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 96px; height: 96px; }
.chan-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.chan-head h1 { font-size: 1.65rem; letter-spacing: -.02em; }
.chan-head .chips { margin-left: auto; }

.banner {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 18px 24px;
  margin-bottom: 24px;
  border-radius: 20px;
  background: linear-gradient(120deg, rgb(255 176 32 / .11), rgb(255 176 32 / .02) 55%), var(--panel);
  border: 1px solid rgb(255 176 32 / .2);
  box-shadow: 0 10px 30px rgb(0 0 0 / .24);
}
.banner h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.015em; }
.banner p { color: var(--text-2); font-size: .92rem; margin-top: 3px; max-width: 60ch; }

/* ---- home launcher & square app tiles ----------------------------------------------------------------------- */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title.tight { margin-bottom: 0; }
.home-head .search { flex: 1; max-width: 440px; height: 48px; }

.launcher {
  min-height: calc(100% - 8px);
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 6px 0 24px;
}
.launcher-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.launcher-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.live-clock {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / .055);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.launcher-title h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.02;
  background: linear-gradient(180deg, #ffffff 10%, #c8d2e6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.launcher-title p {
  color: var(--text-3);
  font-size: .96rem;
  margin-top: 5px;
}
.launcher-top .search {
  width: min(360px, 100%);
  height: 48px;
}

.app-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.app-dock[data-count="4"], .app-dock[data-count="5"], .app-dock[data-count="6"] {
  gap: 18px;
}
.app-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 26px;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / .12);
  box-shadow: 0 20px 48px rgb(0 0 0 / .46), inset 0 1px 0 rgb(255 255 255 / .16);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), border-color .2s ease, box-shadow .2s ease;
}
.app-dock[data-count="1"] .app-tile,
.app-dock[data-count="2"] .app-tile,
.app-dock[data-count="3"] .app-tile {
  aspect-ratio: 1 / 1;
}
.app-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 65% at 50% 0%, rgb(255 255 255 / .1), transparent 70%);
  pointer-events: none;
}
.app-tile:hover {
  transform: translateY(-5px) scale(1.015);
  border-color: rgb(255 255 255 / .28);
}
.app-tile:active { transform: scale(.97); }

.app-yt {
  background:
    radial-gradient(85% 75% at 50% 35%, rgb(255 0 51 / .26), transparent 68%),
    linear-gradient(160deg, #241016 0%, #100b10 100%);
}
.app-yt:hover { box-shadow: 0 26px 60px rgb(255 0 51 / .2), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-disney {
  background:
    radial-gradient(85% 75% at 50% 32%, rgb(38 148 255 / .34), transparent 68%),
    linear-gradient(160deg, #0b2458 0%, #071026 100%);
}
.app-disney:hover { box-shadow: 0 26px 60px rgb(38 148 255 / .24), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .24); }

.app-hbo {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(138 92 255 / .32), transparent 68%),
    linear-gradient(160deg, #1b1342 0%, #0b0918 100%);
}
.app-hbo:hover { box-shadow: 0 26px 60px rgb(138 92 255 / .24), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .24); }

.app-netflix {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(229 9 20 / .24), transparent 68%),
    linear-gradient(160deg, #1c0c0f 0%, #0b080a 100%);
}
.app-netflix:hover { box-shadow: 0 26px 60px rgb(229 9 20 / .22), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-hulu {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(28 231 131 / .24), transparent 68%),
    linear-gradient(160deg, #0b241c 0%, #081210 100%);
}
.app-hulu:hover { box-shadow: 0 26px 60px rgb(28 231 131 / .2), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-prime {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(7 121 255 / .3), transparent 68%),
    linear-gradient(160deg, #0a1f3d 0%, #070e1c 100%);
}
.app-prime:hover { box-shadow: 0 26px 60px rgb(7 121 255 / .24), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-appletv {
  background:
    radial-gradient(85% 75% at 50% 30%, rgb(255 255 255 / .14), transparent 68%),
    linear-gradient(160deg, #212530 0%, #0e1017 100%);
}
.app-appletv:hover { box-shadow: 0 26px 60px rgb(255 255 255 / .12), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .24); }

.app-twitch {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(145 70 255 / .34), transparent 68%),
    linear-gradient(160deg, #241342 0%, #0e0a1a 100%);
}
.app-twitch:hover { box-shadow: 0 26px 60px rgb(145 70 255 / .26), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-spotify {
  background:
    radial-gradient(85% 75% at 50% 34%, rgb(30 215 96 / .24), transparent 68%),
    linear-gradient(160deg, #0d2417 0%, #08120c 100%);
}
.app-spotify:hover { box-shadow: 0 26px 60px rgb(30 215 96 / .2), 0 18px 40px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .22); }

.app-logo {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  filter: drop-shadow(0 12px 26px rgb(0 0 0 / .48));
}
.brand-img {
  display: block;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  max-height: 76px;
}
.brand-img.logo-yt { width: 84px; height: auto; }
.brand-img.logo-disney { width: 138px; height: auto; filter: brightness(0) invert(1); }
.brand-img.logo-hbo { width: 112px; height: auto; filter: brightness(0) invert(1); }
.brand-img.logo-netflix { width: 132px; height: auto; }
.brand-img.logo-hulu { width: 116px; height: auto; }
.brand-img.logo-prime { width: 88px; height: auto; border-radius: 18px; }
.brand-img.logo-appletv { width: 122px; height: auto; filter: brightness(0) invert(1); }
.brand-img.logo-twitch { width: 118px; height: auto; filter: brightness(0) invert(1); }
.brand-img.logo-spotify { width: 138px; height: auto; }
.app-tile.compact .brand-img { max-height: 36px; width: auto; max-width: 110px; }

/* ---- Resume last watched pill & Home app picker ------------------------------------------------------------- */
.resume-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, rgb(255 176 32 / .14), rgb(255 176 32 / .03) 65%), var(--panel);
  border: 1px solid rgb(255 176 32 / .28);
  border-radius: 18px;
  padding: 6px 8px 6px 10px;
  box-shadow: 0 10px 28px rgb(0 0 0 / .28);
}
.resume-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 6px;
  border-radius: 12px;
}
.resume-main:hover { background: rgb(255 255 255 / .04); }
.resume-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 14px rgb(255 176 32 / .35);
}
.resume-meta { display: flex; flex-direction: column; min-width: 0; }
.resume-k { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.resume-v { font-size: .98rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-x { width: 40px; height: 40px; }
.app-picks { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 10px; }

/* ---- Favorite star button on TV Guide & Tiles --------------------------------------------------------------- */
.fav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--text-3);
  transition: color .14s ease, background .14s ease, transform .1s ease;
}
.fav-btn:hover { background: rgb(255 255 255 / .08); color: var(--text); }
.fav-btn:active { transform: scale(.9); }
.fav-btn.on { color: var(--accent); }
.tile-art .fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgb(0 0 0 / .38);
  border: 1px solid rgb(255 255 255 / .1);
}
.epg-cat-row.fav .group-title { color: var(--accent); }
.app-foot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgb(255 255 255 / .08);
}
.app-name { font-size: 1.08rem; font-weight: 700; letter-spacing: -.015em; }
.app-status {
  font-size: .78rem;
  font-weight: 600;
  color: rgb(255 255 255 / .72);
  background: rgb(255 255 255 / .09);
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-status.live { background: rgb(61 220 132 / .18); color: #6ef0a8; }

.app-dock.compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 14px;
}
.app-tile.compact {
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  padding: 14px 16px 12px;
}
.app-tile.compact .app-logo svg { max-height: 36px; width: auto; }
.app-tile.compact .app-foot { padding-top: 6px; }
.app-tile.compact .app-name { font-size: .92rem; }

.launcher-quick {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.quick-pill {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgb(255 255 255 / .045);
  border: 1px solid var(--line);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  transition: background .15s, color .15s, border-color .15s;
}
.quick-pill:hover { background: rgb(255 255 255 / .09); color: var(--text); border-color: var(--line-strong); }

/* ---- TV ----------------------------------------------------------------------------------------------------- */
.group-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--text);
  margin: 28px 0 14px;
}
.groups .group-title:first-child { margin-top: 4px; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 18px 16px; }
.tile-art {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  padding: 14px;
  color: rgb(255 255 255 / .95);
  border: 1px solid rgb(255 255 255 / .1);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .14), 0 8px 22px rgb(0 0 0 / .34);
  transition: box-shadow .16s ease, border-color .16s ease;
}
.tile-mark {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-shadow: 0 4px 16px rgb(0 0 0 / .45);
}
.tile-mark.sm { font-size: 1.12rem; letter-spacing: .06em; }
.tile-live {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgb(0 0 0 / .45);
  border: 1px solid rgb(255 255 255 / .1);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: rgb(255 255 255 / .86);
}
.tile-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); }
.card.tile:hover .tile-art {
  border-color: rgb(255 255 255 / .24);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 12px 28px rgb(0 0 0 / .44);
}
.card.tile.off { opacity: .62; }

/* ---- Live TV Guide (EPG style) ------------------------------------------------------------------------------ */
.tv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tv-cats {
  flex: 1;
  min-width: 220px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.tv-cats::-webkit-scrollbar { display: none; }
.tv-cats .chip { min-height: 38px; padding: 0 15px; font-size: .85rem; flex: none; }
.tv-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tv-bar-right .search.slim { width: 220px; height: 42px; padding: 0 10px 0 14px; }
.tv-mode button { min-height: 34px; padding: 0 14px; font-size: .84rem; }

.epg {
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  box-shadow: 0 16px 44px rgb(0 0 0 / .38);
}
.epg-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 296px 1fr;
  background: rgb(13 17 26 / .96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-strong);
}
.epg-corner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: .03em;
  text-transform: uppercase;
  border-right: 1px solid var(--line);
}
.epg-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 10px var(--live); }
.epg-times {
  position: relative;
  display: grid;
  grid-template-columns: 2fr 1.25fr 1fr;
  align-items: stretch;
}
.epg-time {
  position: relative;
  padding: 12px 15px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.epg-time:first-child { border-left: 0; color: var(--text); }
.epg-now-pill {
  background: rgb(255 176 32 / .18);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.epg-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgb(255 176 32 / .7);
  pointer-events: none;
}

.epg-body { display: grid; }
.epg-cat-row {
  padding: 10px 18px 8px;
  background: rgb(7 9 14 / .65);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.epg-cat-row:first-child { border-top: 0; }
.epg-cat-row .group-title { margin: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }

.epg-row {
  display: grid;
  grid-template-columns: 296px 1fr;
  width: 100%;
  cursor: pointer;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background .14s ease;
}
.epg-row:last-child { border-bottom: 0; }
.epg-row:hover { transform: none; background: rgb(255 255 255 / .045); }
.epg-row:active { transform: none; background: rgb(255 176 32 / .09); }

.epg-ch {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  min-width: 0;
  background: rgb(11 14 21 / .55);
}
.epg-num {
  width: 30px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex: none;
}
.epg-badge {
  width: 56px;
  height: 36px;
  padding: 0 4px;
  overflow: hidden;
  border-radius: 9px;
  border: 1px solid rgb(255 255 255 / .12);
  display: grid;
  place-items: center;
  flex: none;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: #fff;
}
.epg-badge .sm { font-size: .56rem; letter-spacing: .02em; }
.epg-ch-meta { min-width: 0; flex: 1; }
.epg-ch-name { font-size: .92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-ch-sub { font-size: .74rem; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.epg-slots {
  display: grid;
  grid-template-columns: 2fr 1.25fr 1fr;
  min-width: 0;
}
.epg-slot {
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  border-left: 1px solid var(--line);
}
.epg-slot:first-child { border-left: 0; }
.epg-slot.on-now {
  background: linear-gradient(90deg, rgb(255 176 32 / .1), rgb(255 176 32 / .02) 65%);
  box-shadow: inset 3px 0 0 var(--accent);
}
.epg-row:hover .epg-slot.on-now { background: linear-gradient(90deg, rgb(255 176 32 / .16), rgb(255 176 32 / .04) 70%); }
.epg-slot.upcoming { background: rgb(255 255 255 / .015); }
.epg-slot.upcoming.dim { opacity: .62; }
.epg-slot-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.epg-prog { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-slot.upcoming .epg-prog { color: var(--text-2); font-weight: 500; font-size: .86rem; }
.epg-live-tag {
  background: var(--live);
  color: #fff;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 5px;
  flex: none;
}
.epg-prog-meta { font-size: .74rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.epg-bar { height: 3px; border-radius: 3px; background: rgb(255 255 255 / .12); margin-top: 4px; overflow: hidden; }
.epg-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cat {
  min-height: 60px;
  padding: 0 16px 0 20px;
  border-radius: var(--r);
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  transition: background .14s ease, border-color .14s ease;
}
.cat:hover { background: var(--panel-2); border-color: var(--line-strong); }
.cat span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat small { color: var(--text-3); font-weight: 500; }
.cat .ic { color: var(--text-3); }

.chan-list { display: grid; gap: 8px; }
.chan-row {
  display: grid;
  grid-template-columns: 96px minmax(140px, 1fr) minmax(0, 2.2fr);
  gap: 16px;
  align-items: center;
  min-height: 74px;
  padding: 8px 18px 8px 8px;
  border-radius: var(--r);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: background .14s ease, border-color .14s ease;
}
.chan-row:hover { background: var(--panel-2); border-color: var(--line-strong); }
.chan-logo { width: 96px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--panel-2); display: grid; }
.chan-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.chan-logo .tile-art { border-radius: 0; font-size: 1.05rem; aspect-ratio: auto; height: 100%; border: 0; box-shadow: none; }
.chan-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide { min-width: 0; }
.now { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.g-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-time { color: var(--text-3); white-space: nowrap; }
.g-bar { height: 4px; border-radius: 4px; background: rgb(255 255 255 / .12); margin: 6px 0; overflow: hidden; }
.g-bar i { display: block; height: 100%; background: var(--accent); }
.next { color: var(--text-3); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid.posters { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 24px 18px; }
.poster-art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r);
  overflow: hidden;
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}
.poster-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-name { padding: 14px; text-align: center; color: var(--text-3); font-weight: 600; }
.progress, .progress i { position: absolute; left: 0; bottom: 0; height: 4px; }
.progress { right: 0; background: rgb(255 255 255 / .24); }
.progress i { background: var(--accent); }
.series-head { display: flex; gap: 20px; margin-bottom: 20px; color: var(--text-2); max-width: 900px; }
.series-head img { width: 130px; border-radius: 12px; flex: none; }
.season { margin: 22px 0 10px; font-size: 1rem; color: var(--text-2); }
.ep-list { display: grid; gap: 8px; max-width: 1000px; }
.ep-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 66px;
  padding: 10px 18px 10px 10px;
  border-radius: var(--r);
  background: var(--panel);
  border: 1px solid var(--line);
}
.ep-row:hover { background: var(--panel-2); }
.ep-n { width: 46px; height: 46px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; color: var(--text-2); }
.ep-row .s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ep-d { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---- watch screen ------------------------------------------------------------------------------------------- */
.watch { position: fixed; inset: 0; background: #000; z-index: 50; overflow: hidden; user-select: none; -webkit-user-select: none; }
.watch:not(.hud-on) { cursor: none; }
.w-stage { position: absolute; inset: 0; }
.w-ytbar, .w-ytfooter { display: none; }
.watch.youtube-player { display: flex; flex-direction: column; cursor: auto; overflow: auto; background: var(--bg); }
.youtube-player .w-ytbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgb(11 14 21 / .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.w-ytbar span { flex: 1; min-width: 0; font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-ytbar a { white-space: nowrap; min-height: 42px; padding: 0 16px; font-size: .88rem; }
.w-ytbar a, a.card.tile { color: inherit; text-decoration: none; }
.youtube-player .w-stage { position: relative; flex: 1 0 200px; min-height: 200px; background: #000; }
.youtube-player .w-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.youtube-player .w-ytfooter { display: block; max-height: 28vh; overflow: auto; padding: 12px 18px; background: var(--rail); border-top: 1px solid var(--line); }
.youtube-player .w-ytfooter:empty { display: none; }
.youtube-player :is(.pl-canvas, .w-hud, .w-veil, .w-caps, .w-stats) { display: none; }

.pl-canvas { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.w-caps { position: absolute; left: 6%; right: 6%; bottom: 7%; text-align: center; pointer-events: none; transition: bottom .2s; }
.hud-on .w-caps { bottom: 190px; }
.w-caps span { display: inline; background: rgb(0 0 0 / .78); padding: 4px 12px; border-radius: 8px; font-size: clamp(1.2rem, 2.6vw, 2rem); line-height: 1.5; box-decoration-break: clone; -webkit-box-decoration-break: clone; white-space: pre-line; }
.w-veil { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.w-veil > * { pointer-events: auto; }
.w-veil .spinner { width: 64px; height: 64px; border-width: 5px; pointer-events: none; }

.w-error {
  background: rgb(16 20 30 / .94);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  padding: 28px 34px;
  max-width: min(560px, 86vw);
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
  box-shadow: 0 24px 60px rgb(0 0 0 / .65);
  z-index: 3;
}
.w-error p { color: var(--text-2); }

.w-hud { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; opacity: 0; pointer-events: none; transition: opacity .18s; background: linear-gradient(rgb(0 0 0 / .72), transparent 24%, transparent 58%, rgb(0 0 0 / .86)); }
.hud-on .w-hud { opacity: 1; pointer-events: auto; }
.w-top { display: flex; align-items: center; gap: 10px; padding: 16px 20px; }
.w-top .icon-btn { color: #fff; width: 58px; height: 58px; }
.w-titles { flex: 1; min-width: 0; }
.w-title { font-size: 1.25rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-sub { color: var(--text-2); font-size: .95rem; padding: 3px 0; }
.w-sub:disabled { opacity: 1; cursor: default; }
.w-tools { display: flex; gap: 4px; }
.w-mid { display: flex; align-items: center; justify-content: center; gap: clamp(28px, 7vw, 86px); }
[data-state="loading"] .w-mid, [data-state="buffering"] .w-mid, [data-state="error"] .w-mid { visibility: hidden; }
.w-big, .w-side {
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgb(12 15 22 / .64);
  backdrop-filter: blur(12px);
  border: 1px solid rgb(255 255 255 / .12);
  color: #fff;
  transition: transform .12s ease, background .14s ease;
}
.w-big { width: 98px; height: 98px; }
.w-side { width: 74px; height: 74px; }
.w-big:hover, .w-side:hover { background: rgb(20 25 36 / .82); }
.w-big:active, .w-side:active { transform: scale(.92); }

.w-bottom { padding: 0 26px 20px; display: grid; gap: 12px; }
.w-scrub { display: flex; align-items: center; gap: 16px; }
.w-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 54px; text-align: center; }
.w-track { position: relative; flex: 1; height: 44px; cursor: pointer; touch-action: none; }
.w-track::before, .w-buf, .w-pos { content: ""; position: absolute; left: 0; top: 18px; height: 7px; border-radius: 8px; }
.w-track::before { right: 0; background: rgb(255 255 255 / .22); }
.w-buf { background: rgb(255 255 255 / .34); }
.w-pos { background: var(--accent); }
.w-knob { position: absolute; top: 10px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .6); }
.w-tip { position: absolute; bottom: 46px; transform: translateX(-50%); background: #fff; color: #000; font-weight: 700; padding: 5px 12px; border-radius: 10px; display: none; font-variant-numeric: tabular-nums; }
.w-track.drag .w-tip { display: block; }
.w-track.drag .w-knob { transform: scale(1.25); }
.w-live { display: none; background: var(--live); padding: 3px 12px; border-radius: 8px; font-weight: 800; letter-spacing: .05em; font-size: .85rem; }
.is-live .w-live { display: inline-block; }
.is-live .w-track, .is-live .w-time { visibility: hidden; }
.is-live .w-scrub { justify-content: flex-end; height: 30px; }
.is-live .w-track, .is-live .w-time { display: none; }

.w-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.w-actions:empty, .w-strip:empty { display: none; }
.w-actions .chip { background: rgb(20 24 34 / .82); color: #fff; }
.w-actions .chip.on { background: var(--accent); color: var(--accent-ink); }
.w-strip { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.w-strip::-webkit-scrollbar { display: none; }
.w-next { flex: none; width: 210px; }
.w-next-img { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--panel) center / cover; border: 1px solid var(--line); }
.w-next-title { font-size: .85rem; font-weight: 600; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.w-next-by { font-size: .76rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.w-menu {
  position: absolute;
  right: 18px;
  top: 78px;
  width: min(350px, 82vw);
  max-height: calc(100% - 110px);
  background: rgb(15 19 29 / .96);
  backdrop-filter: blur(22px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgb(0 0 0 / .65);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 6;
}
.w-menu.on { display: flex; }
.w-menu-title { padding: 15px 20px 8px; color: var(--text-3); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
.w-menu-list { overflow-y: auto; padding: 0 8px 8px; }
.w-row { width: 100%; min-height: 52px; padding: 0 14px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: .95rem; }
.w-row:hover { background: rgb(255 255 255 / .06); }
.w-row:active { background: var(--panel-2); }
.w-row.on { color: var(--accent); background: var(--accent-soft); }
.w-stats { position: absolute; left: 14px; top: 88px; margin: 0; padding: 8px 12px; background: rgb(0 0 0 / .74); border: 1px solid var(--line); border-radius: 10px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cfe; pointer-events: none; z-index: 2; }

/* ---- sheets, sign-in, settings ------------------------------------------------------------------------------ */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgb(4 6 10 / .72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.sheet {
  width: min(540px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 28px 72px rgb(0 0 0 / .65);
  animation: rise .2s ease-out;
}
.sheet.wide { width: min(860px, 100%); }
@keyframes rise { from { transform: translateY(14px) scale(.985); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 8px 26px; }
.sheet-head h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.sheet-body { padding: 8px 26px 26px; }
.signin { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 14px; font-size: 1.02rem; color: var(--text-2); }
.steps b { color: var(--text); }
.qr-side { display: grid; gap: 12px; justify-items: center; }
.qr { width: 228px; height: 228px; background: #fff; border-radius: 18px; padding: 10px; display: grid; box-shadow: 0 12px 32px rgb(0 0 0 / .4); }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.code { font: 700 1.65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-align: center; }
.code-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; color: var(--text-2); }

.form { display: grid; gap: 14px; }
.form-part { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--text-2); font-size: .88rem; font-weight: 600; }
.text-in {
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  padding: 0 16px;
  outline: 0;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(255 176 32 / .15); }
.text-in.small { width: 190px; height: 46px; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--text-2); transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--text); color: #090b10; }

.switch { width: 60px; height: 36px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-strong); position: relative; flex: none; transition: background .16s ease, border-color .16s ease; }
.switch i { position: absolute; left: 3px; top: 3px; width: 28px; height: 28px; border-radius: 50%; background: var(--text-2); transition: transform .16s ease, background .16s ease; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on i { transform: translateX(24px); background: var(--accent-ink); }

.slider { display: flex; align-items: center; gap: 12px; }
.slider input { width: 210px; accent-color: var(--accent); height: 38px; }
.set-value { min-width: 74px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .92rem; }

.settings { display: grid; gap: 16px; max-width: 920px; }
.set-card {
  background: linear-gradient(165deg, rgb(20 25 38 / .92), rgb(14 18 28 / .96));
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 22px 26px;
  display: grid;
  gap: 2px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .3), inset 0 1px 0 rgb(255 255 255 / .06);
}
.set-card h2 { font-size: 1.08rem; font-weight: 700; display: flex; align-items: center; gap: 11px; margin-bottom: 8px; }
.set-card h2 .ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgb(255 176 32 / .24);
  color: var(--accent);
}
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-card h2 + .set-row, .set-card .set-hint + .set-row { border-top: 0; }
.set-row > div:first-child { flex: 1; min-width: 220px; }
.set-title { font-weight: 600; font-size: .97rem; }
.set-hint { color: var(--text-3); font-size: .88rem; margin-top: 2px; line-height: 1.4; }
.set-card > .row { padding-top: 12px; }

/* ---- lock / pairing screen ---------------------------------------------------------------------------------- */
.pair {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(640px 420px at 50% 18%, rgb(255 176 32 / .11), transparent 70%),
    radial-gradient(500px 360px at 50% 88%, rgb(84 122 255 / .06), transparent 72%),
    var(--bg);
}
.pair-card {
  width: min(400px, 100%);
  padding: 32px 28px 30px;
  border-radius: 30px;
  background: linear-gradient(165deg, rgb(22 27 40 / .88), rgb(14 17 26 / .94));
  backdrop-filter: blur(24px);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgb(0 0 0 / .62), inset 0 1px 0 rgb(255 255 255 / .08);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
}
.pair-emblem {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  background: linear-gradient(145deg, #1b2233, #111521);
  border: 1px solid rgb(255 176 32 / .36);
  box-shadow: 0 12px 28px rgb(0 0 0 / .48), 0 0 32px rgb(255 176 32 / .14);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.pair-emblem svg { width: 38px; height: 38px; display: block; }
.pair-kicker {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}
.pair h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.025em; }
.pair-sub { color: var(--text-2); font-size: .92rem; min-height: 1.4em; max-width: 30ch; }
.pair-sub.bad { color: var(--bad); font-weight: 500; }

.pin-dots {
  display: flex;
  gap: 14px;
  margin: 10px 0 14px;
  align-items: center;
  justify-content: center;
}
.pin-dots span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgb(255 255 255 / .24);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pin-dots span.on {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.16);
  box-shadow: 0 0 14px rgb(255 176 32 / .55);
}
.pin-dots.busy span.on { opacity: .65; }
.pin-dots.shake { animation: pin-shake .36s ease; }
@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  45% { transform: translateX(8px); }
  70% { transform: translateX(-5px); }
  88% { transform: translateX(4px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 12px 18px;
  margin-top: 4px;
}
.key {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgb(255 255 255 / .055);
  border: 1px solid rgb(255 255 255 / .09);
  font-size: 1.65rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  transition: background .12s ease, border-color .12s ease, transform .1s ease;
}
.key:hover { background: rgb(255 255 255 / .11); border-color: rgb(255 255 255 / .18); }
.key:active { background: rgb(255 176 32 / .2); border-color: rgb(255 176 32 / .45); transform: scale(.93); }
.key-del { background: transparent; border-color: transparent; color: var(--text-2); }
.key-del:hover { background: rgb(255 255 255 / .06); color: var(--text); border-color: transparent; }

/* ---- compact landscape (car screen like 1024x600) ----------------------------------------------------------- */
@media (max-height: 660px) {
  .pair { padding: 12px; }
  .pair-card { padding: 20px 26px 20px; gap: 6px; border-radius: 26px; }
  .pair-emblem { width: 52px; height: 52px; border-radius: 16px; }
  .pair-emblem svg { width: 30px; height: 30px; }
  .pair h1 { font-size: 1.35rem; }
  .pin-dots { margin: 6px 0 8px; }
  .keypad { grid-template-columns: repeat(3, 64px); gap: 8px 16px; }
  .key { width: 64px; height: 64px; font-size: 1.45rem; }
  .launcher { gap: 22px; padding: 4px 0 12px; }
  .app-dock { gap: 18px; max-width: 740px; width: 100%; margin: 0 auto; }
  .app-tile { border-radius: 24px; padding: 18px 18px 16px; }
}

/* ---- narrow screens (phones) -------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  :root { font-size: 15px; }
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgb(11 14 21 / .92);
    backdrop-filter: blur(18px);
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
  }
  .rail .brand, .rail .grow { display: none; }
  .nav { width: 74px; height: 56px; border-radius: 14px; }
  .nav.on::before { display: none; }
  #view { padding: 16px 16px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .view-top.inline { grid-template-columns: 1fr; }
  .launcher { justify-content: flex-start; gap: 22px; padding-top: 8px; }
  .launcher-top .search { width: 100%; }
  .app-dock { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
  .app-tile { flex: 0 0 calc(50% - 7px); border-radius: 24px; padding: 18px 16px 14px; }
  .app-logo svg { max-width: 96px; height: auto; }
  .brand-img.logo-yt { width: 64px; }
  .brand-img.logo-disney { width: 108px; }
  .brand-img.logo-hbo { width: 88px; }
  .tv-bar-right { width: 100%; justify-content: space-between; }
  .tv-bar-right .search.slim { flex: 1; width: auto; }
  .epg-head { grid-template-columns: 1fr; }
  .epg-corner { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .epg-times { grid-template-columns: 1fr; }
  .epg-time:not(:first-child) { display: none; }
  .epg-row { grid-template-columns: 1fr; }
  .epg-ch { border-right: 0; border-bottom: 1px solid rgb(255 255 255 / .05); padding: 10px 12px; }
  .epg-slots { grid-template-columns: 1fr; }
  .epg-slot.upcoming { display: none; }
  .app-name { font-size: .96rem; }
  .app-status { font-size: .72rem; padding: 3px 8px; }
  .launcher-quick { display: none; }
  .app-dock.compact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .app-tile.compact { padding: 10px; border-radius: 16px; }
  .app-tile.compact .app-foot { display: none; }
  .signin { grid-template-columns: 1fr; }
  .qr-side { order: -1; }
  .chan-row { grid-template-columns: 72px 1fr; }
  .chan-row .g-slot { grid-column: 1 / -1; }
  .chan-logo { width: 72px; height: 46px; }
  .w-big { width: 82px; height: 82px; }
  .w-side { width: 62px; height: 62px; }
  .w-next { width: 170px; }
  .pair-card { padding: 28px 20px 26px; border-radius: 26px; }
  .keypad { grid-template-columns: repeat(3, 72px); gap: 12px 16px; }
  .key { width: 72px; height: 72px; }
}
@media (max-height: 620px) { .w-strip { display: none; } .hud-on .w-caps { bottom: 120px; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; transition: none !important; } }

/* ---- games -------------------------------------------------------------------------------------------------- */
.host-head { display: flex; align-items: center; gap: 8px; }
.host-head .group-title { flex: 1; }
.note.small { padding: 0 0 10px; font-size: .88rem; color: var(--text-3); max-width: 80ch; }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px 18px; margin-bottom: 12px; }
.game-art {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  color: rgb(255 255 255 / .92);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 34px rgb(0 0 0 / .42), inset 0 1px 0 rgb(255 255 255 / .12);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.game-art.cover { padding: 0; background: #0a0d16; }
.game-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .28s cubic-bezier(.22, 1, .36, 1); }
.card.game:hover .game-art {
  border-color: rgb(255 176 32 / .42);
  box-shadow: 0 20px 44px rgb(0 0 0 / .56), 0 0 0 1px rgb(255 176 32 / .18);
}
.card.game:hover .game-art img { transform: scale(1.05); }
.game-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(7 9 14 / .76);
  backdrop-filter: blur(10px);
  border: 1px solid rgb(255 255 255 / .14);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.game-play-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .76rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgb(0 0 0 / .45);
  opacity: .92;
  transition: transform .16s ease, opacity .16s ease;
}
.card.game:hover .game-play-pill { opacity: 1; transform: scale(1.04); }
.game-art.desk { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px dashed var(--line-strong); color: var(--text-2); }
.game-art.word { background: linear-gradient(140deg, #5c3d04, #1b2840); color: var(--accent); border-color: rgb(255 176 32 / .24); }
.steps.small { font-size: .92rem; gap: 8px; }
.watch.game { background: #000; }
.gm-stage { position: absolute; inset: 0; touch-action: none; }
.gm-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.gm-bar { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -140%); transition: transform .2s; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: rgb(14 18 28 / .92); backdrop-filter: blur(14px); border: 1px solid var(--line-strong); z-index: 3; max-width: 94vw; }
.hud-on .gm-bar { transform: translate(-50%, 0); }
.gm-name { font-weight: 700; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.gm-stat { color: var(--text-3); font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 6px; }
.gm-typer { position: absolute; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
.gm-wait { position: absolute; margin-top: 130px; color: var(--text-2); pointer-events: none; }
.watch.game .w-menu { top: 84px; right: 50%; transform: translateX(50%); }
.type-area { width: 100%; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); padding: 16px; font: inherit; font-size: 1.05rem; outline: 0; resize: vertical; }
.type-area:focus { border-color: var(--accent); }
.kb-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; max-width: 680px; margin-bottom: 18px; }
.kb-wrap { display: grid; gap: 16px; max-width: 680px; }
.kb-status { color: var(--text-2); font-size: .9rem; }
.kb-live-in { height: 58px; font-size: 1.08rem; background: var(--panel); }
.kb-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-key {
  min-width: 64px;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-weight: 700;
  font-size: .92rem;
  display: inline-grid;
  place-items: center;
  transition: background .12s, transform .1s;
}
.kb-key:hover { background: var(--panel-hover); }
.kb-key:active { transform: scale(.94); background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.kb-batch { display: grid; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
a.btn { text-decoration: none; color: inherit; }

/* ---- word of the day ---------------------------------------------------------------------------------------- */
.wd-msg { min-height: 1.6em; text-align: center; color: var(--text-2); margin-bottom: 10px; font-weight: 600; font-size: .95rem; }
.wd-msg.bad { color: var(--bad); }
.wd-msg.good { color: var(--good); }
.wd-grid { display: grid; gap: 7px; justify-content: center; margin-bottom: 18px; }
.wd-row { display: grid; grid-template-columns: repeat(5, 52px); gap: 7px; }
.wd-cell { height: 52px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: rgb(255 255 255 / .02); display: grid; place-items: center; font-size: 1.45rem; font-weight: 800; }
.wd-cell.typed { border-color: var(--text-2); }
.wd-cell.m0 { background: #242a38; border-color: transparent; color: var(--text-2); }
.wd-cell.m1 { background: #2c6fb8; border-color: transparent; }
.wd-cell.m2 { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.wd-keys { display: grid; gap: 7px; justify-items: center; }
.wd-kr { display: flex; gap: 6px; }
.wd-key { width: 42px; height: 52px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 700; display: grid; place-items: center; }
.wd-key.wide { width: 72px; font-size: .84rem; }
.wd-key:hover { background: var(--panel-hover); }
.wd-key:active { transform: scale(.94); }
.wd-key.m0 { background: #191d27; color: var(--text-3); }
.wd-key.m1 { background: #2c6fb8; border-color: transparent; }
.wd-key.m2 { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
@media (max-width: 760px) { .wd-row { grid-template-columns: repeat(5, 46px); } .wd-cell { height: 46px; } .wd-key { width: 30px; height: 46px; } .wd-key.wide { width: 50px; } }

/* ---- built-in arcade mini-games ----------------------------------------------------------------------------- */
.mg-glyph { font-size: 1.85rem; font-weight: 900; letter-spacing: .04em; text-shadow: 0 6px 20px rgb(0 0 0 / .45); }
.game-art.mg-2048 { background: linear-gradient(140deg, #7c4700, #23190f); color: #ffd070; border-color: rgb(255 176 32 / .28); }
.game-art.mg-snake { background: linear-gradient(140deg, #0d4b31, #0b1b18); color: #6ef0a8; border-color: rgb(61 220 132 / .28); }
.game-art.mg-break { background: linear-gradient(140deg, #5e1834, #17122a); color: #ff7c98; border-color: rgb(255 71 87 / .28); }
.game-art.mg-mem { background: linear-gradient(140deg, #163b6e, #0e1629); color: #7cc8ff; border-color: rgb(56 182 255 / .28); }
.game-art.mg-react { background: linear-gradient(140deg, #2e4a12, #121c0f); color: #a7f464; border-color: rgb(167 244 100 / .28); }
.game-art.mg-ttt { background: linear-gradient(140deg, #3c1f63, #131126); color: #c79dff; border-color: rgb(168 122 255 / .28); }

.mg-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mg-stats { display: flex; gap: 10px; }
.mg-stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; display: grid; text-align: center; min-width: 72px; }
.mg-stat small { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 700; }
.mg-val { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mg-msg { text-align: center; color: var(--text-2); font-size: .92rem; font-weight: 600; min-height: 1.5em; margin-bottom: 12px; }
.mg-msg.good { color: var(--good); }
.mg-msg.bad { color: var(--bad); }
.mg-canvas { display: block; margin: 0 auto; max-width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line-strong); touch-action: none; background: #090c14; }
.mg-canvas.wide { width: 100%; max-width: 560px; }
.mg-dpad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; margin-top: 14px; }
.mg-dpad .kb-key { width: 64px; height: 52px; padding: 0; font-size: 1.25rem; }

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
  padding: 10px;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  touch-action: none;
}
.g2048-cell {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgb(255 255 255 / .045);
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.g2048-cell.v2 { background: #1c2333; color: #eef0f5; }
.g2048-cell.v4 { background: #263147; color: #eef0f5; }
.g2048-cell.v8 { background: #b85d19; color: #fff; }
.g2048-cell.v16 { background: #d45b24; color: #fff; }
.g2048-cell.v32 { background: #e04646; color: #fff; }
.g2048-cell.v64 { background: #d62851; color: #fff; }
.g2048-cell.v128 { background: #c98b16; color: #fff; font-size: 1.35rem; }
.g2048-cell.v256 { background: #dea018; color: #1b1200; font-size: 1.35rem; }
.g2048-cell.v512 { background: #f2b424; color: #1b1200; font-size: 1.35rem; }
.g2048-cell.v1024 { background: #3ddc84; color: #05240f; font-size: 1.15rem; }
.g2048-cell.v2048, .g2048-cell.vhi { background: #ffb020; color: #1b1200; font-size: 1.15rem; box-shadow: 0 0 24px rgb(255 176 32 / .45); }

.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 380px; margin: 0 auto; }
.mem-card {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--panel-2), #121726);
  border: 1px solid var(--line-strong);
  font-size: 2rem;
  display: grid;
  place-items: center;
  transition: transform .14s ease, background .16s ease, border-color .16s ease;
}
.mem-card:active { transform: scale(.94); }
.mem-card.up { background: #1e273d; border-color: rgb(255 176 32 / .45); }
.mem-card.done { background: rgb(61 220 132 / .14); border-color: rgb(61 220 132 / .4); }

.react-pad {
  width: 100%;
  min-height: 240px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  transition: background .12s ease;
}
.react-pad.wait { background: #5a1822; border-color: rgb(255 71 87 / .5); }
.react-pad.go { background: #15803d; border-color: #4ade80; }
.react-pad.early { background: #7c2d12; border-color: #fb923c; }
.react-pad.done { background: #152540; border-color: rgb(56 182 255 / .45); }
.react-big { font-size: 2.3rem; font-weight: 900; letter-spacing: -.03em; }
.react-sub { color: rgb(255 255 255 / .78); font-size: .95rem; font-weight: 600; }

.ttt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 310px; margin: 0 auto; }
.ttt-cell {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-size: 2.4rem;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.ttt-cell:hover { background: var(--panel-hover); }
.ttt-cell.pX { color: var(--accent); }
.ttt-cell.pO { color: #56c2ff; }
.ttt-cell.win { background: rgb(255 176 32 / .18); border-color: var(--accent); }
