/* JUSTE TV — viewer page */
:root {
  --bg: #000;
  --panel: rgba(12, 12, 14, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f3f1;
  --dim: #8f8f8a;
  --accent: #ffe500;      /* signal yellow, used sparingly */
  --live: #ff2b2b;
  --pw: 360px;            /* panel width */
  --head: 0px;            /* header zone above the video (mobile portrait) */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
svg { fill: currentColor; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  position: fixed; top: 0; left: 0;
  width: var(--app-w, 100vw); height: var(--app-h, 100vh);
  display: grid;
  grid-template-columns: 0 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "panel stage";
  transition: grid-template-columns .35s cubic-bezier(.2, .8, .2, 1);
}
.app.panel-open { grid-template-columns: var(--pw) 1fr; }

/* ---------------------------------------------------------------- stage */
.stage { grid-area: stage; position: relative; overflow: hidden; background: #000; min-width: 0; }
.screen, .static, .testcard, .casting {
  position: absolute; left: 0; right: 0; top: var(--head); height: calc(100% - var(--head)); width: 100%;
}
.screen { object-fit: contain; background: #000; opacity: 0; pointer-events: none; }
.screen.is-active { opacity: 1; }
video::-webkit-media-controls { display: none !important; }

/* TV static while tuning / buffering */
.static { image-rendering: pixelated; opacity: 0; transition: opacity .25s; pointer-events: none; }
.static.on { opacity: .9; }

/* The logo: unchanged from the original site */
#logo { position: absolute; top: 10px; right: 10px; width: 200px; z-index: 10; pointer-events: none; }

/* Test card when nothing is scheduled / signal lost */
.testcard { display: flex; flex-direction: column; background: #111; z-index: 2; }
.testcard .bars { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); }
.testcard .bars i:nth-child(1) { background: #c0c0c0; } .testcard .bars i:nth-child(2) { background: #c0c000; }
.testcard .bars i:nth-child(3) { background: #00c0c0; } .testcard .bars i:nth-child(4) { background: #00c000; }
.testcard .bars i:nth-child(5) { background: #c000c0; } .testcard .bars i:nth-child(6) { background: #c00000; }
.testcard .bars i:nth-child(7) { background: #0000c0; }
.testcard-text { margin: 0; padding: 18px; text-align: center; background: #000; font: 700 clamp(14px, 2.4vw, 22px)/1 var(--mono); letter-spacing: .2em; }

.casting { z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(ellipse at center, #1a1a1a, #000 70%); text-align: center; }
.casting-icon { width: 56px; height: 56px; color: var(--accent); }
.casting p { margin: 0; font-size: 18px; }

/* MTV-style video credits, lower left */
.credits {
  display: block; text-decoration: none; color: inherit;
  position: absolute; left: clamp(20px, 4vw, 56px); bottom: clamp(70px, 9vh, 110px); z-index: 4;
  max-width: min(70%, 640px); pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.9), 0 0 18px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(6px); transition: opacity .6s ease, transform .6s ease;
}
.credits.show { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
.credits.show:hover .credits-artist { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.credits-artist { font-weight: 800; font-size: clamp(20px, 2.6vw, 34px); line-height: 1.05; letter-spacing: -.01em; }
.credits-title { font-weight: 400; font-size: clamp(18px, 2.2vw, 28px); line-height: 1.2; margin-top: 2px; }
.credits-meta { font: 400 clamp(11px, 1vw, 13px)/1.6 var(--mono); text-transform: uppercase; letter-spacing: .12em; margin-top: 8px; color: #e8e8e8; }
.credits-meta a { pointer-events: auto; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.5); }

/* Top-left channel bug */
.topbar { position: absolute; top: 0; left: 0; z-index: 12; display: flex; align-items: center; gap: 12px; padding: 14px 16px; pointer-events: none; }
.app.panel-open .topbar { left: var(--pw); }
.bug { display: flex; align-items: center; gap: 10px; font: 700 12px/1 var(--mono); letter-spacing: .14em; }
.bug-live, .bug-vod { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px 6px 8px; background: rgba(0,0,0,.6); }
.bug-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.bug-viewers { color: #ddd; font-weight: 400; letter-spacing: .06em; text-shadow: 0 1px 2px #000; }
.back-live { pointer-events: auto; background: var(--live); color: #fff; font: 700 12px/1 var(--mono); letter-spacing: .1em; padding: 8px 12px; text-transform: uppercase; }

.sound-cta {
  position: absolute; z-index: 9; left: 50%; top: calc(var(--head) + (100% - var(--head)) / 2); transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px;
  background: var(--accent); color: #000; font: 800 15px/1 var(--font); text-transform: uppercase; letter-spacing: .08em;
  box-shadow: 6px 6px 0 #000;
}
.sound-cta svg { width: 22px; height: 22px; }

/* Controls */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 40px 14px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  transition: opacity .4s;
}
.controls-left, .controls-right { display: flex; align-items: center; gap: 4px; }
.ctl { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 40px; justify-content: center; padding: 0 10px; color: #fff; }
.ctl svg { width: 22px; height: 22px; }
.ctl:hover { background: rgba(255,255,255,.12); }
.ctl-text span { font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.ctl.on { color: var(--accent); }
.badge { position: absolute; top: 6px; left: 24px; min-width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.tabs .badge { position: static; display: inline-block; vertical-align: middle; margin-left: 4px; }
.volume { display: flex; align-items: center; }
.volume input { width: 0; opacity: 0; transition: width .25s, opacity .25s; accent-color: var(--accent); }
.volume:hover input, .volume:focus-within input { width: 90px; opacity: 1; margin-right: 6px; }
#muteBtn .ic-off { display: none; } #muteBtn.muted .ic-on { display: none; } #muteBtn.muted .ic-off { display: block; }
.app.idle .controls, .app.idle .credits-meta a { opacity: 0; }
.app.idle .stage { cursor: none; }

.vodbar { position: absolute; z-index: 8; left: 14px; right: 14px; bottom: 64px; display: flex; align-items: center; gap: 10px; font: 400 12px var(--mono); transition: opacity .4s; }
.vodbar input { flex: 1; accent-color: var(--live); }
.app.idle .vodbar { opacity: 0; }

/* Now strip (mobile) */
.nowstrip { display: none; }
.progress { height: 2px; background: var(--line); }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }

/* ---------------------------------------------------------------- panel */
.panel {
  grid-area: panel; min-width: 0; overflow: hidden; display: flex; flex-direction: column;
  background: #0b0b0c; border-right: 1px solid var(--line); width: var(--pw);
}
.tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); flex: none; }
.tabs [role=tab] { flex: 1; padding: 16px 6px 14px; font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--dim); border-bottom: 2px solid transparent; }
.tabs [role=tab][aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tabs-close { width: 46px; font-size: 26px; line-height: 1; color: var(--dim); }
.tabs-close:hover { color: var(--text); }
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.panel-foot { flex: none; display: flex; justify-content: space-between; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.linklike { font: 400 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.linklike:hover { color: var(--text); }

/* Chat */
.chat-log { flex: 1; overflow-y: auto; padding: 12px 16px 4px; font-size: 15px; line-height: 1.4; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.msg { padding: 3px 0; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .nick { font-weight: 700; margin-right: 6px; }
.msg .time { font: 400 10px var(--mono); color: var(--dim); margin-left: 6px; opacity: 0; }
.msg:hover .time { opacity: 1; }
.msg a { color: var(--accent); }
.msg.host { margin: 6px -16px; padding: 8px 16px; background: rgba(255,229,0,.08); border-left: 3px solid var(--accent); }
.msg.host .nick { color: var(--accent); }
.msg.notice { color: var(--dim); font-style: italic; font-size: 13px; }
.msg.divider { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; font: 400 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.msg.divider::before { content: "▶"; color: var(--accent); }
.msg.divider span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-jump { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--accent); color: #000; font: 700 11px var(--mono); padding: 7px 12px; text-transform: uppercase; }
.chat-form { flex: none; padding: 8px 12px 6px; border-top: 1px solid var(--line); }
.chat-nick { font: 400 11px var(--mono); color: var(--dim); padding: 2px 4px 7px; text-transform: uppercase; letter-spacing: .08em; }
.nick-btn { font: 700 11px var(--mono); text-transform: none; letter-spacing: 0; border-bottom: 1px dashed currentColor; }
.chat-input-row { display: flex; gap: 6px; }
.chat-input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; background: #1a1a1c; color: var(--text); border: 1px solid transparent; font: 16px var(--font); /* 16px stops iOS zoom */ outline: none; }
.chat-input:focus { border-color: #444; }
.chat-send { width: 44px; height: 44px; flex: none; background: var(--accent); color: #000; display: grid; place-items: center; }
.chat-send svg { width: 20px; height: 20px; }
.chat-status { margin: 4px 4px 0; min-height: 14px; font: 400 11px var(--mono); color: var(--dim); }

/* Guide */
.guide { list-style: none; margin: 0; padding: 6px 0 16px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.gi { display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding: 10px 16px; align-items: baseline; }
.gi-time { font: 700 13px var(--mono); color: var(--dim); }
.gi-artist { font-weight: 700; font-size: 15px; }
.gi-title { color: #cfcfcb; font-size: 14px; }
.gi-tag { display: inline-block; margin-left: 6px; padding: 2px 5px; font: 700 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; vertical-align: 2px; border: 1px solid currentColor; color: var(--dim); }
.gi-tag.premiere { color: var(--accent); }
.gi.now { background: #161617; padding-top: 14px; padding-bottom: 14px; }
.gi.now .gi-time { color: var(--live); }
.gi.now .progress { grid-column: 1 / -1; margin-top: 8px; }
.gi-thumb { grid-column: 1 / -1; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #222; margin-bottom: 4px; }
.guide-day { padding: 16px 16px 4px; font: 700 10px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .15em; }

/* Library */
.lib-tools { flex: none; padding: 12px 16px 8px; display: grid; gap: 10px; }
.lib-tools input { height: 40px; padding: 0 12px; background: #1a1a1c; border: 1px solid transparent; color: var(--text); font: 16px var(--font); outline: none; }
.lib-tools input:focus { border-color: #444; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 7px 10px; font: 700 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--line); color: var(--dim); }
.chips button.on { background: var(--text); color: #000; border-color: var(--text); }
.library { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.li { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 8px 16px; cursor: pointer; }
.li:hover, .li:focus-visible { background: #161617; }
.li.playing { background: #1b1b10; }
.li-thumb { width: 96px; aspect-ratio: 16/9; object-fit: cover; background: #1d1d1f; display: grid; place-items: center; font: 800 18px var(--font); color: #555; overflow: hidden; }
.li-artist { font-weight: 700; font-size: 14px; }
.li-title { color: #cfcfcb; font-size: 13.5px; }
.li-dur { font: 400 11px var(--mono); color: var(--dim); }
.li-empty { padding: 30px 16px; color: var(--dim); text-align: center; }

/* About dialog */
.about { max-width: 420px; width: calc(100% - 32px); background: #0d0d0e; color: var(--text); border: 1px solid var(--line); padding: 28px; line-height: 1.55; font-size: 15px; }
.about::backdrop { background: rgba(0,0,0,.75); backdrop-filter: blur(4px); }
.about-logo { width: 160px; display: block; margin-bottom: 18px; }
.about-contact { font: 400 12px var(--mono); margin-top: 22px; }
.about a { color: var(--accent); }
.ghost { margin-top: 12px; padding: 10px 16px; border: 1px solid var(--line); font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.ghost:hover { border-color: var(--text); }
.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ------------------------------------------------- tablet, portrait */
/* tablet held upright: video on top, panel below (set by JS: .lay-stack) */
@supports (display: grid) {
  .app.lay-stack { --head: 80px; }
  .app.lay-stack, .app.lay-stack.panel-open { display: flex; flex-direction: column; }
  .lay-stack .stage { flex: none; height: calc(var(--app-w, 100vw) * 9 / 16 + var(--head)); }
  .lay-stack .topbar, .app.lay-stack.panel-open .topbar { left: 0; padding: 14px 12px; }
  .lay-stack .bug { flex-direction: column; align-items: flex-start; gap: 6px; }
  .lay-stack .credits { display: none; }
  .lay-stack .controls { padding: 30px 6px 6px; }
  .lay-stack .controls-left .ctl-text { display: none; }
  .lay-stack .volume input { display: none; }
  .lay-stack .vodbar { bottom: 48px; }
  .lay-stack .nowstrip { display: grid; grid-template-columns: 1fr auto; align-items: center; flex: none; background: #0b0b0c; border-bottom: 1px solid var(--line); }
  .lay-stack .nowstrip-text { padding: 10px 14px; min-width: 0; }
  .lay-stack .nowstrip-artist { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lay-stack .nowstrip-title { color: #cfcfcb; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lay-stack .nowstrip-link { padding: 14px; color: var(--accent); }
  .lay-stack .nowstrip-link svg { width: 20px; height: 20px; }
  .lay-stack .nowstrip .progress { grid-column: 1 / -1; }
  .lay-stack .panel { flex: 1; width: auto; border-right: 0; }
  .lay-stack .tabs-close { display: none; }
  .lay-stack .sound-cta { font-size: 13px; padding: 11px 16px; }
}

/* ------------------------------------------------- phone, landscape / small tablets: panel overlays the video */
@supports (display: grid) {
  .app.lay-compact, .app.lay-compact.panel-open { grid-template-columns: 0 1fr; }
  .lay-compact .panel { position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; width: min(var(--pw), calc(var(--app-w, 100vw) * .62)); transform: translateX(-100%); transition: transform .3s; }
  .app.lay-compact.panel-open .panel { transform: none; }
  .app.lay-compact.panel-open .topbar { left: 0; }
  .lay-compact .ctl-text span { display: none; }
}

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

/* closed panel on desktop: keep it out of the tab order */
.app:not(.panel-open) .panel { visibility: hidden; transition: visibility 0s .35s; }
.app.lay-stack:not(.panel-open) .panel { visibility: visible; }
.chat-input-row { flex-wrap: wrap; }
#nickInput { flex-basis: 100%; }
.app.vod .credits { bottom: clamp(110px, 14vh, 150px); }

/* ------------------------------------------------- phones: always landscape
   A phone held upright gets the whole app turned 90°, so the picture is
   always horizontal no matter how the phone is held (even with rotation lock). */
.app.rotated { left: var(--app-h); transform: rotate(90deg); transform-origin: 0 0; }
.turn-hint {
  position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(0,0,0,.82); font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: .14em; pointer-events: none;
  animation: hintfade 3.2s forwards;
}
.turn-hint svg { width: 64px; height: 64px; color: var(--accent); animation: turn 1.4s ease-in-out infinite alternate; }
@keyframes turn { from { transform: rotate(0); } to { transform: rotate(-90deg); } }
@keyframes hintfade { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.lay-compact .ctl { height: 44px; min-width: 44px; }  /* bigger touch targets */
.lay-compact #logo { top: 8px; right: 8px; }

/* ------------------------------------------------- ads */
.ad-layer { position: absolute; left: 0; right: 0; top: var(--head); bottom: 70px; z-index: 5; cursor: pointer; }
.lay-compact .ad-layer { display: none; }   /* on phones only the button links, so a tap can't open a page by accident */
.ad-bug { position: absolute; z-index: 13; top: 52px; left: 16px; display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px; background: rgba(0,0,0,.65); font: 400 12px var(--mono); }
.app.panel-open:not(.lay-compact):not(.lay-stack) .ad-bug { left: 16px; }
.ad-bug b { background: var(--accent); color: #000; padding: 3px 6px; font-weight: 700; letter-spacing: .1em; }
.ad-count { color: var(--dim); }
.lay-stack .ad-bug { top: calc(var(--head) + 10px); }
.ad-cta {
  position: absolute; z-index: 9; right: clamp(14px, 3vw, 40px); bottom: clamp(74px, 11vh, 110px);
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 20px; max-width: 70%;
  background: var(--accent); color: #000; text-decoration: none; font: 800 15px/1.1 var(--font); text-transform: uppercase; letter-spacing: .06em;
  box-shadow: 6px 6px 0 #000; animation: ctaIn .5s cubic-bezier(.2,.9,.3,1.3);
}
.ad-cta:hover { filter: brightness(1.08); transform: translate(-1px, -1px); box-shadow: 7px 7px 0 #000; }
@keyframes ctaIn { from { transform: translateY(16px); opacity: 0; } }
.lay-stack .ad-cta { bottom: 52px; font-size: 13px; padding: 10px 14px; }

/* ------------------------------------------------- artist button + page */
.ctl-artist span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: .02em; font-family: var(--font); font-size: 14px; font-weight: 700; }
.lay-compact .ctl-artist span { display: inline; max-width: 120px; font-size: 13px; }
.lay-stack .ctl-artist { display: none; }
.artist { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #333 transparent; padding-bottom: 20px; }
.artist-back { display: flex; align-items: center; gap: 6px; padding: 14px 16px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.artist-back:hover { color: var(--text); }
.artist-hero { position: relative; aspect-ratio: 16/10; background: #161617 center/cover no-repeat; }
.artist-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, #0b0b0c); }
.artist-name { position: relative; z-index: 1; margin: -54px 16px 0; font-size: 32px; font-weight: 900; line-height: 1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.artist-bio { padding: 4px 16px 0; color: #d7d7d3; font-size: 15px; line-height: 1.55; }
.artist-bio p { margin: 12px 0 0; }
.artist-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.artist-links a { padding: 9px 12px; border: 1px solid var(--line); text-decoration: none; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.artist-links a:hover { border-color: var(--accent); color: var(--accent); }
.artist-links a.primary { background: var(--accent); border-color: var(--accent); color: #000; }
.artist-h { padding: 18px 16px 6px; font: 700 10px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .15em; }
.artist-air { list-style: none; margin: 0; padding: 0 16px; font-size: 14px; }
.artist-air li { padding: 4px 0; } .artist-air b { font-family: var(--mono); color: var(--accent); margin-right: 8px; }
.artist-share { margin: 18px 16px 0; }
.li-artist[role=link] { cursor: pointer; } .li-artist[role=link]:hover { text-decoration: underline; }
.gi-artist[role=link] { cursor: pointer; } .gi-artist[role=link]:hover { text-decoration: underline; }

/* ------------------------------------------------- in-app overlays (about) */
.overlay { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.75); backdrop-filter: blur(4px); }
.overlay .about { max-height: 100%; overflow-y: auto; }
.lay-compact .artist-hero { aspect-ratio: auto; height: 34%; min-height: 90px; max-height: 150px; }
.lay-compact .artist-name { margin-top: -40px; font-size: 26px; }
.foot-artists { text-decoration: none; opacity: .55; }
.foot-artists:hover { opacity: 1; }
.panel-foot { gap: 14px; }
.panel-foot #installBtn { margin-left: auto; }
.about-artists { margin-top: 8px; color: var(--dim); }
.panel-foot { justify-content: flex-start; }
