/* Shared interaction states: actionable, focused, pressed, selected, disabled. */
.chapter-v5 button:not(:disabled):focus-visible,
.chapter-v5 a:focus-visible,
.chapter-v5 summary:focus-visible,
.chapter-v5 select:focus-visible {
  outline: 3px solid var(--cream) !important; outline-offset: 4px;
}
.chapter-v5 button:not(:disabled):active {
  transform: translateY(1px); filter: brightness(.94) !important;
}
.chapter-v5 button:disabled {
  cursor: not-allowed; opacity: .55;
  transform: none !important; filter: none !important;
  box-shadow: none !important;
}
.chapter-v5 .choices button:disabled {
  border-image-source: var(--frame-sm) !important;
}
#panel .setup-intro { max-width: 65ch; margin: 0 0 24px; }
#panel .setup-mode-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
#panel .mode-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  min-height: 132px; min-width: 0; padding: 12px 16px !important;
  color: var(--paper); text-align: left; line-height: 1.4;
  border: 10px solid transparent !important;
  border-image: var(--frame-sm) 18 fill / 18px / 0 stretch !important;
  border-radius: 0; background: none !important;
  transition: filter 160ms ease-out, transform 160ms ease-out;
}
#panel .mode-choice strong { font-size: 19px; font-weight: 700; }
#panel .mode-choice span { font-size: 15px; color: #d7c9d5; }
#panel .mode-choice:not(:disabled):hover {
  border-image-source: var(--frame-focus) !important;
  filter: drop-shadow(0 0 8px #b9a6ff55);
}
#panel .mode-choice[aria-pressed=true] {
  border-image-source: var(--frame-gold) !important; color: #2a2131;
}
#panel .mode-choice[aria-pressed=true] span { color: #3f3044; }
#panel .mode-choice[aria-pressed=true]::after { content: '✓ Seleccionado'; font-size: 14px; font-weight: 700; }
#panel .setup-mode-detail { min-height: 126px; padding: 20px 0; border-block: 1px solid #967552; }
#panel .setup-mode-detail h3, #panel .setup-recommended h3 { margin: 0 0 10px; font-size: 22px; color: var(--cream); }
#panel .setup-mode-detail p { margin: 0; max-width: 65ch; }
#panel .setup-note { color: #d0becf; font-size: 15px; max-width: 65ch; margin-top: 18px; }
#panel .panel-bottom { align-items: center; gap: 12px; flex-wrap: wrap; }
#panel .setup-confirm { justify-content: flex-end; margin: 0; margin-left: auto; }
#panel #panel-actions[hidden], #panel #panel-actions button[hidden] { display: none !important; }
#panel-content { flex: 1 1 auto; }
#panel .setup-confirm button { min-height: 48px; }
#panel .setup-recommended { margin: 24px 0; }
#panel .setup-preset { border-top: 1px solid #967552; padding-top: 10px; }
#panel .setup-preset summary { min-height: 48px; padding: 10px 0; cursor: pointer; color: var(--cream); }
#panel .setup-preset p, #panel .setup-preset ul { max-width: 65ch; }
.chapter-origin { margin: 0 0 20px; color: #e8d2ab; font-size: 16px; line-height: 1.55; max-width: 65ch; }
.chapter-selector .chapter-play-actions button {
  border: 10px solid transparent !important;
  border-image: var(--frame-sm) 18 fill / 18px / 0 stretch !important;
  background: none !important; border-radius: 0; padding: 6px 16px !important;
}
.chapter-selector .chapter-play-actions button.primary {
  border-image-source: var(--frame-gold) !important; color: #25172b !important;
}
.chapter-selector .chapter-play-actions button:not(:disabled):hover {
  filter: drop-shadow(0 0 8px #b9a6ff66);
}
.chapter-selector .chapter-choice:not(:disabled):hover { border-color: var(--gem); }
.chapter-selector .chapter-choice[aria-pressed=true]:hover { border-color: var(--cream); }
@media (max-width: 760px) {
  #panel .setup-mode-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #panel .mode-choice { min-height: 104px; }
  #panel .setup-mode-detail { min-height: 0; }
  #panel .setup-confirm { width: 100%; }
  #panel .setup-confirm button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #panel .mode-choice { transition: none; }
  .chapter-v5 button:not(:disabled):active { transform: none; }
}

/* Welcome: Elena introduces the experience; options remain native and reversible. */
#panel[data-setup=welcome] { width: min(1180px, 94vw); }
.welcome-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
.welcome-guide { align-self: start; padding: 12px 16px; background: radial-gradient(ellipse at 50% 20%, #b69a6026, transparent 70%); }
.welcome-guide img { display: block; width: 180px; height: 180px; object-fit: contain; margin: 0 auto 16px; }
.welcome-message h3 { color: var(--cream); font-family: var(--serif-display); font-size: 25px; line-height: 1.25; margin: 10px 0; }
.welcome-message p { margin: 0; line-height: 1.6; }
.welcome-message .eyebrow { font-size: 12px; letter-spacing: .06em; }
.welcome-options { min-width: 0; }
#panel .welcome-group { min-width: 0; margin: 0 0 18px; padding: 12px 18px 16px; border: 1px solid #96755280; }
.welcome-group legend { padding: 0 8px; color: var(--cream); font-size: 18px; font-weight: 700; }
.welcome-toggle { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 0; cursor: pointer; }
.welcome-toggle + .welcome-toggle { border-top: 1px solid #96755240; }
.welcome-toggle-copy { min-width: 0; }
.welcome-toggle-copy strong { display: block; font-size: 18px; }
.welcome-toggle-copy small { display: block; color: #d0becf; font-size: 15px; line-height: 1.5; margin-top: 5px; }
.welcome-toggle-control { display: flex; flex-direction: column; align-items: center; flex: 0 0 100px; gap: 4px; color: #d0becf; font-size: 12px; }
.welcome-toggle input { appearance: none; width: 60px; height: 34px; margin: 0; border: 2px solid #b69a60; border-radius: 18px; background: #30243c; position: relative; cursor: pointer; }
.welcome-toggle input::before { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #d0becf; }
.welcome-toggle input:checked { background: #e1c88e; }
.welcome-toggle input:checked::before { left: 30px; background: #30243c; }
.welcome-toggle:hover input { border-color: var(--cream); }
.welcome-toggle input:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; }
#panel .welcome-group .setup-intro { font-size: 15px; line-height: 1.5; margin-bottom: 14px; }
#panel .welcome-group .setup-mode-list { gap: 10px; margin-bottom: 12px; }
#panel .welcome-group .mode-choice { min-height: 120px; padding: 8px !important; }
#panel .welcome-group .mode-choice strong { font-size: 16px; }
#panel .welcome-group .mode-choice span { font-size: 14px; }
#panel .welcome-group .setup-mode-detail { min-height: 0; padding: 12px 0; font-size: 15px; line-height: 1.5; }
#panel .welcome-group .setup-mode-detail h3 { font-size: 18px; }
#panel .welcome-group .setup-note { margin: 10px 0 0; font-size: 14px; }
#panel .welcome-group .panel-buttons { margin: 6px 0 0; }
@media (max-width: 900px) {
 .welcome-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
 .welcome-guide { display: flex; align-items: center; gap: 18px; padding: 0; }
 .welcome-guide img { flex: 0 0 96px; width: 96px; height: 112px; margin: 0; }
 .welcome-message h3 { font-size: 22px; }
}
@media (max-width: 480px) {
 .welcome-guide { align-items: flex-start; gap: 12px; }
 .welcome-guide img { flex-basis: 64px; width: 64px; height: 80px; }
 .welcome-message p { font-size: 15px; }
 #panel .welcome-group { padding: 10px; }
 .welcome-toggle { gap: 10px; }
 .welcome-toggle-control { flex-basis: 76px; }
}
