* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0c;
  color: #c9ccd1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  /* Smart-display system chrome: the upper-left playback logo slot.
     Replaces the plain app-name text with the RES◉NATOR wordmark on
     surfaces that render the platform player (Nest Hubs). */
  --playback-logo-image: url("wordmark.svg");
}

cast-media-player {
  /* CAF plays a silent carrier so the device owns a media session (see
     receiver.js); its built-in now-playing layout must not paint over the
     Resonator screen. Transparent, not display:none — the media element
     inside keeps playing. */
  position: absolute;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  --theme-hue: 16;
  --progress-color: #ff4400;
  --splash-color: #0a0a0c;
  --background-color: #0a0a0c;
}

/* ----------------------------------------------------------------
   Idle screen — visible by default, hidden when body has .playing
   ---------------------------------------------------------------- */

#idle-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  transition: opacity 0.4s ease;
}

body.playing #idle-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Kill the cone mark's drop-shadow animation while playing — the GPU was
   compositing an infinite filter animation under opacity: 0 forever. */
body.playing .logo .mark {
  animation: none;
}

.logo {
  text-align: center;
}

.logo .mark {
  width: 240px;
  height: 240px;
  display: block;
  margin: 0 auto 36px;
  border-radius: 28px;
  animation: resonate 6s ease-in-out infinite;
}

@keyframes resonate {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(255, 68, 0, 0.18)); }
  50%      { filter: drop-shadow(0 0 42px rgba(255, 68, 0, 0.45)); }
}

.wordmark {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: baseline;
}

.o-glyph {
  width: 0.75em;
  height: 0.75em;
  vertical-align: baseline;
  margin: 0 -0.02em;
  overflow: visible;
}

.logo .tagline {
  font-size: 22px;
  color: #5a5f68;
  margin-bottom: 10px;
}

.logo p {
  font-size: 20px;
  opacity: 0.6;
  transition: color 0.3s;
}

.logo p.ok {
  color: #4ade80;
  opacity: 1;
}

.logo p.error {
  color: #f87171;
  opacity: 1;
}

/* ----------------------------------------------------------------
   Now-playing overlay — visible when body has .playing
   ---------------------------------------------------------------- */

#now-playing {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4vw;
  width: 100vw;
  height: 100vh;
  /* ~5% margins keep content clear of TV overscan */
  padding: 5vh 5vw;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#np-wordmark {
  position: absolute;
  /* Inside the ~5% overscan-safe area — at 3vh/4vw the whole 18px mark sat
     in the band TVs crop, so it never showed on the device. */
  top: 6vh;
  left: 6vw;
  z-index: 20;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c9ccd1;
  opacity: 0.7;
}

.np-logo {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}

#np-wordmark > span {
  display: inline-flex;
  align-items: baseline;
}

#np-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

body.playing #now-playing {
  opacity: 1;
  pointer-events: auto;
}

#np-artwork {
  width: 300px;
  height: 300px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  background: #1a1c22;
}

/* Live-region wrapper (C-0007): transparent to the #np-main flex column. */
#np-meta {
  display: contents;
}

#np-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}

#np-artist {
  font-size: 20px;
  font-weight: 400;
  opacity: 0.7;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------
   Album line — "From the album <X>", shown below the artist name.
   Filled from item.albumName in updateNowPlayingOverlay.
   ---------------------------------------------------------------- */

#np-album {
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
  color: #5a5f68;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#np-album.visible {
  opacity: 1;
}

/* ----------------------------------------------------------------
   Journey line — orange ◉ dot + reasoning headline, shown below
   the album line. Discovery context from the `journey` bridge
   command. #FF4400 dot / #c9ccd1 text per RESONATOR_BRAND_DESIGN.
   Inside the ≥6vh/6vw overscan-safe area, ellipsis-clamped.
   ---------------------------------------------------------------- */

#np-journey {
  font-size: 16px;
  font-weight: 500;
  color: #c9ccd1;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#np-journey.visible {
  opacity: 0.85;
}

#np-journey::before {
  content: "\25C9";
  color: #ff4400;
  margin-right: 6px;
}

/* ----------------------------------------------------------------
   Road eyebrow — journey/road context above the now-playing block.
   "ON THE <SEED> ROAD" or album-detour wording per brand vocabulary.
   Uppercase letter-spaced #FF4400, matching the credits role-label
   style (brand §12).
   ---------------------------------------------------------------- */

#np-road {
  position: absolute;
  top: 6vh;
  right: 6vw;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff4400;
  text-align: right;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 20;
}

#np-road.visible {
  opacity: 1;
}

/* ----------------------------------------------------------------
   Up Next strip — bottom of the now-playing screen, receiver-local.
   Text only ("UP NEXT  Track — Artist · ..."), single line,
   ellipsized, fixed at bottom:6vh inside the overscan-safe area.
   ---------------------------------------------------------------- */

#np-upnext {
  position: absolute;
  bottom: 6vh;
  left: 6vw;
  right: 6vw;
  font-size: 14px;
  font-weight: 500;
  color: #5a5f68;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 20;
}

#np-upnext.visible {
  opacity: 0.85;
}

#np-upnext .upnext-label {
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #c9ccd1;
  margin-right: 12px;
  opacity: 0.5;
}

/* ----------------------------------------------------------------
   Rolling credits band — the artists on the TV. One role group at a
   time, 6 s crossfade cycle, fed by the `credits` bridge command.
   ---------------------------------------------------------------- */

/* ----------------------------------------------------------------
   Feedback row — thumbs down · Resonate · thumbs up, mirroring the
   phone's player row. Hidden until the receiver knows it can act:
   touch-capable device + a connected sender + a feedback-state push
   from a new-enough app (updateFeedbackAvailability toggles
   .available). Thumbs render outline (stroke) and flip to filled
   accent when latched, matching the phone's SF Symbol states.
   ---------------------------------------------------------------- */

#np-actions {
  display: none;
  gap: 32px;
  margin: 18px 0 6px;
  align-items: center;
}

#np-actions.available {
  display: flex;
}

.np-action {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(201, 204, 209, 0.25);
  padding: 14px;
  cursor: pointer;
  color: #c9ccd1;
  transition: transform 0.12s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.np-action svg {
  width: 100%;
  height: 100%;
  display: block;
}

.np-action .thumb-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.np-action:active {
  transform: scale(0.92);
}

.np-action.pressed {
  transform: scale(0.92);
  border-color: rgba(255, 68, 0, 0.6);
}

.np-action.latched {
  color: #ff4400;
  border-color: rgba(255, 68, 0, 0.55);
}

.np-action.latched .thumb-path {
  fill: currentColor;
  stroke: none;
}

/* Static latched glow — the original infinite filter: drop-shadow
   animation carried the same GPU hazard killed at .logo .mark
   (see body.playing .logo .mark, :58-62 above). */
.np-action-resonate.latched {
  box-shadow: 0 0 14px rgba(255, 68, 0, 0.35);
}

#np-actions.disabled .np-action,
.np-action[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

/* Transport row — replaces the system overlay's controls on touch
   displays (the overlay is gone once the app declares itself
   touch-optimized). Receiver-local: works with no sender connected, so
   deep sleep never strands the screen without controls. */

#np-transport {
  display: none;
  gap: 28px;
  margin: 12px 0 4px;
  align-items: center;
}

#np-transport.available {
  display: flex;
}

.transport-path {
  fill: currentColor;
}

.np-action-primary {
  border-color: rgba(255, 68, 0, 0.45);
}

/* ----------------------------------------------------------------
   Side column — holds lyrics and credits, crossfading between them
   via the sideMode state machine (lyrics 40 s -> credits 20 s ->
   repeat). Both are position:absolute inside #np-side so there is
   no layout shift during transitions. When only one slot has data
   it runs full-time.
   ---------------------------------------------------------------- */

#np-side {
  position: relative;
  flex: 1 1 55%;
  align-self: stretch;
  overflow: hidden;
  display: none;
}

#now-playing.has-side #np-side {
  display: block;
}

#np-side > #lyrics {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#np-side > #lyrics.side-active {
  opacity: 1;
}

#np-side > #np-credits {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  min-height: 64px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#np-side > #np-credits.side-active {
  opacity: 1;
}

#np-credits-role {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff4400;
  margin-bottom: 6px;
}

#np-credits-names {
  font-size: 25px;
  font-weight: 500;
  color: #c9ccd1;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------
   Lyrics — shown inside #np-side when lyrics arrive over the bridge.
   With the side column active, #now-playing becomes artwork+meta
   left / side right. Scrolling is a translateY on #lyrics-scroller
   that keeps the current line vertically centered.
   ---------------------------------------------------------------- */

#lyrics-scroller {
  transition: transform 0.3s ease;
  will-change: transform;
}

.lyric-line {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.45;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  padding: 12px 0;
  /* font-size deliberately NOT transitioned: animating it reflows the whole
     lyrics column every frame for 300 ms on Chromecast-class CPUs. */
  transition: opacity 0.3s ease, color 0.3s ease;
}

.lyric-line.current {
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  opacity: 1;
}

/* Static (unsynced) lyrics: wrapped centered text, no highlight, no scroll */
#np-side > #lyrics.static {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----------------------------------------------------------------
   Google Home Hub / small smart displays — same TV features
   (artwork, lyrics, credits, wordmark) scaled to fit.
   Original Hub is 1024x600, Hub Max is 1280x800.
   ---------------------------------------------------------------- */

@media (max-height: 700px) {
  #now-playing {
    padding: 3vh 4vw;
    gap: 3vw;
  }

  #np-artwork {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  #np-title {
    font-size: 20px;
  }

  #np-artist {
    font-size: 15px;
  }

  #np-album {
    font-size: 13px;
    margin-top: 2px;
  }

  #np-journey {
    font-size: 13px;
    margin-top: 4px;
  }

  #np-wordmark {
    font-size: 14px;
    top: 3vh;
    left: 4vw;
  }

  .np-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
  }

  #np-actions {
    gap: 22px;
    margin: 10px 0 4px;
  }

  #np-transport {
    gap: 20px;
    margin: 8px 0 2px;
  }

  .np-action {
    width: 52px;
    height: 52px;
    padding: 11px;
  }

  #np-credits-role {
    font-size: 14px;
  }

  #np-credits-names {
    font-size: 18px;
  }

  #np-road {
    font-size: 12px;
    top: 3vh;
    right: 4vw;
  }

  #np-upnext {
    font-size: 12px;
    bottom: 3vh;
    left: 4vw;
    right: 4vw;
  }

  .lyric-line {
    font-size: 22px;
    padding: 8px 0;
  }

  .lyric-line.current {
    font-size: 28px;
  }
}
