/* Video messages: recorder, player, library, watch page (36_video.js). Uses the theme tokens from app-1.css. */

/* status lines stay visible (the app hides .fine help text in short-help mode) */
.vfine { font-size: 13px; color: var(--muted); margin: 0; } .vfine.bad { color: var(--bad); }

/* ---------- recorder ---------- */
.vr { position: fixed; inset: 0; z-index: 70; background: rgba(15,16,18,.62); display: grid; place-items: center; padding: var(--s4); overflow-y: auto; }
.vr-panel { width: min(760px, 100%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s4) var(--s5) var(--s5); box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: var(--s3); }
.vr.recording .vr-panel { width: min(1100px, 100%); }
.vr-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); } .vr-head h2 { margin: 0; }
.vr-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); }
.vr-modes button { display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 var(--s3); border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font-weight: 560; cursor: pointer; }
.vr-modes button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.vr-stage { position: relative; display: grid; place-items: center; min-height: 220px; background: #0E0F11; border-radius: var(--r2); overflow: hidden; }
.vr-stage canvas, .vr-stage video { display: block; max-width: 100%; max-height: 62vh; }
.vr-stage.live canvas { width: 100%; height: auto; cursor: grab; }
.vr-cam { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; margin: var(--s4); transform: scaleX(-1); }
.vr-cam.full { width: 100%; height: auto; max-height: 62vh; border-radius: 0; border: 0; margin: 0; object-fit: contain; }
.vr-stage.live .vr-cam.full { transform: none; }
.vr-screen-ph { color: #C9C4BA; text-align: center; padding: var(--s6) var(--s4); } .vr-screen-ph p { margin-top: var(--s2); }
.vr-devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); }
.vr-devices select { min-height: var(--tap); border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg); padding: 0 var(--s2); flex: 1; min-width: 0; }
.vr-check { gap: 6px; cursor: pointer; } .vr-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.vr-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.vr-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
.vr-bar .grow { flex: 1; }
.vr-dot { width: 12px; height: 12px; border-radius: 50%; background: #E0442C; animation: vr-blink 1.2s infinite; }
.vr.paused .vr-dot { animation: none; background: var(--muted); }
@keyframes vr-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .vr-dot { animation: none; } }
.vr-time { font-size: 22px; font-weight: 650; min-width: 64px; font-variant-numeric: tabular-nums; }
.vr-up { max-width: 40ch; }
.vr-bubble-tools { gap: 6px; }
.vr-draw-tools { gap: 6px; }
.vr-draw.on { background: var(--accent); border-color: var(--accent); color: #1A0D04; }
.vr-swatches { display: inline-flex; gap: 4px; padding: 0 4px; }
.vr-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); cursor: pointer; padding: 0; }
.vr-swatch[aria-checked="true"] { outline: 3px solid var(--accent); outline-offset: 1px; }
.vr-stage.live canvas.drawing { cursor: crosshair; }
.vr-draw-done { display: none; }
/* Draw: the recorded screen full size with the pen tools floating on top */
.vr-stage:fullscreen { background: #000; min-height: 0; border-radius: 0; }
.vr-stage.live:fullscreen canvas { width: min(100vw, calc(100vh * var(--ar, 1.7778))); height: auto; max-width: 100vw; max-height: 100vh; }
.vr-draw-tools.float { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px);
  background: rgba(21,23,26,.92); color: #F1EEE8; padding: 8px 10px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.vr-draw-tools.float .btn.ghost { color: #F1EEE8; }
.vr-draw-tools.float .vr-draw-hint { color: #C9C4BA; }
.vr-draw-tools.float .vr-draw-done { display: inline-flex; }
.vr-more summary { cursor: pointer; font-weight: 560; padding: 6px 0; } .vr-more[open] summary { margin-bottom: var(--s2); }
.vr-count { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; font-size: clamp(90px, 20vw, 180px); font-weight: 700; color: #fff; background: rgba(0,0,0,.45); pointer-events: none; }
.vr progress, .vp progress { width: 100%; height: 10px; accent-color: var(--accent); }
.vr-done-video { width: 100%; max-height: 50vh; background: #000; border-radius: var(--r2); }
.vr textarea, .vw-compose textarea { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg); padding: var(--s2) var(--s3); resize: vertical; }
.vr input[type=text] { min-height: var(--tap); border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg); padding: 0 var(--s3); }
@media (max-width: 600px) { .vr { padding: 0; place-items: stretch; } .vr-panel { border-radius: 0; padding: var(--s3); min-height: 100%; } .vr-bar .btn { flex: 1; justify-content: center; } }

/* ---------- player ---------- */
.vp { position: relative; background: #000; border-radius: var(--r2); overflow: hidden; aspect-ratio: 16 / 9; }
.vp-video { width: 100%; height: 100%; display: block; background: #000; }
.vp-status { position: absolute; inset: auto 0 0 0; padding: var(--s2) var(--s3); font-size: 14px; color: #F1EEE8; background: rgba(0,0,0,.6); }
.vp-status.bad { color: #FFB4A6; }
.vp-speed { min-height: 34px; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--surface); padding: 0 6px; }
.vp-marks { position: relative; height: 34px; margin: 6px 0 var(--s2); border-bottom: 2px solid var(--line); }
.vp-mark { position: absolute; bottom: -2px; transform: translateX(-50%); border: 0; padding: 0; background: none; cursor: pointer; }
.vp-mark .avatar { width: 26px; height: 26px; font-size: 11px; background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- watch page ---------- */
.vw { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s5); align-items: start; }
@media (max-width: 960px) { .vw { grid-template-columns: 1fr; } }
.vw-head h1 { margin: 0; } .vw-head .row { flex-wrap: nowrap; }
.vw-actions { gap: var(--s2); } .vw-speed { gap: 6px; } .vw-speed select { width: auto; }
.vw-meta { color: var(--muted); margin: 6px 0 0; }
.vw-side h2 { margin-bottom: var(--s3); }
.vw-comments { list-style: none; margin: 0 0 var(--s3); padding: 0; display: flex; flex-direction: column; gap: var(--s3); max-height: 52vh; overflow-y: auto; }
.vw-comment .who { display: flex; align-items: center; gap: 8px; font-size: 14px; } .vw-comment .who time { color: var(--muted); font-size: 12px; margin-left: auto; }
.vw-comment p { margin: 4px 0 0 42px; white-space: pre-wrap; overflow-wrap: anywhere; } .vw-comment > .link { margin-left: 42px; }
.vw-at { font-weight: 650; font-variant-numeric: tabular-nums; background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; padding: 0 5px; text-decoration: none; }
.vw-compose { display: flex; flex-direction: column; gap: var(--s2); border-top: 1px solid var(--line); padding-top: var(--s3); }

/* ---------- library ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); }
.vcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; color: var(--ink); text-decoration: none; }
.vcard:hover { border-color: var(--line-2); text-decoration: none; } .vcard:hover strong { text-decoration: underline; }
.vcard.unfinished { opacity: .7; }
.vc-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: #0E0F11; color: #9A958B; overflow: hidden; }
.vc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vc-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.vc-body { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); } .vc-body strong { overflow-wrap: anywhere; }

/* ---------- video in a conversation ---------- */
.vcard-msg { display: flex; align-items: center; gap: var(--s3); margin-top: 6px; padding: 6px; max-width: 360px; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--surface); color: var(--ink); text-decoration: none; }
.vcard-msg:hover { border-color: var(--accent); text-decoration: none; }
.vcard-msg .vc-thumb { width: 128px; flex: none; border-radius: 6px; }
.vc-meta { display: flex; flex-direction: column; min-width: 0; } .vc-meta strong { overflow-wrap: anywhere; }

/* ---------- Video Rec. box (Loom-style): sits at the side, never covers the page ---------- */
.vl { position: fixed; top: 76px; right: 16px; z-index: 80; width: 300px; max-width: calc(100vw - 24px); max-height: calc(100vh - 92px); overflow-y: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 12px; box-shadow: 0 18px 50px rgba(0,0,0,.28);
  display: flex; flex-direction: column; gap: 10px; }
.vl.wide { width: 380px; }
.vl[hidden] { display: none; }
.vl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .vl-head strong { font-size: 17px; }
.vl-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.vl-row select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; min-height: 44px; cursor: pointer; }
.vl-row select:disabled { color: var(--muted); }
.vl-ico { display: grid; place-items: center; color: var(--muted); flex: none; }
.vl-tog { flex: none; min-width: 44px; height: 26px; border-radius: 8px; border: 0; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--ok, #2FB36B); color: #fff; }
.vl-tog[aria-checked="false"] { background: var(--bad, #D2402B); }
.vl-hint { margin: -4px 4px 0; }
.vl-start { min-height: 48px; justify-content: center; font-size: 16px; border-radius: 12px; }
.vl-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); padding: 2px 4px 0; }
.vl .vr-foot { margin-top: 0; }
.vl input[type=text] { min-height: var(--tap); border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg); padding: 0 var(--s3); width: 100%; }
.vl textarea { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--bg); padding: var(--s2) var(--s3); resize: vertical; }
.vl progress { width: 100%; height: 10px; accent-color: var(--accent); }
.vl .vr-done-video { max-height: 30vh; }
@media (max-width: 600px) { .vl { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; } .vl.wide { width: auto; } }

/* camera bubble and pen layer on the page while recording */
.vbub { position: fixed; z-index: 2147483645; border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: 0 8px 28px rgba(0,0,0,.35); cursor: grab; background: #111; }
.vbub[hidden] { display: none; }
.vbub video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; pointer-events: none; }
.vbub-size { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.vbub:hover .vbub-size { opacity: 1; }
.vbub-size button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font: 700 11px system-ui, sans-serif; cursor: pointer; }
.vbub.under-ink { pointer-events: none; }
.vink { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2147483644; pointer-events: none; }
.vink.on { pointer-events: auto; cursor: crosshair; }
.vr-count { z-index: 2147483647; }

/* Draw while recording another screen: a still picture of it, full screen on that screen */
.vdraw { position: fixed; inset: 0; z-index: 2147483646; background: #000; display: grid; place-items: center; }
.vdraw canvas { width: min(100vw, calc(100vh * var(--ar, 1.7778))); height: auto; max-height: 100vh; cursor: crosshair; display: block; }
.vdraw-tools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 24px); background: rgba(21,23,26,.92); color: #F1EEE8; padding: 8px 12px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.vdraw-tools .btn.ghost { color: #F1EEE8; }

/* ---------- phones and tablets: camera video, full screen while recording ---------- */
.vl-prev { width: 100%; aspect-ratio: 3 / 4; max-height: 38vh; object-fit: cover; background: #111; border-radius: 14px; }
.vl-prev.mirror, .vmob video.mirror { transform: scaleX(-1); }
.vmob { position: fixed; inset: 0; z-index: 2147483640; background: #000; }
.vmob video { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 600px) { .vl { max-height: calc(100dvh - 88px); } }
.vl .vl-up { width: 100%; justify-content: center; }
