/* ============================================================
   Stargety Reels Studio 2.0 · Sistema de Diseño "Glass Frost"
   Basado en tokens.css, DESIGN.md, EXPERIENCE.md y validation-report.md
   ============================================================ */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--color-background, #0b1120);
  --panel: rgba(26, 35, 50, 0.72);
  --panel-2: #1a2332;
  --input-bg: rgba(11, 17, 32, 0.78);
  --line: var(--glass-border, rgba(255, 255, 255, 0.08));
  --line-strong: rgba(178, 221, 76, 0.28);
  --text: var(--color-foreground, #eef3fa);
  --muted: var(--color-muted-foreground, #7b89a0);
  --dim: #66758e;
  --accent: var(--color-accent, #b2dd4c);
  --accent-hover: var(--color-accent-hover, #c5e86a);
  --accent-fg: var(--color-accent-foreground, #0b1120);
  --accent-2: #b2dd4c;
  --focus-ring: #b2dd4c;
  --ok: #b2dd4c;
  --warn: #fbbf24;
  --bad: var(--color-destructive, #e74c4c);
  --radius: 24px;
  --mono: var(--font-mono, "JetBrains Mono", "Cascadia Mono", "Consolas", monospace);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3fa;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-2: #ffffff;
  --input-bg: rgba(255, 255, 255, 0.88);
  --line: rgba(11, 17, 32, 0.09);
  --line-strong: rgba(107, 143, 46, 0.35);
  --text: #0b1120;
  --muted: #5a6880;
  --dim: #6b7a93;
  --accent: #b2dd4c;
  --accent-hover: #a3cf3b;
  --accent-fg: #0b1120;
  --accent-2: #5b7f1e;
  --focus-ring: #6b8f2e; /* WCAG AA contrast fix in light mode per validation-report.md */
  --ok: #4d7c0f;
  --warn: #d97706;
  --bad: #dc2626;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Skip-to-content link (WCAG 2.4.1) */
.skip-link {
  position: fixed;
  top: -100px;
  left: 24px;
  z-index: 999;
  padding: 10px 18px;
  border-radius: 9999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-glow);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(178, 221, 76, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(178, 221, 76, 0.42); background-clip: content-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------------- Orbes Glass Frost decorativos ---------------- */

.glass-shape {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(178, 221, 76, 0.14), rgba(178, 221, 76, 0.02));
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 18s ease-in-out infinite;
}
.glass-shape-1 { width: 520px; height: 520px; top: -180px; left: -140px; }
.glass-shape-2 { width: 460px; height: 460px; bottom: -180px; right: -120px; animation-delay: -6s; }
.glass-shape-3 { width: 320px; height: 320px; top: 38%; left: 45%; opacity: 0.55; animation-delay: -11s; }

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-16px) scale(1.03); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 26px 44px;
}

/* ---------------- Floating Glass Nav Header (Stargety Design System) ---------------- */

.topbar.glass-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  margin-bottom: 20px;
  border-radius: 60px;
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.2));
}

.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 2px 0;
}
.brand-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
}
.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tagline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(178, 221, 76, 0.14);
  border: 1px solid rgba(178, 221, 76, 0.32);
  color: var(--accent-2);
  padding: 3px 11px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tagline-badge.sm {
  font-size: 9.8px;
  padding: 2px 9px;
}

.ver-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
}
.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  background: var(--glass-bg, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .15s;
}
.pill:hover {
  border-color: var(--line-strong);
  background: rgba(178, 221, 76, 0.1);
  transform: translateY(-1px);
}
.pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
  flex: none;
}
.pill.is-ok .dot { background: #b2dd4c; box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.22); }
.pill.is-bad .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(231, 76, 76, 0.18); }

/* ---------------- Quick Templates Bar ---------------- */

.templates-bar {
  margin-bottom: 20px;
  padding: 16px 20px !important;
}
.templates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.templates-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.templates-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.templates-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.tpl-btn {
  appearance: none;
  text-align: left;
  background: var(--glass-bg, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  transition: all .22s ease;
}
.tpl-btn:hover {
  background: rgba(178, 221, 76, 0.07);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.tpl-btn.active {
  background: linear-gradient(135deg, rgba(178, 221, 76, 0.18), rgba(178, 221, 76, 0.05));
  border-color: #b2dd4c;
  box-shadow: 0 8px 24px -10px rgba(178, 221, 76, 0.45);
}
.tpl-default-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 99px;
  background: #b2dd4c;
  color: #0b1120;
  margin-left: 3px;
  vertical-align: middle;
}
.tpl-Dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: none;
  box-shadow: 0 0 8px currentColor;
}
.tpl-btn strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}
.tpl-btn small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.25;
}

/* ---------------- Layout & Glass Cards ---------------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 20px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card, .glass-card {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md, 0 8px 32px rgba(0, 0, 0, 0.18));
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  border-color: rgba(178, 221, 76, 0.18);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.num {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #b2dd4c;
  color: #0b1120;
  font-size: 11.5px;
  font-weight: 800;
}
.hint { font-size: 11.5px; color: var(--muted); }

/* ---------------- Buttons (Stargety Pill CTA Style) ---------------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all .22s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: rgba(178, 221, 76, 0.1);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn.primary {
  border: 1px solid transparent;
  color: #0b1120;
  font-weight: 700;
  background: var(--accent, #b2dd4c);
  box-shadow: 0 6px 20px rgba(178, 221, 76, 0.28);
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover, #c5e86a);
  box-shadow: var(--shadow-glow, 0 8px 28px rgba(178, 221, 76, 0.42));
  transform: translateY(-2px);
}

.btn.accent2 {
  border: 1px solid rgba(178, 221, 76, 0.48);
  color: var(--text);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(178, 221, 76, 0.22) 0%, rgba(26, 35, 50, 0.9) 100%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .btn.accent2 {
  background: linear-gradient(135deg, rgba(178, 221, 76, 0.35) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.btn.accent2:hover:not(:disabled) {
  border-color: #b2dd4c;
  box-shadow: 0 8px 24px rgba(178, 221, 76, 0.28);
}

.btn.big { width: 100%; padding: 14px 18px; font-size: 14.5px; border-radius: 9999px; }
.btn.big svg { width: 18px; height: 18px; flex: none; }

.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(178, 221, 76, 0.09); }

.btn.sm { padding: 6px 13px; font-size: 12px; border-radius: 9999px; }

.btn.danger {
  color: var(--bad);
  border-color: rgba(231, 76, 76, 0.38);
  background: rgba(231, 76, 76, 0.1);
}
.btn.danger:hover:not(:disabled) { background: rgba(231, 76, 76, 0.18); border-color: var(--bad); }

.link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.icon-btn:hover { background: rgba(178, 221, 76, 0.12); color: var(--text); }

/* Focus Visible (WCAG AA compliant in both dark & light themes) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------------- Recent Videos Box ---------------- */

.recent-box {
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.recent-item:hover { background: rgba(178, 221, 76, 0.14); border-color: var(--line-strong); }
.recent-item small { color: var(--muted); font-family: var(--mono); }

/* ---------------- Dropzone / Source ---------------- */

.dropzone {
  border: 1.5px dashed rgba(178, 221, 76, 0.32);
  border-radius: 16px;
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  background: rgba(178, 221, 76, 0.03);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.08);
}
.dropzone.drag { border-color: #b2dd4c; background: rgba(178, 221, 76, 0.14); transform: scale(1.005); }

.dz-icon {
  width: 44px; height: 44px;
  margin: 0 auto 8px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: var(--accent-2);
  background: rgba(178, 221, 76, 0.14);
  border: 1px solid rgba(178, 221, 76, 0.28);
}
.dz-icon svg { width: 20px; height: 20px; }
.dz-title { font-weight: 700; font-size: 14px; }
.dz-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.dz-sub code, .footer code, .field-head code, .recent-head code {
  background: rgba(178, 221, 76, 0.1);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
}

.upload-row { padding: 6px 2px; }
.up-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--muted); margin-bottom: 7px;
}
.bar { height: 7px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #b2dd4c, #c5e86a);
  border-radius: 999px;
  transition: width .16s linear;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(178, 221, 76, 0.05);
}
.file-ico {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #0b1120;
  background: #b2dd4c;
}
.file-ico svg { width: 19px; height: 19px; }
.file-meta { min-width: 0; flex: 1; }
.file-name { font-size: 13.5px; font-weight: 700; }
.file-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.path-toggle { margin-top: 10px; }
.path-box { display: flex; gap: 8px; margin-top: 8px; }
.path-box input { flex: 1; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
select:disabled { cursor: not-allowed; opacity: .55; }
select option, select optgroup { background-color: #0f172a; color: #eef3fa; }
[data-theme="light"] select option, [data-theme="light"] select optgroup { background-color: #ffffff; color: #0b1120; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(178, 221, 76, 0.06);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 700; }
.chip .k { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; }
.probe { margin-top: 12px; }

.preview-wrap {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
}

/* ---------------- Interactive 9:16 Video & Layers Studio (#previewWrap) ---------------- */

.stage-studio-wrap {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.stage-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stage-master-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  cursor: pointer;
  user-select: none;
  background: rgba(178, 221, 76, 0.12);
  border: 1px solid rgba(178, 221, 76, 0.35);
  padding: 5px 11px;
  border-radius: 999px;
}
.stage-master-toggle input {
  accent-color: #b2dd4c;
  margin: 0;
}
.stage-drag-hint {
  font-size: 11px;
  color: var(--muted);
}
.stage-layer-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.layer-pill,
.sim-mini-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.layer-pill:hover,
.sim-mini-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.layer-pill.active,
.sim-mini-pill.active {
  background: rgba(178, 221, 76, 0.18);
  border-color: #b2dd4c;
  color: var(--text);
  box-shadow: 0 2px 10px -3px rgba(178, 221, 76, 0.45);
}

.stage-canvas-outer {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(21, 30, 48, 0.9), #070b14);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--line);
}
.stage-phone-canvas {
  position: relative;
  width: min(330px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  border: 2px solid rgba(178, 221, 76, 0.42);
  background: #0b1120;
  overflow: hidden;
  box-shadow: 0 18px 46px -14px rgba(0, 0, 0, 0.85);
}
.stage-video-bg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}
.stage-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}
/* Draggable Layers inside both #stagePhoneCanvas and #simPhone */
.stage-draggable {
  position: absolute;
  pointer-events: auto !important;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: box-shadow .12s ease, outline .12s ease;
}
.stage-draggable * {
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none !important;
}
.stage-draggable:hover {
  outline: 1.5px dashed #b2dd4c;
  outline-offset: 2px;
}
.stage-draggable.is-selected {
  outline: 1.5px solid rgba(178, 221, 76, 0.88);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.18), 0 6px 18px rgba(0, 0, 0, 0.55);
}
.stage-draggable.is-dragging {
  cursor: grabbing !important;
  outline: 2px solid #b2dd4c !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(178, 221, 76, 0.28), 0 12px 26px rgba(0, 0, 0, 0.72) !important;
  z-index: 25 !important;
  transition: none !important;
}
.stage-coord-tag {
  position: absolute;
  top: -19px;
  right: 0;
  background: #0b1120;
  color: #b2dd4c;
  border: 1px solid rgba(178, 221, 76, 0.65);
  border-radius: 6px;
  padding: 1.5px 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
  z-index: 30;
}
.stage-draggable:hover .stage-coord-tag,
.stage-draggable.is-selected .stage-coord-tag,
.stage-draggable.is-dragging .stage-coord-tag {
  opacity: 1;
}

/* Quick Contextual Layer Inspector below 9:16 Stage */
.quick-layer-inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(15, 22, 38, 0.78);
  border: 1px solid rgba(178, 221, 76, 0.35);
}
html[data-theme="light"] .quick-layer-inspector {
  background: rgba(255, 255, 255, 0.85);
}
.qli-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.qli-badge {
  font-size: 11.5px;
  font-weight: 800;
  color: #0b1120;
  background: #b2dd4c;
  padding: 2px 9px;
  border-radius: 999px;
}
.qli-coords {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.qli-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.qli-size-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.qli-slider {
  width: 120px !important;
  flex: 0 1 130px;
}
.qli-out {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-2);
  min-width: 44px;
  text-align: right;
}
.qli-btn {
  padding: 4px 9px !important;
  font-size: 11px !important;
}

.disabled-feature-hint {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(178, 221, 76, 0.05);
  border: 1px dashed var(--line-strong);
  font-size: 11.5px;
  color: var(--muted);
}

/* Safe Zone Guides (TikTok / Instagram Reels UI Areas) */
.stage-safe-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.guide-top-zone {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 9%;
  background: rgba(231, 76, 76, 0.14);
  border-bottom: 1px dashed rgba(231, 76, 76, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(255, 200, 200, 0.9);
  letter-spacing: 0.6px;
}
.guide-right-zone {
  position: absolute;
  top: 42%;
  right: 0;
  bottom: 18%;
  width: 15%;
  background: rgba(231, 76, 76, 0.14);
  border-left: 1px dashed rgba(231, 76, 76, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 7.5px;
  font-weight: 700;
  color: rgba(255, 200, 200, 0.9);
}
.guide-bottom-zone {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 16%;
  background: rgba(231, 76, 76, 0.14);
  border-top: 1px dashed rgba(231, 76, 76, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(255, 200, 200, 0.9);
}
.guide-center-v {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  border-left: 1px dotted rgba(178, 221, 76, 0.45);
}
.guide-center-h {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  border-top: 1px dotted rgba(178, 221, 76, 0.45);
}

.stage-telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(178, 221, 76, 0.05);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.tele-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s ease;
}
.tele-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.tele-btn.is-active {
  background: rgba(178, 221, 76, 0.14);
  border-color: rgba(178, 221, 76, 0.45);
  color: var(--text);
}
.tele-item b {
  color: var(--accent-2);
  font-family: var(--mono);
}

/* ---------------- Live Style Simulator & Colors (Section 2) ---------------- */

.style-simulator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 16px;
  align-items: center;
}
.color-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.color-row input[type="color"] {
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  cursor: pointer;
  flex: none;
}
.swatches {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.swatch {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.45);
  cursor: pointer;
  padding: 0;
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.2); }

.live-sim-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sim-head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}
.sim-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.sim-layer-toggles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}
.sim-lpill {
  appearance: none;
  flex: 1;
  padding: 3px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all .14s;
}
.sim-lpill.active {
  background: rgba(178, 221, 76, 0.16);
  border-color: rgba(178, 221, 76, 0.48);
  color: var(--text);
}
.sim-foot-meta {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
}
.sim-phone {
  width: 198px;
  height: 352px;
  border-radius: 20px;
  border: 2px solid rgba(178, 221, 76, 0.38);
  background: radial-gradient(circle at 50% 30%, #1a2332 0%, #0b1120 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 32px -10px rgba(0,0,0,.75);
}
.sim-video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
}
.sim-pbar {
  position: absolute;
  left: 0;
  top: 0;
  width: 68%;
  height: 4px;
  background: #B2DD4C;
  transition: background .2s;
  z-index: 8;
}

/* Proportional Overlay Elements inside both #stagePhoneCanvas and #simPhone */
.stage-logo-box,
.sim-logo-wrap {
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stage-brand-logo-img,
.sim-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.stage-logo-box.is-pill,
.sim-logo-wrap.is-pill {
  background: rgba(11, 17, 32, 0.9);
  border: 1.5px solid #b2dd4c;
  border-radius: 999px;
  padding: 3px 8px;
}

.sim-hook {
  background: rgba(11, 17, 32, 0.92);
  color: #EEF3FA;
  border: 1.5px solid #B2DD4C;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
  letter-spacing: 0.2px;
  z-index: 5;
  width: 86%;
  left: 7%;
}
.sim-hook-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sim-hook-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: none;
  border-radius: 4px;
}
.sim-hook-texts {
  min-width: 0;
  flex: 1;
}

.sim-illust {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  background: rgba(11, 17, 32, 0.92);
  border: 1.5px solid #B2DD4C;
  border-radius: 12px;
  padding: 5px 8px;
  font-weight: 700;
  color: #EEF3FA;
  box-shadow: 0 6px 14px rgba(0,0,0,.5);
  z-index: 6;
  width: 78%;
  transform-origin: center center;
}
.sim-illust.is-claude {
  background: #fdf8f5;
  color: #161413;
  border-color: #E06350;
  border-radius: 999px;
}
.sim-illust.is-float-icon {
  width: auto !important;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  padding: 6px;
}
.sim-illust.is-png-clean {
  width: auto !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  padding: 2px;
}
.sim-illust-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: none;
  border-radius: 4px;
}
.sim-illust.is-float-icon .sim-illust-img,
.sim-illust.is-png-clean .sim-illust-img {
  width: 48px;
  height: 48px;
}
.stage-illust-box.is-float-icon .sim-illust-img,
.stage-illust-box.is-png-clean .sim-illust-img {
  width: 76px;
  height: 76px;
}
.sim-num {
  background: #B2DD4C;
  color: #0B1120;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  font-size: 7.5px;
  font-weight: 800;
  flex: none;
}
.sim-itext {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.sim-ibadge {
  font-size: 6.5px;
  padding: 2px 4px;
  border-radius: 99px;
  background: rgba(178, 221, 76, 0.18);
  color: #B2DD4C;
}
.sim-subs {
  text-align: center;
  font-weight: 900;
  line-height: 1.15;
  color: #EEF3FA;
  text-shadow: 0 2px 0 #0b1120, 0 -1px 0 #0b1120, 1px 0 0 #0b1120, -1px 0 0 #0b1120;
  padding: 3px 4px;
  width: 90%;
  left: 5%;
  z-index: 6;
}
.sim-hl {
  color: #B2DD4C;
  display: inline-block;
  transform: scale(1.08);
}

/* ---------------- Selector Visual de Logos Oficiales Stargety ---------------- */

.brand-logos-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.brand-pick-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  transition: all .18s ease;
}
.brand-pick-btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.brand-pick-btn.active {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.14);
  box-shadow: 0 4px 16px -6px rgba(178, 221, 76, 0.45);
}
.brand-pick-none {
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.brand-pick-preview {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
}
.brand-pick-preview.dark-bg {
  background: #0b1120;
  border: 1px solid rgba(255,255,255,.08);
}
.brand-pick-preview.light-bg {
  background: #eef3fa;
  border: 1px solid rgba(11,17,32,.12);
}
.brand-pick-preview.glass-pill-bg {
  background: #0b1120;
  border: 1.5px solid #b2dd4c;
  border-radius: 999px;
}
.brand-pick-preview img {
  max-width: 100%;
  max-height: 20px;
  object-fit: contain;
}

/* ---------------- Illustration Catalog ---------------- */

.catalog-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
}
.catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 10px;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.cat-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all .15s;
}
.cat-card:hover {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.12);
  transform: translateY(-1px);
}
.cat-card img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
  object-fit: contain;
}
.cat-card span {
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- Variants Config ---------------- */

.variants-config-section {
  background: linear-gradient(135deg, rgba(178, 221, 76, 0.08), rgba(178, 221, 76, 0.02));
  margin: 0 -20px;
  padding: 14px 20px !important;
}
.variant-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}
.v-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.v-chip:has(input:checked) {
  background: rgba(178, 221, 76, 0.18);
  border-color: #b2dd4c;
  color: var(--text);
}
.v-chip input { accent-color: #b2dd4c; margin: 0; }

/* ---------------- Options ---------------- */

.opt-section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.opt-section:first-of-type { border-top: none; padding-top: 2px; }
.opt-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 11px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 12.8px;
  margin-bottom: 8px;
}
.switch:last-child { margin-bottom: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px;
  border-radius: 999px;
  background: rgba(123, 137, 160, 0.25);
  border: 1px solid var(--line);
  position: relative;
  flex: none;
  transition: background .18s, border-color .18s;
}
.switch .thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .18s, background .18s;
}
.switch input:checked + .track {
  background: #b2dd4c;
  border-color: transparent;
}
.switch input:checked + .track .thumb { transform: translateX(16px); background: #0b1120; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.3); }
.switch input:disabled + .track { opacity: .4; }
.switch-label { color: var(--text); font-weight: 500; }
.switch.inline { margin-bottom: 0; align-self: end; padding-bottom: 9px; }

.switch-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }

.opt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.custom-cards-builder {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(178, 221, 76, 0.03);
}
.builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.builder-head strong {
  font-size: 12.5px;
  display: block;
}
.builder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cards-rows-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.cards-rows-list:empty {
  margin-top: 0;
}
.card-row-item {
  display: grid;
  grid-template-columns: 32px 140px 1fr 125px 68px 68px 28px;
  gap: 6px;
  align-items: center;
  background: var(--input-bg);
  padding: 6px 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
}
.card-row-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-2);
  text-align: center;
}
.card-row-item input, .card-row-item select {
  padding: 6px 8px;
  font-size: 12px;
}
.card-row-del {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.card-row-del:hover {
  color: var(--bad);
  border-color: var(--bad);
}

.extracted-hooks-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(178, 221, 76, 0.32);
  background: rgba(178, 221, 76, 0.07);
}
.extracted-label {
  display: block;
  font-size: 11.5px;
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 7px;
}
.extracted-hooks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hook-chip {
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.hook-chip:hover {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.18);
}

.sim-hook-tag {
  font-size: 6.5px;
  letter-spacing: .5px;
  opacity: .9;
  margin-bottom: 2px;
  color: #b2dd4c;
}

.fields { display: grid; gap: 13px; margin-top: 10px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 780px) {
  .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-logos-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.fields + .fields { margin-top: 12px; }

.field { min-width: 0; }
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.field-head output {
  font-family: var(--mono);
  font-size: 11.2px;
  color: var(--text);
  background: rgba(178, 221, 76, 0.12);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}
.field-hint { font-size: 10.8px; color: var(--dim); margin-top: 4px; line-height: 1.35; }

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: rgba(123, 137, 160, 0.28);
  outline: none;
  margin: 4px 0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #b2dd4c;
  border: 2px solid #0b1120;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #b2dd4c;
  border: 2px solid #0b1120;
  cursor: pointer;
}

.advanced { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 4px; }
.advanced summary, .silence-details summary, #srtBox summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  list-style: none;
}
.advanced summary::-webkit-details-marker, .silence-details summary::-webkit-details-marker, #srtBox summary::-webkit-details-marker { display: none; }
.advanced summary::before, .silence-details summary::before, #srtBox summary::before {
  content: "＋";
  display: inline-block;
  margin-right: 7px;
  color: var(--accent-2);
  font-size: 12px;
}
.advanced[open] summary::before, .silence-details[open] summary::before, #srtBox[open] summary::before { content: "－"; }
.advanced[open] summary { margin-bottom: 12px; }

/* ---------------- Run Card ---------------- */

.run-card { padding: 18px; }
.primary-actions-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
}
.run-summary {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin: 10px 0 12px;
  min-height: 16px;
}
.alt-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* ---------------- Job Panel ---------------- */

.job-idle { text-align: center; padding: 26px 16px 20px; }
.idle-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: #0b1120;
  border: 1.5px solid rgba(178, 221, 76, 0.38);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.idle-isotipo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.job-idle p { margin: 4px 0; font-size: 13px; }
.job-idle .muted { color: var(--muted); font-size: 12px; }

.job-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}
.job-titlewrap { flex: 1; min-width: 0; }
.job-title { font-size: 13.5px; font-weight: 700; }
.job-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.spinner {
  width: 18px; height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(178, 221, 76, 0.22);
  border-top-color: #b2dd4c;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.job-card[data-state="done"] .spinner,
.job-card[data-state="failed"] .spinner,
.job-card[data-state="cancelled"] .spinner {
  animation: none;
  border: none;
  position: relative;
}
.job-card[data-state="done"] .spinner::before { content: "✓"; color: var(--ok); font-size: 17px; font-weight: 800; }
.job-card[data-state="failed"] .spinner::before { content: "!"; color: var(--bad); font-size: 17px; font-weight: 800; }
.job-card[data-state="cancelled"] .spinner::before { content: "×"; color: var(--warn); font-size: 19px; font-weight: 700; }

.badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.ok { color: var(--accent-2); border-color: rgba(178, 221, 76, 0.4); background: rgba(178, 221, 76, 0.12); }

.stepper {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0 0 13px;
  padding: 0;
}
.stepper li {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-top: 17px;
  font-size: 10.5px;
  color: var(--dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stepper li::before {
  content: "";
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #262c3a;
  border: 1.5px solid #333b4d;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.stepper li::after {
  content: "";
  position: absolute;
  top: 8px; left: calc(50% + 8px);
  width: calc(100% - 16px);
  height: 1.5px;
  background: var(--line);
}
.stepper li:last-child::after { display: none; }
.stepper li.done { color: var(--muted); }
.stepper li.done::before { background: #b2dd4c; border-color: #b2dd4c; }
.stepper li.done::after { background: rgba(178, 221, 76, 0.45); }
.stepper li.active { color: var(--text); font-weight: 700; }
.stepper li.active::before {
  background: #b2dd4c;
  border-color: #eef3fa;
  box-shadow: 0 0 0 4px rgba(178, 221, 76, 0.25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.22); }
  50% { box-shadow: 0 0 0 7px rgba(178, 221, 76, 0.06); }
}

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  margin: 10px 0;
  border: 1px solid;
  white-space: pre-wrap;
  word-break: break-word;
}
.alert.bad { background: rgba(231, 76, 76, 0.1); border-color: rgba(231, 76, 76, 0.35); color: var(--bad); }

.logwrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #070b14;
  margin-top: 4px;
}
.logbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #8b9bb4;
}
.logbar-actions { display: flex; align-items: center; gap: 12px; }
.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0;
  color: #8b9bb4;
  cursor: pointer;
}
.mini-check input { accent-color: #b2dd4c; }

.log {
  margin: 0;
  padding: 9px 11px;
  max-height: 280px;
  min-height: 90px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.3px;
  line-height: 1.55;
  color: #c2cde0;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line { padding: 0 0 1px; }
.log-line.l-step { color: #b2dd4c; font-weight: 700; margin-top: 5px; }
.log-line.l-ok { color: #a7c98f; }
.log-line.l-warn { color: #fbbf24; }
.log-line.l-err { color: #f87171; }
.log:empty::before { content: "esperando salida…"; color: #4b5970; }

/* ---------------- Result & Variants Gallery ---------------- */

.variants-gallery {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(178, 221, 76, 0.08);
  border: 1px solid rgba(178, 221, 76, 0.3);
}
.variants-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.variants-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.var-tab {
  appearance: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s;
}
.var-tab:hover { border-color: #b2dd4c; }
.var-tab.active {
  background: #b2dd4c;
  border-color: transparent;
  color: #0b1120;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(178, 221, 76, 0.65);
}

.result-grid {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.phone {
  width: 100%;
  max-width: 236px;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1.5px solid rgba(178, 221, 76, 0.35);
  flex: none;
  box-shadow: 0 14px 34px -18px rgba(0,0,0,.95);
}
.phone video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.result-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.result-title { font-size: 15px; font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.srt-block { border-top: 1px solid var(--line); padding-top: 11px; }
.srt-editor-wrap {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
}
.srt-editor-wrap textarea {
  font-family: var(--mono);
  font-size: 11.2px;
  line-height: 1.45;
  resize: vertical;
}
#srtBox { margin-top: 9px; }
.srt-text {
  margin: 8px 0 0;
  max-height: 190px;
  overflow: auto;
  background: #070b14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-family: var(--mono);
  font-size: 10.8px;
  line-height: 1.5;
  color: #b4c0d4;
  white-space: pre-wrap;
}

/* ---------------- Analysis ---------------- */

.timeline {
  display: flex;
  gap: 2px;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0 9px;
  background: rgba(123, 137, 160, 0.15);
}
.tl { height: 100%; min-width: 2px; transition: filter .15s; }
.tl.keep { background: linear-gradient(90deg, #b2dd4c, #84cc16); }
.tl.cut { background: rgba(123, 137, 160, 0.35); }
.tl:hover { filter: brightness(1.25); }

.legend { display: flex; gap: 18px; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.keep { background: #b2dd4c; }
.sw.cut { background: rgba(123, 137, 160, 0.45); }

.silence-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.silence-list { margin-top: 9px; display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.silence-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(178, 221, 76, 0.05);
}
.silence-row b { color: var(--text); font-weight: 600; }

/* ---------------- Storage & History ---------------- */

.storage-pill .storage-gen-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(178, 221, 76, 0.16);
  color: var(--accent-2);
}

.storage-meter-box {
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.storage-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.storage-free-headline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.storage-free-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: -0.02em;
}
.storage-total-sub {
  font-size: 11.5px;
  color: var(--muted);
}
.storage-bar {
  height: 8px;
}
.storage-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.storage-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.history-subhead {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.history-list { display: flex; flex-direction: column; gap: 6px; }
.hist-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}
.hist-item:hover { background: rgba(178, 221, 76, 0.08); border-color: var(--line-strong); }
.hist-del-btn {
  appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 11px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13.5px;
  transition: all .16s;
  flex: none;
}
.hist-del-btn:hover {
  background: rgba(231, 76, 76, 0.14);
  border-color: var(--bad);
  color: var(--bad);
}
.hist-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.hist-dot.done { background: #b2dd4c; }
.hist-dot.failed { background: var(--bad); }
.hist-dot.running, .hist-dot.starting { background: #b2dd4c; animation: pulse2 1.4s infinite; }
.hist-dot.cancelled { background: var(--warn); }
@keyframes pulse2 { 50% { opacity: .35; } }
.hist-main { flex: 1; min-width: 0; }
.hist-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-sub { font-size: 10.8px; color: var(--muted); margin-top: 1px; }
.hist-right { font-size: 10.8px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }

.head-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ---------------- Storage & Confirm Modals ---------------- */

.storage-dialog {
  width: min(680px, calc(100vw - 32px));
}
.storage-modal-summary {
  padding: 10px 13px;
  border-radius: 12px;
  background: rgba(178, 221, 76, 0.08);
  border: 1px solid rgba(178, 221, 76, 0.25);
  font-size: 12.5px;
}
.storage-modal-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 6px;
}
.storage-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.storage-files-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow: auto;
  padding: 2px 0;
}
.storage-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  font-size: 12px;
}
.storage-file-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.storage-file-size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  border-color: rgba(231, 76, 76, 0.45);
}
.confirm-desc {
  margin: 4px 0 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.confirm-size-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(231, 76, 76, 0.09);
  border: 1px solid rgba(231, 76, 76, 0.28);
  font-size: 12.5px;
  margin-bottom: 10px;
}
.confirm-size-box strong {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--bad);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ---------------- Footer & Dialog & Toasts ---------------- */

.footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  padding: 28px 0 0;
}

.dialog {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 24px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.85);
}
.dialog::backdrop { background: rgba(11, 17, 32, 0.72); backdrop-filter: blur(6px); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.diag-body { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 7px; }
.diag-row { display: flex; gap: 10px; font-size: 12px; align-items: baseline; }
.diag-row .k { color: var(--muted); width: 92px; flex: none; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.diag-row .v { font-family: var(--mono); font-size: 11.3px; color: var(--text); word-break: break-all; }
.diag-row .yes { color: var(--ok); }
.diag-row .no { color: var(--bad); }
.diag-pre {
  margin: 6px 0 0;
  max-height: 180px;
  overflow: auto;
  background: #070b14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #a9b6cc;
  white-space: pre-wrap;
}

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  padding: 11px 15px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.65);
  animation: toast-in .22s ease-out;
  white-space: pre-wrap;
  word-break: break-word;
}
.toast.ok { border-color: #b2dd4c; }
.toast.bad { border-color: var(--bad); }
.toast.warn { border-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Responsive Architecture, Accordions & Mobile UX ---------------- */

/* Mobile Quick-Jump Navigation (hidden on desktop > 1100px, sticky bar on tablet/mobile) */
.mobile-jump-nav {
  display: none;
}

/* Accordion system inside #optionsCard (Desktop: all open & spacious; Mobile: compact collapsible cards) */
.opt-accordion {
  padding: 0;
  border-top: 1px solid var(--line);
  transition: background .2s ease, border-color .2s ease;
}
.opt-accordion:first-of-type {
  border-top: none;
}
.opt-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 4px;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  transition: background .16s ease;
}
.opt-summary::-webkit-details-marker {
  display: none;
}
.opt-summary:hover {
  background: rgba(178, 221, 76, 0.04);
}
.opt-summary-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent-2);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.opt-summary-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.opt-summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.opt-acc-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text);
  background: rgba(178, 221, 76, 0.12);
  border: 1px solid rgba(178, 221, 76, 0.28);
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opt-acc-chevron {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(178, 221, 76, 0.1);
  color: var(--accent-2);
  font-size: 12px;
  transition: transform .22s cubic-bezier(0.22, 1, 0.36, 1), background .18s;
}
.opt-accordion[open] > .opt-summary .opt-acc-chevron {
  transform: rotate(180deg);
  background: rgba(178, 221, 76, 0.22);
}
.opt-body {
  padding: 2px 0 14px;
}

.variants-config-section.opt-accordion {
  margin: 4px -12px;
  padding: 0 12px !important;
  border-radius: 14px;
  border: 1px solid rgba(178, 221, 76, 0.24);
}

/* ---------------- Breakpoint 1: Tablet / Single-Column Layout (<= 1180px) ---------------- */
@media (max-width: 1180px) {
  .templates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .mobile-jump-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    position: sticky;
    top: 8px;
    z-index: 25;
    padding: 6px 8px;
    margin-bottom: 12px;
    border-radius: 999px;
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.65);
  }
  .mobile-jump-nav::-webkit-scrollbar {
    display: none;
  }
  .mjump-btn {
    appearance: none;
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all .18s ease;
  }
  .mjump-btn .mjump-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 10px;
    font-weight: 800;
    background: rgba(178, 221, 76, 0.14);
    color: var(--accent-2);
  }
  .mjump-btn:hover,
  .mjump-btn.active {
    background: rgba(178, 221, 76, 0.16);
    border-color: rgba(178, 221, 76, 0.42);
    color: var(--text);
  }
  .mjump-btn.active .mjump-num {
    background: #b2dd4c;
    color: #0b1120;
  }
}

/* ---------------- Breakpoint 2: Mobile & Phablet Accordion Mode (<= 860px) ---------------- */
@media (max-width: 860px) {
  .app {
    padding: 12px 12px 92px;
  }

  /* Compact Topbar */
  .topbar.glass-nav {
    border-radius: 20px;
    padding: 10px 14px;
    margin-bottom: 10px;
    gap: 10px;
  }
  .brand-divider,
  .brand-text p {
    display: none;
  }
  .brand-logo-img {
    height: 30px;
  }
  .tagline-badge {
    font-size: 9.5px;
    padding: 2px 8px;
  }
  .top-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .pill {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Horizontal Swipeable Quick Templates Strip (saves 180px height on mobile) */
  .templates-bar {
    padding: 11px 13px;
    margin-bottom: 12px;
    border-radius: 18px;
  }
  .templates-head {
    margin-bottom: 8px;
  }
  .templates-head .hint {
    display: none;
  }
  .templates-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .templates-grid::-webkit-scrollbar {
    display: none;
  }
  .tpl-btn {
    flex: 0 0 205px;
    scroll-snap-align: start;
    padding: 8px 11px;
    border-radius: 12px;
  }
  .tpl-btn strong {
    font-size: 11.8px;
  }
  .tpl-btn small {
    font-size: 10px;
  }

  /* Cards & Section Headers */
  .card {
    padding: 14px 14px;
    border-radius: 20px;
  }
  .card-head {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }
  .card-head h2 {
    font-size: 14px;
  }
  .dropzone {
    padding: 16px 12px;
  }

  /* Mobile Accordions: boxed tactile cards for each option group */
  #optionsCard .opt-accordion {
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(15, 22, 38, 0.38);
    margin-bottom: 8px;
    padding: 0 12px;
  }
  html[data-theme="light"] #optionsCard .opt-accordion {
    background: rgba(255, 255, 255, 0.65);
  }
  #optionsCard .opt-accordion[open] {
    border-color: rgba(178, 221, 76, 0.42);
    background: rgba(178, 221, 76, 0.04);
  }
  #optionsCard .opt-summary {
    padding: 11px 2px;
  }
  #optionsCard .opt-summary-title {
    font-size: 11.5px;
  }
  #optionsCard .opt-body {
    padding: 6px 0 12px;
    border-top: 1px solid var(--line);
  }
  .variants-config-section.opt-accordion {
    margin: 0 0 8px !important;
  }

  /* Custom Cards Builder: Clean 3-row mobile card layout instead of cramped 7 columns */
  .card-row-item {
    grid-template-columns: 32px 1fr 32px;
    grid-template-areas:
      "num icon del"
      "title title title"
      "badge start end";
    gap: 7px;
    padding: 9px 10px;
  }
  .card-row-num { grid-area: num; }
  .card-row-icon { grid-area: icon; }
  .card-row-del { grid-area: del; justify-self: end; }
  .card-row-title { grid-area: title; }
  .card-row-badge { grid-area: badge; }
  .card-row-start { grid-area: start; }
  .card-row-end { grid-area: end; }

  /* Sticky Bottom Run Card on Mobile */
  .run-card {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    padding: 12px 14px;
    border-radius: 18px;
    border-color: rgba(178, 221, 76, 0.45);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.65), 0 16px 36px -12px rgba(0, 0, 0, 0.85);
  }
  .run-summary {
    margin: 6px 0 8px;
    font-size: 10.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .btn.big {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Modals as Mobile Bottom Sheets */
  .dialog {
    width: calc(100vw - 16px);
    max-height: 88dvh;
    border-radius: 20px;
    margin: auto 8px 8px;
  }
  .diag-body {
    max-height: calc(88dvh - 60px);
    overflow-y: auto;
  }
}

/* ---------------- Breakpoint 3: Compact Phones (<= 580px) ---------------- */
@media (max-width: 580px) {
  .style-simulator-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  /* Centered interactive 9:16 preview on phones */
  .live-sim-wrap {
    flex-direction: column;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 12px;
  }
  .sim-head-bar,
  .sim-layer-toggles {
    max-width: 210px;
  }
  .sim-phone {
    width: 180px;
    height: 320px;
    padding: 0;
    border-radius: 18px;
  }
  .fields.two,
  .fields.three,
  .fields.four {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  /* Keep numeric/slider triplets 2-col where compact */
  .opt-body > .fields.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .opt-body > .fields.three > .field:last-child {
    grid-column: 1 / -1;
  }
  .brand-logos-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .primary-actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .alt-actions {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .alt-actions::-webkit-scrollbar {
    display: none;
  }
  .alt-actions .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .result-grid {
    flex-direction: column;
  }
  .phone {
    max-width: 240px;
    margin: 0 auto;
  }
  .storage-actions-row,
  .confirm-actions {
    flex-direction: column;
  }
  .storage-actions-row .btn,
  .confirm-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .opt-acc-badge {
    max-width: 115px;
    font-size: 9.8px;
  }
}

/* Accesibilidad: reducción de movimiento (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ------------------------------------------------------------------ */
/* Google Gemini IA                                                    */
/* ------------------------------------------------------------------ */
.ai-pill.is-off .dot { background: var(--dim); }
.ai-pill.is-ok { border-color: rgba(178, 221, 76, 0.45); }
.ai-pill.is-ok .dot { background: #b2dd4c; box-shadow: 0 0 0 3px rgba(178, 221, 76, 0.22); }

.ai-studio-bar {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(178, 221, 76, 0.38);
  background: linear-gradient(135deg, rgba(178, 221, 76, 0.06), rgba(56, 189, 248, 0.04));
}
.ai-studio-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ai-mini-label { font-size: 11.5px; font-weight: 700; color: var(--accent-2); line-height: 1.35; }
.ai-input-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.ai-input-row input { flex: 1; min-width: 0; }
.ai-type-select { width: auto; max-width: 190px; flex: none; }
.ai-gen-btn { flex: none; white-space: nowrap; }

.gemini-dialog { width: min(620px, calc(100vw - 24px)); }
.gemini-dialog-body { display: flex; flex-direction: column; gap: 4px; }
.gemini-test-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
}
.gemini-test-box.ok { border-color: rgba(178, 221, 76, 0.5); color: var(--accent-2); background: rgba(178, 221, 76, 0.08); }
.gemini-test-box.bad { border-color: var(--bad); color: var(--bad); background: rgba(231, 76, 76, 0.08); }

@media (max-width: 900px) {
  .ai-studio-bar { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ai-input-row { flex-wrap: wrap; }
  .ai-type-select { max-width: none; flex: 1 1 100%; }
  .ai-gen-btn { flex: 1 1 100%; }
  .ai-pill #aiBadgeText { font-size: 11px; }
}


/* ------------------------------------------------------------------ */
/* MODO ASISTENTE (WIZARD) · 1 PANTALLA A LA VEZ · OPTIMIZADO MÓVIL   */
/* ------------------------------------------------------------------ */
.wizard-pill {
  cursor: pointer;
  background: rgba(178, 221, 76, 0.08);
  border-color: rgba(178, 221, 76, 0.32);
  gap: 8px;
}
.wizard-pill.is-on {
  background: rgba(178, 221, 76, 0.18);
  border-color: #b2dd4c;
  color: var(--text);
  box-shadow: 0 0 12px rgba(178, 221, 76, 0.22);
}
.wiz-switch {
  width: 24px;
  height: 14px;
  border-radius: 999px;
  background: rgba(123, 137, 160, 0.35);
  position: relative;
  display: inline-block;
  flex: none;
  transition: background .18s;
}
.wiz-switch-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform .18s, background .18s;
}
.wizard-pill.is-on .wiz-switch { background: #b2dd4c; }
.wizard-pill.is-on .wiz-switch-thumb {
  transform: translateX(10px);
  background: #0b1120;
}

body.wizard-on #mainContent,
body.wizard-on .templates-bar,
body.wizard-on .mobile-jump-nav {
  display: none !important;
}

.wizard {
  max-width: 660px;
  margin: 14px auto 36px;
  padding: 0 14px;
}
.wiz-shell {
  padding: 22px 24px;
  border-radius: 22px;
  background: var(--surface-frost);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.wiz-head { margin-bottom: 20px; }
.wiz-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.wiz-step-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent-2);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(178, 221, 76, 0.12);
  border: 1px solid rgba(178, 221, 76, 0.3);
}
.wiz-exit {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.wiz-exit:hover { color: var(--accent-2); }

.wiz-progress {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.wiz-progress li { min-width: 0; }
.wiz-progress button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 8px;
  transition: opacity .15s;
}
.wiz-progress button:disabled { opacity: .35; cursor: not-allowed; }
.wiz-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: all .2s;
}
.wiz-dot-label {
  font-size: 10.5px;
  color: var(--dim);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.wiz-progress button.active .wiz-dot {
  background: #b2dd4c;
  color: #0b1120;
  border-color: #b2dd4c;
  box-shadow: 0 0 0 4px rgba(178, 221, 76, 0.25);
  font-weight: 800;
}
.wiz-progress button.active .wiz-dot-label { color: var(--text); font-weight: 700; }
.wiz-progress button.done .wiz-dot {
  background: rgba(178, 221, 76, 0.18);
  color: var(--accent-2);
  border-color: rgba(178, 221, 76, 0.45);
}

.wiz-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -.4px;
}
.wiz-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.wiz-body {
  margin: 20px 0 24px;
  min-height: 260px;
}
.wiz-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wiz-step[hidden] { display: none !important; }

@keyframes wizInFwd {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes wizInBack {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.wiz-in-fwd { animation: wizInFwd .2s cubic-bezier(.2,.8,.3,1) both; }
.wiz-in-back { animation: wizInBack .2s cubic-bezier(.2,.8,.3,1) both; }

.wiz-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  display: block;
}
.wiz-label small { font-weight: normal; color: var(--muted); }
.wiz-muted { color: var(--muted); }

/* Paso 1 */
.wiz-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 18px;
  border-radius: 18px;
  border: 2px dashed rgba(178, 221, 76, 0.45);
  background: rgba(178, 221, 76, 0.04);
  cursor: pointer;
  text-align: center;
  transition: all .18s;
}
.wiz-drop:hover, .wiz-drop.drag, .wiz-drop:focus-visible {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.1);
  box-shadow: 0 0 20px rgba(178, 221, 76, 0.2);
  outline: none;
}
.wiz-drop-ico { font-size: 38px; }
.wiz-drop strong { font-size: 15px; color: var(--text); }
.wiz-drop small { font-size: 12px; color: var(--muted); }

.wiz-wide { width: 100%; justify-content: center; }
.wiz-big { font-size: 15px; padding: 13px 20px; font-weight: 800; }

.wiz-server-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}
.wiz-server-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
}
.wiz-server-item:hover {
  background: rgba(178, 221, 76, 0.1);
  border-color: rgba(178, 221, 76, 0.3);
}
.wiz-server-item small { color: var(--muted); font-size: 11px; flex: none; }

.wiz-video-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
}
.wiz-video-card video {
  width: 90px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
  flex: none;
}
.wiz-video-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wiz-video-meta strong { font-size: 13.5px; color: var(--text); }
.wiz-video-meta small { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }

/* Paso 2 */
.wiz-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.wiz-preset {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: all .16s;
}
.wiz-preset:hover { border-color: rgba(178, 221, 76, 0.5); }
.wiz-preset.active {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.12);
  box-shadow: 0 0 0 2px rgba(178, 221, 76, 0.35);
}
.wiz-preset-sample {
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
}
.wiz-preset-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.wiz-def {
  font-style: normal;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #b2dd4c;
  color: #0b1120;
  font-weight: 900;
}
.wiz-preset small {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.25;
}

.wiz-logos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.wiz-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  transition: all .16s;
}
.wiz-logo:hover { border-color: rgba(178, 221, 76, 0.5); }
.wiz-logo.active {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.12);
  box-shadow: 0 0 0 2px rgba(178, 221, 76, 0.3);
}
.wiz-logo-none { font-size: 22px; height: 32px; display: grid; place-items: center; }
.wiz-logo-pv {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  padding: 4px;
}
.wiz-logo-pv img { max-width: 100%; max-height: 24px; object-fit: contain; }
.wiz-logo-pv.dark { background: #0b1120; }
.wiz-logo-pv.glass {
  background: rgba(238, 243, 250, 0.1);
  border: 1px solid rgba(178, 221, 76, 0.45);
}

.wiz-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}

/* Paso 3 */
.wiz-ai-status {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.wiz-ai-status.ok {
  border-color: rgba(178, 221, 76, 0.4);
  background: rgba(178, 221, 76, 0.08);
  color: var(--text);
}
.wiz-ai-status.ok b { color: var(--accent-2); }

.wiz-hooks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wiz-hook {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.wiz-hook:hover { border-color: rgba(178, 221, 76, 0.5); }
.wiz-hook.active {
  background: #b2dd4c;
  color: #0b1120;
  border-color: #b2dd4c;
  font-weight: 700;
}

/* Paso 4 */
.wiz-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wiz-mode {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .16s;
}
.wiz-mode input { margin-top: 3px; accent-color: #b2dd4c; }
.wiz-mode span { display: flex; flex-direction: column; gap: 2px; }
.wiz-mode strong { font-size: 13px; color: var(--text); }
.wiz-mode small { font-size: 11px; color: var(--muted); }
.wiz-mode:has(input:checked) {
  border-color: #b2dd4c;
  background: rgba(178, 221, 76, 0.12);
  box-shadow: 0 0 0 2px rgba(178, 221, 76, 0.3);
}

.wiz-variant-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}
.wiz-vchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text);
}
.wiz-vchip input { accent-color: #b2dd4c; }
.wiz-vchip span { display: inline-flex; align-items: center; gap: 6px; }
.wiz-vchip span i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.wiz-vchip:has(input:checked) {
  border-color: rgba(178, 221, 76, 0.5);
  background: rgba(178, 221, 76, 0.12);
}

.wiz-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(178, 221, 76, 0.05);
  border: 1px solid rgba(178, 221, 76, 0.25);
}
.wiz-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.wiz-sum-row span { color: var(--muted); }
.wiz-sum-row b { color: var(--text); font-weight: 600; text-align: right; }

/* Paso 5 */
.wiz-ready {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wiz-job {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
}
.wiz-job-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.wiz-job-head strong { font-size: 14px; color: var(--text); }
.wiz-job-bar { height: 8px; }
.wiz-job-steps { margin: 6px 0; }
.wiz-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(231, 76, 76, 0.1);
  border: 1px solid var(--bad);
  color: var(--bad);
  font-size: 12px;
  line-height: 1.4;
}

.wiz-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.wiz-var-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}
.wiz-var-tab {
  flex: 1 1 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
}
.wiz-var-tab.active {
  background: #b2dd4c;
  color: #0b1120;
  border-color: #b2dd4c;
  font-weight: 700;
}
.wiz-phone {
  width: min(260px, 70vw);
  aspect-ratio: 9/16;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid var(--line-strong);
  background: #000;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.wiz-phone video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wiz-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.wiz-result-actions button { flex: 1 1 120px; }

/* Navegación footer */
.wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .wiz-shell { padding: 16px 14px; border-radius: 18px; }
  .wiz-title { font-size: 19px; }
  .wiz-dot-label { display: none; }
  .wiz-dot { width: 26px; height: 26px; font-size: 11px; }
  .wiz-presets { grid-template-columns: repeat(2, 1fr); }
  .wiz-logos { grid-template-columns: repeat(2, 1fr); }
  .wiz-modes { grid-template-columns: 1fr; }
  .wiz-nav button { flex: 1; justify-content: center; }
}


.wiz-lang-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
}
.wiz-lang-select {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 12px;
}
