/* Chameleon Studio — estilos.
   Identidad: azul noche de fondo, superficies azul grisáceo, turquesa para marca y selección,
   coral para grabar. --hue lo mueve app.js («Color de la interfaz»); por defecto, turquesa. */
:root {
  --hue: 175;
  /* turquesa de marca (#19D3C5 / #00BFAF con --hue 175) */
  --acento: hsl(var(--hue) 79% 46%);
  --acento-hover: hsl(var(--hue) 100% 37%);
  --acento-suave: hsl(var(--hue) 79% 46% / 0.13);
  --acento-borde: hsl(var(--hue) 70% 50% / 0.45);
  --acento-texto: hsl(var(--hue) 78% 60%);
  --sobre-acento: #04211E;          /* texto sobre fondo turquesa */
  /* azul noche y superficies */
  --fondo: #0B1220;
  --fondo-2: #0E1626;               /* franjas que separan secciones */
  --panel: #182438;
  --panel-2: #202D42;
  --campo: #111A2B;                 /* fondo de campos y listas */
  --texto: #E8EEF6;
  --texto-2: #9AA8BE;
  --texto-3: #6E7C93;
  --borde: #26344C;
  --borde-suave: #1D2A40;
  /* acción y estados */
  --coral: #FF5D5D;
  --coral-hover: #FF7373;
  --rojo: #FF5D5D;
  --rojo-hover: #FF7373;
  --rojo-suave: rgb(255 93 93 / 0.14);
  --ambar: #F5B942;
  --sombra-1: 0 1px 2px rgb(0 0 0 / 0.35);
  --sombra-2: 0 8px 24px rgb(2 6 14 / 0.45);
  --sombra-3: 0 24px 60px rgb(2 6 14 / 0.6);
  --radio: 16px;
  --radio-s: 10px;
  --fuente: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14px/1.5 var(--fuente);
  background: var(--fondo);
  color: var(--texto);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
html { scrollbar-color: #2A3A55 var(--fondo); }
textarea, .transcripcion, .modal { scrollbar-color: #2A3A55 transparent; scrollbar-width: thin; }
::selection { background: hsl(var(--hue) 79% 46% / 0.35); color: #fff; }
.vista:not([hidden]) { animation: vista-entra 0.22s ease-out; }
@keyframes vista-entra { from { opacity: 0; } }
a { color: var(--acento-texto); }
kbd {
  font: 500 11px/1 var(--fuente);
  padding: 3px 5px; border-radius: 5px;
  background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.1);
  color: inherit; opacity: 0.85;
}
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ---------- iconos ---------- */
.ico { width: 18px; height: 18px; flex: none; vertical-align: -4px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--fuente); text-decoration: none; white-space: nowrap;
  height: 38px; padding: 0 14px; border-radius: var(--radio-s);
  border: 1px solid var(--borde); background: var(--panel); color: var(--texto);
  cursor: pointer; box-shadow: var(--sombra-1);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
}
.btn:hover:not(:disabled) { border-color: var(--acento-borde); background: var(--panel-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primario { background: var(--acento); border-color: transparent; color: var(--sobre-acento); box-shadow: 0 4px 14px hsl(var(--hue) 79% 46% / 0.25); }
.btn-primario:hover:not(:disabled) { background: var(--acento-hover); border-color: transparent; }
.btn-peligro { background: var(--rojo); border-color: transparent; color: #fff; }
.btn-peligro:hover:not(:disabled) { background: var(--rojo-hover); border-color: transparent; }
.btn-peligro kbd { background: rgb(255 255 255 / 0.18); border-color: rgb(255 255 255 / 0.2); }
.btn-primario kbd { background: rgb(4 33 30 / 0.12); border-color: rgb(4 33 30 / 0.2); }
.btn-sutil { box-shadow: none; background: transparent; }
.btn.ancho { width: 100%; }

.btn-icono {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radio-s);
  border: 1px solid transparent; background: transparent; color: var(--texto-2);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.btn-icono:hover:not(:disabled) { background: var(--panel-2); color: var(--texto); }
.btn-icono.grande { width: 44px; height: 44px; border-color: var(--borde); background: var(--panel); }
.btn-icono.grande .ico { width: 20px; height: 20px; }
.btn-icono.peligro:hover { color: var(--rojo); background: var(--rojo-suave); }

.rec-circulo { width: 12px; height: 12px; border-radius: 50%; background: var(--rojo); box-shadow: 0 0 0 3px rgb(255 255 255 / 0.85); flex: none; }

/* ---------- cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--fondo) 90%, transparent);
  backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--borde-suave);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.02), 0 8px 24px rgb(2 6 14 / 0.25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto); border-radius: var(--radio-s); }
/* nombre de la marca: CHAMELEON en blanco, STUDIO en turquesa */
.marca { font-weight: 800; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; }
.marca b { color: var(--acento-texto); font-weight: 600; letter-spacing: 0.16em; margin-left: 2px; }
.logo-app { width: 40px; height: 40px; flex: none; display: block; filter: drop-shadow(0 2px 8px hsl(var(--hue) 79% 46% / 0.25)); }

.tabs { display: flex; gap: 4px; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radio-s);
  color: var(--texto-2); text-decoration: none; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.tabs a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -13px; height: 2px; border-radius: 2px;
  background: var(--acento); transform: scaleX(0); transition: transform 0.2s ease;
}
.tabs a.activa::after { transform: scaleX(1); }
.tabs a:hover { background: var(--panel-2); color: var(--texto); }
.tabs a.activa { background: var(--acento-suave); color: var(--acento-texto); }
.tabs a.bloqueada { opacity: 0.45; pointer-events: none; }
.contador { font-size: 12px; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--panel-2); color: var(--texto-2); text-align: center; }
.tabs a.activa .contador { background: var(--panel); color: var(--acento-texto); }

.top-acciones { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.estado {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--panel-2); color: var(--texto-2); font-weight: 600; font-size: 13px;
}
.estado .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--acento); }
.estado.grabando { background: var(--rojo-suave); color: var(--rojo); }
.estado.grabando .punto { background: var(--rojo); animation: latido 1.2s infinite; }
.estado.pausado .punto { background: var(--ambar); }
.estado.cuenta .punto { background: var(--ambar); animation: latido 0.6s infinite; }
@keyframes latido { 50% { opacity: 0.25; } }

.banner {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--radio-s);
  background: rgb(245 185 66 / 0.1); color: #F7D58C; border: 1px solid rgb(245 185 66 / 0.35);
}

/* ---------- vistas ---------- */
main { max-width: 1560px; margin: 0 auto; padding: 20px; }
.panel {
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: var(--sombra-1);
}
.nota { color: var(--texto-2); font-size: 13px; margin: 6px 0 0; }

/* ---------- vista grabar ---------- */
.vista-grabar {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: 290px minmax(0, 1fr) 270px;
}
.config { padding: 0; display: grid; gap: 12px; background: transparent; border: 0; box-shadow: none; }
.grupo {
  padding: 16px; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra-1); transition: border-color 0.2s;
}
.grupo:hover { border-color: color-mix(in srgb, var(--borde) 60%, var(--acento) 25%); }
.grupo h3, .grupo summary {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--texto-2); margin-bottom: 12px;
}
/* pequeña marca turquesa delante de cada título */
.grupo h3::before, .grupo summary::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--acento); flex: none; }
details.grupo:not([open]) summary::before { background: var(--texto-3); }
details.grupo:not([open]) { padding-top: 13px; padding-bottom: 13px; }
.grupo summary { cursor: pointer; list-style: none; margin: 0; }
.grupo summary:hover { color: var(--texto); }
.grupo summary::-webkit-details-marker { display: none; }
.grupo summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; margin-right: 4px; }
.grupo[open] summary { margin-bottom: 10px; }
.grupo[open] summary::after { transform: rotate(-135deg); }

.campo { display: grid; gap: 6px; margin-bottom: 12px; }
.campo:last-child { margin-bottom: 0; }
.campo > span { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--texto-2); }
.campo > span .ico { width: 15px; height: 15px; }
select, input[type=text], input[type=search], textarea {
  font: 400 14px/1.4 var(--fuente); color: var(--texto);
  background: var(--campo); border: 1px solid var(--borde); border-radius: var(--radio-s);
  padding: 8px 10px; width: 100%; min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select { height: 40px; padding-right: 28px; cursor: pointer; }
select:hover:not(:disabled), input[type=text]:hover, input[type=search]:hover, textarea:hover { border-color: color-mix(in srgb, var(--borde) 50%, var(--acento) 40%); }
option { background: var(--panel); color: var(--texto); }
select:disabled { opacity: 0.5; cursor: not-allowed; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 20%, transparent); }
input[type=range] { width: 100%; accent-color: var(--acento); cursor: pointer; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fila-2 .campo { margin-bottom: 12px; }

.segmentado { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--campo); border: 1px solid var(--borde-suave); }
.segmentado.tres { grid-auto-flow: row; }
.segmentado label { cursor: pointer; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado span {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 6px 10px; border-radius: 8px;
  font-weight: 600; font-size: 13px; color: var(--texto-2);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.segmentado.tres span { justify-content: flex-start; }
.segmentado label:hover input:not(:checked):not(:disabled) + span { background: var(--panel); color: var(--texto); }
.segmentado input:checked + span { background: var(--acento-suave); color: var(--acento-texto); box-shadow: inset 0 0 0 1px var(--acento-borde); }
.segmentado input:focus-visible + span { outline: 2px solid var(--acento); }
.segmentado input:disabled + span { opacity: 0.45; cursor: not-allowed; }

.medidor { height: 6px; border-radius: 99px; background: var(--campo); overflow: hidden; margin: -4px 0 12px; }
.aviso-medidor { margin: -6px 0 12px; color: var(--ambar); }
.medidor div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--acento) 70%, var(--ambar) 88%, var(--rojo)); transition: width 0.06s linear; }

.interruptor { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--texto-2); }
.interruptor input { accent-color: var(--acento); width: 16px; height: 16px; margin: 0; }

/* escenario */
.centro { display: grid; gap: 14px; min-width: 0; }
.escenario { display: grid; gap: 8px; }
.lienzo-wrap {
  --ar: 1.7778;
  position: relative; margin: 0 auto;
  aspect-ratio: var(--ar); width: min(100%, calc(66vh * var(--ar)));
  border-radius: 20px; overflow: hidden;
  background: var(--fondo);
  border: 1px solid var(--borde);
  box-shadow: 0 0 0 6px rgb(255 255 255 / 0.015), var(--sombra-3);
}
#lienzo { display: block; width: 100%; height: 100%; touch-action: none; }
#lienzo.sobre-burbuja { cursor: grab; }
#lienzo.arrastrando { cursor: grabbing; }
.vacio {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px;
  text-align: center; padding: 24px; color: var(--texto);
  background:
    radial-gradient(circle at 50% 38%, hsl(var(--hue) 79% 46% / 0.16), transparent 55%),
    radial-gradient(circle at 50% 120%, rgb(29 111 224 / 0.18), transparent 60%),
    var(--fondo-2);
}
/* bienvenida: logotipo de la marca en lugar del icono genérico */
.vacio-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 6px; }
.vacio-ico .ico { width: 26px; height: 26px; }
.vacio .vacio-ico { width: 104px; height: 104px; border-radius: 0; display: grid; place-items: center; margin-bottom: 8px; animation: aparece 0.5s ease-out both; }
.vacio-ico img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 24px hsl(var(--hue) 79% 46% / 0.3)); }
.vacio-titulo { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.vacio-texto { margin: 0 0 14px; color: var(--texto-2); max-width: 420px; }
@keyframes aparece { from { opacity: 0; transform: translateY(6px) scale(0.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vacio .vacio-ico { animation: none; } }
.cuenta {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 800 140px/1 var(--fuente); color: #fff; text-shadow: 0 0 40px rgb(255 93 93 / 0.6);
  background: rgb(11 18 32 / 0.6); backdrop-filter: blur(2px);
}
.cuenta.pop { animation: pop 0.9s ease-out; }
@keyframes pop { from { transform: scale(1.5); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
/* barra de dibujo */
.herramientas {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px;
  width: fit-content; max-width: 100%; margin: 4px auto 0; padding: 6px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--borde); border-radius: 14px;
  box-shadow: var(--sombra-2); backdrop-filter: blur(8px);
}
.herramientas button {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--texto-2); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.herramientas button:hover { background: var(--panel-2); color: var(--texto); }
.herramientas button.activa { background: var(--acento); color: var(--sobre-acento); box-shadow: 0 4px 12px hsl(var(--hue) 79% 46% / 0.3); }
.herramientas .ico { width: 17px; height: 17px; }
.herramientas .color { width: 28px; height: 28px; border-radius: 50%; }
.herramientas .color:hover { background: var(--panel-2); }
.herramientas .color::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2); }
.herramientas .color.activa { background: transparent; box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--c); }
.herramientas .sep { width: 1px; height: 22px; background: var(--borde); margin: 0 4px; }
.interruptor.mini { font-size: 12px; padding: 0 6px; gap: 6px; }
.interruptor.mini input { width: 14px; height: 14px; }
#lienzo.dibujando { cursor: crosshair; }
.entrada-texto {
  position: absolute; z-index: 3; transform: translateY(-50%);
  width: min(320px, 60%); padding: 6px 10px; border-radius: 8px;
  font: 700 18px/1.2 var(--fuente); background: rgb(0 0 0 / 0.65); border: 2px solid currentColor;
}

.pista { margin: 0; text-align: center; font-size: 12px; color: var(--texto-3); display: flex; align-items: center; justify-content: center; gap: 6px; }
.pista .ico { width: 14px; height: 14px; }

.barra-grabacion { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn-grabar {
  display: inline-flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 26px 0 20px; border-radius: 999px; border: 0;
  font: 700 16px/1 var(--fuente); color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #FF6B6B, #EE4848);
  box-shadow: 0 8px 24px rgb(255 93 93 / 0.32), inset 0 1px 0 rgb(255 255 255 / 0.25);
  transition: filter 0.15s, transform 0.08s, box-shadow 0.15s;
}
.btn-grabar:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 10px 30px rgb(255 93 93 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.25); }
.btn-grabar:active:not(:disabled) { transform: scale(0.98); }
.btn-grabar:disabled { opacity: 0.6; cursor: progress; }
.btn-grabar .rec-circulo { width: 14px; height: 14px; background: #fff; box-shadow: none; animation: respira 2.4s ease-in-out infinite; }
.btn-grabar kbd { background: rgb(255 255 255 / 0.18); border-color: rgb(255 255 255 / 0.22); }
@keyframes respira { 50% { transform: scale(0.75); opacity: 0.8; } }

.controles-rec {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--borde); box-shadow: var(--sombra-2);
}
.controles-rec .btn-icono.grande { border-radius: 999px; }
.controles-rec .btn { height: 44px; border-radius: 999px; padding: 0 18px; }
.crono { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; font: 600 18px/1 var(--fuente); font-variant-numeric: tabular-nums; min-width: 92px; }
.chip-permiso {
  margin-left: auto; border: 0; border-radius: 999px; padding: 1px 8px; cursor: default;
  font: 600 11px/1.6 var(--fuente); background: var(--panel-2); color: var(--texto-2);
}
.chip-permiso[data-estado="granted"] { background: var(--acento-suave); color: var(--acento-texto); }
.chip-permiso[data-estado="denied"] { background: var(--rojo-suave); color: var(--rojo); cursor: pointer; text-decoration: underline; }
.medidor-mini { width: 44px; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; flex: none; }
.medidor-mini span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acento) 70%, var(--ambar) 88%, var(--rojo)); }
.medidor-mini[hidden] { display: none; }
.no-disponible { opacity: 0.5; }
.estado-guardado { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--texto-2); white-space: nowrap; }
.marca-guardado { width: 8px; height: 8px; border-radius: 50%; background: var(--acento); }
.estado-guardado[data-estado="guardando"] .marca-guardado { background: var(--ambar); animation: latido 1s infinite; }
.estado-guardado[data-estado="memoria"] { color: var(--rojo); }
.estado-guardado[data-estado="memoria"] .marca-guardado { background: var(--rojo); }
@media (max-width: 520px) {
  .estado-guardado span:last-child { display: none; }
  /* barra de grabación en dos filas: controles arriba, «Terminar» a lo ancho debajo */
  .controles-rec { flex-wrap: wrap; justify-content: center; border-radius: 18px; max-width: 100%; }
  .controles-rec .crono { min-width: 0; padding: 0 6px; }
  .controles-rec .btn { flex: 1 1 100%; }
  /* barra de dibujo más compacta */
  .herramientas { gap: 2px; padding: 4px; }
  .herramientas button { width: 30px; height: 30px; }
  .herramientas .color { width: 24px; height: 24px; }
  .herramientas .sep { display: none; }
  /* cabecera: que el botón de atajos no se salga por la derecha */
  .marca { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .tabs a { padding: 0 8px; gap: 6px; }
  /* diálogos: si no caben, los botones ocupan el ancho en varias filas */
  .modal-botones .btn { flex: 1 1 auto; }
}
.rec-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); animation: latido 1.2s infinite; }
body.pausado .rec-punto { background: var(--ambar); animation: none; }

/* notas */
.notas-panel { padding: 16px; display: grid; gap: 14px; border-radius: var(--radio); }
.notas-panel h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--borde-suave); }
.notas-panel h3 .ico { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--acento-suave); color: var(--acento-texto); }
.notas-panel textarea { min-height: 240px; resize: vertical; line-height: 1.6; font-size: 15px; padding: 12px 14px; }
.notas-panel .campo > span { justify-content: space-between; }
.notas-panel .nota { margin: 0; }

/* ---------- biblioteca ---------- */
.biblio-cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
  padding: 20px 22px; border-radius: 20px; border: 1px solid var(--borde);
  background:
    radial-gradient(circle at 0% 0%, hsl(var(--hue) 79% 46% / 0.12), transparent 45%),
    linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 70%, var(--fondo)));
  box-shadow: var(--sombra-1);
}
.biblio-cabecera h1 { font-size: 28px; font-weight: 800; }
.biblio-cabecera .nota { margin-top: 4px; }
.biblio-herramientas { display: flex; flex-wrap: wrap; gap: 10px; }
.buscador { position: relative; display: block; width: 280px; }
.buscador .ico { position: absolute; left: 12px; top: 11px; color: var(--texto-3); pointer-events: none; }
.buscador input { padding-left: 38px; height: 40px; border-radius: 999px; }
.buscador:focus-within .ico { color: var(--acento-texto); }
.biblio-herramientas select { width: 170px; }

.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.tarjeta {
  position: relative; display: grid; grid-template-rows: auto 1fr;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 18px;
  overflow: hidden; box-shadow: var(--sombra-1);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.tarjeta:hover { box-shadow: var(--sombra-2), 0 0 0 1px var(--acento-borde); transform: translateY(-3px); border-color: var(--acento-borde); }
.miniatura { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--fondo); overflow: hidden; }
.miniatura img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.tarjeta:hover .miniatura img { transform: scale(1.03); }
.miniatura .sin-poster { position: absolute; inset: 0; display: grid; place-items: center; color: var(--acento-texto); background: radial-gradient(circle at 50% 45%, hsl(var(--hue) 79% 46% / 0.14), transparent 60%); }
/* al pasar el ratón: velo azul noche y botón de reproducir (decorativo: la tarjeta ya es un enlace) */
.miniatura::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgb(11 18 32 / 0.55)); opacity: 0; transition: opacity 0.2s; z-index: 1; pointer-events: none; }
.miniatura::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; z-index: 1; pointer-events: none;
  background: var(--acento) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13l11-6.5z' fill='%2304211E'/%3E%3C/svg%3E") 56% 50% / 24px no-repeat;
  box-shadow: 0 8px 24px rgb(2 6 14 / 0.5); opacity: 0; transform: scale(0.85); transition: opacity 0.2s, transform 0.2s;
}
.tarjeta:hover .miniatura::before, .tarjeta:hover .miniatura::after { opacity: 1; }
.tarjeta:hover .miniatura::after { transform: scale(1); }
.duracion {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 7px; border-radius: 6px;
  background: rgb(11 18 32 / 0.8); color: #fff; font: 600 12px/1.5 var(--fuente); font-variant-numeric: tabular-nums; z-index: 2;
  border: 1px solid rgb(255 255 255 / 0.08); backdrop-filter: blur(4px);
}
.tarjeta-info { padding: 14px 16px 16px; min-width: 0; }
.tarjeta-titulo { display: block; font-weight: 600; color: var(--texto); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 64px; }
.tarjeta-titulo::after { content: ""; position: absolute; inset: 0; } /* toda la tarjeta es clicable */
.tarjeta-meta { margin: 4px 0 0; font-size: 12px; color: var(--texto-2); }
.tarjeta-acciones { position: absolute; right: 10px; bottom: 12px; display: flex; gap: 4px; z-index: 3; }
.tarjeta-acciones .btn-icono { width: 32px; height: 32px; border-radius: 9px; }
.tarjeta-acciones .btn-icono:not(.peligro):hover { color: var(--acento-texto); background: var(--acento-suave); }
.tarjeta-acciones .btn-icono .ico { width: 16px; height: 16px; }
.biblio-vacia { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 72px 20px; border: 2px dashed var(--borde); border-radius: 20px; background: radial-gradient(circle at 50% 30%, hsl(var(--hue) 79% 46% / 0.08), transparent 60%); }
.biblio-vacia .vacio-ico { color: var(--acento); background: var(--acento-suave); }
.biblio-vacia .btn { margin-top: 12px; }
.biblio-vacia .rec-circulo { box-shadow: none; background: #fff; }

/* ---------- vista video ---------- */
.vista-video { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--texto-2); text-decoration: none; font-weight: 600; width: fit-content; }
.volver:hover { color: var(--texto); }
.video-cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.video-titulos { flex: 1 1 360px; min-width: 0; }
.titulo-edit {
  width: 100%; font: 700 24px/1.25 var(--fuente); letter-spacing: -0.02em; color: var(--texto);
  border: 1px solid transparent; background: transparent; border-radius: var(--radio-s); padding: 4px 8px; margin-left: -9px;
}
.titulo-edit:hover { border-color: var(--borde); }
.titulo-edit:focus { background: var(--campo); }
.video-titulos .nota { margin-top: 2px; }
.video-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.video-acciones .rec-circulo { width: 10px; height: 10px; box-shadow: none; }
.video-acciones .btn-icono:hover { color: var(--rojo); background: var(--rojo-suave); }
.video-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .video-cuerpo { grid-template-columns: 1fr; } }
.transcripcion-panel { padding: 16px; border-radius: 18px; display: grid; gap: 10px; max-height: 68vh; grid-template-rows: auto 1fr auto; }
.transcripcion-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--borde-suave); }
.transcripcion-cabecera h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.transcripcion-acciones { display: flex; align-items: center; gap: 2px; }
.transcripcion-acciones .btn { height: 32px; padding: 0 8px; font-size: 13px; }
.transcripcion-acciones .btn-icono { width: 32px; height: 32px; }
.transcripcion { overflow-y: auto; display: grid; gap: 2px; align-content: start; margin: 0 -6px; }
.frase { display: grid; grid-template-columns: 52px 1fr; gap: 6px; padding: 6px; border-radius: 8px; transition: background 0.15s; }
.frase.actual { background: var(--acento-suave); }
.frase-tiempo {
  align-self: start; border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: 600 12px/1.6 var(--fuente); color: var(--acento-texto); font-variant-numeric: tabular-nums; text-align: left;
}
.frase-tiempo:hover { text-decoration: underline; }
.frase-texto { margin: 0; padding: 0 4px; border-radius: 4px; line-height: 1.5; outline: none; }
.frase-texto:focus { background: var(--panel-2); box-shadow: 0 0 0 2px var(--acento); }
.reproductor-wrap { border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--borde); box-shadow: 0 0 0 6px rgb(255 255 255 / 0.015), var(--sombra-3); }
.reproductor-wrap video { display: block; width: 100%; max-height: 68vh; background: #000; }

.recortador { padding: 18px; display: grid; gap: 14px; border-radius: 18px; }
.recortador-cabecera { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.recortador-cabecera h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.recortador-cabecera .nota { margin: 0; }
.tira { position: relative; height: 64px; border-radius: 10px; background: var(--campo); overflow: hidden; user-select: none; touch-action: none; cursor: pointer; }
.miniaturas { position: absolute; inset: 0; display: flex; }
.miniaturas canvas { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.sombra { position: absolute; top: 0; bottom: 0; background: rgb(11 18 32 / 0.7); pointer-events: none; }
.sombra.izq { left: 0; }
.sombra.der { right: 0; }
.seleccion { position: absolute; top: 0; bottom: 0; border: 3px solid var(--acento); border-left-width: 0; border-right-width: 0; pointer-events: none; }
.asa {
  position: absolute; top: -3px; bottom: -3px; width: 14px; background: var(--acento);
  cursor: ew-resize; pointer-events: auto; display: grid; place-items: center;
}
.asa::after { content: ""; width: 2px; height: 22px; border-radius: 2px; background: var(--sobre-acento); opacity: 0.7; }
.asa[data-asa="ini"] { left: -14px; border-radius: 8px 0 0 8px; }
.asa[data-asa="fin"] { right: -14px; border-radius: 0 8px 8px 0; }
.cabezal { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4); pointer-events: none; left: 0; }
.recorte-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.recorte-tiempos { color: var(--texto-2); font-variant-numeric: tabular-nums; }
.recorte-tiempos b { color: var(--texto); }
.recorte-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.progreso { display: grid; gap: 6px; }
.progreso div { height: 8px; border-radius: 99px; background: var(--campo); overflow: hidden; position: relative; }
.progreso div::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--acento); border-radius: inherit; transition: width 0.2s; }
.progreso span { font-size: 13px; color: var(--texto-2); }

/* ---------- avisos (toasts) ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: #1A2740; color: var(--texto); border: 1px solid var(--borde); border-left: 3px solid var(--borde); box-shadow: var(--sombra-3);
  font-weight: 500; animation: entra 0.25s ease-out;
}
.toast .ico { margin-top: 1px; }
.toast.ok { border-left-color: #19D3C5; }
.toast.ok .ico { color: #19D3C5; }
.toast.error { border-left-color: #FF5D5D; }
.toast.error .ico { color: #FF7373; }
.toast.info { border-left-color: #7CC4FF; }
.toast.info .ico { color: #7CC4FF; }
.progreso-tarea { flex-direction: column; align-items: stretch; gap: 8px; }
.pt-barra { height: 6px; border-radius: 99px; background: rgb(255 255 255 / 0.15); overflow: hidden; }
.pt-barra div { height: 100%; width: 0; background: var(--acento); transition: width 0.2s; }
.toast.sale { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } }

/* ---------- diálogo ---------- */
.modal {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--borde);
  border-radius: 20px; background: var(--panel); color: var(--texto);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.02), var(--sombra-3);
}
.modal[open] { animation: modal-entra 0.2s ease-out; }
@keyframes modal-entra { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal::backdrop { background: rgb(5 9 18 / 0.62); backdrop-filter: blur(4px); }
.modal form { padding: 22px; display: grid; gap: 14px; }
.modal h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.modal h2 .ico { color: var(--acento-texto); width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--acento-suave); flex: none; }
.modal-cuerpo { color: var(--texto-2); }
.modal-cuerpo p { margin: 0 0 10px; }
.modal-cuerpo ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.modal-cuerpo code { background: var(--campo); padding: 1px 5px; border-radius: 5px; }
.modal-botones { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.lista-resumen { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 8px; }
.lista-resumen .lista-resumen { margin: 6px 0 0; gap: 4px; font-size: 13px; }
.opcion-resumen { display: flex; align-items: center; gap: 8px; margin-top: 6px; cursor: pointer; color: var(--texto); }
.opcion-resumen input { accent-color: var(--acento); }
.atajos { width: 100%; border-collapse: collapse; }
.atajos td { padding: 9px 0; border-bottom: 1px solid var(--borde-suave); }
.atajos td:last-child { text-align: right; }
.atajos kbd { font-size: 12px; padding: 4px 7px; }

/* ---------- adaptable ---------- */
@media (max-width: 1240px) {
  .vista-grabar { grid-template-columns: 280px minmax(0, 1fr); }
  .notas-panel { grid-column: 2; }
  .notas-panel textarea { min-height: 160px; }
}
@media (max-width: 860px) {
  main { padding: 16px; }
  .topbar { gap: 12px; padding: 0 16px; }
  #btnInstalar, .estado { display: none; }
  .marca { font-size: 14px; }
  .vista-grabar { grid-template-columns: 1fr; }
  .centro { order: -1; }
  .notas-panel { grid-column: auto; }
  .lienzo-wrap { width: 100%; }
  .btn-grabar kbd, .btn kbd { display: none; }
  .biblio-herramientas { width: 100%; }
  .buscador { flex: 1 1 100%; width: auto; }
  .biblio-herramientas select { flex: 1 1 100%; width: auto; }
  .cuenta { font-size: 90px; }
}

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