:root {
  --purple:      #6C3FC5;
  --purple-lt:   #8B5CF6;
  --gold:        #F59E0B;
  --bg:          #F5F5F5;
  --card:        #FFFFFF;
  --border:      #E5E7EB;
  --text:        #1F2937;
  --muted:       #6B7280;
  --success:     #10B981;
  --r:           14px;
  --shadow:      0 4px 24px rgba(108,63,197,.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Ccircle cx='18' cy='22' r='2' fill='%23000' opacity='0.1'/%3E%3Ccircle cx='75' cy='55' r='2' fill='%23000' opacity='0.1'/%3E%3Ccircle cx='100' cy='12' r='2' fill='%23000' opacity='0.1'/%3E%3Ccircle cx='42' cy='95' r='2' fill='%23000' opacity='0.1'/%3E%3Ccircle cx='118' cy='78' r='2' fill='%23000' opacity='0.1'/%3E%3Ccircle cx='28' cy='130' r='1.5' fill='%23000' opacity='0.08'/%3E%3Ccircle cx='90' cy='115' r='1.5' fill='%23000' opacity='0.08'/%3E%3Cpath d='M60,25 L60.7,29.3 L65,30 L60.7,30.7 L60,35 L59.3,30.7 L55,30 L59.3,29.3 Z' fill='%23000' opacity='0.1'/%3E%3Cpath d='M10,67.5 L10.6,71.4 L14.5,72 L10.6,72.6 L10,76.5 L9.4,72.6 L5.5,72 L9.4,71.4 Z' fill='%23000' opacity='0.09'/%3E%3Cpath d='M92,104 L92.6,107.4 L96,108 L92.6,108.6 L92,112 L91.4,108.6 L88,108 L91.4,107.4 Z' fill='%23000' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  color: var(--text);
  min-height: 100vh;
}

#app { max-width: 820px; margin: 0 auto; padding: 20px 16px 60px; }

/* ── Header ── */
header { padding: 32px 0 20px; position: relative; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.header-icon {
  height: 64px;
  width: auto;
  flex-shrink: 0;
}

.user-badge {
  position: absolute;
  top: 14px; right: 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: .8rem; color: var(--muted);
}
.user-badge-name { font-weight: 600; color: var(--text); }
.user-badge-logout {
  color: var(--purple); text-decoration: none; font-weight: 600;
}
.user-badge-logout:hover { text-decoration: underline; }

/* ── Login screen ── */
#login-screen {
  display: flex;
  justify-content: center;
  padding: 80px 20px;
  align-items: center;
  min-height: calc(100vh - 140px);
  background: var(--bg);
  position: relative;
  z-index: 10;
}
.login-box {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 40px 28px;
  max-width: 420px; width: 100%;
  text-align: center;
}
.login-logo {
  margin-bottom: 24px;
}
.login-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}
.login-box .btn-generate { margin-top: 18px; }
.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-title {
  font-size: 2rem;
  font-weight: 800;
  color: #2C2C2C;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.header-tagline {
  font-size: 0.875rem;
  color: #666666;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ── Wizard card ── */
#wizard {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}

/* ── Progress dots ── */
.wizard-progress { margin-bottom: 40px; }

.step-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  color: var(--muted);
  transition: all .25s;
  flex-shrink: 0;
}
.dot.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.dot.done   { background: var(--success); border-color: var(--success); color: #fff; }

.connector {
  flex: 1; max-width: 60px; height: 2px;
  background: var(--border);
  transition: background .25s;
}
.connector.done { background: var(--success); }

.step-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── Steps ── */
.step { display: none; animation: fadeUp .3s ease; }
.step.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step h2     { font-size: 1.65rem; font-weight: 700; margin-bottom: 6px; }
.step-sub    { color: var(--muted); margin-bottom: 28px; }

/* ── Bienvenida step-1 ── */
.welcome-block {
  text-align: center;
  margin-bottom: 28px;
}
.welcome-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--purple);
  margin: 0 0 6px;
  line-height: 1.2;
}
.welcome-sub {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 8px;
}
.welcome-hint {
  font-size: .8rem;
  color: var(--muted);
  opacity: .75;
  margin: 0;
}

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}

/* ── Style-card previews ── */
/* Para reactivar naive_crayon: quitar esta regla */
.style-card:has([value="naive_crayon"])   { display: none !important; }
/* Para reactivar collage_ultra: quitar esta regla */
.style-card:has([value="collage_ultra"])  { display: none !important; }
#style-screen .card-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.style-card .card-body {
  padding: 0;
  gap: 0;
}
.style-preview {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
.style-preview img  { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-preview svg  { width: 100%; height: 100%; display: block; }
.style-card .card-body strong { margin: 12px 0 4px; font-size: 1rem; font-weight: 700; }
.style-card .card-body span   { margin: 0 12px 14px; font-size: .8rem; }

/* Tez skin-tone picker */
.tez-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.tez-btn { cursor: pointer; }
.tez-btn input[type="radio"] { display: none; }
.tez-circle {
  display: block;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.10);
  transition: box-shadow .18s, transform .18s;
}
.tez-btn:hover .tez-circle { transform: scale(1.12); box-shadow: 0 0 0 2px rgba(108,63,197,.4); }
.tez-btn input:checked + .tez-circle { box-shadow: 0 0 0 3px var(--purple); transform: scale(1.12); }

/* ── FIX 2: Selector de género ── */
.genero-selector {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
.genero-btn {
  flex: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  transition: all 0.2s ease;
}
.genero-btn:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 63, 197, 0.15);
}
.genero-btn input[type="radio"] {
  display: none;
}
.genero-btn input:checked + .genero-label {
  color: var(--purple);
  font-weight: 600;
}
.genero-btn:has(input:checked) {
  border-color: var(--purple);
  background: rgba(108, 63, 197, 0.05);
  box-shadow: 0 0 0 3px rgba(108, 63, 197, 0.1);
}
.genero-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s ease;
  user-select: none;
}

.card-body.swatch-row {
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.swatch-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Subtítulo sección apariencia ── */
.apariencia-subtitle {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-bottom: 18px;
}

/* ── Card destacada para subir foto del niño ── */
.photo-upload-card {
  background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 24px;
  transition: border-color .2s, background .2s;
}
.photo-upload-card:hover {
  border-color: var(--purple);
  background: linear-gradient(135deg, #f0f2ff 0%, #fff 100%);
}
.photo-upload-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
}
.photo-upload-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.photo-upload-desc {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}
.photo-upload-card .s2-foto-preview-wrap {
  margin-top: 18px;
  justify-content: center;
}
.photo-upload-card .s2-foto-thumb {
  width: 80px;
  height: 80px;
}

/* ── Payment form ── */
.payment-form {
  max-width: 560px;
  margin: 0 auto;
}
.payment-form input[type="text"],
.payment-form input[type="tel"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.payment-form input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.1);
}
.tapa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.tapa-card {
  cursor: pointer;
  display: block;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all .2s;
  background: #fff;
}
.tapa-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 12px rgba(108,63,197,.12);
}
.tapa-card input[type="radio"] {
  display: none;
}
.tapa-card input:checked + .tapa-card-body {
  color: var(--purple);
}
.tapa-card input:checked ~ .tapa-card-body::before {
  content: '✓ ';
  font-weight: 700;
}
.tapa-card:has(input:checked) {
  border-color: var(--purple);
  background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
  box-shadow: 0 4px 12px rgba(108,63,197,.18);
}
.tapa-card-body {
  text-align: center;
}
.tapa-card-body strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.tapa-desc {
  font-size: .88rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.tapa-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--purple);
}

/* ── Labels en mayúscula ── */
label.label-caps {
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .06em;
  font-weight: 700;
}
.label-opt {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* ── Color circle picker (cabello y ojos) ── */
.color-picker-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.color-btn {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.color-btn input[type="radio"] { display: none; }
.color-circle {
  display: block;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.10);
  transition: box-shadow .18s, transform .18s;
}
.color-btn:hover .color-circle { transform: scale(1.1); box-shadow: 0 0 0 2px rgba(108,63,197,.4); }
.color-btn input:checked + .color-circle { box-shadow: 0 0 0 3px var(--purple); transform: scale(1.1); }
.color-btn-label {
  font-size: .72rem;
  color: var(--muted);
  text-align: center;
}

/* ── Step-2 compact foto ── */
.s2-foto-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.s2-foto-preview-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.s2-foto-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.btn-s2-foto-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  padding: 0 2px;
}
.btn-s2-foto-remove:hover { color: var(--text); }
.btn.btn-sm {
  padding: 7px 14px;
  font-size: .85rem;
}

/* ── Peinado chips ── */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text);
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1.4;
}
.chip:hover { border-color: var(--purple-lt); }
.chip.selected {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
}
.flequillo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.flequillo-label {
  font-size: .875rem;
  color: var(--text);
  white-space: nowrap;
}

.card { cursor: pointer; }
.card input[type="radio"] { display: none; }

.card-body {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 12px;
  border: 2px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  text-align: center;
  gap: 6px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.card:hover .card-body             { border-color: var(--purple-lt); box-shadow: 0 0 0 3px rgba(108,63,197,.1); }
.card input:checked + .card-body   { border-color: var(--purple); background: #F5F0FF; box-shadow: 0 0 0 3px rgba(108,63,197,.15); }

.ci   { font-size: 2rem; line-height: 1; }
.card-body strong { font-size: .875rem; color: var(--text); }
.card-body span   { font-size: .75rem; color: var(--muted); line-height: 1.3; }

/* ── Forms ── */
.form-group       { margin-bottom: 24px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; }

.form-group input[type="text"],
.form-group textarea {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: 1rem; font-family: inherit; color: var(--text);
  background: #fff; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,63,197,.1); }
.form-group textarea { resize: vertical; }

.char-count { display: block; text-align: right; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.hint       { font-size: .875rem; color: var(--muted); font-style: italic; margin-top: 10px; }

/* ── Nav ── */
.wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn {
  padding: 12px 28px; border-radius: 10px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit;
  transition: all .18s ease;
}
.btn-primary   { background: var(--purple); color: #fff; }
.btn-primary:hover   { background: var(--purple-lt); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text); border: 2px solid var(--border); }
.btn-secondary:hover { border-color: var(--purple); color: var(--purple); }
.btn-generate  {
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  color: #fff; padding: 14px 36px; font-size: 1.05rem;
  box-shadow: 0 6px 20px rgba(108,63,197,.3);
  text-decoration: none; display: inline-block;
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(108,63,197,.4); }

.hidden { display: none !important; }

/* ── Screens (loading / success / error) ── */
.screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 60px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
  text-align: center;
}

/* Book animation */
.book-anim {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 4px; height: 90px; margin-bottom: 32px;
}
.page {
  width: 36px; border-radius: 3px 10px 10px 3px;
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  transform-origin: left bottom;
  animation: flip 1.8s ease-in-out infinite;
}
.p1 { height: 80px; animation-delay: 0s; opacity: .7; }
.p2 { height: 88px; animation-delay: .25s; opacity: .85; }
.p3 { height: 80px; animation-delay: .5s; opacity: .7; }

@keyframes flip {
  0%, 100% { transform: rotateY(0deg) scaleX(1); }
  50%       { transform: rotateY(-40deg) scaleX(.6); }
}

.screen h2    { font-size: 1.7rem; font-weight: 700; margin-bottom: 10px; }
.screen p     { color: var(--muted); margin-bottom: 24px; font-size: 1rem; }
.screen .btn  { margin: 8px; }

#load-msg { min-height: 1.4em; }

.progress-wrap {
  width: 100%; max-width: 420px; margin: 0 auto 10px;
  height: 8px; background: var(--border); border-radius: 100px; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  border-radius: 100px;
  transition: width .5s ease;
}
.pct       { font-weight: 700; color: var(--purple); font-size: 1.1rem; margin-bottom: 16px; }
.load-note { font-size: .85rem; color: var(--muted); font-style: italic; }
.load-mobile-notice {
  margin-top: 14px;
  padding: 10px 14px;
  background: #FEF3C7;
  border: 1.5px solid #FCD34D;
  border-radius: 10px;
  color: #92400E;
  font-style: normal;
  font-weight: 600;
}

/* ── Cover preview screen ── */
#cover-preview-screen {
  text-align: center;
}
#cover-preview-title {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.cover-preview-container {
  max-width: 500px;
  margin: 0 auto 32px;
  padding: 24px;
  background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(108, 63, 197, 0.12);
}
.cover-preview-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.big-icon  { font-size: 4rem; margin-bottom: 16px; }

/* Shake validation */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.shake { animation: shake .4s ease; }

/* ── Preview screen ── */
.preview-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.preview-screen h2    { font-size: 1.65rem; font-weight: 700; margin-bottom: 6px; }
.preview-screen .step-sub { margin-bottom: 28px; }

.preview-label {
  display: block;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.preview-title-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: inherit;
  color: #1E1048;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  margin-bottom: 28px;
}
.preview-title-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,63,197,.1); }

.preview-page-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: #FAFAFA;
  transition: border-color .18s;
}
.preview-page-card:hover { border-color: #D1D5DB; }
.preview-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.preview-page-num {
  font-size: .7rem;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.preview-page-text { font-size: .95rem; line-height: 1.65; color: var(--text); margin: 0; }
.preview-page-textarea {
  width: 100%; min-height: 72px;
  padding: 10px 12px;
  font-size: .95rem; line-height: 1.65;
  font-family: inherit; color: var(--text);
  border: 2px solid var(--purple);
  border-radius: 8px; resize: vertical; outline: none;
}
.btn-edit {
  padding: 5px 13px; font-size: .8rem; font-weight: 600;
  border-radius: 6px; border: 1.5px solid var(--border);
  background: white; cursor: pointer; color: var(--muted);
  font-family: inherit; transition: all .18s; flex-shrink: 0;
}
.btn-edit:hover { border-color: var(--purple-lt); color: var(--purple); }
.btn-edit.editing { background: var(--purple); color: white; border-color: var(--purple); }

.preview-approve-btn {
  width: 100%; margin-top: 32px;
  padding: 18px; font-size: 1.05rem;
  border-radius: 12px; display: block;
}

/* ── Chips (Step 3 optional selectors) ── */
.chip-section { margin-bottom: 28px; }
.chip-label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  font-size: .9rem;
}
.chip-optional { font-weight: 400; color: var(--muted); font-size: .8rem; }
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  transition: all .18s ease;
  display: flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--purple-lt); color: var(--purple); }
.chip.selected { background: var(--purple); border-color: var(--purple); color: white; }
.chip-text-input {
  width: 100%; margin-top: 10px;
  padding: 10px 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: .9rem; font-family: inherit; color: var(--text);
  background: #fff; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.chip-text-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,63,197,.1); }

/* ── Story build stage progress (options screen) ── */
.story-build-progress { margin-bottom: 32px; }
.sbp-dots {
  display: flex; align-items: center; justify-content: center;
}
.sbp-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--muted);
  transition: all .25s; flex-shrink: 0;
}
.sbp-dot.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.sbp-dot.done   { background: var(--success); border-color: var(--success); color: #fff; }
.sbp-connector {
  flex: 1; max-width: 80px; height: 2px;
  background: var(--border); transition: background .25s;
}
.sbp-connector.done { background: var(--success); }
.sbp-labels {
  display: flex; justify-content: space-between;
  margin-top: 8px; font-size: .72rem; color: var(--muted); font-weight: 500;
}

/* ── Options screen (story builder) ── */
#options-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
#options-screen h2 { font-size: 1.65rem; font-weight: 700; margin-bottom: 6px; }
#options-screen > p { color: var(--muted); margin-bottom: 28px; }

.options-grid { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }

.option-card {
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
  cursor: pointer;
  background: white;
  transition: border-color .18s, box-shadow .18s, background .18s;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.option-card:hover { border-color: var(--purple-lt); box-shadow: 0 0 0 3px rgba(108,63,197,.08); }
.option-card.selected { border-color: var(--purple); background: #F5F0FF; box-shadow: 0 0 0 3px rgba(108,63,197,.12); }

.option-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--border); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
  transition: background .18s, color .18s;
}
.option-card.selected .option-num { background: var(--purple); color: white; }

.option-body { flex: 1; }
.option-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; color: var(--text); }
.option-desc  { font-size: .875rem; color: var(--muted); line-height: 1.6; }
.option-text  { font-size: .925rem; color: var(--text); line-height: 1.7; }

.options-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 20px; border-top: 1px solid var(--border);
}

/* ── Style screen (post-preview) ── */
#style-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
#style-screen h2 { font-size: 1.65rem; font-weight: 700; margin-bottom: 6px; }
#style-screen .step-sub { margin-bottom: 28px; }
.style-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── Preview action buttons ── */
.preview-actions {
  display: flex; gap: 14px; margin-top: 32px;
}
.preview-actions .btn { flex: 1; padding: 16px; font-size: 1rem; text-align: center; }

/* ── Wizard validation error ── */
.wizard-error {
  color: #DC2626;
  font-size: .875rem;
  font-weight: 600;
  text-align: center;
  padding: 10px 16px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  margin-top: 16px;
}

/* ── Landing screen ── */
#landing-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 52px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
  text-align: center;
}
#landing-screen h2     { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }
#landing-screen .step-sub { margin-bottom: 36px; }

.landing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  border: 2px solid var(--border);
  border-radius: var(--r);
  background: white;
  cursor: pointer;
  font-family: inherit;
  transition: all .22s ease;
  text-align: center;
}
.landing-card:hover {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.12), var(--shadow);
  transform: translateY(-3px);
}
.landing-icon { font-size: 3rem; line-height: 1; }
.landing-card strong { font-size: 1.1rem; color: var(--text); display: block; }
.landing-card span   { font-size: .85rem; color: var(--muted); line-height: 1.4; display: block; }

/* ── Non-fiction wizard (reuses #wizard card styles) ── */
#nonfiction-wizard {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}

/* ── Illustrated pages grid (success screen) ── */
.illustrated-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 28px 0 12px;
  text-align: left;
}

.ill-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #FAFAFA;
  transition: border-color .18s;
}
.ill-card:has(.ill-regen-form:not(.hidden)) { border-color: var(--purple-lt); }

.ill-card-header {
  padding: 8px 12px 4px;
  font-size: .68rem; font-weight: 700;
  color: var(--purple); text-transform: uppercase; letter-spacing: .06em;
}

/* Layout de pares texto+imagen */
.ill-card-content {
  display: flex;
  flex-direction: row;
  gap: 16px;
  padding: 0;
}

/* Páginas solo-imagen (sin texto) */
.ill-card-content-image-only {
  flex-direction: column;
  gap: 0;
}

.ill-card-content-image-only .ill-image-col {
  flex: 1;
  max-width: 100%;
}

.ill-text-col {
  flex: 1;
  padding: 16px;
  display: flex;
  align-items: center;
  background: white;
}

.ill-page-text {
  font-size: .95rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
  font-family: 'Georgia', 'Palatino', serif;
}

.ill-image-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ill-img-wrap {
  position: relative;
  width: 100%; aspect-ratio: 1;
  background: var(--border);
}

/* Contenedor landscape para imágenes 1 y 11 (16:9) */
.ill-img-wrap-landscape {
  aspect-ratio: 16/9;
}

/* Mobile: texto arriba, imagen abajo */
@media (max-width: 768px) {
  .ill-card-content {
    flex-direction: column;
    gap: 0;
  }

  .ill-text-col {
    padding: 12px;
  }

  .ill-page-text {
    font-size: .88rem;
    line-height: 1.55;
  }
}
.ill-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: opacity .25s;
}
.ill-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--muted); background: #F3F4F6;
}

/* Placeholder con blur para imágenes no generadas (preview) */
.ill-img-wrap-locked {
  background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
}

.ill-placeholder-locked {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.7);
}

.ill-lock-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  opacity: 0.4;
}

.ill-lock-text {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.ill-loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  font-size: .78rem; color: var(--muted); font-weight: 600;
}
.ill-spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ill-card-actions { padding: 8px 12px 4px; }
.btn-regen-open {
  width: 100%; padding: 7px 12px;
  font-size: .78rem; font-weight: 600;
  border-radius: 7px; border: 1.5px solid var(--border);
  background: white; cursor: pointer;
  color: var(--muted); font-family: inherit;
  transition: all .18s;
}
.btn-regen-open:hover { border-color: var(--purple-lt); color: var(--purple); }

.ill-regen-form { padding: 4px 12px 12px; }
.ill-regen-input {
  width: 100%; padding: 8px 11px;
  border: 2px solid var(--border); border-radius: 8px;
  font-size: .82rem; font-family: inherit; color: var(--text);
  background: white; outline: none;
  transition: border-color .18s;
  margin-bottom: 8px;
}
.ill-regen-input:focus { border-color: var(--purple); }

.ill-regen-btns { display: flex; gap: 7px; }
.btn-regen-cancel {
  flex: 1; padding: 7px;
  font-size: .78rem; font-weight: 600;
  border-radius: 7px; border: 1.5px solid var(--border);
  background: white; cursor: pointer;
  color: var(--muted); font-family: inherit; transition: all .18s;
}
.btn-regen-cancel:hover { border-color: #9CA3AF; }
.btn-regen-confirm {
  flex: 2; padding: 7px;
  font-size: .78rem; font-weight: 600;
  border-radius: 7px; border: none;
  background: var(--purple); color: white;
  cursor: pointer; font-family: inherit; transition: background .18s;
}
.btn-regen-confirm:hover:not(:disabled) { background: var(--purple-lt); }
.btn-regen-confirm:disabled { opacity: .55; cursor: not-allowed; }

.ill-regen-error {
  font-size: .75rem; color: #DC2626;
  margin-top: 6px; line-height: 1.4;
}

/* ── Regen info block ── */
#regen-info {
  width: 100%; margin: 0 0 18px;
  background: #F5F3FF; border: 1.5px solid #DDD6FE;
  border-radius: 12px; padding: 14px 16px;
  text-align: left;
}
#regen-counter-text {
  font-size: .85rem; color: var(--text); margin: 0 0 10px;
}
#regen-counter-text strong { color: var(--purple); }
.regen-tips { display: flex; flex-direction: column; gap: 3px; }
.regen-tip {
  font-size: .78rem; color: var(--muted); margin: 0;
}
.regen-tip-example {
  font-size: .76rem; color: var(--purple);
  font-style: italic; margin: 0 0 0 12px;
}

/* ── Portada radio inside ill-card ── */
.ill-portada-label {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 2px;
  font-size: .75rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  transition: color .15s;
}
.ill-portada-label:has(.ill-portada-radio:checked) { color: #D97706; }
.ill-portada-radio { accent-color: #D97706; cursor: pointer; }

/* ── Visual detail field (preview page cards) ── */
.detail-wrap {
  margin-top: 10px;
  border-top: 1px dashed #E5E7EB;
  padding-top: 10px;
}
.detail-label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.detail-textarea {
  width: 100%;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: .82rem;
  color: var(--text);
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
  box-sizing: border-box;
  background: #FAFBFF;
}
.detail-textarea:focus { outline: none; border-color: var(--purple); }

.field-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Story idea step — field + tips side by side ── */
.story-idea-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: start;
}

.story-tips {
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: 12px;
  padding: 14px 16px;
}

.story-tips-title {
  font-weight: 700;
  font-size: .9rem;
  color: #92400E;
  margin-bottom: 10px;
}

.story-tips ul {
  margin: 0;
  padding-left: 14px;
}

.story-tips li {
  font-size: .78rem;
  color: #78350F;
  line-height: 1.5;
  margin-bottom: 8px;
}

.story-tips li:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  .story-idea-layout { grid-template-columns: 1fr; }
}

/* ── Market selection screen ── */
#market-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 48px 44px 52px;
  box-shadow: var(--shadow);
  margin-top: 24px;
  text-align: center;
}
.market-title { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }

.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 32px;
}
@media (max-width: 540px) { .market-grid { grid-template-columns: 1fr; } }

.market-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: 32px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  font-family: inherit;
  text-align: center;
}
.market-card:hover  { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(108,63,197,.1); transform: translateY(-2px); }
.market-card:active { transform: translateY(0); }
.market-flag  { font-size: 2.8rem; line-height: 1; }
.market-card strong { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.market-card span   { font-size: .82rem; color: var(--muted); line-height: 1.4; }

/* ── Photo upload ── */
.foto-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--r);
  padding: 32px 24px;
  text-align: center;
  background: #FAFBFF;
  margin-bottom: 12px;
}
.foto-placeholder .foto-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.foto-placeholder p           { font-size: .95rem; font-weight: 600; margin-bottom: 14px; }
.foto-preview-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.foto-preview-wrap img {
  width: 160px; height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.preview-dedication-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  margin-top: 4px;
  display: block;
}
.preview-dedication-textarea:focus { outline: none; border-color: var(--purple); }

/* ── Back cover box (preview screen) ── */
.backcover-box {
  border: 2px dashed #D1D5DB; border-radius: 14px;
  padding: 20px; margin: 2rem 0 1rem;
  background: #FAFAFA;
}
.backcover-header {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.backcover-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.backcover-header strong { display: block; font-size: .95rem; color: var(--text); margin-bottom: 2px; }
.backcover-header p { font-size: .8rem; color: var(--muted); margin: 0; }
.backcover-textarea {
  width: 100%; border: 1px solid #E5E7EB; border-radius: 8px;
  padding: 10px 12px; font-size: .9rem; color: var(--text);
  resize: vertical; font-family: inherit; line-height: 1.5;
  box-sizing: border-box;
}
.backcover-textarea:focus { outline: none; border-color: var(--purple); }

/* ── Cover screen ── */
.cover-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px; margin-bottom: .5rem;
}
.cover-img-option {
  cursor: pointer; border-radius: 10px; overflow: hidden;
  border: 3px solid #E5E7EB; transition: border-color .15s;
  display: flex; flex-direction: column;
}
.cover-img-option input[type="radio"] { display: none; }
.cover-img-option:has(input:checked) { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,63,197,.18); }
.cover-img-option img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.cover-img-option span {
  display: block; text-align: center; font-size: .72rem;
  color: var(--muted); padding: 4px 0 5px; background: white;
}

/* ── Spellcheck screen ── */
.spellcheck-none {
  text-align: center; padding: 2rem; font-size: 1.1rem;
  color: #059669; background: #ECFDF5; border-radius: 12px;
  border: 1px solid #A7F3D0; margin-bottom: 1rem;
}
.spellcheck-card {
  border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 14px; background: #fff;
}
.spellcheck-page-num {
  font-size: .75rem; font-weight: 600; color: var(--purple);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.spellcheck-original {
  font-size: .9rem; color: #6B7280; text-decoration: line-through;
  background: #FEF2F2; border-radius: 6px; padding: 8px 12px;
}
.spellcheck-arrow {
  font-size: .75rem; color: var(--muted); text-align: center;
  margin: 6px 0; font-weight: 600;
}
.spellcheck-corrected {
  font-size: .9rem; color: #1F2937;
  background: #F0FDF4; border-radius: 6px; padding: 8px 12px;
  border: 1px solid #BBF7D0;
}

/* ── Modal portada ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.75rem 1.5rem;
  max-width: 360px; width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-icon { font-size: 2rem; margin: 0 0 .5rem; }
.modal-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 .5rem; color: #1a1a2e; }
.modal-body  { font-size: .9rem; color: #555; margin: 0 0 1.5rem; line-height: 1.5; }
.modal-actions { display: flex; flex-direction: column; gap: .6rem; }

/* ── Print order section ── */
#print-order-section {
  margin: 24px auto 0;
  max-width: 480px;
}
.btn-print-order {
  width: 100%;
  padding: 18px 32px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 14px;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, .3);
  transition: transform .18s, box-shadow .18s;
  margin-bottom: 18px;
  display: block;
}
.btn-print-order:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(16, 185, 129, .4);
}
.pricing-box {
  background: #fff;
  border: 1.5px solid #E5E7EB;
  border-radius: 14px;
  padding: 20px 24px;
  text-align: left;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}
.pricing-row {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding: 7px 0;
  border-bottom: 1px solid #F3F4F6;
}
.pricing-row:last-of-type { border-bottom: none; }
.pricing-shipping { font-weight: 500; color: var(--muted); }
.pricing-note {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 0;
}

/* ── Order form ── */
#order-form-wrap {
  margin: 20px auto 0;
  max-width: 480px;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px 24px;
}
.order-form-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  text-align: center;
}
.order-field {
  margin-bottom: 14px;
}
.order-field input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: #FAFBFF;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
}
.order-field input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 63, 197, .1);
  background: #fff;
}
.order-field-row {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 10px;
}
.order-field-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.order-field-equal input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: #FAFBFF;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
}
.order-field-equal input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 63, 197, .1);
  background: #fff;
}
.order-submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  font-size: 1rem;
  border-radius: 12px;
}
.order-submit-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Order loading message ── */
.order-loading-msg {
  margin: 16px auto 0;
  max-width: 480px;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: .95rem;
  font-weight: 600;
  color: #1D4ED8;
  text-align: center;
  line-height: 1.5;
}

/* ── Order success message ── */
.order-success-msg {
  margin: 24px auto;
  max-width: 480px;
  background: #ECFDF5;
  border: 1.5px solid #A7F3D0;
  border-radius: 14px;
  padding: 24px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #059669;
  text-align: center;
  line-height: 1.5;
}

/* ── Adventure option cards ── */
.adventure-card {
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
  background: white;
  transition: border-color .18s, box-shadow .18s;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.adventure-card:hover {
  border-color: var(--purple-lt);
  box-shadow: 0 0 0 3px rgba(108,63,197,.08);
}
.adventure-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
  margin: 0;
}
.adventure-card-text {
  font-size: .95rem;
  color: var(--text);
  line-height: 1.75;
  font-style: italic;
  margin: 0;
}
.btn-adventure-pick {
  align-self: flex-end;
  padding: 10px 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  color: white;
  font-size: .875rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 12px rgba(108,63,197,.25);
}
.btn-adventure-pick:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(108,63,197,.35);
}

/* ── Secondary characters, jarvis & adventure screens ── */
#secondary-chars-screen,
#jarvis-screen,
#jarvis-screen-animal,
#adventure-options-screen {
  background: var(--card);
  border-radius: var(--r);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
#secondary-chars-screen h2,
#jarvis-screen h2,
#jarvis-screen-animal h2,
#adventure-options-screen h2 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ── Cambiar mercado button — hidden; remove display:none below to reactivate ── */
.cambiar-mercado { display: none; }

/* ── Jarvis help button (step 4) ── */
.btn-jarvis-help {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px 20px;
  background: white;
  border: 2px dashed var(--purple-lt);
  border-radius: var(--r);
  color: var(--purple);
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.btn-jarvis-help:hover {
  background: rgba(108,63,197,.05);
  border-color: var(--purple);
}

/* ── Adventure hint box ── */
.adventure-hint-box {
  margin-top: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.adventure-hint-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 14px 18px;
  text-align: left;
  font-size: .9rem;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.adventure-hint-toggle:hover {
  background: rgba(108,63,197,.05);
}
.adventure-hint-body {
  padding: 0 18px 16px;
  border-top: 1.5px solid var(--border);
}
.adventure-hint-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  margin-top: 12px;
  box-sizing: border-box;
  transition: border-color .18s;
}
.adventure-hint-textarea:focus {
  outline: none;
  border-color: var(--purple-lt);
}
.sec-char-field {
  margin-bottom: 20px;
}
.sec-char-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.sec-char-checkbox-field {
  margin-bottom: 12px;
}
.sec-char-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .18s;
}
.sec-char-checkbox-label:hover {
  border-color: var(--purple-lt);
  background: rgba(108,63,197,.03);
}
.sec-char-checkbox {
  width: 18px; height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.sec-char-checkbox:checked + span {
  color: var(--purple);
  font-weight: 600;
}
.sec-char-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.sec-char-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.1);
}

/* ── Secondary characters structured form (reutiliza estilos del wizard) ── */
.sec-char-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  padding-bottom: 32px;
  background: #fff;
  transition: border-color 0.2s;
  position: relative;
}
.sec-char-card::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 0;
  right: 0;
  height: 0;
  border-bottom: 2px dotted #D1D5DB;
}
.sec-char-card:last-child::after {
  display: none;
}
/* Validación: rojo solo en el componente específico que falta completar */
.genero-selector.incomplete {
  border: 2px solid #DC2626;
  border-radius: 12px;
  padding: 8px;
  margin: -8px;
}
.sec-char-pet-input.incomplete {
  border-color: #DC2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}
.sec-char-card-name {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  color: var(--text) !important;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: inherit;
}
/* Campo de mascota (siempre visible, disabled por defecto) */
.sec-char-pet-field {
  /* Usa estilos de .form-group, sin necesidad de override */
}
.sec-char-pet-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.sec-char-pet-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.1);
}
.sec-char-pet-input:disabled {
  background: #F5F5F5;
  color: #9CA3AF;
  cursor: not-allowed;
  border-color: #E5E7EB;
}
/* Input de edad */
.sec-char-edad-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.sec-char-edad-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.1);
}
.sec-char-edad-input:disabled {
  background: #F5F5F5;
  color: #9CA3AF;
  cursor: not-allowed;
  border-color: #E5E7EB;
}
/* Grids para organizar campos (reutilizan estilos de form-group) */
.sec-char-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}
.sec-char-row-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #wizard, #nonfiction-wizard, #secondary-chars-screen, #jarvis-screen, #jarvis-screen-animal, #adventure-options-screen, .screen { padding: 24px 18px; }
  #landing-screen { padding: 36px 18px; }
  .landing-grid      { grid-template-columns: 1fr; }
  .card-grid         { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-4  { grid-template-columns: repeat(2, 1fr); }
  .step h2           { font-size: 1.35rem; }
  .step-labels       { font-size: .65rem; }
  .illustrated-grid  { grid-template-columns: 1fr; }
  #order-form-wrap   { padding: 20px 16px; }
  .order-field-row   { grid-template-columns: 1fr 80px; }
  .order-field-equal { grid-template-columns: 1fr; }
  .vidriera-image    { max-width: 100%; }
}

/* ── FIX 1: Vidriera Screen ────────────────────────────────────────────── */
#vidriera-screen {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

#vidriera-screen h2 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--text);
}

#vidriera-screen .step-sub {
  color: var(--muted);
  margin-bottom: 32px;
}

.vidriera-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.loading-hint {
  font-size: 0.9rem;
  color: var(--muted);
}

.vidriera-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.vidriera-image-container {
  width: 100%;
  max-width: 500px;
  background: var(--card);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow);
}

.vidriera-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.vidriera-error {
  padding: 40px 20px;
  text-align: center;
}

#btn-continue-to-story,
#btn-skip-vidriera {
  min-width: 200px;
}


/* ══════════════════════════════════════════════════════════════════
   Story sections (unified step 5)
   ══════════════════════════════════════════════════════════════════ */

/* Tarjetas de sección del cuento - con fondos de color suave diferenciados */
.story-section {
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 2px solid var(--border);
  transition: all .2s ease;
}

.story-section-details {
  background: #FEF3E2; /* Beige/melocotón suave */
}

.story-section-textarea {
  background: #F3E8FF; /* Violeta muy suave */
}

.story-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.story-section-subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text);
  opacity: 0.75;
  margin: 0 0 16px 0;
}

/* Una sola columna para los 4 campos de detalles */
.story-details-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-detail-field {
  display: flex;
  flex-direction: column;
}

.story-detail-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.story-detail-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  transition: border-color .2s ease;
}

.story-detail-field input:focus {
  outline: none;
  border-color: var(--purple);
}

/* Textarea protagonista con borde violeta */
.story-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--purple);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.6;
  background: white;
  resize: vertical;
  min-height: 140px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.story-textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,63,197,.12);
}

/* Footer hint */
.story-footer-hint {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 0 0;
  font-style: italic;
}

/* Estados de validación — solo error, no success */
.story-section.validation-error {
  border-color: var(--red);
}
