/* /tv: help panel in house style, stage as a black room. */
.tvwrap { padding-top: 48px; padding-bottom: 64px; }
.tvwrap .lede { max-width: 60ch; color: var(--muted); margin: 10px 0 22px; }
.tvstart {
  font: 500 18px/1 var(--serif); color: var(--bg); background: var(--accent);
  border: 0; border-radius: 8px; padding: 14px 26px; cursor: pointer;
}
.tvstart:hover { filter: brightness(1.08); }
.tvactions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tvcast {
  font: 500 18px/1 var(--serif); color: var(--fg); background: var(--panel);
  border: 1px solid var(--accent); border-radius: 8px; padding: 13px 24px; cursor: pointer;
}
.tvcast.avail { background: var(--accent); color: var(--bg); }
.tvcast:hover { filter: brightness(1.08); }
.tvbest { color: var(--fg); }
/* the per-device cast instructions popover (shown where one-click cast is
   unavailable: Firefox, iPhones, Android, Safari) */
#tvcasthow {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 70;
  background: rgba(8, 8, 10, 0.55); display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
/* display:flex above OUT-SPECIFIES the UA's [hidden]{display:none} (the
   gotcha-32 trap): restate it stronger or the card shows on every load */
#tvcasthow[hidden] { display: none; }
.tvcastcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  max-width: 520px; width: 100%; padding: 22px 24px;
  box-shadow: 0 18px 60px var(--shadow);
}
.tvcastcard h2 { font-size: 20px; margin-bottom: 12px; }
.tvcastcard ol { margin: 0 0 10px 20px; padding: 0; display: grid; gap: 8px; }
.tvcastcard li, .tvcastcard p { color: var(--muted); }
.tvcastcard strong { color: var(--fg); }
#tvcastok {
  margin-top: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--bg); border-radius: 8px; padding: 10px 22px;
  font: 500 15px/1 var(--serif); cursor: pointer;
}
.tvbest::before { content: "Easiest here: "; color: var(--accent); font-weight: 600; }
.tvnow { margin: 18px 0 6px; }
.tvnow span { display: block; }
#tvrtitle { font-family: var(--serif); font-size: 26px; line-height: 1.2; }
#tvrartist { color: var(--muted); margin-top: 4px; }
.tvractions { display: flex; gap: 8px; margin: 14px 0 4px; }
.tvractions button, .tvchannels button {
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  border-radius: 8px; padding: 10px 18px; font-size: 15px; cursor: pointer;
}
.tvchannels button { border-radius: 999px; padding: 5px 13px; font-size: 13px; }
.tvractions button:hover, .tvchannels button:hover { border-color: var(--accent); }
.tvstop {
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer; margin-top: 14px;
}
.tvstop:hover { color: var(--fg); border-color: var(--accent); }
.tvchannels { margin: 22px 0 6px; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: baseline; }
.tvchanlabel { color: var(--muted); font-size: 13px; }
.tvchannels a {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 5px 13px; font-size: 13px;
}
.tvchannels a:hover { border-color: var(--accent); }
.tvchannels button.sel, .tvchannels a.sel {
  border-color: var(--accent); background: var(--accent); color: var(--bg);
}
.tvhow { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 18px; max-width: 74ch; }
.tvhow h2 { font-size: 21px; margin-bottom: 10px; }
.tvhow ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.tvhow li { color: var(--muted); }
.tvhow li strong { color: var(--fg); font-weight: 600; }
.tvintro { color: var(--muted); margin-bottom: 14px; }
.tvsteps { margin: 8px 0 2px; }
.tvsteps summary {
  cursor: pointer; color: var(--accent); font-size: 14px; width: fit-content;
}
.tvsteps summary:hover { text-decoration: underline; }
.tvsteps ol { margin: 10px 0 6px 22px; padding: 0; display: grid; gap: 8px; }
.tvsteps ol li { color: var(--muted); }
.tvplain li { padding-left: 0; }
.tvfaqa { color: var(--muted); margin: 10px 0 6px; max-width: 70ch; }
.tvnote { margin-top: 22px; font-size: 13px; color: var(--muted); max-width: 74ch; }
.tvnote code { border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* the stage: fixed, black, exactly two stacked images.
   longhand offsets, not the inset shorthand: old TV browsers (pre Chromium 87)
   drop inset and the stage collapses to a 0x0 box. */
#tvstage {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: #000; z-index: 60;
}
/* every stage img is an OPAQUE full-viewport frame (black letterboxing baked
   into the element box): the incoming frame fades in ABOVE the solid outgoing
   one, so no moment ever shows two artworks blended at half opacity */
#tvstage img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain; opacity: 0; max-width: none;
  background: #000; z-index: 1;
}
@media (prefers-reduced-motion: no-preference) {
  #tvstage img { transition: opacity 0.45s ease; }
  #tvstage.quick img { transition: opacity 0.25s ease; }
  #tvmedia video, #tvmedia iframe { transition: opacity 0.25s ease; }
}
#tvstage img.on { opacity: 1; z-index: 2; }
#tvstage img.in { opacity: 1; z-index: 4; }
#tvstage img.notrans { transition: none; }
/* the media layer: films, loops, live pieces. above the img pair, below the
   caption/controls; pointer-events none keeps tap-for-controls working */
#tvmedia {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 3; pointer-events: none;
}
#tvmedia video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain; background: #000; opacity: 0;
}
#tvmedia iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: 0; opacity: 0;   /* transparent: a piece that paints nothing leaves
                              the poster visible = the device-failure fallback */
}
#tvmedia .on { opacity: 1; }
/* the instant blurred placeholder that paints while the sharp tier decodes.
   selector matches #tvstage img.on specificity or the 0.85 never applies */
#tvlow { filter: blur(14px); transform: scale(1.02); }
#tvstage img#tvlow.on { opacity: 0.85; z-index: 1; }
body.tv-playing { overflow: hidden; }
body.tv-playing header.site, body.tv-playing footer { display: none; }

#tvcap {
  position: absolute; left: 22px; bottom: 20px; z-index: 62;
  max-width: 640px; max-width: min(70vw, 640px);
  padding: 10px 16px; border-radius: 8px;
  background: rgba(8, 8, 10, 0.62); color: #eae8e2;
  backdrop-filter: blur(6px);
}
#tvcap span { display: block; }
#tvcapt { font-family: var(--serif); font-size: 19px; line-height: 1.25; }
#tvcapa { font-size: 13px; color: #b7b4a8; margin-top: 2px; }

#tvctl {
  position: absolute; right: 18px; bottom: 18px; z-index: 63;
  display: flex; gap: 6px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
#tvctl.vis { opacity: 1; pointer-events: auto; }
#tvctl button {
  min-width: 44px; height: 44px; border-radius: 8px; border: 1px solid #33333c;
  background: rgba(8, 8, 10, 0.72); color: #eae8e2; font-size: 17px; cursor: pointer;
}
#tvctl button:hover { border-color: #c8a25c; }
