/* viewer.css - chrome for the 3D viewer, in the visual language of the 2D version (css/style.css) */
:root {
  --iaf: #ff8c1a; --paf: #39d98a; --rec: #ffc48a; --bg: #0b0f14;
  --panel: rgba(12, 16, 22, 0.84); --text: #e8e8e8; --muted: #9aa5ab;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif; --serif: Georgia, "Times New Roman", serif; --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
button { font: inherit; }
canvas#gl, canvas#hud { position: fixed; inset: 0; display: block; }
canvas#hud { pointer-events: none; }
canvas#gl.guncam { filter: grayscale(1) sepia(0.35) contrast(1.35) brightness(0.95); }
#dip { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* ---------- top bar ---------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; min-height: 62px; display: flex; align-items: flex-start; gap: 16px; padding: 8px 14px;
  background: linear-gradient(to bottom, rgba(8, 10, 14, 0.9), rgba(8, 10, 14, 0.0)); pointer-events: none; }
.clockcol { display: flex; flex-direction: column; gap: 5px; }
#clock { font-family: var(--mono); font-size: 16px; letter-spacing: 0.08em; color: #fff; white-space: pre; background: rgba(8, 10, 14, 0.7); padding: 6px 10px; border-radius: 4px; border-left: 3px solid var(--iaf); }
#manLabel { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; font-variant: small-caps; color: #1a1000; background: var(--iaf); padding: 3px 9px; border-radius: 3px; opacity: 0; transition: opacity 0.25s; max-width: 46vw; }
#manLabel.on { opacity: 1; }
.titlecol { flex: 1; min-width: 0; padding-top: 3px; }
#chapterTitle { font-size: 15px; font-weight: 600; color: #f4f4f4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; }
#camLabel { font-family: var(--mono); font-size: 11px; color: var(--rec); margin-top: 4px; text-shadow: 0 1px 2px #000; }
#status { display: flex; flex-wrap: wrap; gap: 4px 11px; justify-content: flex-end; max-width: 50vw; font-family: var(--mono); font-size: 11px;
  background: rgba(8, 10, 14, 0.72); border: 1px solid rgba(255, 140, 26, 0.35); padding: 5px 10px; border-radius: 4px; }
#status .who { color: var(--iaf); font-weight: 700; }
#status .item { color: var(--muted); white-space: nowrap; }
#status b { color: #fff; font-weight: 600; } #status b.warn { color: #ffd27a; } #status b.bad { color: #ff6b6b; }

/* ---------- side panels ---------- */
#sidebar, #panel { position: fixed; top: 76px; bottom: 112px; width: 262px; padding: 12px 12px 10px; background: var(--panel); overflow-y: auto; transition: transform 0.25s ease; }
#sidebar { left: 0; border-right: 1px solid rgba(255, 255, 255, 0.06); }
#sidebar.hidden { transform: translateX(-105%); }
#panel { right: 0; width: 330px; border-left: 1px solid rgba(255, 255, 255, 0.06); transform: translateX(105%); }
#panel.open { transform: none; }
#sidebar h1 { font-family: var(--serif); font-size: 19px; line-height: 1.15; margin: 0 0 6px; color: #fff; }
#sidebar h1 span { font-size: 12px; color: var(--rec); font-family: var(--font); font-weight: 500; }
#sidebar .sub { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.4; }
#sidebar a { color: var(--rec); }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 6px 0 6px; }
h2 span { text-transform: none; letter-spacing: 0; color: #6f7a80; }
#chapterList, #manList { list-style: none; margin: 0; padding: 0; }
#chapterList li, #manList li { display: grid; grid-template-columns: 22px 1fr auto; gap: 7px; align-items: baseline; padding: 5px 7px; border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1.3; color: #d8dde2; }
#chapterList li:hover, #manList li:hover { background: rgba(255, 255, 255, 0.07); }
#chapterList li.active, #manList li.active { background: rgba(255, 140, 26, 0.16); color: #fff; box-shadow: inset 3px 0 0 var(--iaf); }
.num, .clk { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.legend { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-left: 4px; }
.sw.iaf { background: var(--iaf); } .sw.paf { background: #0a5c2f; border: 1px solid var(--paf); } .sw.rec { border: 1px dashed var(--rec); }
.sw.brd { width: 16px; background: repeating-linear-gradient(90deg, #d6161b 0 4px, #f6f3ee 4px 8px); }

/* ---------- caption / cards ---------- */
#caption { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(820px, calc(100vw - 32px)); padding: 10px 16px 12px;
  background: rgba(8, 10, 14, 0.86); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; font-size: 15px; line-height: 1.45; color: #f3f3f3; transition: opacity 0.25s; pointer-events: none; }
#caption.empty { opacity: 0; }
#caption .caphead { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--rec); }
#caption.radio { border-color: rgba(127, 224, 255, 0.4); font-family: var(--mono); font-size: 14px; }
#capRadio { display: none; background: #7fe0ff; color: #05222c; padding: 1px 6px; border-radius: 3px; font-weight: 700; }
#capBadge, #card .badge { display: none; border: 1px dashed var(--rec); color: var(--rec); padding: 1px 7px; border-radius: 10px; font-size: 10px; letter-spacing: 0.06em; }
#card .badge { display: inline-block; }
#capSpeaker:empty { display: none; }
#card { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); width: min(640px, calc(100vw - 40px)); padding: 18px 24px; background: rgba(8, 10, 14, 0.82);
  border: 1px solid rgba(255, 196, 138, 0.35); border-radius: 8px; transition: opacity 0.4s; pointer-events: none; }
#card.empty { opacity: 0; }
#card h2 { font-family: var(--serif); font-size: 24px; text-transform: none; letter-spacing: 0; color: #fff; margin: 0 0 4px; }
#card h3 { font-size: 13px; color: var(--rec); margin: 0 0 10px; font-weight: 500; }
#card p { font-size: 14px; line-height: 1.5; margin: 6px 0; color: #e6e6e6; }
#gcLabel { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); font-family: var(--mono); font-size: 12px; color: #efe6cf; background: rgba(0,0,0,0.6); padding: 4px 10px; border-radius: 3px; opacity: 0; pointer-events: none; }
#gcLabel.on { opacity: 1; }

/* ---------- controls ---------- */
#controls { position: fixed; left: 0; right: 0; bottom: 0; padding: 6px 14px 10px; background: linear-gradient(to top, rgba(8, 10, 14, 0.96), rgba(8, 10, 14, 0.72)); border-top: 1px solid rgba(255, 255, 255, 0.06); }
#controls .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#controls .scrubrow { position: relative; height: 30px; margin-bottom: 6px; display: block; }
#scrub { width: 100%; margin: 12px 0 0; -webkit-appearance: none; appearance: none; height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; outline: none; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--iaf); border: 2px solid #fff; cursor: pointer; }
#scrub::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--iaf); border: 2px solid #fff; cursor: pointer; }
#ticks { position: absolute; left: 8px; right: 8px; top: 4px; height: 6px; pointer-events: none; }
#ticks span { position: absolute; top: 0; width: 1px; height: 6px; background: rgba(255, 255, 255, 0.55); }
#ticks span.m { top: 20px; height: 4px; width: 3px; background: var(--iaf); border-radius: 1px; }
#controls button { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 5px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
#controls button:hover { background: rgba(255, 255, 255, 0.16); }
#btnPlay { min-width: 70px; background: var(--iaf) !important; color: #1a1000 !important; font-weight: 700; border-color: transparent !important; }
#btnPlay.playing { background: rgba(255, 255, 255, 0.14) !important; color: #fff !important; }
#controls .group { display: inline-flex; }
#controls .group button { border-radius: 0; margin-left: -1px; }
#controls .group button:first-child { border-radius: 5px 0 0 5px; }
#controls .group button:last-child { border-radius: 0 5px 5px 0; }
#controls .group button.active { background: rgba(255, 140, 26, 0.3); border-color: var(--iaf); }
#time { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 86px; }

@media (max-width: 1000px) {
  #status { display: none; } #controls button { padding: 5px 7px; font-size: 11px; }
  #caption { font-size: 13px; bottom: 150px; } #sidebar, #panel { bottom: 150px; }
}
