/* Public viewer edition, on top of player.css + extras.css */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body.viewer { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
body.viewer #mode, body.viewer #buildBadge { display: none !important; }
#vStart { z-index: 40; }

/* ---------- Start screen ---------- */
#vStart {
  position: fixed; inset: 0; display: grid; place-items: center; overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: radial-gradient(120% 90% at 50% 20%, #151515, #000 70%);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.45s ease;
}
#vStart.gone { opacity: 0; pointer-events: none; }
body.viewer:not(.started) #hud { visibility: hidden; }
#vStart[hidden] { display: none; }
.vs-card { width: min(560px, 100%); }
.vs-eyebrow { font: 500 11px var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
#vStart h1 { margin: 10px 0 12px; font: 300 clamp(34px, 7vw, 56px)/1.05 var(--sans); letter-spacing: -0.01em; }
.vs-lead { margin: 0 0 14px; font-size: clamp(15px, 2.4vw, 18px); line-height: 1.45; color: #cfcfcf; }
.vs-meta { margin-bottom: 26px; font: 500 11px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.vs-actions { display: grid; gap: 10px; }
.vs-actions button {
  display: grid; gap: 4px; padding: 16px 18px; border-radius: 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--rule); transition: background 0.15s, border-color 0.15s;
}
.vs-actions b { font: 600 16px var(--sans); }
.vs-sub { font-size: 13px; color: var(--dim); }
.vs-go { background: var(--accent); border-color: var(--accent) !important; color: #04130c; }
.vs-go .vs-sub { color: rgba(4, 19, 12, 0.72); }
.vs-go:hover { filter: brightness(1.06); }
.vs-alt:hover { background: rgba(255, 255, 255, 0.06); }
.vs-resume { display: block; margin-top: 12px; padding: 10px 0; font-size: 14px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.vs-resume[hidden] { display: none; }
.vs-hints { margin: 22px 0 0; padding: 18px 0 0; list-style: none; border-top: 1px solid var(--rule); display: grid; gap: 8px; }
.vs-hints li { font-size: 13px; line-height: 1.45; color: #a9a9a9; }
.vs-hints b { color: var(--text); font-weight: 600; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--rule); border-radius: 3px; color: var(--text); }
.vs-share {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; margin-top: 12px; padding: 13px 18px;
  border: 1px solid rgba(95, 217, 163, 0.55); border-radius: 8px; color: var(--accent); font: 600 15px var(--sans); cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.vs-share svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.vs-share:hover { background: rgba(95, 217, 163, 0.1); border-color: var(--accent); }
/* The studio and its contact details (links), at the top of the start screen and the foot of the guide */
.v-contact { display: grid; gap: 8px; }
.vs-card > .v-contact { margin-bottom: 34px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.v-studio { font: 600 13px var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--text); text-decoration: none; }
a.v-studio:hover { color: var(--accent); }
.v-reach { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.v-reach a { font-size: 14px; color: #cfcfcf; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.22); padding: 2px 0; }
.v-reach a:hover { color: var(--accent); border-color: var(--accent); }
.v-reach a.copied { color: var(--accent); border-color: var(--accent); }
body.viewer #help .v-contact { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--rule); }

/* ---------- Controls ---------- */
body.viewer #clientNext { background: var(--accent); border-color: var(--accent); color: #04130c; font-weight: 600; }
body.viewer #clientNext span { color: #04130c; }
body.viewer #hud, body.viewer #cmpBar, body.viewer .lab-bar {
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
body.viewer:not(.band) #hud, body.viewer:not(.band) #cmpBar, body.viewer:not(.band) .lab-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
body.viewer.band #hud { padding-bottom: env(safe-area-inset-bottom); }
#vNow { display: none; }
/* In a band the Compare and Analysis bars stay put too (nothing of the picture to uncover) */
body.viewer.band.idle #cmpBar, body.viewer.band.idle .lab-bar { opacity: 1; transform: none; pointer-events: auto; }
body.viewer.band.idle, body.viewer.band.idle * { cursor: auto !important; }

/* Touch: finger-sized targets */
body.viewer.touch #bar > .group > button:not(.pill) { width: 44px; height: 44px; }
body.viewer.touch #bar svg { width: 22px; height: 22px; }
body.viewer.touch .pill, body.viewer.touch .lab-tog, body.viewer.touch .cmpModes button { padding: 11px 14px; font-size: 11px; }
body.viewer.touch #track { height: 34px; }
body.viewer.touch #blocks { inset: 12px 0; }
body.viewer.touch #cmpLine .ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; }

/* A phone on its side: one slim row over the bottom of the picture (the chapter's name is in the bar) */
@media (max-height: 500px) and (orientation: landscape) {
  body.viewer #hud { padding-top: 0; padding-bottom: max(8px, env(safe-area-inset-bottom)); display: flex; flex-direction: row; align-items: center; gap: 12px; height: auto; }
  body.viewer #timeline { order: 2; flex: 1; min-width: 80px; padding-top: 0; }
  body.viewer #labels { display: none; }
  body.viewer #bar { display: contents; }
  body.viewer #bar > .group:first-child { order: 1; flex: none; }
  body.viewer #bar > .group:last-child { order: 3; flex: none; }
  body.viewer #tc, body.viewer #tc ~ .dim, body.viewer #tcTotal, body.viewer #chapName, body.viewer #status { display: none; }
  body.viewer.touch #bar > .group > button:not(.pill) { width: 40px; height: 40px; }
  body.viewer #bar .pill { margin-right: 4px; }
  body.viewer #bCompare, body.viewer #bLab { padding: 9px 10px; }
}

/* Keyboard hints mean nothing on a touch screen */
body.viewer.touch .cmpInfo .tech { display: none; }

/* A phone on its side: Compare and Analysis get one slim row too (pair names as small pills, no thumbnails),
   and tuck away with the rest when idle; a tap brings them back */
@media (max-height: 500px) and (orientation: landscape) {
  body.viewer #cmpBar, body.viewer .lab-bar {
    padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 10px; flex-wrap: nowrap; align-items: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.45)); border-top: 0;
  }
  body.viewer #cmpPairs { flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  body.viewer #cmpPairs img { display: none; }
  body.viewer #cmpPairs button { width: auto; }
  body.viewer #cmpPairs span { padding: 7px 9px; border: 1px solid var(--rule); border-radius: 4px; }
  body.viewer #cmpPairs button.on span { border-color: rgba(95, 217, 163, 0.6); color: var(--text); }
  body.viewer .cmpInfo { gap: 6px; flex-wrap: nowrap; }
  body.viewer.touch .cmpModes button, body.viewer.touch .lab-tog, body.viewer.touch .lab-bar .pill { padding: 8px 9px; font-size: 10px; }
  body.viewer .lab-left { display: none; }
  body.viewer .lab-tog { white-space: nowrap; }
  body.viewer .lab-toggles { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  body.viewer .tag { top: 12px; }
}

/* Narrow screens (a phone upright): the bar wraps into centred rows instead of running off the edge */
@media (max-width: 760px) and (orientation: portrait) {
  body.viewer #bar { flex-wrap: wrap; justify-content: center; row-gap: 10px; }
  body.viewer #bar > .group { flex-wrap: wrap; justify-content: center; }
  body.viewer #bar > .group:last-child { width: 100%; }
  body.viewer #tc { margin-left: 8px; font-size: 12px; }
  body.viewer #cmpBar { flex-wrap: wrap; justify-content: center; }
  body.viewer #cmpPairs { width: 100%; flex-wrap: wrap; justify-content: center; overflow: visible; }
  body.viewer .cmpInfo { width: 100%; justify-content: center; flex-wrap: wrap; }
  body.viewer .lab-bar { justify-content: center; }
  body.viewer .lab-left { min-width: 0; width: 100%; align-items: center; }
  body.viewer .ov-head { margin-bottom: 14px; }
  body.viewer #overview { padding: max(16px, env(safe-area-inset-top)) 16px 16px; }
}

/* A phone upright has a tall band under the picture: the chapter's name goes there, large */
body.viewer.band:not(.band-tight) #vNow { display: flex; gap: 10px; align-items: baseline; justify-content: center; margin-bottom: 14px; }
@media (min-width: 761px) { body.viewer.band #vNow { display: none !important; } }
#vNow b { font: 400 13px var(--mono); color: var(--accent); }
#vNow span { font: 300 22px var(--sans); }

/* Phone on its side (no band): bars float over the picture and tuck away when idle */
body.viewer.full #hud::before { background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.55)); }

/* How to watch */
body.viewer #help dt { font: 600 12px var(--sans); color: var(--text); white-space: normal; }
body.viewer #help dd { color: #b9b9b9; }
.vh-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
