/* Imaginary Shiny Rocks — matches the TV guide mockups */
:root {
  --bg: #0A1238; --deep: #050A22; --panel: #0F1B52; --cell: #17256B; --chan: #22186B;
  --border: #2B3B8F; --yellow: #FFD84D; --yellow-2: #FFE88A; --muted: #B9C4FF; --dim: #8E9BD6;
  --red: #E5484D; --white: #FFFFFF; --violet: #9466FF; --violet-2: #6633DD; --cyan: #22B8CC; --cyan-2: #6CE0EC;
  --display: 'Bungee', 'Arial Black', sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--white); font-family: var(--body); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

#app { max-width: 1920px; margin: 0 auto; padding: clamp(12px, 2.5vw, 48px); display: flex; flex-direction: column; gap: clamp(12px, 1.25vw, 24px); }

/* ---------- Hero: screen + branding ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 37fr) minmax(0, 63fr); gap: clamp(16px, 2vw, 40px); align-items: stretch; }
.screen { position: relative; align-self: start; width: 100%; aspect-ratio: 16 / 9; background: var(--deep); border: 3px solid var(--border); border-radius: 12px; overflow: hidden; container-type: size; cursor: pointer; }
#yt-wrap, #yt-wrap iframe, #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen.card-on #yt-wrap { visibility: hidden; }
.live-pill { position: absolute; top: 10px; right: 10px; z-index: 3; font: 700 13px var(--body); background: var(--red); color: #fff; padding: 3px 9px; border-radius: 6px; pointer-events: none; display: none; }
.guide-mode .screen.card-on.on-air .live-pill { display: block; }

.hero-info { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; min-width: 0; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo { height: clamp(72px, 7.5vw, 150px); width: auto; max-width: 100%; display: block; }
.brand-tag { font-size: clamp(15px, 1.15vw, 22px); color: var(--cyan-2); }
.tonight { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tonight-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tonight-on, .tonight-sub { font-size: clamp(15px, 1.25vw, 24px); color: var(--cyan-2); }
.tonight-sub { color: var(--white); }
.tonight-title { font-size: clamp(28px, 2.9vw, 56px); font-weight: 700; line-height: 1.05; color: var(--yellow); }
.clock-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.clock { font-family: var(--display); font-size: clamp(30px, 3.3vw, 64px); line-height: 1; }
.clock-date { font-size: clamp(14px, 1.25vw, 24px); color: var(--muted); }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.keys-hint { font-size: 14px; color: var(--dim); }

.btn { font: 700 16px var(--body); min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 2px solid var(--border); background: var(--panel); color: var(--white); cursor: pointer; }
.btn:hover { border-color: var(--yellow); }
.btn-yellow { background: var(--yellow); color: var(--bg); border-color: var(--yellow); font-family: var(--display); font-weight: 400; letter-spacing: .5px; }
.btn-yellow:hover { background: var(--yellow-2); }

/* DVR: LIVE when synced, "−2:10 · Go live" when behind */
.live-btn { white-space: nowrap; }
.live-btn:disabled { background: var(--red); border-color: var(--red); color: #fff; cursor: default; opacity: 1; font-family: var(--display); font-weight: 400; }
.live-btn.behind { background: var(--panel); border-color: var(--yellow); color: var(--yellow); }
#btn-pause:disabled { opacity: .5; cursor: default; }

/* ---------- Guide grid ---------- */
.guide { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.guide-inner { min-width: 680px; display: flex; flex-direction: column; gap: 6px; }
.g-row { display: grid; grid-template-columns: clamp(130px, 13.5vw, 260px) 1fr; gap: 6px; }
.g-label { border-radius: 8px; display: flex; align-items: center; padding: 0 16px; }
.g-date { justify-content: space-between; gap: 8px; padding: 0 8px; }
.g-nav { background: var(--deep, #070b2a); color: var(--yellow); border: 2px solid currentColor; border-radius: 8px; min-width: 40px; height: 36px; font-size: 16px; font-weight: 700; cursor: pointer; }
.g-nav:hover, .g-nav:focus-visible { background: var(--yellow); color: var(--bg, #0b1040); }
.g-block.off { opacity: .55; }
.g-date { height: 48px; background: var(--panel); font-size: clamp(15px, 1.05vw, 20px); font-weight: 700; color: var(--yellow); }
.g-track { position: relative; min-height: 48px; }
.g-time { position: absolute; top: 0; bottom: 0; background: var(--panel); border-radius: 8px; display: flex; align-items: center; padding: 0 14px; font-size: clamp(15px, 1.15vw, 22px); font-weight: 700; color: var(--yellow); overflow: hidden; white-space: nowrap; }
.g-chan { height: 70px; background: var(--chan); gap: 14px; border: 0; color: var(--white); font-family: inherit; text-align: left; cursor: pointer; }
.g-chan b { font-family: var(--display); font-weight: 400; font-size: clamp(20px, 1.35vw, 26px); color: var(--yellow); }
.g-chan span { font-size: clamp(16px, 1.25vw, 24px); font-weight: 700; }
.g-chan.on { outline: 2px solid var(--yellow); outline-offset: -2px; }
.g-row .g-track.shows { height: 70px; }
.g-block { position: absolute; top: 0; bottom: 0; background: var(--cell); border-radius: 8px; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; min-width: 0; }
.g-block .t { font-size: clamp(14px, 1.1vw, 21px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-block .s { font-size: clamp(12px, .9vw, 17px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-block.feature { border: 2px solid var(--violet); }
.g-block.now { background: var(--yellow); color: var(--bg); }
.g-block.now .s { color: var(--bg); }
.now-line { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--red); border-radius: 2px; z-index: 2; pointer-events: none; }

/* ---------- Ticker ---------- */
.ticker { height: 56px; background: var(--yellow); color: var(--bg); border-radius: 8px; display: flex; align-items: center; gap: 24px; padding: 0 20px; overflow: hidden; white-space: nowrap; }
.ticker-tag { font-family: var(--display); font-size: clamp(16px, 1.15vw, 22px); flex: none; }
.ticker-text { font-size: clamp(15px, 1.15vw, 22px); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Lineup list ---------- */
.lineup h2 { font-family: var(--display); font-weight: 400; font-size: clamp(18px, 1.4vw, 26px); color: var(--yellow); margin: 8px 0 12px; }
.lineup ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.l-show { margin-top: 14px; padding: 10px 16px; background: var(--chan); border-radius: 8px; font-weight: 700; font-size: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.l-show .when { color: var(--yellow); }
.l-show .sub { color: var(--muted); font-weight: 400; }
.l-item { display: grid; grid-template-columns: 90px 1fr auto; gap: 4px 16px; padding: 10px 16px; background: var(--cell); border-radius: 8px; align-items: baseline; }
.l-item time { color: var(--muted); font-weight: 700; }
.l-item .ttl { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.l-item .ttl small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.l-item .len { color: var(--muted); font-size: 14px; }
.l-item.on-now { background: var(--yellow); color: var(--bg); }
.l-item.on-now time, .l-item.on-now small, .l-item.on-now .len { color: var(--bg); }
.l-item.past { opacity: .55; }
.foot { color: var(--dim); font-size: 14px; padding: 12px 0 72px; }

/* ---------- Watch mode (full screen TV) ---------- */
.nowbar { display: none; }
.watch-mode { overflow: hidden; }
body.watching { overflow: hidden; }
.watch-mode .screen { position: fixed; inset: 0 0 64px 0; z-index: 50; border: 0; border-radius: 0; aspect-ratio: auto; background: #000; cursor: default; }
.watch-mode .nowbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; z-index: 51; background: var(--bg); border-top: 3px solid var(--yellow); align-items: center; gap: 18px; padding: 0 16px; padding-bottom: env(safe-area-inset-bottom); }
.nb-chan { font-family: var(--display); color: var(--yellow); font-size: 20px; white-space: nowrap; }
.nb-now, .nb-next { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; }
.nb-next { flex: .8; }
.nb-label { font-family: var(--display); font-size: 13px; color: var(--muted); flex: none; }
.nb-title { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; }
.nb-left { color: var(--muted); font-size: 15px; flex: none; }

/* ---------- Cards drawn in the screen (Press OK, station break, stand by) ---------- */
.card-host { position: absolute; inset: 0; z-index: 2; display: none; font-size: max(5px, min(1.78cqh, 2.4cqw)); }
.screen.card-on .card-host { display: block; }
.card { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; color: var(--white); overflow: hidden; }
.card-ok { background: var(--deep); padding: 2.9em 3.3em; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 1em; }
.badge { display: flex; align-items: center; gap: .8em; background: var(--panel); border-radius: .5em; padding: .6em 1em; }
.badge b { font-family: var(--display); font-weight: 400; font-size: 1.45em; color: var(--yellow); white-space: nowrap; }
.badge span { font-size: 1.25em; color: var(--muted); white-space: nowrap; }
.brand-sm { display: flex; align-items: center; gap: .7em; font-family: var(--display); font-size: 1.35em; white-space: nowrap; }
.brand-sm .mark { width: auto; height: 1.9em; display: block; }
.card-mid { display: flex; flex-direction: column; align-items: center; gap: 1em; text-align: center; }
.kicker { font-size: 1.45em; letter-spacing: .15em; color: var(--cyan-2); }
.show-title { font-family: var(--display); font-size: 2.1em; color: var(--yellow); }
.card h1 { margin: 0; font-size: 4.6em; font-weight: 700; line-height: 1.05; max-width: 90%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-size: 1.55em; color: var(--muted); }
.ok-btn { margin-top: 1em; font-family: var(--display); font-size: 2.3em; background: var(--yellow); color: var(--bg); border: none; border-radius: .36em; padding: .6em 1.6em; cursor: pointer; min-height: 44px; }
.ok-btn:hover, .ok-btn:focus-visible { background: var(--yellow-2); }
.hint { font-size: 1.25em; color: var(--dim); }
.card-bottom { display: flex; justify-content: space-between; align-items: flex-end; min-height: 1em; }
.host { display: flex; align-items: center; gap: 1em; background: var(--panel); border-radius: .6em; padding: .9em 1.2em; }
.host img { width: 4.6em; height: 4.6em; border-radius: 50%; object-fit: cover; border: .15em solid var(--yellow); }
.host span { display: block; }
.host .h1 { font-size: 1.05em; color: var(--muted); }
.host .h2 { font-size: 1.35em; font-weight: 700; }

.card-station { background: var(--bg); }
.st-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4em; text-align: center; padding: 0 3em; }
.st-mid .mark { height: 9.4em; width: auto; }
.st-logo { height: min(15em, 26cqw); width: auto; max-width: 86%; display: block; }
.st-name { font-family: var(--display); font-size: min(5.4em, 6.6cqw); line-height: 1; }
.st-tag { font-family: var(--display); font-size: min(2.9em, 4.4cqw); color: var(--yellow); }
.st-pitch { font-size: 1.55em; color: var(--muted); }
.st-big { font-family: var(--display); font-size: min(4.4em, 6cqw); color: var(--yellow); line-height: 1.1; }
.st-row { display: flex; justify-content: space-between; align-items: center; gap: 2em; padding: 0 3.3em 2.1em; }
.st-left { font-size: 1.55em; font-weight: 700; }
.st-right { font-size: 1.35em; color: var(--muted); text-align: right; }
.bars { height: 2.5em; display: flex; flex: none; }
.bars i { flex: 1; }
.bars i:nth-child(1) { background: #FFD84D; } .bars i:nth-child(2) { background: #3FC1C9; } .bars i:nth-child(3) { background: #5BD16E; }
.bars i:nth-child(4) { background: #C86BFA; } .bars i:nth-child(5) { background: #E5484D; } .bars i:nth-child(6) { background: #3E63DD; }

/* Small preview screen: drop the secondary lines */
.guide-mode .card .hint, .guide-mode .card .card-bottom, .guide-mode .st-pitch, .guide-mode .brand-sm { display: none; }
.guide-mode .card-host { font-size: max(1.35cqw, 5px); }
.guide-mode .card h1 { font-size: 3.6em; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .screen { border-width: 2px; border-radius: 10px; }
  .guide-mode .card-host { font-size: max(1.6cqw, 5px); }
  .guide-mode .card .badge span { display: none; }
  .tonight { align-items: flex-start; }
  .clock-wrap { align-items: flex-start; }
  .keys-hint { display: none; }
  .l-item { grid-template-columns: 70px 1fr; }
  .l-item .len { grid-column: 2; }
  .watch-mode .nowbar { gap: 10px; }
  .nb-next, .nb-now { display: none; }
  .watch-mode .nowbar { justify-content: space-between; }
  .watch-mode .nowbar .btn { padding: 8px 10px; font-size: 14px; }
  .nb-chan { font-size: 16px; }
  .nb-title { font-size: 15px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .watch-mode .screen { bottom: 44px; }
  .watch-mode .nowbar { height: 44px; }
  .watch-mode .nowbar .btn { min-height: 36px; padding: 4px 14px; }
}
