/* ==========================================================================
   Radionovela · sistema visual
   ========================================================================== */

:root {
  --bg: #07090d;
  --panel: #0f141d;
  --panel-2: #131a25;
  --line: #1c2533;
  --line-2: #2b374a;
  --txt: #e9eff9;
  --dim: #8394aa;
  --dim-2: #5a6a80;
  --accent: #ffb020;
  --red: #ff4d5e;
  --green: #37d67a;
  --radius: 14px;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 14px/1.45 var(--sans);
  color: var(--txt);
  background:
    radial-gradient(1100px 520px at 12% -12%, rgba(255, 176, 32, .07), transparent 62%),
    radial-gradient(900px 480px at 102% -8%, rgba(76, 201, 240, .06), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e2836; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #2c3a4d; background-clip: padding-box; }

/* --- botones ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: linear-gradient(180deg, #18212e, #121924);
  color: var(--txt);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .06s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #3c4d66; background: linear-gradient(180deg, #1d2735, #151d29); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--dim); }
.btn.ghost:hover { color: var(--txt); border-color: var(--line-2); }
.btn.primary { background: linear-gradient(180deg, #ffc247, #f0a012); border-color: #ffca5e; color: #1a1204; }
.btn.primary:hover { background: linear-gradient(180deg, #ffd06b, #f5ab21); }
.btn.danger { background: linear-gradient(180deg, #ff5d6c, #e6394a); border-color: #ff7280; color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }

/* --- barra superior ----------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 66px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 17, .82);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--dim-2);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .03);
  flex: none;
  transition: background .3s, box-shadow .3s;
}
.brand-dot.live { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 77, 94, .12), 0 0 14px rgba(255, 77, 94, .8); animation: pulse 2.4s infinite; }
.brand-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(55, 214, 122, .1); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.brand h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.brand .sub {
  display: block;
  font-size: 11px;
  color: var(--dim-2);
  font-family: var(--mono);
  letter-spacing: .02em;
}

.scene-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0f16;
}
.scene-nav .nav-btn {
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.scene-nav .nav-btn:hover { background: #18202c; color: var(--txt); }
.scene-nav .cur { min-width: 190px; text-align: center; padding: 0 8px; }
.scene-nav .cur small { display: block; font-size: 10px; color: var(--dim-2); font-family: var(--mono); letter-spacing: .08em; }
.scene-nav .cur strong { display: block; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.master-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: #0b0f16; }
.master-box label { font-size: 10px; letter-spacing: .12em; color: var(--dim-2); font-weight: 700; }
.master-box output { font-family: var(--mono); font-size: 11px; color: var(--dim); min-width: 44px; text-align: right; }

/* --- layout principal --------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 330px;
  height: calc(100vh - 66px);
}

.col { min-height: 0; overflow-y: auto; }
.col-scenes { border-right: 1px solid var(--line); padding: 16px 12px; background: rgba(8, 11, 16, .5); }
.col-stage {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 20px 16px;
}
.col-stage > .panel-title { flex: none; }
.col-stage #pads {
  flex: 0 1 auto;
  max-height: 46%;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}
.col-mix { border-left: 1px solid var(--line); padding: 16px 16px 24px; background: rgba(8, 11, 16, .5); }

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 700;
  margin: 0 0 10px 4px;
}
.panel-title:not(:first-child) { margin-top: 22px; }

/* --- rail de escenas ---------------------------------------------------- */

.scene-list { display: flex; flex-direction: column; gap: 6px; }

.scene-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--dim);
  transition: background .14s, color .14s, border-color .14s;
}
.scene-item:hover { background: #121926; color: var(--txt); }
.scene-item .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim-2);
  width: 18px;
  flex: none;
}
.scene-item .nm { font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-item.active {
  background: linear-gradient(90deg, rgba(255, 176, 32, .13), rgba(255, 176, 32, .03));
  border-color: rgba(255, 176, 32, .28);
  color: var(--txt);
}
.scene-item.active .num { color: var(--accent); }
.scene-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: auto; flex: none; opacity: 0; }
.scene-item.active .dot { opacity: 1; box-shadow: 0 0 10px var(--accent); }

/* --- pads de pistas ----------------------------------------------------- */

#pads { display: flex; flex-direction: column; gap: 16px; }

.pad-views { display: flex; gap: 4px; text-transform: none; letter-spacing: 0; }
.pad-views button {
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--dim-2);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.pad-views button.on {
  color: #1a1204;
  background: var(--accent);
  border-color: var(--accent);
}

.pad-group-title {
  margin: 0 0 8px 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bus, var(--dim-2));
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.pad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #121a25, #0c121a);
  text-align: left;
  cursor: default;
  overflow: hidden;
  transition: border-color .16s, box-shadow .2s, background .2s;
}
.pad-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 0 28px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.pad-grip {
  position: absolute;
  top: 8px;
  right: 36px;
  z-index: 3;
  width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #0a0e14;
  color: var(--txt);
  font-size: 12px;
  line-height: 1;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
}
.pad-grip:active { cursor: grabbing; }
.pad.sortable .pad-name { padding-right: 54px; }
.pad.dragging { opacity: .45; }
.pad.drag-over { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pad-wave {
  position: relative;
  height: 42px;
  margin: 0 -12px;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, .18)),
    #0a1018;
}
.pad-wave canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pad-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.pad-gain {
  flex: 1 1 90px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pad-gain input[type="range"] { width: 100%; accent-color: var(--bus, var(--accent)); }
.pad-gain-val { flex: none; width: 28px; font-family: var(--mono); font-size: 10px; color: var(--dim); text-align: right; }
.pad-loop, .pad-stop, .pad-monitor {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0a0f16;
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.pad-loop.on, .pad-monitor.primary { color: var(--bus, var(--accent)); border-color: color-mix(in srgb, var(--bus, var(--accent)) 55%, transparent); }
.pad-fade {
  width: 52px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0a0f16;
  color: var(--txt);
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
}
.pad-fade-label { font-size: 10px; color: var(--dim-2); letter-spacing: .06em; text-transform: uppercase; }
.pad::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--bus, var(--accent));
  opacity: .5;
  transition: opacity .2s;
}
.pad:hover { border-color: #35455c; }

.pad.playing {
  border-color: color-mix(in srgb, var(--bus) 60%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bus) 13%, #0f1620), #0c121a);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bus) 25%, transparent),
              0 16px 34px -18px var(--bus);
}
.pad.playing::before { opacity: 1; box-shadow: 0 0 12px var(--bus); }

.pad-key {
  position: absolute;
  top: 10px; right: 10px;
  min-width: 20px; height: 20px;
  display: grid; place-items: center;
  padding: 0 5px;
  border: 1px solid #26313f;
  border-radius: 6px;
  background: #0a0e14;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim-2);
}
.pad.playing .pad-key { color: var(--bus); border-color: color-mix(in srgb, var(--bus) 40%, transparent); }

.pad-bus {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bus);
  opacity: .8;
  margin-bottom: 3px;
}
.pad-name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.2;
  padding-right: 22px;
}
.pad-meta {
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim-2);
}
.pad-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, .045);
}
.pad-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bus);
  box-shadow: 0 0 10px var(--bus);
}

/* --- guión -------------------------------------------------------------- */

.script-wrap {
  margin-top: 12px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(15, 20, 29, .75), rgba(11, 15, 21, .55));
  overflow: hidden;
}
.script-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}
.script-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 700;
}
.script-head .mono {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.script {
  padding: 18px 20px 22px;
  font-size: 14.5px;
  line-height: 1.72;
  color: #b9c6d8;
  white-space: pre-wrap;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
}
.autocue-preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #070b10;
  border-left: 1px solid var(--line);
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
}
.autocue-label {
  flex: none;
  padding: 8px 12px 6px;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 700;
}
.autocue-preview .prompter-frame {
  flex: 1;
  min-height: 0;
  margin: 0 10px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #05080c;
}
.autocue-preview.is-live .prompter-guide { border-top-color: var(--accent); }
.autocue {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: none;
}
.autocue button {
  height: 26px;
  min-width: 26px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #101820;
  color: var(--txt);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.autocue button:hover { border-color: var(--accent); }
.autocue button.on {
  color: #1a1204;
  background: var(--accent);
  border-color: var(--accent);
}
.autocue .spd {
  min-width: 16px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.chip-grip {
  font-style: normal;
  font-weight: 500;
  opacity: .72;
  margin-right: 4px;
  pointer-events: none;
  letter-spacing: 0;
}
.script-editor .cue-token {
  user-select: none;
  cursor: grab;
  vertical-align: text-bottom;
}
.script-editor .cue-token::before { content: none; }
.script-editor .cue-token.is-dragging { opacity: .35; pointer-events: none; }
.script-editor .cue-token[data-missing] {
  color: var(--dim-2);
  border-style: dashed;
}
#scriptDropCaret {
  position: fixed;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  pointer-events: none;
  z-index: 80;
  border-radius: 1px;
}
.script p:last-child { margin-bottom: 0; }
.script em, .script i { font-style: italic; }
.script .mark-missing { color: var(--dim-2); }

.cue-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 8px;
  margin: 0 1px;
  border: 1px solid color-mix(in srgb, var(--bus) 38%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bus) 10%, #0c121a);
  color: var(--bus);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  vertical-align: baseline;
  transition: background .15s, box-shadow .2s, border-color .15s;
}
.cue-token::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--bus);
  flex: none;
}
.cue-token:hover { background: color-mix(in srgb, var(--bus) 20%, #0c121a); border-color: var(--bus); }
.cue-token.playing { box-shadow: 0 0 0 1px var(--bus), 0 0 18px -4px var(--bus); }

/* --- columna de mezcla -------------------------------------------------- */

.mix-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1118;
  padding: 12px;
}
.mix-block + .mix-block { margin-top: 10px; }

.fader { display: block; }
.fader + .fader { margin-top: 13px; }
.fader-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.fader-head .nm { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.fader-head .nm::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 2px;
  background: var(--bus);
  flex: none;
}
.fader-head .val { font-family: var(--mono); font-size: 10.5px; color: var(--dim-2); }

input[type="range"].hz {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"].hz::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--bus) 0 var(--fill, 50%), #1b2431 var(--fill, 50%) 100%);
}
input[type="range"].hz::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  margin-top: -4px;
  border-radius: 50%;
  background: #e9eff9;
  border: 2px solid #0a0e14;
  box-shadow: 0 0 0 1px var(--bus), 0 2px 6px rgba(0, 0, 0, .6);
}
input[type="range"].hz::-moz-range-track {
  height: 5px;
  border-radius: 99px;
  background: #1b2431;
}
input[type="range"].hz::-moz-range-progress {
  height: 5px;
  border-radius: 99px;
  background: var(--bus);
}
input[type="range"].hz::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #e9eff9;
  border: 2px solid #0a0e14;
}

.track {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1px 8px;
  padding: 8px 9px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e141d;
  overflow: hidden;
}
.track + .track { margin-top: 6px; }
.track .tn { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .tb { font-size: 9.5px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--bus); opacity: .8; }
.track .stop {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 1px solid #2a3648;
  border-radius: 7px;
  background: #0a0f16;
  color: var(--dim);
  font-size: 9px;
  cursor: pointer;
}
.track .stop:hover { color: var(--red); border-color: rgba(255, 77, 94, .5); }
.track .bar { grid-column: 1 / -1; height: 2px; margin-top: 5px; border-radius: 99px; background: #1a2230; overflow: hidden; }
.track .bar i { display: block; height: 100%; width: 0; background: var(--bus); }

.ptrack .ptime {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim-2);
  text-align: right;
}

.kbd-help { display: flex; flex-direction: column; gap: 7px; padding: 0 4px; font-size: 11.5px; color: var(--dim-2); }
.kbd-help > div { display: flex; align-items: center; gap: 6px; }
.kbd-help .lbl { margin-left: auto; color: var(--dim-2); }

.meter-mini { display: block; width: 70px; height: 10px; }


.empty {
  padding: 14px 6px;
  font-size: 12px;
  color: var(--dim-2);
  text-align: center;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 168px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
}
.log .ln { display: flex; gap: 8px; }
.log .t { color: #3d4b5e; flex: none; }
.log .ev { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .ev.play { color: #9fb3c9; }
.log .ev.stop { color: #7a8798; }
.log .ev.sys { color: var(--accent); }

/* --- avisos ------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border: 1px solid rgba(255, 77, 94, .45);
  border-radius: 10px;
  background: #1a0d11;
  color: #ffc9cf;
  font-size: 13px;
  box-shadow: 0 18px 40px -18px #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- diálogo de PIN ----------------------------------------------------- */

.pin-back {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 9, .82);
  backdrop-filter: blur(8px);
}
.pin-card {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: linear-gradient(180deg, #121a25, #0a0f16);
  box-shadow: 0 40px 80px -40px #000;
}
.pin-card h2 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.pin-card p { font-size: 13px; color: var(--dim); line-height: 1.55; margin-bottom: 16px; }
.pin-card .in { height: 42px; font-size: 17px; letter-spacing: .22em; text-align: center; }
.pin-actions { display: flex; gap: 10px; margin-top: 16px; }
.pin-actions .btn { flex: 1; height: 38px; }

/* --- editor ------------------------------------------------------------- */

.editor {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: rgba(5, 7, 10, .9);
  backdrop-filter: blur(10px);
}
.editor-head {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #0a0e14;
  flex: none;
}
.editor-head h2 { font-size: 15px; font-weight: 700; }
.editor-head .spacer { flex: 1; }
.ed-head-title { flex: 1; min-width: 180px; max-width: 420px; }
.ed-head-title .in { height: 36px; font-weight: 650; }
.ed-menu { position: relative; }
.ed-menu summary { list-style: none; }
.ed-menu summary::-webkit-details-marker { display: none; }
.ed-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121820;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.ed-lib-toggle { display: none; }
.editor-body { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(280px, 360px); min-height: 0; }
.editor-body > * { min-width: 0; }
.ed-scenes { border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; background: rgba(8, 11, 16, .6); display: flex; flex-direction: column; gap: 8px; }
.ed-main { overflow-y: auto; padding: 18px 22px 48px; min-height: 0; }
.ed-library {
  border-left: 1px solid var(--line);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 14px 40px;
  background: #0c1118;
  min-height: 0;
}
.ed-library .library { margin-top: 0; }
.ed-library .quick-add,
.ed-library .lib-filters { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.ed-library .lib-types { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-library .lib-types button {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.ed-library .lib-types button.on { color: #1a1204; background: var(--accent); border-color: var(--accent); }
.lib-replace-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 176, 32, .12);
  color: var(--accent);
  font-size: 12.5px;
  line-height: 1.45;
}
.lib-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lib-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.lib-card:first-child { border-top: 0; }
.lib-card-name { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card-meta { font-size: 11px; color: var(--dim-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .lib-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.lib-edit { grid-column: 1 / -1; display: none; }
.lib-card.is-edit .lib-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.script-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.script-tools button {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0a0f16;
  color: var(--txt);
  font: inherit;
  cursor: pointer;
}
.script-tools .swatch {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.in.script-editor {
  display: block;
  flex: none;
  align-self: stretch;
  height: 260px;
  min-height: 140px;
  max-height: 70vh;
  padding: 12px 14px;
  overflow: auto;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  font-size: 14.5px;
}
.cue-file-line { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px 48px; }
.cue-file-line .cue-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12px; }
.cue-row.is-replacing { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 700;
}

.in {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #0a0f16;
  color: var(--txt);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 176, 32, .12); }
textarea.in { height: auto; padding: 10px; line-height: 1.6; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
select.in { cursor: pointer; }

.ed-show-title { margin-bottom: 18px; }
.ed-show-title .in { font-size: 16px; font-weight: 650; height: 40px; }
.mark-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mark-chip {
  border: 1px solid var(--line-2);
  background: #121926;
  color: var(--txt);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.mark-chip[draggable="true"] { cursor: grab; }
.mark-chip[draggable="true"]:active { cursor: grabbing; }
#edScript.drag-over { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lib-card.is-fresh { box-shadow: inset 3px 0 0 var(--accent); background: rgba(255, 176, 32, .06); }
.mark-report { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mark-report .mark-chip { cursor: default; }
.mark-chip.is-missing { border-color: rgba(255, 77, 94, .7); color: #ff8f99; }
.ed-cues-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.cue-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d131b;
  margin-top: 8px;
}
.cue-row.drag-over { border-color: var(--accent); }
.cue-row-main {
  display: grid;
  grid-template-columns: 22px 28px minmax(0, 1fr) 110px auto auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.cue-grip { cursor: grab; color: var(--dim-2); text-align: center; user-select: none; }
.cue-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim-2);
  text-align: center;
}
.cue-detail { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.cue-detail.hidden { display: none; }
.ed-scene-row.drag-over .ed-scene-item { border-color: var(--accent); }
.scene-grip { cursor: grab; color: var(--dim-2); padding: 0 2px; user-select: none; }
.library { margin-top: 22px; }
.lib-lead { margin: 0 0 12px; color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.lib-filters { display: grid; grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.lib-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lib-head, .lib-row {
  display: grid;
  grid-template-columns: 22px minmax(120px, 1.4fr) 110px minmax(90px, 1fr) 64px 70px auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.lib-head { background: #101722; border-bottom: 1px solid var(--line); }
.lib-head button {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.lib-head button:hover { color: var(--txt); }
.lib-row { border-top: 1px solid var(--line); }
.lib-row:first-child { border-top: 0; }
.lib-dur { font-size: 12px; color: var(--dim); }
.lib-actions { display: flex; gap: 6px; justify-content: flex-end; }
.lib-drop {
  margin-top: 10px;
  padding: 16px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  text-align: center;
  color: var(--dim);
  background: rgba(18, 25, 38, .35);
}
.lib-drop strong { display: block; color: var(--txt); font-size: 13px; margin-bottom: 4px; }
.lib-drop span { font-size: 12px; }
.lib-drop.is-over {
  border-color: var(--accent);
  background: rgba(255, 176, 32, .1);
  color: var(--txt);
}
.lib-drop.is-busy { opacity: .7; }
.preview-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: #1a140c;
  color: var(--txt);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.quick-add {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 120px minmax(140px, 1.3fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  background: rgba(18, 25, 38, .45);
}
.cue-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ed-scene-row { display: flex; align-items: center; gap: 4px; }
.ed-scene-row .ed-scene-item { flex: 1; min-width: 0; }
.ed-scene-row .mini-move {
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--dim-2);
  cursor: pointer;
}
.ed-scene-row .mini-move:hover { color: var(--txt); border-color: var(--line); }
.ed-row { display: grid; grid-template-columns: 1fr 150px; gap: 14px; margin-bottom: 14px; }
.ed-row-3 { display: grid; grid-template-columns: 1fr 120px 120px; gap: 14px; margin-bottom: 14px; }

.cue-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d131b;
  padding: 12px;
}
.cue-card + .cue-card { margin-top: 10px; }
.cue-top { display: grid; grid-template-columns: minmax(0, 1fr) 66px 150px 32px; gap: 8px; margin-bottom: 8px; }
.cue-file { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-bottom: 10px; }
.cue-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.mini { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); }
.mini input { width: 58px; height: 28px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 7px; background: #0a0f16; color: var(--txt); font: inherit; font-family: var(--mono); font-size: 11px; outline: none; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); cursor: pointer; user-select: none; }
.gate-preload { margin: 16px auto 8px; justify-content: center; }
.preload-toggle { font-size: 12px; color: var(--dim); white-space: nowrap; }
.preload-toggle[data-stat]::after { content: " · " attr(data-stat); color: var(--dim-2); }
.chk input { accent-color: var(--accent); width: 14px; height: 14px; }

.ed-scene-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  text-align: left;
  cursor: pointer;
  font-size: 12.5px;
}
.ed-scene-item:hover { background: #121926; color: var(--txt); }
.ed-scene-item.active { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .3); color: var(--txt); }
.ed-scene-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- reproductor (salida de audio) -------------------------------------- */

.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: 100vh;
  padding: 26px 34px;
  gap: 20px;
}
.player-top,
.player-foot,
.player > lm-credit { grid-column: 1 / -1; }
.player-main { grid-column: 1; grid-row: 2; }

.player-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.player-vol {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.player-vol span {
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 700;
  color: var(--dim-2);
  text-transform: uppercase;
}
.player-vol input[type="range"].hz { width: 160px; flex: none; }
.player-vol output {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  min-width: 52px;
  text-align: right;
}
.gate-vol { justify-content: center; margin: 4px auto 6px; max-width: 340px; }
.player-top .tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 800;
  color: var(--dim-2);
  text-transform: uppercase;
}
.player-top .tag.on { color: var(--red); border-color: rgba(255, 77, 94, .4); background: rgba(255, 77, 94, .07); }

.player-main { display: flex; flex-direction: column; justify-content: center; max-width: 860px; width: 100%; margin: 0 auto; min-height: 0; }
.player.is-stereo .player-vol-head,
.player.is-stereo .stat-meter { display: none; }
.player.is-stereo .player-main {
  width: min(860px, calc(100% - 400px));
}
.player-prompter { display: none; }
.player.is-script .player-show { display: none; }
.player.is-script .player-main {
  max-width: 980px;
  justify-content: flex-start;
}
.player.is-script .player-prompter {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.prompter-scene {
  flex: none;
  margin-bottom: 12px;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 700;
}
.prompter-frame {
  position: relative;
  overflow: hidden;
  background: #0b1017;
  -webkit-mask-image: linear-gradient(#000 0, #000 10%, #000 76%, transparent);
  mask-image: linear-gradient(#000 0, #000 10%, #000 76%, transparent);
}
.player.is-script .prompter-frame {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.prompter-stage {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  transform-origin: 0 0;
}
.prompter-guide {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  height: 61px;
  background: linear-gradient(180deg, rgba(255, 176, 32, .22), rgba(255, 176, 32, .05));
  border-top: 2px solid rgba(255, 176, 32, .8);
  pointer-events: none;
  z-index: 2;
}
.prompter-roll {
  position: relative;
  z-index: 1;
  padding: 0 52px;
  font-size: 42px;
  line-height: 1.45;
  color: #f4f7fb;
  white-space: pre-wrap;
}
.prompter-roll p { margin: 0 0 .55em; }
.prompter-roll p:last-child { margin-bottom: 0; }
.prompter-roll em, .prompter-roll i { font-style: italic; }
.prompter-roll .mark-missing { color: var(--dim-2); }
.prompter-roll .cue-token {
  height: auto;
  padding: 0 .35em;
  font-size: .62em;
  pointer-events: none;
  vertical-align: baseline;
}
.stereo-stage { display: none; }
.player.is-stereo .stereo-stage {
  display: flex;
  position: fixed;
  top: 96px;
  right: 18px;
  bottom: 86px;
  z-index: 4;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  padding: 12px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1118;
  box-shadow: -20px 0 40px rgba(0, 0, 0, .18);
}
.vu-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  flex: none;
  padding: 2px 0 38px;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  color: var(--dim-2);
  text-align: right;
}
.vu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 36px;
  flex: none;
  height: 100%;
  min-height: 0;
}
.vu canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 3px;
  background: #070b10;
  border: 1px solid #1a2330;
}
.vu span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--dim);
}
.vu b {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--txt);
  min-height: 14px;
}
.vu-fader { width: 54px; cursor: ns-resize; }
.vu-fader b { white-space: nowrap; letter-spacing: 0; }
.vu-fader input[type="range"] {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 28px;
  flex: 1;
  min-height: 0;
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: ns-resize;
}
.player-scene { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim-2); font-weight: 700; margin-bottom: 10px; }
.player-title { font-size: clamp(28px, 4vw, 46px); font-weight: 750; letter-spacing: -.025em; line-height: 1.05; margin-bottom: 30px; }

.player-tracks { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.ptrack {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d131b;
}
.ptrack .led { width: 8px; height: 8px; border-radius: 50%; background: var(--bus); box-shadow: 0 0 12px var(--bus); }
.ptrack .pn { font-size: 14px; font-weight: 600; }
.ptrack .pb { font-size: 10px; font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--bus); opacity: .8; }
.ptrack canvas { width: 120px; height: 26px; display: block; }

.player-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--dim-2); }
.player-foot .stat { display: flex; align-items: center; gap: 8px; }
.player-foot .stat b { color: var(--dim); font-weight: 500; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(700px 400px at 50% 30%, rgba(255, 176, 32, .08), transparent 65%),
    #07090d;
}
.gate-card { max-width: 560px; text-align: center; }
.gate-card h1 { font-size: 34px; font-weight: 750; letter-spacing: -.03em; margin-bottom: 14px; }
.gate-card p { color: var(--dim); font-size: 15px; line-height: 1.65; margin-bottom: 10px; }
.gate-card .hint { font-size: 12.5px; color: var(--dim-2); }
.gate-card .btn { height: 52px; padding: 0 30px; font-size: 15px; margin: 26px 0 18px; border-radius: 14px; }
.gate-icon { font-size: 40px; margin-bottom: 18px; opacity: .85; }

.progress { width: 100%; max-width: 320px; height: 4px; margin: 18px auto 0; border-radius: 99px; background: #182130; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* --- portada ------------------------------------------------------------ */

.home { height: 100vh; overflow-y: auto; padding: 60px 30px 36px; }
.home-inner { max-width: 980px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.home h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 780; letter-spacing: -.03em; line-height: 1.06; }
.home .lead { margin-top: 14px; color: var(--dim); font-size: 16px; max-width: 640px; line-height: 1.65; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.home-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #101722, #0a0f16);
  text-decoration: none;
  color: var(--txt);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.home-card:hover { border-color: #3b4c64; transform: translateY(-2px); box-shadow: 0 24px 50px -30px #000; }
.home-card .ic { font-size: 26px; }
.home-card h2 { font-size: 18px; font-weight: 700; }
.home-card p { color: var(--dim); font-size: 13.5px; line-height: 1.6; }
.home-card .go { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.home-steps { margin-top: 46px; border-top: 1px solid var(--line); padding-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.home-steps h3 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.home-steps p { font-size: 13px; color: var(--dim); line-height: 1.6; }
.kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; background: #0a0f16; font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-align: center; }

.home lm-credit {
  margin-top: auto;
  padding-top: 48px;
  padding-bottom: 22px;
  font-size: 13px;
  color: var(--dim-2);
}

body.app-desk { display: flex; flex-direction: column; }
body.app-desk .topbar { flex: none; }
body.app-desk .layout { flex: 1; height: auto; min-height: 0; }
body.app-desk > lm-credit,
.editor lm-credit,
.player lm-credit,
.gate lm-credit {
  margin: 0;
  font-size: 12px;
  color: var(--dim-2);
}
body.app-desk > lm-credit,
.editor lm-credit {
  flex: none;
  padding: 8px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.player lm-credit { padding: 2px 0 10px; }
.gate { padding-bottom: 72px; }
.gate lm-credit {
  position: absolute;
  left: 34px;
  bottom: 8px;
  padding: 0 0 16px;
}

/* --- adaptación --------------------------------------------------------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr) 292px; }
  .brand h1 { max-width: 200px; }
}

@media (max-width: 940px) {
  body { overflow: auto; }
  body.app-desk { display: block; height: auto; overflow: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 14px; gap: 12px; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .col { overflow: visible; }
  .col-stage { display: block; overflow: visible; }
  .col-stage #pads { overflow: visible; }
  .script-split { grid-template-columns: minmax(0, 1fr) minmax(200px, 46%); }
  .script-wrap { min-height: 320px; }
  .col-scenes { border-right: 0; border-bottom: 1px solid var(--line); }
  .scene-list { flex-direction: row; overflow-x: auto; }
  .scene-item { width: auto; flex: none; }
  .col-mix { border-left: 0; border-top: 1px solid var(--line); }
  .home-cards, .home-steps { grid-template-columns: 1fr; }
  .quick-add { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .ed-lib-toggle { display: inline-flex; }
  .editor-body { grid-template-columns: 200px minmax(0, 1fr); }
  .ed-library {
    position: absolute;
    top: 62px;
    right: 0;
    bottom: 0;
    width: min(440px, 100%);
    transform: translateX(105%);
    transition: transform .2s ease;
    z-index: 4;
    box-shadow: -24px 0 40px rgba(0, 0, 0, .35);
  }
  .editor.is-library .ed-library { transform: none; }
}
@media (max-width: 720px) {
  .cue-row-main { grid-template-columns: 22px 28px minmax(0, 1fr); }
}


