/* ===== Elite Prompter ===== */
:root {
  --bg: #0a0a0b;
  --bg-2: #111113;
  --panel: #16161a;
  --panel-2: #1d1d22;
  --line: #2a2a31;
  --text: #f4f1ea;
  --muted: #8d8a83;
  --gold: #d4af37;
  --gold-2: #f2d37c;
  --gold-soft: rgba(212, 175, 55, .14);
  --red: #ff3b30;
  --green: #34c759;
  --pausa: #5ac8fa;
  --sonrie: #ffcc4d;
  --enfasis: #ff6b6b;

  --fs: 44px;          /* tamaño de letra del guion */
  --col: 26;           /* ancho de columna en caracteres */
  --guide: 22%;        /* posición vertical de la línea guía */
  --split: 55%;        /* altura del panel de guion */
  --lh: 1.42;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- Barra superior ---------- */
#topbar {
  position: absolute; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: linear-gradient(to bottom, rgba(10,10,11,.96), rgba(10,10,11,.75) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0a0a0b 0 34%, var(--gold) 36% 54%, transparent 56%),
              conic-gradient(from 210deg, var(--gold-2), var(--gold), #8a6d1f, var(--gold-2));
  box-shadow: 0 0 16px rgba(212,175,55,.35);
}
.brand-name { font-size: 13px; letter-spacing: .22em; font-weight: 500; color: var(--muted); }
.brand-name b { color: var(--gold); font-weight: 700; }
.top-mid { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; justify-content: center; }
.top-actions { display: flex; align-items: center; gap: 4px; }
#scriptSelect { max-width: 260px; min-width: 0; }
.chip {
  font-size: 12px; font-weight: 600; color: var(--gold-2); white-space: nowrap;
  padding: 6px 10px; border-radius: 999px; background: var(--gold-soft); border: 1px solid rgba(212,175,55,.25);
}

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px; color: var(--text);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.07); }
.icon-btn.on { color: var(--gold); }
.badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--gold); color: #000; font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}
.pill {
  height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .05em;
  border: 1px solid var(--gold); color: var(--gold);
}
.pill:hover { background: var(--gold-soft); }

/* ---------- Escenario ---------- */
#stage {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding-top: calc(60px + var(--safe-t));
  padding-bottom: calc(92px + var(--safe-b));
  transition: padding .35s ease;
}
body.ui-hidden #stage { padding-top: var(--safe-t); padding-bottom: var(--safe-b); }

#prompter {
  position: relative; flex: 0 0 var(--split); overflow: hidden;
  background: var(--bg); touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none;
}
#mirrorWrap { position: absolute; inset: 0; }
body.mirror #mirrorWrap { transform: scaleX(-1); }
#scroller { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
#text {
  position: relative;
  font-size: var(--fs); line-height: var(--lh); font-weight: 600; letter-spacing: -.005em;
  width: min(calc(var(--col) * 1ch), 94%);
  margin: 0 auto; padding-bottom: 70vh;
  text-align: center; text-wrap: pretty; overflow-wrap: break-word;
}
#text .s { color: rgba(244,241,234,.28); transition: color .25s ease; }
#text .s.past { color: rgba(244,241,234,.16); }
#text .s.active { color: var(--text); }
#text .p { display: block; height: .55em; }
#text .w.emph { color: inherit; }
#text .s.active .w.emph { color: var(--enfasis); }
#text .s .w.emph { text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .14em; text-decoration-color: rgba(255,107,107,.6); }

.mk {
  display: inline-block; vertical-align: .18em; margin: 0 .2em;
  font-size: .36em; font-weight: 800; letter-spacing: .12em; line-height: 1;
  padding: .45em .7em; border-radius: 999px; border: 1.5px solid currentColor; opacity: .55;
}
.s.active .mk { opacity: 1; }
.mk-pausa { color: var(--pausa); }
.mk-sonrie { color: var(--sonrie); }
.mk-enfasis { color: var(--enfasis); }

#guide {
  position: absolute; left: 0; right: 0; top: var(--guide);
  height: calc(var(--fs) * var(--lh) * 1.08); transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(212,175,55,.08) 15%, rgba(212,175,55,.08) 85%, transparent);
  border-top: 1px solid rgba(212,175,55,.22); border-bottom: 1px solid rgba(212,175,55,.22);
  pointer-events: none;
}
.guide-arrow { position: absolute; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.guide-arrow.l { left: 6px; border-left: 12px solid var(--gold); }
.guide-arrow.r { right: 6px; border-right: 12px solid var(--gold); }

.fade { position: absolute; left: 0; right: 0; pointer-events: none; }
.fade.top { top: 0; height: 12%; background: linear-gradient(var(--bg), transparent); }
.fade.bottom { bottom: 0; height: 22%; background: linear-gradient(transparent, var(--bg)); }

.pause-hint, .voice-badge {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; background: rgba(22,22,26,.85); border: 1px solid var(--line);
  pointer-events: none; white-space: nowrap;
}
.voice-badge { bottom: auto; top: 10px; color: var(--gold-2); display: flex; align-items: center; gap: 7px; }
.voice-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s infinite; }
.voice-badge.listening .dot { background: var(--green); }

/* ---------- Divisor ---------- */
#divider {
  flex: 0 0 18px; display: grid; place-items: center; cursor: row-resize; touch-action: none;
  background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
#divider span { width: 46px; height: 4px; border-radius: 3px; background: #3a3a42; transition: background .2s; }
#divider:hover span, #divider.drag span { background: var(--gold); }

/* ---------- Cámara ---------- */
#camera { position: relative; flex: 1 1 auto; min-height: 0; background: #000; display: grid; place-items: center; overflow: hidden; }
#frame {
  position: relative; overflow: hidden; background: #060607;
  aspect-ratio: 9 / 16; height: 100%; max-width: 100%;
  border-radius: 10px; outline: 1px solid rgba(212,175,55,.25);
}
#app[data-format="16:9"] #frame { aspect-ratio: 16 / 9; height: auto; width: 100%; max-height: 100%; }
@supports not (aspect-ratio: 1) { #frame { width: 100%; height: 100%; } }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
body.mirror-preview #video { transform: scaleX(-1); }

.overlay-grid { position: absolute; inset: 0; pointer-events: none; }
.overlay-grid i { position: absolute; background: rgba(255,255,255,.28); }
.overlay-grid i:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.overlay-grid i:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.overlay-grid i:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.overlay-grid i:nth-child(4) { top: 66.666%; left: 0; right: 0; height: 1px; }
.eye-line { position: absolute; left: 0; right: 0; top: 33.333%; height: 0; border-top: 1.5px dashed rgba(212,175,55,.85); pointer-events: none; }
.eye-line span { position: absolute; right: 6px; top: -18px; font-size: 9px; font-weight: 800; letter-spacing: .15em; color: var(--gold); }
body:not(.show-grid) .overlay-grid, body:not(.show-eye) .eye-line { display: none; }

.cam-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; color: var(--muted); }
.cam-empty svg { width: 34px; height: 34px; color: var(--gold); }
.cam-empty p { margin: 0; font-size: 13px; }

.cam-switch { position: absolute; top: 10px; right: 10px; background: rgba(10,10,11,.6); backdrop-filter: blur(6px); }
.rec-badge {
  position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.6); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px;
}
.rec-badge .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }

.meter { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.meter-bar { position: relative; width: 120px; height: 6px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
#meterFill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--green) 0 65%, #ffd60a 65% 85%, var(--red) 85%); background-size: 120px 100%; }
#meterPeak { position: absolute; top: 0; bottom: 0; width: 2px; left: 0; background: #fff; opacity: .8; }
#meterDb { font-size: 10px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-shadow: 0 1px 2px #000; }
.meter.clip #meterDb { color: var(--red); }

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 5;
  font-size: min(32vw, 200px); font-weight: 800; color: var(--gold);
  background: rgba(0,0,0,.45); text-shadow: 0 0 40px rgba(212,175,55,.5);
}
.countdown.tick { animation: tick 1s ease-out; }

/* ---------- Controles ---------- */
#controls {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 16px);
  padding: 12px 12px calc(14px + var(--safe-b));
  background: linear-gradient(to top, rgba(10,10,11,.97), rgba(10,10,11,.8) 70%, transparent);
}
.ctl {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  transition: transform .15s, background .2s, border-color .2s, color .2s;
}
.ctl:hover { border-color: #3b3b44; }
.ctl:active { transform: scale(.94); }
.ctl.sm { width: 38px; height: 38px; }
.ctl.sm svg { width: 18px; height: 18px; }
.ctl.on { color: #000; background: var(--gold); border-color: var(--gold); }
.ctl.play { width: 60px; height: 60px; color: var(--gold); border-color: rgba(212,175,55,.5); }
.ctl.play svg { width: 26px; height: 26px; }
.speed { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.speed-val { display: flex; flex-direction: column; align-items: center; min-width: 46px; line-height: 1.05; }
.speed-val b { font-size: 16px; font-variant-numeric: tabular-nums; }
.speed-val small { font-size: 9px; color: var(--muted); letter-spacing: .04em; }

.rec {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--text); background: transparent; transition: transform .15s;
}
.rec span { width: 56px; height: 56px; border-radius: 50%; background: var(--red); transition: all .25s ease; box-shadow: 0 0 22px rgba(255,59,48,.35); }
.rec:active { transform: scale(.94); }
.rec.recording span { width: 28px; height: 28px; border-radius: 7px; }
.rec.armed span { animation: pulse .5s infinite; }

/* Dejar sitio a la insignia del hosting (p. ej. "Powered by Netlify") si tapa los botones */
body.badge-lift #controls { padding-bottom: calc(14px + var(--safe-b) + var(--badge-lift, 56px)); }
body.badge-lift:not(.ui-hidden) #stage { padding-bottom: calc(92px + var(--safe-b) + var(--badge-lift, 56px)); }

/* Auto-ocultar controles */
.chrome { transition: opacity .35s ease, transform .35s ease; }
body.ui-hidden #topbar { opacity: 0; transform: translateY(-100%); pointer-events: none; }
body.ui-hidden #controls { opacity: 0; transform: translateY(100%); pointer-events: none; }
body.ui-hidden .cam-switch { opacity: 0; pointer-events: none; }

/* ---------- Formularios ---------- */
.select, .input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; min-height: 38px; outline: none; transition: border-color .2s;
}
.select:focus, .input:focus { border-color: var(--gold); }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--line); background: var(--panel-2); transition: background .2s, border-color .2s, opacity .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: #444; }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #111; border-color: transparent; }
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff7a72; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold); border-right-color: transparent; animation: spin .8s linear infinite; }

/* ---------- Diálogos ---------- */
dialog {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 18px; padding: 0; max-width: min(560px, calc(100vw - 24px)); width: 100%;
  max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog[open] { display: flex; flex-direction: column; animation: pop .22s ease; }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog.wide { max-width: min(1040px, calc(100vw - 24px)); height: min(760px, calc(100dvh - 24px)); }
dialog.sheet { margin: auto auto 0; border-radius: 20px 20px 0 0; max-width: 560px; padding-bottom: var(--safe-b); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.dlg-body { padding: 16px 20px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }

.range { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.range span { display: flex; justify-content: space-between; color: var(--muted); }
.range b { color: var(--gold-2); font-weight: 600; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--gold); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--gold); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 3px solid var(--panel); }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; line-height: 1.35; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line); position: relative; transition: background .2s; margin: 0; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked { background: var(--gold); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle span { padding-top: 2px; }

.settings h4 { margin: 8px 0 -4px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.field .select, .field .input { color: var(--text); width: 100%; }
.field-row { display: flex; gap: 12px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
kbd { display: inline-block; padding: 1px 6px; margin: 0 1px; border-radius: 5px; border: 1px solid var(--line); background: var(--bg-2); font-size: 11px; font-family: inherit; color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.right { margin-left: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* Editor de guiones */
.scripts-layout { display: grid; grid-template-columns: 250px 1fr; min-height: 0; flex: 1; }
.scripts-list { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.scripts-list ul { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.scripts-list li { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.scripts-list li:hover { background: var(--panel-2); }
.scripts-list li.sel { border-color: rgba(212,175,55,.45); background: var(--gold-soft); }
.scripts-list li b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scripts-list li small { color: var(--muted); font-size: 11px; }
.editor { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.input.title { font-size: 17px; font-weight: 700; }
.input.area { flex: 1; min-height: 160px; resize: none; line-height: 1.6; font-size: 15px; padding: 12px 14px; }
.marker-bar, .ai-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mk-btn { font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 6px 10px; border-radius: 999px; border: 1.5px solid currentColor; }
.mk-btn:hover { background: rgba(255,255,255,.05); }
.ai-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gold-2); margin-right: 4px; }
.ai-label svg { width: 16px; height: 16px; }
.ai-bar .btn { height: 34px; font-size: 13px; padding: 0 12px; border-color: rgba(212,175,55,.35); }
.ai-result { border: 1px solid rgba(212,175,55,.35); background: var(--bg-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 40%; min-height: 120px; }
.ai-result-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--gold-2); }
.ai-result pre { margin: 0; white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.55; overflow: auto; flex: 1; }

/* Tomas */
.takes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.take { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.take video { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #000; flex: none; cursor: pointer; }
.take .meta { flex: 1; min-width: 0; }
.take .meta b { display: block; font-size: 14px; }
.take .meta small { color: var(--muted); font-size: 12px; }
.take .icon-btn { width: 36px; height: 36px; }
.take .icon-btn svg { width: 19px; height: 19px; }
#playerVideo { width: 100%; max-height: 62dvh; border-radius: 10px; background: #000; }

.toast {
  position: fixed; z-index: 100; left: 50%; top: calc(70px + var(--safe-t)); transform: translate(-50%, -20px);
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s ease; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,59,48,.5); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes tick { from { transform: scale(1.4); opacity: .2; } to { transform: scale(1); opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .brand-name { display: none; }
  #topbar { gap: 6px; padding-left: 10px; padding-right: 6px; }
  .top-mid { justify-content: flex-start; }
  #scriptSelect { flex: 1 1 auto; min-width: 84px; max-width: 42vw; font-size: 13px; }
  .top-actions { gap: 0; }
  .pill { padding: 0 9px; }
  .cam-empty .btn { height: auto; padding: 8px 12px; font-size: 13px; }
  .hide-sm { display: none !important; }
  .icon-btn { width: 36px; height: 36px; }
  .ctl { width: 46px; height: 46px; }
  .ctl.play { width: 52px; height: 52px; }
  .rec { width: 66px; height: 66px; }
  .rec span { width: 50px; height: 50px; }
  #btnRestart { display: none; }
  .speed-val { min-width: 36px; }
  .scripts-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .scripts-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 30dvh; }
  .toggles { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; }
  #durationChip { padding: 5px 8px; font-size: 11px; }
}
@media (max-width: 400px) {
  #durationChip { display: none; }
  .speed { gap: 2px; }
  .ctl.sm { width: 32px; height: 32px; }
  #controls { gap: 6px; padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 340px) {
  #btnQuick { display: none; }
}
