/* ============================================================
   DoceIA — Estudio de Creación
   ============================================================ */

/* Ensure [hidden] always wins over display:flex/grid declarations below */
[hidden] { display: none !important; }

:root {
  --tc: #7c3aed;   /* type color — overridden by JS */
  --tc2: #5b21b6;
  --tc-bg: #f5f3ff;
  --tc-pal: #ede9fe;
}

/* ── STUDIO HERO ───────────────────────────────────────────── */
.st-hero {
  padding-top: 5.5rem;
  background: linear-gradient(135deg, var(--st-g1, #5b21b6) 0%, var(--st-g2, #7c3aed) 55%, var(--st-g3, #9333ea) 100%);
  position: relative; overflow: hidden;
}
/* Dot grid overlay */
.st-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.13) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  pointer-events: none; z-index: 0;
}
/* Glow orb top-right */
.st-hero::after {
  content: ""; position: absolute; top: -35%; right: -6%;
  width: 580px; height: 580px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.15) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
}

.st-hero-in {
  max-width: 1140px; margin-inline: auto; padding: 2.5rem 1.5rem 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  position: relative; z-index: 2; min-height: 240px;
}
.st-hero-content { flex: 1; min-width: 0; padding-bottom: 3.75rem; }

/* Breadcrumb */
.st-breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; color: rgba(255,255,255,.5); margin-bottom: 1.25rem;
}
.st-breadcrumb a { color: rgba(255,255,255,.65); text-decoration: none; }
.st-breadcrumb a:hover { color: #fff; }

/* Badge icon */
.st-hero-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 18px;
  background: rgba(255,255,255,.2); backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,.28);
  font-size: 2rem; margin-bottom: 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.st-hero-h1 {
  font-family: var(--df); font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 900; color: #fff; margin-bottom: .625rem;
  letter-spacing: -.035em; line-height: 1.05;
  text-shadow: 0 2px 24px rgba(0,0,0,.18);
}
.st-hero-sub {
  font-size: 1rem; color: rgba(255,255,255,.75); line-height: 1.65;
  max-width: 500px; margin-bottom: 1.5rem;
}

/* Pills row */
.st-hero-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.st-meta-cr {
  font-family: var(--df); font-size: .8rem; font-weight: 800;
  background: rgba(255,255,255,.22); color: #fff;
  padding: .375rem 1rem; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.32);
  backdrop-filter: blur(8px);
}
.st-meta-time, .st-meta-ai {
  font-size: .78rem; font-weight: 700; color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.1); padding: .375rem .875rem;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
}

/* Image wrapper + glow halo */
.st-hero-img-wrap {
  flex-shrink: 0; align-self: flex-end; position: relative;
}
.st-hero-img-wrap::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse 80% 60% at 50% 75%, rgba(255,255,255,.28) 0%, transparent 68%);
  filter: blur(22px); pointer-events: none; z-index: 0;
  transform: scale(1.1);
}
.st-hero-fig {
  height: 310px; width: auto; display: block; position: relative; z-index: 1;
  filter: drop-shadow(0 24px 56px rgba(0,0,0,.38));
  pointer-events: none; user-select: none;
  animation: heroFloat 5s ease-in-out infinite;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-16px); }
}

/* Wave divider */
.st-hero-wave {
  position: relative; z-index: 3; line-height: 0; margin-top: -1px;
}
.st-hero-wave svg { display: block; width: 100%; height: 56px; }

@media (max-width: 900px) {
  .st-hero-img-wrap { display: none; }
  .st-hero-content  { padding-bottom: 2.5rem; }
}

/* ── STUDIO MAIN ───────────────────────────────────────────── */
.st-main {
  min-height: calc(100vh - 350px);
  background: var(--bg);
  background: linear-gradient(180deg, #f0ebff 0%, #f8f6ff 60%, #fff 100%);
  padding: 2.5rem 1.5rem 4rem;
}
.st-grid {
  max-width: 1140px; margin-inline: auto;
  display: grid; grid-template-columns: 400px 1fr; gap: 1.75rem; align-items: flex-start;
}
@media (max-width: 900px) { .st-grid { grid-template-columns: 1fr; } }

/* ── SETTINGS PANEL ────────────────────────────────────────── */
.st-panel { display: flex; flex-direction: column; gap: 1rem; }

.st-card {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 20px; padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(109,40,217,.06);
}
.st-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.st-card-title {
  font-family: var(--df); font-size: 1rem; font-weight: 800; color: var(--ink);
}
.st-help-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--p-pal); border: none; color: var(--p);
  font-size: .8rem; font-weight: 900; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.st-help-btn:hover { background: var(--p); color: #fff; }

/* ── FORM FIELDS ───────────────────────────────────────────── */
.st-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.st-field:last-child { margin-bottom: 0; }
.st-field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem;
}
.st-label {
  font-family: var(--df); font-size: .7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.st-input, .st-select {
  padding: .6rem .875rem; border: 1.5px solid var(--border);
  border-radius: 12px; background: #fff;
  font-family: var(--bf); font-size: .9rem; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; outline: none;
  width: 100%;
}
.st-input:focus, .st-select:focus {
  border-color: var(--p); box-shadow: 0 0 0 3px rgba(109,40,217,.1);
}
.st-input::placeholder { color: var(--ink-4); }

.st-textarea-wrap { position: relative; }
.st-textarea {
  width: 100%; padding: .75rem .875rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: #faf9ff; font-family: var(--bf); font-size: .875rem;
  color: var(--ink); line-height: 1.6; resize: vertical;
  transition: border-color .15s, box-shadow .15s; outline: none;
  min-height: 160px;
}
.st-textarea:focus {
  border-color: var(--p); background: #fff;
  box-shadow: 0 0 0 3px rgba(109,40,217,.1);
}
.st-textarea::placeholder { color: var(--ink-4); }
.st-char-count {
  position: absolute; bottom: .5rem; right: .75rem;
  font-size: .68rem; color: var(--ink-4); pointer-events: none;
}
.st-ai-btn {
  margin-top: .5rem; padding: .45rem .875rem;
  background: none; border: 1.5px dashed var(--border-2);
  border-radius: 10px; color: var(--p);
  font-family: var(--df); font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: all .15s; text-align: left;
}
.st-ai-btn:hover { background: var(--p-pal); border-color: var(--p); }

/* Number inputs */
.st-number-wrap { display: flex; align-items: center; gap: .5rem; }
.st-number-wrap .st-input { max-width: 80px; text-align: center; }
.st-number-hint { font-size: .75rem; color: var(--ink-4); }

/* Toggle switch */
.st-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 0; border-bottom: 1px solid var(--border);
}
.st-toggle-row:last-child { border-bottom: none; }
.st-toggle-label { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.st-toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.st-toggle input { opacity: 0; width: 0; height: 0; }
.st-toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-2); border-radius: 999px; transition: background .2s;
}
.st-toggle-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.st-toggle input:checked + .st-toggle-slider { background: var(--p); }
.st-toggle input:checked + .st-toggle-slider::before { transform: translateX(16px); }

/* ── ADVANCED SETTINGS ─────────────────────────────────────── */
.st-card-adv { padding: 0; overflow: hidden; }
.st-adv-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 1rem 1.5rem; font-family: var(--df); font-size: .9rem; font-weight: 700;
  color: var(--ink-2); transition: background .15s;
}
.st-adv-toggle:hover { background: var(--p-pal); color: var(--p); }
.st-adv-ico { font-size: .85rem; transition: transform .2s; }
.st-adv-toggle[aria-expanded="true"] .st-adv-ico { transform: rotate(180deg); }
.st-adv-body { padding: 0 1.5rem 1.25rem; border-top: 1.5px solid var(--border); }
.st-adv-section { margin-bottom: .75rem; }
.st-adv-section-title {
  font-family: var(--df); font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4);
  margin: 1rem 0 .5rem;
}

/* ── GENERATE AREA ─────────────────────────────────────────── */
.st-generate-area { display: flex; flex-direction: column; gap: .75rem; }
.st-gen-info {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: var(--p-pal);
  border-radius: 12px; border: 1.5px solid var(--p-pal);
}
.st-gen-cost {
  font-family: var(--df); font-size: .9rem; font-weight: 800; color: var(--p);
}
.st-gen-bal { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.st-gen-btn {
  display: flex; align-items: center; justify-content: center;
  gap: .5rem; width: 100%; padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--st-g1, #5b21b6), var(--st-g2, #7c3aed));
  color: #fff; border: none; border-radius: 14px;
  font-family: var(--df); font-size: 1.0625rem; font-weight: 800;
  cursor: pointer; transition: all .2s;
  box-shadow: 0 6px 24px rgba(109,40,217,.35);
}
.st-gen-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(109,40,217,.45); }
.st-gen-btn:active { transform: scale(.98); }
.st-gen-btn:disabled {
  opacity: .6; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.st-gen-err {
  font-size: .82rem; color: #b91c1c; min-height: 1.2em; font-weight: 600;
  background: #fef2f2; border-radius: 8px; padding: .4rem .75rem;
  display: none;
}
.st-gen-err:not(:empty) { display: block; }

/* ── OUTPUT PANEL ──────────────────────────────────────────── */
.st-output {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 2px 12px rgba(109,40,217,.06);
  min-height: 520px; max-height: calc(100vh - 6rem);
  display: flex; flex-direction: column;
  position: sticky; top: 5.5rem;
}

/* Placeholder state */
.st-ph {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 3rem 2rem; text-align: center;
}
.st-ph-inner { max-width: 320px; }
.st-ph-ic { font-size: 3.5rem; display: block; margin-bottom: 1rem; opacity: .7; }
.st-ph-title {
  font-family: var(--df); font-size: 1.125rem; font-weight: 800;
  color: var(--ink); margin-bottom: .5rem;
}
.st-ph-sub { font-size: .9rem; color: var(--ink-4); line-height: 1.6; margin-bottom: 1.5rem; }
.st-ph-tips {
  display: flex; flex-direction: column; gap: .5rem; text-align: left;
  background: var(--bg); border-radius: 12px; padding: .875rem 1rem;
}
.st-ph-tip {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .8125rem; color: var(--ink-3); line-height: 1.45;
}
.st-ph-tip-ic { flex-shrink: 0; font-size: 1rem; }

/* Loading state */
.st-loading {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem;
}
.st-loading-inner { text-align: center; }
.st-spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid var(--p-pal); border-top-color: var(--p);
  animation: spin .8s linear infinite; margin: 0 auto 1.25rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.st-loading-label {
  font-family: var(--df); font-size: 1rem; font-weight: 700; color: var(--ink);
  margin-bottom: 1rem;
}
.st-loading-steps { display: flex; flex-direction: column; gap: .375rem; align-items: center; }
.st-ls { font-size: .8125rem; color: var(--ink-4); font-weight: 600; }
.st-ls.active { color: var(--p); }
.st-ls.done { color: var(--green); text-decoration: line-through; }

/* Result state */
.st-result { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.st-result-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: 1rem 1.25rem; border-bottom: 1.5px solid var(--border);
  background: #faf9ff;
  flex-shrink: 0; position: sticky; top: 0; z-index: 5;
}
.st-result-title {
  font-family: var(--df); font-size: .875rem; font-weight: 800; color: var(--ink);
}
.st-result-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.st-act-btn {
  padding: .4rem .875rem; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--border);
  font-family: var(--df); font-size: .78rem; font-weight: 700; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.st-act-btn:hover { border-color: var(--p); color: var(--p); background: var(--p-pal); }
.st-act-btn--dl { background: var(--p); color: #fff; border-color: var(--p); }
.st-act-btn--dl:hover { background: var(--p3); color: #fff; }

/* Google success card */
.st-google-success {
  display: flex; align-items: flex-start; gap: 1rem;
  margin: 1.25rem; padding: 1.5rem; border-radius: 16px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1.5px solid #86efac;
}
.st-gs-icon { font-size: 2.5rem; flex-shrink: 0; }
.st-gs-title { font-family: var(--df); font-size: 1rem; font-weight: 800; color: #14532d; margin-bottom: .25rem; }
.st-gs-sub { font-size: .875rem; color: #166534; margin-bottom: .75rem; }
.st-gs-link {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #059669; color: #fff; text-decoration: none;
  padding: .55rem 1.125rem; border-radius: 999px;
  font-family: var(--df); font-size: .85rem; font-weight: 800;
  transition: background .15s;
}
.st-gs-link:hover { background: #047857; }

/* Markdown output */
.st-md-output {
  flex: 1; overflow-y: auto; padding: 1.5rem 1.75rem;
  font-size: .9375rem; color: var(--ink-2); line-height: 1.75;
}
.st-md-output h1,.st-md-output h2,.st-md-output h3 {
  font-family: var(--df); color: var(--ink); margin: 1.5em 0 .6em; letter-spacing: -.02em;
}
.st-md-output h1 { font-size: 1.375rem; }
.st-md-output h2 { font-size: 1.125rem; border-bottom: 1.5px solid var(--border); padding-bottom: .4em; }
.st-md-output h3 { font-size: 1rem; }
.st-md-output p { margin-bottom: .875em; }
.st-md-output ul,.st-md-output ol { padding-left: 1.5em; margin-bottom: .875em; }
.st-md-output li { margin-bottom: .3em; }
.st-md-output strong { font-weight: 800; color: var(--ink); }
.st-md-output code {
  background: var(--p-pal); color: var(--p);
  padding: .15em .4em; border-radius: 4px; font-size: .875em;
}
.st-md-output pre {
  background: #1e1b2e; color: #e9d5ff; padding: 1.25rem; border-radius: 12px;
  overflow-x: auto; margin-bottom: 1em;
}
.st-md-output pre code { background: none; color: inherit; padding: 0; }
.st-md-output::-webkit-scrollbar { width: 5px; }
.st-md-output::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
.st-md-output::-webkit-scrollbar-track { background: transparent; }

/* Google needed warning */
.st-google-needed {
  margin: 1.25rem; padding: 1.25rem; border-radius: 16px;
  background: #fffbeb; border: 1.5px solid #fde68a;
  font-size: .875rem; color: #78350f;
}
.st-google-needed a {
  color: var(--p); font-weight: 700; text-decoration: underline;
}

/* ── TUTORIAL OVERLAY ──────────────────────────────────────── */
.tut-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13,12,20,.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  animation: tutFade .22s ease;
}
.tut-overlay[hidden] { display: none; }
@keyframes tutFade { from { opacity: 0; } to { opacity: 1; } }

.tut-modal {
  background: #fff; border-radius: 24px; padding: 2.5rem 2.25rem 2rem;
  width: 100%; max-width: 440px;
  box-shadow: 0 40px 80px rgba(13,12,20,.35);
  animation: tutPop .28s cubic-bezier(.2,.9,.3,1.3);
  text-align: center;
}
@keyframes tutPop { from { opacity: 0; transform: scale(.9) translateY(20px); } to { opacity: 1; transform: none; } }

.tut-dots {
  display: flex; gap: .4rem; justify-content: center; margin-bottom: 2rem;
}
.tut-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--border-2);
  transition: all .2s;
}
.tut-dot.active { background: var(--p); width: 22px; border-radius: 999px; }

.tut-step-ic {
  font-size: 3rem; margin-bottom: 1.25rem; display: block;
  animation: tIc .4s ease;
}
@keyframes tIc { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tut-step-title {
  font-family: var(--df); font-size: 1.375rem; font-weight: 900; color: var(--ink);
  letter-spacing: -.025em; margin-bottom: .625rem;
}
.tut-step-body {
  font-size: .9375rem; color: var(--ink-3); line-height: 1.65; margin-bottom: 2rem;
}
.tut-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.tut-skip {
  background: none; border: none; color: var(--ink-4); font-size: .875rem;
  font-weight: 600; cursor: pointer; padding: .5rem; transition: color .15s;
}
.tut-skip:hover { color: var(--ink); }
.tut-next {
  background: linear-gradient(135deg, var(--st-g1, #5b21b6), var(--st-g2, #7c3aed));
  color: #fff; border: none; border-radius: 999px; padding: .7rem 1.75rem;
  font-family: var(--df); font-size: .9375rem; font-weight: 800;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 14px rgba(109,40,217,.32);
}
.tut-next:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(109,40,217,.42); }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .st-field-row { grid-template-columns: 1fr; }
  .st-hero-in   { min-height: 180px; }
  .st-hero-h1   { font-size: 1.75rem; }
  .st-result-bar { flex-direction: column; align-items: flex-start; }
  .tut-modal    { padding: 2rem 1.5rem 1.5rem; }
}

/* ── STORYBOARD (vídeo) ─────────────────────────────────────── */
.sb-meta {
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.sb-meta-title   { margin: 0 0 .2rem; font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.sb-meta-tagline { margin: 0; font-size: .875rem; color: var(--tc-2); font-style: italic; }

.sb-narr-wrap {
  padding: .4rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.sb-narr-wrap summary {
  cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--tc-2);
  list-style: none; display: flex; align-items: center; gap: .35rem;
  padding: .3rem 0; user-select: none;
}
.sb-narr-wrap summary::-webkit-details-marker { display: none; }
.sb-narr-wrap summary::before { content: '▶'; font-size: .6rem; transition: transform .18s; }
details[open].sb-narr-wrap summary::before { transform: rotate(90deg); }
.sb-narr-text {
  margin: .5rem 0 .4rem; font-size: .825rem; line-height: 1.65; color: var(--ink-3);
  max-height: 150px; overflow-y: auto;
}

.sb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: .75rem; padding: .875rem 1rem;
}
.sb-card {
  background: var(--sb-bg, #1e3a5f);
  border-radius: 14px; padding: .875rem;
  color: #fff; display: flex; flex-direction: column; gap: .45rem;
  transition: transform .15s;
}
.sb-card:hover { transform: translateY(-2px); }
.sb-card-top { display: flex; justify-content: space-between; align-items: center; }
.sb-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.22); display: flex; align-items: center;
  justify-content: center; font-size: .73rem; font-weight: 800;
}
.sb-dur {
  font-size: .68rem; background: rgba(255,255,255,.18);
  padding: .13rem .4rem; border-radius: 99px; font-weight: 600;
}
.sb-card-title   { margin: 0; font-size: .92rem; font-weight: 800; line-height: 1.3; }
.sb-card-caption {
  margin: 0; font-size: .73rem; font-weight: 600; opacity: .88;
  background: rgba(255,255,255,.13); padding: .18rem .42rem; border-radius: 6px; line-height: 1.35;
}
.sb-card-narr { margin: 0; font-size: .76rem; line-height: 1.5; opacity: .9; }
.sb-card-prompt { margin-top: auto; }
.sb-card-prompt summary {
  cursor: pointer; font-size: .66rem; opacity: .55; font-style: italic;
  list-style: none; user-select: none;
}
.sb-card-prompt summary::-webkit-details-marker { display: none; }
.sb-card-prompt > p { margin: .35rem 0 0; font-size: .66rem; opacity: .6; line-height: 1.4; }

@media (max-width: 640px) {
  .sb-grid { grid-template-columns: 1fr 1fr; }
}

/* Storyboard & approach overflow containers */
#storyboard-output, #approach-picker {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  min-height: 0;
}
#storyboard-output::-webkit-scrollbar,
#approach-picker::-webkit-scrollbar { width: 5px; }
#storyboard-output::-webkit-scrollbar-thumb,
#approach-picker::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }

/* ── STORYBOARD ACTIONS (image gen) ────────────────────────── */
.sb-actions {
  padding: .875rem 1rem 1.125rem;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: .45rem;
  background: var(--bg, #faf9ff);
  flex-shrink: 0;
}
.sb-action-label { font-size: .78rem; color: var(--ink-4); margin: 0; }
.sb-btn-images {
  align-self: flex-start;
  background: linear-gradient(135deg, #db2777, #9d174d);
  color: #fff; border: none; border-radius: 12px;
  padding: .62rem 1.25rem; font-size: .875rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 14px rgba(219,39,119,.28);
}
.sb-btn-images:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(219,39,119,.4); }
.sb-btn-images:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.sb-btn-primary {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--p, #7c3aed), var(--p3, #5b21b6));
  color: #fff; border: none; border-radius: 12px;
  padding: .7rem 1.5rem; font-size: .9rem; font-weight: 800;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 14px rgba(109,40,217,.28);
}
.sb-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(109,40,217,.4); }
.sb-btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── APPROACH PICKER ────────────────────────────────────────── */
.ap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem; padding: .875rem 1rem;
}
@media (max-width: 640px) { .ap-grid { grid-template-columns: 1fr; } }

.ap-card {
  background: var(--bg, #fff); border: 2px solid var(--border);
  border-radius: 16px; padding: 1.125rem;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.ap-card:hover { border-color: var(--p, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.ap-card.selected {
  border-color: var(--p, #7c3aed);
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.ap-card-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--p, #7c3aed); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem; margin-bottom: .7rem;
}
.ap-card.selected .ap-card-num { background: #5b21b6; }
.ap-card-title { margin: 0 0 .45rem; font-size: .92rem; font-weight: 800; color: var(--ink); line-height: 1.3; }
.ap-card-desc  { margin: 0 0 .4rem; font-size: .8rem; color: var(--ink-3); line-height: 1.5; }
.ap-card-tone  { margin: 0 0 .35rem; font-size: .73rem; color: var(--p, #7c3aed); font-weight: 700; }
.ap-card-example {
  margin: .3rem 0 0; font-size: .73rem; color: var(--ink-4); font-style: italic;
  line-height: 1.45; border-left: 2px solid var(--border-2); padding-left: .5rem;
}

/* ── PREVIEW MODALS ────────────────────────────────────────── */
.prev-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.58); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
}
.prev-modal {
  background: #fff; border-radius: 20px;
  width: 100%; max-width: 800px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  overflow: hidden;
}
.prev-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem; border-bottom: 1.5px solid #ede9fe;
  flex-shrink: 0; gap: 1rem;
}
.prev-modal-title {
  font-family: var(--df); font-size: 1.1rem; font-weight: 800;
  color: var(--ink); margin: 0 0 .25rem;
}
.prev-modal-hint { font-size: .8rem; color: var(--ink-3); margin: 0; }
.prev-close-btn {
  background: #f5f3ff; border: none; border-radius: 50%;
  width: 32px; height: 32px; flex-shrink: 0; cursor: pointer;
  font-size: .88rem; color: var(--p, #7c3aed);
  display: flex; align-items: center; justify-content: center;
}
.prev-close-btn:hover { background: #ede9fe; }

.prev-modal-body {
  flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: .875rem;
}
.prev-modal-foot {
  padding: 1rem 1.5rem; border-top: 1.5px solid #ede9fe;
  display: flex; align-items: center; justify-content: flex-end;
  gap: .75rem; flex-shrink: 0;
}
.prev-create-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff; border: none; border-radius: 12px;
  padding: .75rem 1.5rem; font-family: var(--df); font-size: .875rem; font-weight: 800;
  cursor: pointer; transition: opacity .15s;
  white-space: nowrap;
}
.prev-create-btn:hover:not(:disabled) { opacity: .88; }
.prev-create-btn:disabled { opacity: .5; cursor: default; }

/* Slide cards */
.prev-slide-card {
  border: 1.5px solid var(--border, #e5e7eb); border-radius: 14px;
  padding: 1rem; display: flex; flex-direction: column; gap: .5rem;
}
.prev-slide-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .2rem;
}
.prev-slide-type {
  font-size: .68rem; font-weight: 800; padding: .18rem .6rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .05em;
}
.prev-slide-type--cover      { background: #fef3c7; color: #92400e; }
.prev-slide-type--content    { background: #ede9fe; color: #6d28d9; }
.prev-slide-type--divider    { background: #dbeafe; color: #1e40af; }
.prev-slide-type--highlight  { background: #fce7f3; color: #9d174d; }
.prev-slide-type--conclusion { background: #d1fae5; color: #065f46; }
.prev-slide-num { font-size: .7rem; color: var(--ink-4, #9ca3af); }
.prev-slide-title { font-weight: 700; font-size: .88rem; }
.prev-slide-body  { font-size: .82rem; resize: vertical; min-height: 68px; }

/* Doc textarea */
.prev-doc-ta {
  width: 100%; box-sizing: border-box; min-height: 360px; resize: vertical;
  font-family: 'Courier New', monospace; font-size: .8rem; line-height: 1.7;
  color: var(--ink, #1e1b4b); border: 1.5px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: .875rem 1rem; outline: none; background: #fafaf9;
}
.prev-doc-ta:focus { border-color: var(--p, #7c3aed); box-shadow: 0 0 0 3px rgba(124,58,237,.08); }

/* Form question cards */
.prev-q-card {
  border: 1.5px solid var(--border, #e5e7eb); border-radius: 14px;
  padding: 1rem; display: flex; flex-direction: column; gap: .5rem;
}
.prev-q-num {
  font-size: .68rem; font-weight: 800; color: var(--p, #7c3aed);
  text-transform: uppercase; letter-spacing: .05em;
}
.prev-q-text { font-weight: 700; font-size: .88rem; }
.prev-q-opts { display: flex; flex-direction: column; gap: .35rem; margin-top: .2rem; }
.prev-q-opt-row { display: flex; align-items: center; gap: .5rem; }
.prev-q-opt-lbl {
  display: flex; align-items: center; gap: .3rem; cursor: pointer; flex-shrink: 0;
}
.prev-q-opt-lbl input[type="radio"] { display: none; }
.prev-q-opt-letter {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #f5f3ff; color: var(--p, #7c3aed);
  font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #ede9fe; transition: background .12s, color .12s;
  cursor: pointer;
}
.prev-q-opt-lbl:has(input[type="radio"]:checked) .prev-q-opt-letter {
  background: #7c3aed; color: #fff; border-color: #6d28d9;
}
.prev-q-opt-input { flex: 1; font-size: .82rem; }
.prev-q-hint { font-size: .68rem; color: var(--ink-4, #9ca3af); margin: .2rem 0 0; }

@media (max-width: 600px) {
  .prev-modal { border-radius: 14px; max-height: 95vh; }
  .prev-modal-head, .prev-modal-body, .prev-modal-foot { padding-inline: 1rem; }
  .prev-create-btn { font-size: .8rem; padding: .65rem 1rem; }
}

/* ── PROJECT SELECTOR ──────────────────────────────────────── */
.st-project-row {
  display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem;
}
.st-project-row .st-label { font-size: .78rem; white-space: nowrap; color: #6b7280; margin: 0; }
.st-project-row .st-select { flex: 1; font-size: .82rem; padding: .42rem .7rem; }

/* ── EXAM HEADER ───────────────────────────────────────────── */
.exam-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
  background: #fafafa;
  font-family: inherit;
}
.exam-header-logo {
  max-height: 52px; max-width: 100px;
  object-fit: contain; border-radius: 4px;
}
.exam-header-info { display: flex; flex-direction: column; gap: .18rem; }
.exam-header-school { font-weight: 700; font-size: .95rem; color: #111827; margin: 0; }
.exam-header-meta { font-size: .82rem; color: #4b5563; margin: 0; }
.exam-header-blank {
  font-size: .82rem; color: #374151;
  display: flex; flex-direction: column; gap: .35rem;
  text-align: right; white-space: nowrap;
}
.exam-header-blank span { color: #6b7280; }

/* Logo upload area */
.st-logo-upload {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.st-logo-thumb {
  max-height: 36px; max-width: 90px; object-fit: contain;
  border: 1px solid #e5e7eb; border-radius: 4px; display: block;
}

/* ── SELECTION TOOLBAR ─────────────────────────────────────── */
.sel-toolbar {
  position: fixed; z-index: 9999;
  display: flex; align-items: center; gap: .25rem;
  background: #1f2937; border-radius: 8px;
  padding: .35rem .5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transform: translateX(-50%);
  pointer-events: auto;
}
.sel-toolbar button {
  background: transparent; border: none; cursor: pointer;
  color: #f9fafb; font-size: .78rem; font-weight: 600;
  padding: .28rem .6rem; border-radius: 5px;
  transition: background .12s; white-space: nowrap;
}
.sel-toolbar button:hover { background: rgba(255,255,255,.15); }
.sel-toolbar .sel-divider {
  width: 1px; height: 16px; background: rgba(255,255,255,.2); flex-shrink: 0;
}
.sel-regen { color: #a78bfa !important; }

/* ── REGEN / EDIT MODALS ───────────────────────────────────── */
.edit-blockquote {
  font-size: .82rem; color: #374151;
  background: #f9fafb; border-left: 3px solid #7c3aed;
  padding: .5rem .75rem; border-radius: 0 4px 4px 0;
  margin: 0 0 .9rem; max-height: 100px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
