/* TV surfaces at 1920×1080. Chromium 47: no gap, no custom properties, no woff2. */
@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 700;
  src: url("fonts/Nunito-Bold.woff") format("woff");
}
@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 800;
  src: url("fonts/Nunito-ExtraBold.woff") format("woff");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  background: #0b1428; color: #f4f1ea;
  font: 700 28px/1.2 Nunito, "SamsungOne", "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; text-align: left; }
button::-moz-focus-inner { border: 0; }
button:focus { outline: none; }

#home { height: 100%; padding: 28px 28px 16px; display: flex; flex-direction: column; }

#top { flex: 0 0 auto; padding: 0 16px; display: flex; align-items: center; min-height: 108px; margin-bottom: 16px; }
#viewers { display: flex; align-items: center; }
.viewer {
  display: flex; align-items: center;
  min-height: 84px; margin-right: 16px; padding: 10px 22px;
  border: 6px solid #f4f1ea; border-radius: 18px;
  font-size: 36px; font-weight: 800; color: #f4f1ea; background: #14213d;
  transition: transform 150ms ease-out, border-color 150ms ease-out, background-color 150ms ease-out;
}
.viewer .tick { width: 44px; height: 44px; margin-right: 12px; flex: 0 0 auto; overflow: hidden; }
.viewer .tick svg { width: 44px; height: 44px; display: block; }
.viewer .tick svg.person-on { display: none; }
.viewer.on { background: #ffb547; border-color: #ffb547; color: #14213d; }
.viewer.on .tick svg.person-off { display: none; }
.viewer.on .tick svg.person-on { display: block; }
.viewer:focus, .viewer.focused { border-color: #ffb547; transform: scale(1.06); }
.viewer.on:focus, .viewer.on.focused { border-color: #f4f1ea; }

#top-meta { margin-left: auto; display: flex; align-items: flex-end; }
.rating {
  position: relative;
  min-width: 96px; min-height: 64px; margin-right: 28px; margin-bottom: 4px; padding: 8px 16px 6px;
  border-radius: 14px; text-align: center;
  font-size: 32px; font-weight: 800; letter-spacing: 0; color: #14213d;
  background: #3dbe5a;
}
.rating .antenna { color: #3dbe5a; }
.rating-letters { display: block; line-height: 1.1; }
.rating-g { background: #3dbe5a; }
.rating-g .antenna { color: #3dbe5a; }
.rating-pg { background: #f5d90a; }
.rating-pg .antenna { color: #f5d90a; }
.rating-pg13 { background: #f5a524; }
.rating-pg13 .antenna { color: #f5a524; }
.rating-m { background: #e5484d; color: #fff; }
.rating-m .antenna { color: #e5484d; }
#clock { font-size: 44px; font-weight: 800; font-feature-settings: "tnum" 1; line-height: 1; }

#channels { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; padding: 32px 16px 16px; }
.channel {
  position: relative; flex: 0 0 auto;
  width: calc((100% - 72px) / 4); height: 330px; margin: 0 24px 20px 0;
  padding: 0; overflow: visible; background: transparent; color: #fff;
  transform-origin: center center;
  transition: transform 150ms ease-out;
}
.channel:nth-child(4n) { margin-right: 0; }
.channel:focus, .channel.focused { z-index: 3; transform: scale(1.06); }
.bezel {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  overflow: hidden; border-radius: 72px;
  border: 16px solid #14213d; background: #0b1428;
  transition: border-color 150ms ease-out;
}
.channel:focus .bezel, .channel.focused .bezel { border-color: #ffb547; }
.channel .art {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  object-fit: cover; background: #14213d center/cover no-repeat;
}
.channel-copy {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 64px 20px 22px;
  background: linear-gradient(to top, rgba(11, 20, 40, 0.94) 0%, rgba(11, 20, 40, 0.7) 46%, rgba(11, 20, 40, 0) 100%);
}
.channel-line { display: flex; align-items: baseline; }
.channel .num {
  flex: 0 0 auto; margin-right: 14px;
  font-size: 44px; font-weight: 800; font-feature-settings: "tnum" 1; line-height: 1;
}
.channel .name {
  flex: 1 1 auto; min-width: 0;
  font-size: 40px; font-weight: 800; line-height: 1.1;
  overflow-wrap: break-word;
}
.channel .now {
  display: flex; align-items: center; margin-top: 8px;
  font-size: 28px; font-weight: 700; line-height: 1.2;
  white-space: nowrap; overflow: hidden;
}
.mini-play { flex: 0 0 auto; width: 26px; height: 26px; margin-right: 8px; color: #ffb547; }
.mini-play svg { width: 26px; height: 26px; display: block; }
.now-title { overflow: hidden; text-overflow: ellipsis; }

.channel > .antenna { display: none; }
.channel.focused > .antenna, .channel:focus > .antenna {
  display: block;
  position: absolute; left: 50%; top: -26px; z-index: 4;
  width: 84px; height: 28px; margin-left: -42px;
  color: #ffb547;
}
.antenna svg { width: 100%; height: 100%; display: block; }

.rating .antenna, .tv-chip .antenna, #tune-num .antenna {
  display: block; position: absolute; left: 50%;
  width: 40px; height: 16px; margin-left: -20px; top: -14px;
}
.rating .antenna { width: 44px; height: 18px; margin-left: -22px; top: -16px; }
#tune-num .antenna { width: 78px; height: 28px; margin-left: -39px; top: -24px; color: #ffb547; }

.app-glyph {
  position: absolute; left: 0; right: 0; top: 28px; bottom: 108px;
  display: flex; align-items: center; justify-content: center;
  color: #ffb547;
}
.app-games .app-glyph svg, .app-console .app-glyph svg { width: 250px; height: 138px; }
.app-uke .app-glyph svg { width: 110px; height: 150px; }

#status {
  position: fixed; left: 44px; right: 44px; bottom: 12px; margin: 0;
  font-size: 28px; font-weight: 800; color: #ffb547;
}
#status:empty { display: none; }

#player { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0b1428; }
#video { width: 100%; height: 100%; background: #0b1428; }
#osd {
  position: fixed; left: 40px; right: 40px; bottom: 24px;
  padding: 18px 28px 16px;
  color: #f4f1ea; background: #14213d;
  border-radius: 36px;
}
#osd.hidden { opacity: 0; }
#osd-title {
  display: flex; align-items: center; margin-bottom: 14px; padding-top: 12px;
  white-space: nowrap; overflow: visible;
}
#osd-channel {
  display: flex; align-items: center; flex: 0 0 auto;
  margin-right: 22px; font-size: 36px; font-weight: 800;
}
.tv-chip {
  position: relative; display: inline-block;
  min-width: 68px; padding: 8px 14px 8px;
  border-radius: 14px; background: #ffb547; color: #14213d;
  text-align: center; line-height: 1;
}
.tv-chip .antenna { color: #ffb547; }
#osd-num-digits { font-size: 44px; font-weight: 800; font-feature-settings: "tnum" 1; }
#osd-chname { margin-left: 16px; }
#osd-show {
  flex: 0 1 auto; margin-right: 22px;
  font-size: 40px; font-weight: 800; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
#osd-episode {
  flex: 1 1 auto; min-width: 0;
  font-size: 28px; font-weight: 700; color: #f4f1ea;
  overflow: hidden; text-overflow: ellipsis;
}
#osd-bar { display: flex; align-items: center; font-size: 32px; font-weight: 800; font-feature-settings: "tnum" 1; }
#osd-elapsed { margin-right: 16px; }
#osd-duration { margin-left: 16px; }
#osd-track { flex: 1; height: 16px; border-radius: 4px; background: rgba(244, 241, 234, 0.32); overflow: hidden; }
#osd-fill { height: 100%; width: 0; background: #ffb547; }
#osd-keys { flex: 0 0 auto; display: flex; align-items: center; margin-top: 0; color: #f4f1ea; font-size: 32px; }
#osd-keys > button { display: block; margin-right: 16px; flex: 0 0 auto; }
#osd-keys button { padding: 8px; border: 3px solid transparent; border-radius: 12px; }
#osd-keys button:hover, #osd-keys button:focus { border-color: #ffb547; }
#osd-keys .icon { width: 40px; height: 40px; display: block; }
#osd-play { color: #ffb547; }
#osd-play .icon-play { display: none; }
#osd-play.is-paused .icon-pause { display: none; }
#osd-play.is-paused .icon-play { display: block; }

#tune-flash {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0; bottom: 0;
  background: #c5c8ce;
}
#tune-flash svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
#tune-num {
  position: fixed; z-index: 41; top: 36px; left: 48px;
  min-width: 196px; padding: 26px 28px 18px;
  background: #14213d; color: #ffb547;
  border: 8px solid #ffb547; border-radius: 40px;
  text-align: center; line-height: 1;
}
#tune-digits { display: block; font-size: 140px; font-weight: 800; font-feature-settings: "tnum" 1; }

#ad-chip {
  position: fixed; z-index: 6; top: 36px; right: 48px;
  display: flex; align-items: center;
  padding: 10px 16px 10px 18px; border-radius: 16px;
  border: 6px solid #ffb547; background: #14213d; color: #f4f1ea;
  font-size: 32px; font-weight: 800; font-feature-settings: "tnum" 1;
}
#ad-chip .glyph { width: 36px; height: 36px; margin-left: 12px; color: #ffb547; }
#ad-chip .glyph svg { width: 36px; height: 36px; display: block; }
#skip-intro {
  position: fixed; z-index: 6; right: 48px; bottom: 250px;
  display: flex; align-items: center;
  min-height: 76px; padding: 0 22px;
  border: 6px solid #ffb547; border-radius: 18px;
  background: #14213d; color: #f4f1ea;
  font-size: 32px; font-weight: 800;
}
#skip-intro .glyph { width: 36px; height: 36px; margin-right: 12px; color: #ffb547; }
#skip-intro .glyph svg { width: 36px; height: 36px; display: block; }
#jump-strip {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 248px;
  text-align: center; white-space: nowrap; overflow: hidden;
}
#jump-strip img {
  width: 220px; height: 124px; margin: 0 8px;
  object-fit: cover; vertical-align: middle;
  border: 6px solid transparent; border-radius: 27px; opacity: 0.55;
}
#jump-strip img.on { opacity: 1; border-color: #ffb547; }
#options {
  position: fixed; z-index: 7; right: 48px; bottom: 248px; width: 640px;
  padding: 16px; background: #14213d;
  border: 8px solid #ffb547; border-radius: 48px;
}
.opt {
  display: flex; align-items: center; width: 100%;
  min-height: 84px; padding: 0 18px; border-radius: 18px;
  font-size: 32px; font-weight: 800;
  background: transparent; color: #f4f1ea; border: 0; text-align: left;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.opt .glyph { width: 44px; height: 44px; margin-right: 16px; flex: 0 0 auto; color: #ffb547; }
.opt .glyph svg { width: 44px; height: 44px; display: block; }
.opt .v { margin-left: auto; font-feature-settings: "tnum" 1; }
.opt.focused, .opt:focus { outline: none; background: #ffb547; color: #14213d; }
.opt.focused .glyph, .opt:focus .glyph { color: #14213d; }

video::cue {
  font-family: Nunito, "SamsungOne", "Helvetica Neue", Arial, sans-serif;
  font-size: 40px; font-weight: 800; color: #fff; background-color: transparent;
  text-shadow: -2px -2px 0 #14213d, 2px -2px 0 #14213d, -2px 2px 0 #14213d, 2px 2px 0 #14213d;
}

#console {
  position: fixed; z-index: 9; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: #0b1428;
}
#console-list { list-style: none; margin: 0; padding: 0; width: 1080px; max-width: 90%; }
.console-game {
  min-height: 96px; padding: 8px 26px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
  border: 6px solid transparent; border-radius: 18px;
  font-size: 34px; font-weight: 800; color: #f4f1ea;
}
.console-game::after { content: attr(data-system); font-size: 28px; font-weight: 800; color: #8fa3c8; }
.console-game.focused { border-color: #ffb547; color: #ffb547; }
.console-game.focused::after { color: #ffb547; }

#setup {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0b1428;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
#setup > * { margin-bottom: 24px; }
#setup label { color: #f4f1ea; font-size: 32px; font-weight: 800; }
#setup input {
  width: 760px; max-width: 90%; padding: 16px 24px;
  font: 800 44px/1.2 Nunito, "SamsungOne", "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  border-radius: 22px; border: 8px solid #ffb547;
  background: #14213d; color: #f4f1ea;
}
#setup input:focus { outline: none; border-color: #ffb547; }
#setup p { margin: 0; color: #ffb547; min-height: 36px; font-size: 28px; font-weight: 800; }

#av { position: fixed; top: 0; left: 0; width: 100%; height: 100%; }
body.avplay.playing, body.avplay.playing #player { background: transparent; }

#game-pairing {
  position: fixed; z-index: 120; right: 44px; top: 28px; max-width: 70vw;
  padding: 12px 18px; background: #14213d; color: #f4f1ea;
  border: 6px solid #ffb547; border-radius: 18px;
  font-size: 28px; font-weight: 800; overflow-wrap: break-word;
}

/* Keep the same instruments reachable on smaller companion screens. */
@media (max-width: 1100px) {
  #home { padding: 16px; }
  #top { flex-wrap: wrap; }
  #viewers { flex-wrap: wrap; }
  .viewer { margin: 0 10px 12px 0; padding: 8px 12px; font-size: 28px; }
  #top-meta { margin: 12px 0 0 auto; }
  .channel { width: calc((100% - 24px) / 2); }
  .channel:nth-child(2n) { margin-right: 0; }
  #osd { left: 16px; right: 16px; padding: 12px; }
  #osd-title { flex-wrap: wrap; white-space: normal; }
  #osd-show { margin-top: 12px; }
}
@media (max-width: 600px) {
  #home { padding: 8px; }
  #top { min-height: 0; padding: 0; }
  .viewer { min-height: 56px; border-width: 4px; }
  .viewer .tick, .viewer .tick svg { width: 28px; height: 28px; }
  #top-meta { margin-top: 0; }
  .channel { width: 100%; margin-right: 0; }
  #osd-chname { font-size: 28px; }
  #osd-keys > button { margin-right: 6px; }
  #osd-show { font-size: 40px; }
  #osd-bar { flex-wrap: wrap; }
  #osd-keys { width: 100%; margin-bottom: 12px; }
  #options { left: 12px; right: 12px; width: auto; padding: 12px; }
  .opt { padding: 0 8px; font-size: 28px; }
}

/* Same player inside the native control surface, at desktop density. */
.desktop-embedded #osd { left:12px; right:12px; bottom:12px; padding:10px 14px; border-radius:14px; }
.desktop-embedded #osd-title { padding-top:0; margin-bottom:8px; flex-wrap:wrap; gap:6px; }
.desktop-embedded #osd-channel { font-size:16px; margin-right:8px; }
.desktop-embedded .tv-chip { min-width:32px; padding:5px 8px; border-radius:7px; }
.desktop-embedded #osd-num-digits { font-size:20px; }
.desktop-embedded #osd-chname { font-size:16px; margin-left:8px; }
.desktop-embedded #osd-show { font-size:18px; margin:0 8px 0 0; }
.desktop-embedded #osd-episode { font-size:13px; }
.desktop-embedded #osd-bar { font-size:14px; flex-wrap:wrap; }
.desktop-embedded #osd-track { height:6px; }
.desktop-embedded #osd-keys { width:auto; margin:0; }
.desktop-embedded #osd-keys > button { margin-right:4px; padding:5px; border-radius:8px; }
.desktop-embedded #osd-keys .icon { width:22px; height:22px; }
.desktop-embedded #options { left:auto; right:12px; bottom:130px; width:min(340px,calc(100% - 24px)); padding:8px; border-width:3px; border-radius:14px; }
.desktop-embedded .opt { min-height:42px; font-size:15px; padding:0 10px; border-radius:8px; }
.desktop-embedded .opt .glyph,.desktop-embedded .opt .glyph svg { width:24px; height:24px; }
.desktop-embedded #jump-strip { bottom:130px; }
.desktop-embedded #jump-strip img { width:100px; height:56px; border-width:3px; }
.desktop-embedded #tune-num { top:24px; left:16px; min-width:70px; padding:10px; border-width:3px; border-radius:14px; }
.desktop-embedded #tune-digits { font-size:40px; }
.desktop-embedded #ad-chip { top:16px; right:16px; font-size:15px; border-width:3px; border-radius:8px; padding:6px 10px; }
.desktop-embedded #skip-intro { right:16px; bottom:130px; min-height:40px; padding:6px 10px; border-width:3px; border-radius:8px; font-size:15px; }
.desktop-embedded #ad-chip .glyph,.desktop-embedded #ad-chip .glyph svg,
.desktop-embedded #skip-intro .glyph,.desktop-embedded #skip-intro .glyph svg { width:22px; height:22px; }
.desktop-embedded video::cue { font-size:20px; }

/* Short companion windows need a complete focused card inside the scrolling grid. */
@media (max-height:500px) and (max-width:1100px) and (min-width:601px) {
  #top { min-height:56px; margin-bottom:8px; padding:0 8px; }
  .viewer { min-height:52px; margin:0 6px 0 0; padding:6px 10px; border-width:4px; font-size:26px; }
  .viewer .tick,.viewer .tick svg { width:26px; height:26px; }
  .viewer .tick { margin-right:8px; }
  #top-meta { margin:0 0 0 auto; align-items:center; }
  .rating { min-width:64px; min-height:44px; margin:0 12px 0 0; padding:6px 10px; font-size:26px; }
  #clock { font-size:32px; }
  .channel { height:210px; }
  .bezel { border-width:8px; border-radius:36px; }
  .channel-copy { padding:24px 14px 12px; }
  .channel .name { font-size:32px; }
  .channel .num { font-size:36px; }
  .channel .now { font-size:26px; }
}

/* Guest phone app (served by src/guest-server.js): back key on the player, guest name where the viewers sit. */
#osd-keys > #osd-back { display: none; }
.guest #osd-keys > #osd-back { display: block; }
.guest .guest-name { font-size: 22px; font-weight: 800; color: #ffb547; padding: 6px 2px; }
.guest #osd-track { height: 12px; cursor: pointer; }
/* Guests see the whole title: wrap rather than ellipsis (no truncation on a phone). */
.guest .channel .now { white-space: normal; align-items: flex-start; }
.guest .now-title { overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.guest .mini-play { margin-top: 4px; }
@media (max-width: 600px) {
  .guest .channel { height: 300px; }
  .guest .bezel { border-width: 10px; border-radius: 48px; }
  .guest .channel-copy { padding: 48px 18px 18px; }
  .guest .channel .num { font-size: 34px; }
  .guest .channel .name { font-size: 32px; }
  .guest .channel .now { font-size: 22px; }
}
