/* ==========================================================================
   Teleprompter profesional con control de velocidad y modo espejo
   fijate.com - Estándares canónicos
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.25);

  --accent: #0ea5e9;
  --accent-gold: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-hud: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Variables del escenario de lectura */
  --prompter-bg: #000000;
  --prompter-color: #ffffff;
  --prompter-font-size: 48px;
  --prompter-line-height: 1.6;
  --prompter-margin-x: 18%;
  --prompter-eyeline-top: 35%;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-glow: rgba(59, 130, 246, 0.35);

  --accent: #38bdf8;
  --accent-gold: #fbbf24;
  --success: #34d399;
  --danger: #f87171;

  --bg-page: #0b0f17;
  --bg-card: #131926;
  --bg-card-alt: #1a2234;
  --bg-input: #101622;
  --border-color: #243048;
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Reset y contención global
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mono-val {
  font-family: var(--font-mono);
}

.tool-layout {
  max-width: 1240px;
  width: 100%;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.tool-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

/* ==========================================================================
   Tarjetas principales
   ========================================================================== */
.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1rem;
    gap: 1.25rem;
  }
}

/* Barra superior de gestión de guiones */
.script-manager-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.script-selector-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 280px;
  min-width: 0;
}

.script-selector-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.custom-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 42px;
  padding: 0 40px 0 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

[data-theme="dark"] .custom-select {
  background-color: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.custom-select option,
.custom-select optgroup {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 8px 12px;
}

.custom-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.script-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Botones estándar */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: transparent;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
}

/* Barra de telemetría de lectura */
.script-telemetry-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  background-color: var(--bg-card-alt);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.telemetry-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  font-weight: 600;
}

.telemetry-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.telemetry-value.highlight {
  color: var(--primary);
}

/* Área de edición */
.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.editor-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editor-title-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 44px;
  padding: 0 1rem;
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.editor-title-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.script-textarea-wrapper {
  position: relative;
  width: 100%;
}

.script-textarea {
  width: 100%;
  min-height: 220px;
  max-height: 500px;
  resize: vertical;
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.script-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   Panel de configuración de lectura y controles
   ========================================================================== */
.prompter-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.control-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-card-badge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Sliders estilizados */
.range-slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.styled-range {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.styled-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s, background-color 0.15s;
}

.styled-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--primary-hover);
}

.styled-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Toggles e interruptores */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

.switch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-color);
  transition: 0.2s;
  border-radius: 26px;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch-toggle input:checked + .switch-slider {
  background-color: var(--primary);
}

.switch-toggle input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* Grupo de botones de opción (paletas, tipografías, cuenta atrás) */
.options-segmented-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.4rem;
}

.seg-btn {
  height: 38px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-alt);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.seg-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.seg-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Barra de inicio y atajo rápido */
.prompter-launch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
}

.btn-launch-prompter {
  min-height: 52px;
  padding: 0 2rem;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px var(--primary-glow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.1s, box-shadow 0.15s;
}

.btn-launch-prompter:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-launch-prompter:active {
  transform: translateY(1px);
}

.launch-shortcuts-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.kbd-badge {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Escenario del Teleprompter (Lectura / Pantalla Completa)
   ========================================================================== */
.prompter-stage-container {
  position: relative;
  width: 100%;
  height: 480px;
  background-color: var(--prompter-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

/* Estado de pantalla completa real y maximizado */
.prompter-stage-container:fullscreen,
.prompter-stage-container:-webkit-full-screen,
.prompter-stage-container.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
}

/* Viewport con scroll virtual */
.prompter-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.prompter-viewport:active {
  cursor: grabbing;
}

/* Contenedor de transformación de espejo (scaleX / scaleY) */
.prompter-mirror-box {
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform 0.2s ease-out;
}

.prompter-mirror-box.mirror-x {
  transform: scaleX(-1);
}

.prompter-mirror-box.mirror-y {
  transform: scaleY(-1);
}

.prompter-mirror-box.mirror-x.mirror-y {
  transform: scale(-1, -1);
}

/* Pista de desplazamiento vertical (Scroll Track) */
.prompter-scroll-track {
  width: 100%;
  padding-top: calc(var(--prompter-eyeline-top) * 100vh / 100);
  padding-bottom: 70vh;
  will-change: transform;
  transform: translate3d(0, 0px, 0);
}

/* Texto del guión en pantalla */
.prompter-text-body {
  margin-left: var(--prompter-margin-x);
  margin-right: var(--prompter-margin-x);
  font-size: var(--prompter-font-size);
  line-height: var(--prompter-line-height);
  color: var(--prompter-color);
  font-weight: 600;
  text-align: left;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.prompter-text-body p {
  margin: 0 0 1.25em 0;
}

/* Resaltado de pausas o anotaciones entre corchetes */
.prompter-text-body .prompter-pause-tag {
  color: var(--accent-gold);
  font-size: 0.75em;
  font-weight: 700;
  background-color: rgba(245, 158, 11, 0.15);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

/* ==========================================================================
   Indicador de línea de mirada (Eyeline Indicator)
   ========================================================================== */
.prompter-eyeline {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--prompter-eyeline-top);
  height: 2px;
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompter-eyeline-line {
  position: absolute;
  left: 36px;
  right: 36px;
  height: 1px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.6) 0%, rgba(56, 189, 248, 0.15) 50%, rgba(56, 189, 248, 0.6) 100%);
}

.eyeline-arrow {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
}

.eyeline-arrow-left {
  border-left: 16px solid #38bdf8;
  margin-left: 8px;
}

.eyeline-arrow-right {
  border-right: 16px solid #38bdf8;
  margin-right: 8px;
}

.prompter-eyeline.is-hidden {
  display: none !important;
}

/* ==========================================================================
   Overlay de cuenta atrás
   ========================================================================== */
.prompter-countdown-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.prompter-countdown-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.countdown-number {
  font-family: var(--font-heading);
  font-size: 8rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 40px rgba(56, 189, 248, 0.8);
  animation: countdownPulse 0.95s infinite ease-out;
}

.countdown-label {
  font-size: 1.25rem;
  color: #cbd5e1;
  margin-top: 1rem;
  font-weight: 600;
}

@keyframes countdownPulse {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* ==========================================================================
   Barra de control HUD flotante
   ========================================================================== */
.prompter-hud {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(19, 25, 38, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  box-shadow: var(--shadow-hud);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 95vw;
}

.prompter-hud.is-idle {
  opacity: 0;
  transform: translate(-50%, 15px);
  pointer-events: none;
}

.hud-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s, border-color 0.15s;
  flex-shrink: 0;
}

.hud-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.hud-btn:active {
  transform: scale(0.94);
}

.hud-btn-primary {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.hud-btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.hud-speed-box {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-speed-val {
  min-width: 44px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #38bdf8;
}

.hud-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

.hud-status-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #94a3b8;
  padding: 0 6px;
  white-space: nowrap;
}

/* ==========================================================================
   Modales Canónicos (sin window.alert)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-backdrop.is-active .modal-window {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background-color 0.15s;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card-alt);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card-alt);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Tabla de atajos de teclado en modal */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.shortcuts-table tr {
  border-bottom: 1px solid var(--border-color);
}

.shortcuts-table tr:last-child {
  border-bottom: none;
}

.shortcuts-table td {
  padding: 0.6rem 0.5rem;
}

.shortcuts-table td:first-child {
  width: 40%;
}

/* Toast de notificación rápida */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000001;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   Ajustes responsivos
   ========================================================================== */
@media (max-width: 768px) {
  .script-manager-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .script-actions {
    justify-content: flex-start;
  }

  .prompter-stage-container {
    height: 380px;
  }

  .prompter-hud {
    bottom: 12px;
    padding: 6px 10px;
    gap: 6px;
  }

  .hud-btn {
    width: 38px;
    height: 38px;
  }

  .hud-btn-primary {
    width: 46px;
    height: 46px;
  }

  .hud-speed-val {
    min-width: 36px;
    font-size: 0.8125rem;
  }

  .btn-launch-prompter {
    width: 100%;
    justify-content: center;
  }
}
