/* TapTV Store — high-fidelity match to design-references 01–04 */
:root {
  --bg: #eaf3ff;
  --bg2: #f2f7ff;
  --panel: #ffffff;
  --panel2: #f7faff;
  --sidebar: rgba(255, 255, 255, 0.82);
  --text: #0d1934;
  --muted: #6a7b99;
  --line: rgba(46, 115, 255, 0.12);
  --accent: #2e73ff;
  --accent2: #13a9ff;
  --accent3: #5b5cf6;
  --glow: rgba(46, 115, 255, 0.45);
  --shadow: 0 12px 32px rgba(39, 80, 139, 0.10);
  --shadow-soft: 0 6px 18px rgba(13, 25, 52, 0.06);
  --radius: 18px;
  --radius-lg: 22px;
  --side-w: 220px;
  --nav-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: 200ms ease;
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent), 0 0 22px var(--glow);
  --hero-day: url('/assets/img/hero-day.webp');
  --hero-night: url('/assets/img/hero-night.webp');
  --hero-m-day: url('/assets/img/hero-mobile-day.png');
  --hero-m-night: url('/assets/img/hero-mobile-night.png');
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #030b18;
  --bg2: #061426;
  --panel: #0b1d38;
  --panel2: #10254a;
  --sidebar: rgba(6, 20, 40, 0.88);
  --text: #f4f8ff;
  --muted: #98acce;
  --line: rgba(46, 115, 255, 0.22);
  --accent: #2e73ff;
  --accent2: #13a9ff;
  --glow: rgba(19, 169, 255, 0.55);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.28);
  --focus: 0 0 0 2px #e8f3ff, 0 0 0 4px #2e73ff, 0 0 26px rgba(46, 115, 255, 0.65);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(700px 420px at 0% 100%, color-mix(in srgb, var(--accent2) 10%, transparent), transparent 70%),
    linear-gradient(160deg, var(--bg), var(--bg2));
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.phone-only { display: none !important; }
.tv-only { display: none !important; }
.phone-chrome { display: grid; place-items: center; }

.app-shell { min-height: 100%; display: grid; grid-template-columns: 1fr; }
.sidebar { display: none; }
.main { min-width: 0; padding: 12px 14px calc(var(--nav-h) + var(--safe-b) + 14px); }

/* Brand */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -.03em;
}
.brand b { color: var(--accent); font-weight: 800; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #3de5ff, #2e73ff 48%, #8b5cf6);
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(46, 115, 255, .35), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand .logo svg { width: 16px; height: 16px; stroke: none; }

/* Top */
.topbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center;
  box-shadow: var(--shadow-soft);
  transition: transform var(--ease), box-shadow var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn.avatar { padding: 0; overflow: hidden; background: linear-gradient(135deg, #93c5fd, #c4b5fd); }
.icon-btn.avatar img { width: 100%; height: 100%; object-fit: cover; }
.clock {
  font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--muted); min-width: 56px; text-align: right; font-size: 14px;
}
.top-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 16px; box-shadow: var(--shadow-soft);
}
.top-search svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.top-search input { border: 0; outline: 0; background: transparent; width: 100%; }

.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 12px 14px; margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.search svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.mic { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 2px; }
.mic svg { width: 18px; height: 18px; }

/* ===== HERO — photographic mountains ===== */
.hero-wrap { position: relative; margin-bottom: 16px; }
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  min-height: 200px;
  aspect-ratio: 2 / 1;
  max-height: 280px;
  padding: 20px 18px 24px;
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.04) inset;
  /* Light theme: soft left shade for white text, bright day mountains visible */
  background:
    linear-gradient(100deg, rgba(8, 28, 64, .72) 0%, rgba(12, 40, 80, .38) 38%, rgba(8, 30, 60, .12) 62%, rgba(255,255,255,.02) 100%),
    var(--hero-m-day) 62% center / cover no-repeat;
  cursor: pointer;
  scroll-margin: 20px;
  transition: transform var(--ease), box-shadow var(--ease);
}
[data-theme="dark"] .hero {
  background:
    linear-gradient(100deg, rgba(2, 8, 20, .78) 0%, rgba(4, 16, 36, .45) 42%, rgba(3, 12, 28, .22) 100%),
    var(--hero-m-night) 62% center / cover no-repeat;
}
.hero.has-custom-banner { background-size: cover !important; background-position: center !important; }
.hero-shade { display: none; }
.hero-copy { position: relative; z-index: 2; max-width: 56%; }
.eyebrow {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 800; color: #c5dcff; margin-bottom: 6px;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.hero h2 {
  margin: 0; font-size: clamp(26px, 7vw, 34px);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  text-shadow: 0 2px 14px rgba(0,0,0,.45);
}
.hero p {
  margin: 6px 0 12px; font-size: 13px; line-height: 1.4; opacity: .94;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 10px rgba(0,0,0,.4);
}
.hero-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-54%);
  width: 96px; height: 96px; border-radius: 24px; object-fit: cover;
  z-index: 2; background: #0b1220;
  box-shadow: 0 16px 40px rgba(0,0,0,.45), 0 0 0 3px rgba(46,115,255,.5), 0 0 32px rgba(46,115,255,.4);
}
.dots { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1; display: flex; gap: 6px; }
.dots span { width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.35); }
.dots span.on { width: 18px; background: #fff; }
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 28px; line-height: 1; display: grid; place-items: center;
  box-shadow: var(--shadow-soft);
  transition: transform var(--ease);
}
.hero-arrow:hover { transform: translateY(-50%) scale(1.05); }
.hero-arrow.left { left: 2px; }
.hero-arrow.right { right: 2px; }

/* Chips */
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px;
  scrollbar-width: none; padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 9px 14px; font-weight: 650; font-size: 13px;
  box-shadow: var(--shadow-soft);
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease);
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { transform: translateY(-2px); }
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-color: transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15), 0 8px 20px var(--glow);
}

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 2px 0 10px;
}
.section-head h3 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.see-all {
  border: 0; background: transparent; color: var(--accent);
  font-weight: 700; font-size: 13px; padding: 4px 0;
}
.row-block { margin-bottom: 16px; }
.h-scroll {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 8px 2px 14px; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }

/* Phone vertical cards (Лучшее) */
.card-v {
  flex: 0 0 156px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 6px;
  scroll-margin: 16px;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.card-v:hover { transform: translateY(-3px); }
.card-v img {
  width: 72px; height: 72px; border-radius: 18px; object-fit: cover;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}
.card-v .t { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-v .d {
  color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 2.7em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-v .m { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.card-v .m .star { color: #f5b301; }
.card-v .btn { margin-top: auto; width: 100%; }

/* Phone recommend rows */
.list-stack { display: grid; gap: 10px; }
.list-row {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow-soft);
  scroll-margin: 16px;
  transition: transform var(--ease), box-shadow var(--ease);
}
.list-row:hover { transform: translateY(-2px); }
.list-row img { width: 58px; height: 58px; border-radius: 15px; object-fit: cover; }
.list-row .info { min-width: 0; }
.list-row .t { font-weight: 800; font-size: 14px; }
.list-row .d { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.tag {
  font-size: 11px; color: var(--muted);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 999px; padding: 2px 8px;
}

/* TV compact horizontal cards */
.app-card {
  flex: 0 0 210px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 11px;
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: 54px 1fr;
  column-gap: 10px; row-gap: 4px;
  align-items: start;
  min-height: 118px;
  scroll-margin: 24px;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease), background var(--ease);
}
.app-card:hover { transform: translateY(-3px) scale(1.01); }
.app-card img {
  width: 54px; height: 54px; border-radius: 14px; object-fit: cover;
  grid-row: 1 / span 2;
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}
.app-card .card-title {
  font-weight: 800; font-size: 13.5px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-card .card-desc {
  color: var(--muted); font-size: 11.5px; line-height: 1.3; min-height: 2.4em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-card .card-meta {
  grid-column: 1 / -1;
  color: var(--muted); font-size: 11.5px;
  display: flex; align-items: center; gap: 4px;
}
.app-card .card-meta .star { color: #f5b301; }
.app-card .btn {
  grid-column: 1 / -1;
  width: auto; justify-self: start;
  padding: 6px 14px; font-size: 12px;
  margin-top: 2px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; padding-bottom: 20px;
}

/* Buttons */
.btn {
  border: 0; border-radius: 999px; padding: 9px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform var(--ease), filter var(--ease), box-shadow var(--ease);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn.open {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent); box-shadow: none;
}
.btn.ghost {
  background: transparent; color: var(--accent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: none; padding: 8px 14px;
}
.btn.block { width: 100%; padding: 13px 16px; font-size: 15px; }

/* Focus / TV remote */
.is-focused, :focus-visible {
  outline: none;
}
.card-v.is-focused, .list-row.is-focused, .app-card.is-focused,
.side-link.is-focused, .side-link:focus-visible, .side-link.active,
.chip.is-focused, .nav-item.is-focused, .btn.is-focused,
.icon-btn:focus-visible, .hero:focus-visible, .hero-arrow:focus-visible,
.card-v:focus-visible, .list-row:focus-visible, .app-card:focus-visible,
.btn:focus-visible, .chip:focus-visible, .nav-item:focus-visible, .see-all:focus-visible {
  box-shadow: var(--focus);
  border-color: var(--accent);
}
.card-v.is-focused, .app-card.is-focused, .list-row.is-focused {
  transform: translateY(-2px) scale(1.02);
  z-index: 2;
}

/* Detail */
.detail-hero {
  position: relative;
  background:
    radial-gradient(500px 220px at 90% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  background-size: cover;
  background-position: center;
}
.detail-back { margin-bottom: 12px; }
.detail-head {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center;
  margin-bottom: 14px;
}
.detail-head img {
  width: 92px; height: 92px; border-radius: 24px; object-fit: cover;
  box-shadow: var(--shadow-soft);
}
.detail-head h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 6px; text-align: center; box-shadow: var(--shadow-soft);
}
.stat strong { display: block; font-size: 16px; }
.stat span { color: var(--muted); font-size: 11px; }
.detail-section { margin-bottom: 18px; }
.detail-section h3 { margin: 0 0 8px; font-size: 17px; }
.desc-block {
  color: var(--muted); line-height: 1.55; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.desc-block.expanded { display: block; -webkit-line-clamp: unset; }
.link-more {
  border: 0; background: transparent; color: var(--accent);
  font-weight: 700; padding: 8px 0 0; font-size: 13px;
}
.screens { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.screens::-webkit-scrollbar { display: none; }
.screens img {
  height: 170px; border-radius: 16px; border: 1px solid var(--line); object-fit: cover;
}
.screens .shot-ph {
  height: 120px; min-width: 160px; border-radius: 16px; border: 1px dashed var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; padding: 12px; text-align: center;
  background: var(--panel2);
}
.empty-state, .empty {
  text-align: center; color: var(--muted); padding: 40px 16px;
}
.empty-state {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); }
.view { display: none; }
.view.active { display: block; }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b));
  height: var(--nav-h);
  display: flex; align-items: flex-end; justify-content: space-between;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 8px 4px 10px;
  z-index: 50;
  overflow: visible;
}
.nav-item {
  border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px; font-size: 9px; font-weight: 650;
  flex: 1 1 0; min-width: 0; max-width: 72px; margin: 0 auto;
  padding: 0 2px;
}
.nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item span {
  display: block; width: 100%; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-item.active { color: var(--accent); }
.nav-item.active svg { filter: drop-shadow(0 0 6px var(--glow)); }
.nav-item.center {
  flex: 0 0 52px; width: 52px; height: 52px; max-width: 52px;
  margin: 0 2px 6px; border-radius: 999px;
  background: linear-gradient(135deg, #2e73ff, #7c3aed);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent), 0 10px 24px var(--glow);
  display: grid; place-items: center; align-self: center;
  padding: 0;
}
.nav-item.center svg { width: 22px; height: 22px; }
.nav-item.center span { display: none; }

/* ===== PHONE ===== */
body.is-phone .brand.phone-only,
body.is-phone .search.phone-only,
body.is-phone .chips.phone-only { display: flex !important; }
body.is-phone .icon-btn.phone-only { display: grid !important; }
body.is-phone .row-block.phone-only { display: block !important; }
body.is-phone .bottom-nav.phone-only { display: grid !important; }
body.is-phone .sidebar { display: none !important; }
body.is-phone .tv-only { display: none !important; }
body.is-phone .app-shell { grid-template-columns: 1fr; }
body.is-phone .main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
body.is-phone .hero {
  aspect-ratio: 1.95 / 1;
  max-height: 220px;
  min-height: 176px;
  padding: 18px 14px 22px;
}
body.is-phone .hero-icon { width: 86px; height: 86px; right: 12px; border-radius: 22px; }
body.is-phone .card-v { flex-basis: min(158px, 43vw); }
body.is-phone .topbar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
body.is-phone .topbar .brand { flex: 0 1 auto; min-width: 0; }
body.is-phone .top-actions {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
body.is-phone .topbar .icon-btn.phone-only,
body.is-phone .topbar .phone-chrome,
body.is-phone .topbar .avatar {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}
body.is-tv .phone-chrome { display: none !important; }

/* Fallback: always show phone chrome under 1100px even if body class lags */
@media (max-width: 1099px) {
  .top-actions { display: flex !important; visibility: visible !important; }
  .top-actions .phone-chrome,
  .top-actions .avatar {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 40px; height: 40px;
  }
  .bottom-nav.phone-only {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
  .brand.phone-only,
  .search.phone-only,
  .chips.phone-only { display: flex !important; }
  .row-block.phone-only { display: block !important; }
}
body.is-phone .search { margin-bottom: 12px; padding: 13px 16px; }
body.is-phone .bottom-nav {
  left: 10px; right: 10px;
  padding: 6px 4px 8px;
  height: 70px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: visible;
}
body.is-phone .nav-item {
  font-size: 9px;
  line-height: 1.1;
  min-width: 0;
  padding: 0 1px;
}
body.is-phone .nav-item span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.is-phone .nav-item svg { width: 18px; height: 18px; }
body.is-phone .nav-item.center {
  width: 48px; height: 48px; margin-bottom: 4px;
}
body.is-phone .nav-item.center svg { width: 20px; height: 20px; }

@media (max-width: 380px) {
  body.is-phone .card-v { flex-basis: 140px; }
  body.is-phone .stats { grid-template-columns: repeat(2, 1fr); }
  body.is-phone .hero-icon { width: 72px; height: 72px; right: 10px; }
  body.is-phone .hero-copy { max-width: 62%; }
  body.is-phone .nav-item { font-size: 8px; }
}

/* ===== TV / DESKTOP ===== */
@media (min-width: 1100px) {
  body.is-tv {
    overflow: hidden;
    height: 100vh;
  }
  body.is-tv .app-shell {
    grid-template-columns: var(--side-w) 1fr;
    height: 100vh;
  }
  body.is-tv .sidebar {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    padding: 22px 14px 16px;
    border-right: 1px solid var(--line);
    background: var(--sidebar);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    height: 100vh;
  }
  body.is-tv .sidebar .brand { margin-bottom: 18px; padding: 0 6px; font-size: 18px; }
  body.is-tv .side-nav { display: grid; gap: 8px; }
  body.is-tv .side-divider {
    height: 1px; margin: 10px 8px;
    background: var(--line);
  }
  body.is-tv .side-spacer { flex: 1; }
  body.is-tv .side-link {
    display: flex; align-items: center; gap: 12px;
    border: 1.5px solid transparent;
    background: transparent;
    text-align: left;
    padding: 11px 14px;
    border-radius: 14px;
    font-weight: 600; font-size: 14px;
    color: var(--text);
    transition: transform var(--ease), background var(--ease), box-shadow var(--ease);
  }
  body.is-tv .side-link .si {
    width: 20px; height: 20px; flex: 0 0 auto; color: var(--muted);
  }
  body.is-tv .side-link:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 10%, transparent); }
  body.is-tv .side-link.active,
  body.is-tv .side-link.is-focused,
  body.is-tv .side-link:focus-visible {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 42%, transparent), color-mix(in srgb, var(--accent2) 22%, transparent));
    border-color: var(--accent);
    box-shadow: var(--focus);
    color: #fff;
  }
  body.is-tv .side-link.active .si,
  body.is-tv .side-link.is-focused .si { color: #fff; }

  body.is-tv .phone-only { display: none !important; }
  body.is-tv .row-block.tv-only { display: block !important; }
  body.is-tv .row-block.tv-only[hidden] { display: none !important; }
  body.is-tv .hero-arrow.tv-only { display: grid !important; }
  body.is-tv .clock.tv-only { display: block !important; }
  /* Reference 03/04: no wide search field — only icon + avatar + clock */
  body.is-tv .top-search.tv-only { display: none !important; }
  body.is-tv .icon-btn.tv-only { display: grid !important; }
  body.is-tv .topbar { justify-content: flex-end; margin-bottom: 8px; min-height: 44px; }

  body.is-tv .main {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: max(14px, 1.6vh) max(22px, 2vw) 28px;
    scrollbar-width: thin;
  }

  body.is-tv .hero {
    aspect-ratio: 4.8 / 1;
    max-height: 268px;
    min-height: 210px;
    padding: 30px 52px 34px;
    border-radius: 20px;
    background:
      linear-gradient(100deg, rgba(8, 28, 64, .7) 0%, rgba(12, 40, 80, .32) 42%, rgba(8, 30, 60, .1) 68%, transparent 100%),
      var(--hero-day) center / cover no-repeat;
  }
  html[data-theme="dark"] body.is-tv .hero {
    background:
      linear-gradient(100deg, rgba(2, 8, 20, .8) 0%, rgba(4, 16, 36, .4) 45%, rgba(3, 12, 28, .18) 100%),
      var(--hero-night) center / cover no-repeat;
  }
  body.is-tv .hero h2 { font-size: 42px; }
  body.is-tv .hero p { font-size: 15px; max-width: 42ch; -webkit-line-clamp: 2; }
  body.is-tv .hero-icon {
    width: 132px; height: 132px; right: 72px; border-radius: 30px;
  }
  body.is-tv .hero-copy { max-width: 44%; }
  body.is-tv .hero-wrap { padding: 0 22px; }
  body.is-tv .hero-arrow.left { left: 0; }
  body.is-tv .hero-arrow.right { right: 0; }
  body.is-tv .eyebrow { font-size: 12px; }

  body.is-tv .app-card {
    flex: 0 0 calc((100% - 48px) / 5);
    max-width: 228px;
    min-width: 176px;
    min-height: 122px;
    padding: 10px;
    border-radius: 15px;
  }
  body.is-tv .app-card img { width: 50px; height: 50px; border-radius: 13px; }
  body.is-tv .h-scroll { gap: 12px; padding-top: 10px; padding-bottom: 16px; }
  body.is-tv .section-head { margin: 4px 0 6px; }
  body.is-tv .section-head h3 { font-size: 20px; }
  body.is-tv .detail-hero { padding: 26px; }
  body.is-tv .detail-head { grid-template-columns: 110px 1fr; }
  body.is-tv .detail-head img { width: 110px; height: 110px; }
  body.is-tv .detail-head h2 { font-size: 30px; }
  body.is-tv .screens img { height: 210px; }

  /* Stronger neon focus on TV cards / sidebar */
  body.is-tv .app-card.is-focused,
  body.is-tv .app-card:focus-visible {
    box-shadow: 0 0 0 2px #e8f3ff, 0 0 0 4px #2e73ff, 0 0 28px rgba(46, 115, 255, .7);
    transform: translateY(-3px) scale(1.025);
  }
}

@media (min-width: 1680px) {
  body.is-tv .app-card {
    flex-basis: calc((100% - 60px) / 6);
  }
}
