/* Apuntador KYRXA: estudio de grabación de bolsillo. Oscuro porque la cámara manda; un rojo para grabar, un azul claro para lo que ya dijiste. */
:root {
  --ground: #0b0d10;
  --surface: #15191f;
  --surface-2: #1e242c;
  --line: #2b333d;
  --ink: #f2f4f6;
  --muted: #a3adb9;
  --rec: #e5383b;
  --said: #8fd3ff;
  --now: #ffffff;
  --focus: #8fd3ff;
  --danger: #ff6b6b;
  --f-head: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-text: "Atkinson Hyperlegible", -apple-system, system-ui, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r1: 6px; --r2: 12px; --r3: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --size: 32px;
  --band: 34vh;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body { background: var(--ground); color: var(--ink); font: 16px/1.5 var(--f-text); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.noscript { padding: var(--s5); }

/* ---------- Pantallas de lista ---------- */
.screen { max-width: 680px; margin: 0 auto; padding: calc(var(--safe-t) + var(--s4)) var(--s4) calc(96px + var(--safe-b)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.top-actions { display: flex; gap: var(--s2); }
.brand { display: flex; align-items: center; gap: var(--s3); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); }
h1 { font-family: var(--f-head); font-variation-settings: "wdth" 85; font-weight: 800; font-size: 28px; line-height: 1.1; margin: 0; }
h2 { font-family: var(--f-head); font-variation-settings: "wdth" 90; font-weight: 800; font-size: 20px; margin: 0; }
.note { color: var(--muted); font-size: 14px; margin: 0 0 var(--s4); }
.empty { color: var(--muted); text-align: center; padding: var(--s7) var(--s4); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r2); padding: 10px 16px; min-height: 44px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); transition: transform 150ms var(--ease), background 150ms var(--ease); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }

.searchrow { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
input[type=search], input[type=text], textarea { width: 100%; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; font-size: 16px; }
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s3); margin-bottom: var(--s2); scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 14px; min-height: 36px; }
.chips button[aria-pressed=true] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s3) var(--s4); }
.item button.open { all: unset; cursor: pointer; display: grid; gap: 2px; min-width: 0; }
.item button.open:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.item .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { color: var(--muted); font-size: 13px; }
.item .go { background: var(--rec); color: #fff; border: 0; border-radius: 999px; min-height: 40px; padding: 0 16px; font-weight: 700; }

.clips .item { grid-template-columns: 96px minmax(0, 1fr); align-items: start; }
.clips video { width: 96px; height: 128px; object-fit: cover; border-radius: var(--r1); background: #000; }
.clip-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.clip-actions .btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: var(--s2); padding: var(--s2) var(--s4) calc(var(--s2) + var(--safe-b)); background: rgba(11, 13, 16, 0.92); border-top: 1px solid var(--line); z-index: 5; }
.tabs button { flex: 1; max-width: 220px; background: transparent; border: 0; border-radius: var(--r2); min-height: 44px; color: var(--muted); font-weight: 700; }
.tabs button[aria-current=page] { color: var(--ink); background: var(--surface-2); }

/* ---------- Editor ---------- */
.form { display: grid; gap: var(--s2); }
.form label, .lbl { font-size: 13px; color: var(--muted); font-weight: 700; margin-top: var(--s2); }
textarea { min-height: 46vh; line-height: 1.6; resize: vertical; }
.stats { color: var(--muted); font-size: 14px; margin: 0; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-b)); background: linear-gradient(transparent, var(--ground) 30%); display: flex; justify-content: center; }
.record-cta { width: 100%; max-width: 640px; background: var(--rec); color: #fff; border: 0; font-family: var(--f-head); font-variation-settings: "wdth" 95; font-size: 18px; min-height: 56px; }
.ring { width: 14px; height: 14px; border-radius: 50%; background: #fff; }

/* ---------- Estudio ---------- */
#studio { position: fixed; inset: 0; background: #000; overflow: hidden; z-index: 10; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#cam.mirror { transform: scaleX(-1); }
.cam-off { position: absolute; inset: 0; display: grid; place-content: center; gap: var(--s4); text-align: center; padding: var(--s5); }
.cam-off p { max-width: 32ch; margin: 0 auto; }

#band { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--band) + var(--safe-t)); padding-top: calc(var(--safe-t) + 22px); overflow: hidden;
  background: linear-gradient(rgba(0,0,0,0.82), rgba(0,0,0,0.72) 75%, rgba(0,0,0,0)); touch-action: none; }
.lens { position: absolute; top: calc(var(--safe-t) + 4px); left: 50%; transform: translateX(-50%); width: 46px; height: 12px; display: grid; place-items: center; }
.lens span { width: 8px; height: 8px; border-radius: 50%; background: var(--said); box-shadow: 0 0 0 3px rgba(143, 211, 255, 0.25); }
#eyeline { position: absolute; left: 0; width: 6px; height: calc(var(--size) * 1.2); top: calc(var(--safe-t) + 22px); background: var(--rec); border-radius: 0 3px 3px 0; }
#track { padding: 0 var(--s5); transition: transform 320ms var(--ease); will-change: transform; font-size: var(--size); line-height: 1.3; font-weight: 700; }
#track p { margin: 0 0 0.6em; text-wrap: pretty; }
#track .w { color: rgba(255,255,255,0.92); transition: color 200ms var(--ease); }
#track .w.said { color: var(--said); }
#track .w.now { color: var(--now); text-decoration: underline; text-decoration-color: var(--rec); text-decoration-thickness: 3px; text-underline-offset: 6px; }
#band.manual #track { transition: none; }

/* Cuadrito pegado a la cámara: pocas palabras, letra chica, los ojos casi no se mueven */
#band.compact { left: 50%; right: auto; width: var(--boxw); max-width: 420px; transform: translateX(-50%);
  top: calc(var(--safe-t) + 12px); height: calc(var(--size) * 1.3 * var(--lines)); padding: 0;
  border-radius: 8px; box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.72);
  border-radius: 14px; background: rgba(0, 0, 0, 0.72); }
#band.compact .lens, #band.compact #eyeline { display: none; }
#band.compact #track { padding: 0 12px; text-align: center; }
#band.compact #track p { display: inline; margin: 0; }
#band.compact #track p + p::before { content: " · "; color: var(--muted); }
#band.compact .w.now { text-underline-offset: 4px; text-decoration-thickness: 2px; }

.face { position: absolute; left: 50%; top: 56%; width: 62vw; max-width: 340px; aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border: 2px dashed rgba(255,255,255,0.55); border-radius: 50%; pointer-events: none; }
.safe span { position: absolute; background: rgba(229, 56, 59, 0.18); pointer-events: none; }
.safe-top { left: 0; right: 0; top: 0; height: 12%; }
.safe-bottom { left: 0; right: 0; bottom: 0; height: 22%; }
.safe-right { right: 0; top: 12%; bottom: 22%; width: 16%; }

#count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-head); font-weight: 800; font-size: 40vw; color: #fff; text-shadow: 0 4px 30px rgba(0,0,0,0.6); pointer-events: none; }
#toast { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); background: rgba(21, 25, 31, 0.95); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 16px; font-size: 14px; max-width: 90vw; text-align: center; }

#hud { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s3) var(--s4) calc(var(--s4) + var(--safe-b)); display: grid; gap: var(--s3); background: linear-gradient(transparent, rgba(0,0,0,0.65) 40%); transition: opacity 250ms var(--ease); }
#studio.recording #hud .hud-row:first-child { opacity: 0.25; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.hud-row.main { justify-content: space-around; }
.hud-btn { background: rgba(21, 25, 31, 0.85); border: 1px solid var(--line); border-radius: var(--r2); min-height: 44px; min-width: 72px; padding: 0 12px; font-weight: 700; font-size: 14px; }
.seg { display: flex; background: rgba(21, 25, 31, 0.85); border: 1px solid var(--line); border-radius: var(--r2); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: var(--r1); min-height: 38px; padding: 0 12px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--ground); }
.seg.light { background: var(--surface-2); flex-wrap: wrap; }
#recBtn { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: grid; place-items: center; padding: 0; }
#recBtn span { width: 58px; height: 58px; border-radius: 50%; background: var(--rec); transition: border-radius 200ms var(--ease), transform 200ms var(--ease); }
#recBtn.on span { border-radius: 8px; transform: scale(0.55); }
.clock { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
#studio.recording .clock { color: var(--rec); }

.sheet { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-card { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--surface); border-radius: var(--r3) var(--r3) 0 0; padding: var(--s5) var(--s4) calc(var(--s5) + var(--safe-b)); display: grid; gap: var(--s4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.row { display: grid; gap: var(--s2); }
.row .head { display: flex; justify-content: space-between; align-items: baseline; }
.row .head label { font-weight: 700; }
.row .head span { font-variant-numeric: tabular-nums; color: var(--muted); }
.row .note { margin: 0; }
input[type=range] { width: 100%; accent-color: var(--rec); min-height: 32px; }
#donePreview { width: 100%; max-height: 50vh; background: #000; border-radius: var(--r2); }
.done-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); }

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