/* Mystery Forge configurator. Paper, ink, and a wax seal. Everything is local: no web font, no image file. */

:root {
  --paper: #f3ebdb;
  --paper-light: #fbf7ef;
  --card: #fffcf5;
  --ink: #2a2018;
  --ink-soft: #4a3c2f;
  --muted: #69584a;
  --line: #e2d5bd;
  --line-strong: #c8b490;
  --accent: #8e2b1f;
  --accent-dark: #6c1e14;
  --accent-tint: #f4dfd7;
  --brass: #9a6d22;
  --brass-tint: #f4e8cc;
  --night: #1c2631;
  --night-soft: #2c3a49;
  --focus: #1f5fa6;
  --ok: #2f6b3a;
  --ok-tint: #e3efe0;
  --warn: #7a4f00;
  --warn-tint: #fcefd2;
  --info: #284f69;
  --info-tint: #e4edf3;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Courier New', Courier, ui-monospace, monospace;
  --radius: 16px;
  --shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 2px rgba(70, 45, 20, 0.08), 0 12px 28px -18px rgba(70, 45, 20, 0.45);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 12% 18%, rgba(255, 255, 255, 0.65), transparent 45%),
    radial-gradient(ellipse at 88% 62%, rgba(150, 105, 55, 0.1), transparent 50%),
    radial-gradient(circle at 40% 92%, rgba(150, 105, 55, 0.08), transparent 35%),
    repeating-linear-gradient(0deg, rgba(90, 60, 30, 0.022) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(90, 60, 30, 0.018) 0 1px, transparent 1px 5px);
  background-attachment: fixed;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ masthead */

.masthead {
  color: #f6ecdc;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse at 85% -10%, rgba(176, 138, 62, 0.35), transparent 55%),
    radial-gradient(ellipse at 0% 120%, rgba(142, 43, 31, 0.45), transparent 50%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px);
  padding: 28px 16px 92px;
  border-bottom: 4px solid var(--brass);
}

.masthead__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.masthead__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand__seal {
  width: 64px;
  height: 64px;
  flex: none;
  color: #a3352a;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
  transform: rotate(-8deg);
}

.brand__kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d9b878;
}

.brand__title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: 0.01em;
  color: #fbf3e4;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.masthead__tagline {
  max-width: 46rem;
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-style: italic;
  color: #eadcc4;
}

.language-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.language-switch__button {
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #eadcc4;
  background: transparent;
  cursor: pointer;
}

.language-switch__button:hover {
  color: #fff;
}

.language-switch__button[aria-pressed='true'] {
  color: var(--night);
  background: #f3e3c3;
}

.language-switch__button:focus-visible {
  outline-color: #f3e3c3;
}

.language-note {
  width: fit-content;
  max-width: 100%;
  margin: 12px 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--night);
  background: #f3e3c3;
  animation: rise 0.35s ease-out;
}

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.how-it-works__step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.92rem;
  color: #dccfb9;
}

.how-it-works__step strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.08rem;
  color: #fbf3e4;
}

.how-it-works__number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--night);
  background: #d9b878;
}

/* ------------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 28px;
  max-width: 1232px;
  margin: -60px auto 0;
  padding: 0 16px;
}

.form-column {
  min-width: 0;
}

/* ------------------------------------------------------------------ panels */

.panel {
  position: relative;
  margin: 0 0 22px;
  padding: 24px 28px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--card);
  background-image: radial-gradient(ellipse at 100% 0%, rgba(176, 138, 62, 0.07), transparent 40%);
  box-shadow: var(--shadow);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.panel__number {
  flex: none;
  margin-top: 2px;
  padding: 2px 8px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  transform: rotate(-4deg);
}

.panel__title {
  font-size: 1.6rem;
  color: var(--ink);
}

.panel__intro {
  margin-top: 4px;
  color: var(--muted);
}

.panel__fields {
  display: grid;
  gap: 24px;
}

.panel--collapsible {
  padding: 0;
}

.panel--collapsible > summary {
  display: block;
  padding: 24px 56px 24px 28px;
  list-style: none;
  cursor: pointer;
  border-radius: var(--radius);
  position: relative;
}

.panel--collapsible > summary::-webkit-details-marker {
  display: none;
}

.panel--collapsible > summary::after {
  content: '';
  position: absolute;
  top: 32px;
  right: 28px;
  width: 12px;
  height: 12px;
  border-right: 2.5px solid var(--accent);
  border-bottom: 2.5px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.panel--collapsible[open] > summary::after {
  transform: rotate(-135deg);
  top: 38px;
}

.panel--collapsible > summary .panel__header {
  margin-bottom: 0;
}

.panel--collapsible > .panel__fields {
  padding: 0 28px 28px;
}

.panel--puzzles .panel__fields {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.panel--puzzles .field {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-light);
}

.panel--puzzles .field__choice-help {
  display: none;
}

.panel--help .panel__fields {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

/* ------------------------------------------------------------------ fields */

.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field__label {
  display: block;
  padding: 0;
  font-weight: 650;
  font-size: 1.02rem;
  color: var(--ink);
}

.field__help {
  display: block;
  margin: 2px 0 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.field__choice-help {
  min-height: 1.4em;
  margin-top: 8px;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}

.field__note {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--brass);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  background: var(--brass-tint);
}

.field__count {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.choice__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

/* Cards: a radio group with an icon or a style preview. */
.choice-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.field--cards[data-field-path='format'] .choice-cards,
.field--cards[data-field-path='host'] .choice-cards {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.field--cards[data-field-path='audience'] .choice-cards {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper-light);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease,
    background-color 0.15s ease;
}

.choice-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.choice-card:has(.choice__input:checked) {
  border-color: var(--accent);
  background: #fff;
  box-shadow:
    0 0 0 3px var(--accent-tint),
    0 8px 18px -12px rgba(142, 43, 31, 0.6);
}

.choice-card:has(.choice__input:checked)::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
}

.choice-card:has(.choice__input:checked)::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 13px;
  right: 17px;
  width: 6px;
  height: 11px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(40deg);
}

.choice-card:has(.choice__input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice-card__icon {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choice-card__title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  padding-right: 22px;
}

.choice-card__help {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Segments: a compact radio group. */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 15px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-light);
  font-size: 0.95rem;
  font-weight: 550;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.segment:hover {
  border-color: var(--ink-soft);
}

.segment:has(.choice__input:checked) {
  color: var(--paper-light);
  border-color: var(--ink);
  background: var(--ink);
}

.segment:has(.choice__input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.segment__meta {
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.85;
}

.panel--puzzles .segment:has(.choice__input[value='like']:checked) {
  border-color: var(--ok);
  background: var(--ok);
}

.panel--puzzles .segment:has(.choice__input[value='avoid']:checked) {
  border-color: var(--accent);
  background: var(--accent);
}

/* Text inputs and selects. */
.text-input,
.select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fffdf9;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.text-input::placeholder {
  color: #8e7d6b;
}

.text-input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.text-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.text-input--area {
  min-height: 7.5em;
  resize: vertical;
  line-height: 28px;
  padding-top: 6px;
  background-color: #fffdf9;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(142, 43, 31, 0.13) 33px 34px);
  background-attachment: local;
  background-position: 0 -6px;
}

.text-input--number {
  max-width: 12rem;
}

.select {
  max-width: 22rem;
  padding-right: 40px;
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 52%,
    calc(100% - 14px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

/* Stepper. */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stepper .text-input--number {
  width: 5rem;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  padding: 6px 4px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.stepper .text-input--number::-webkit-outer-spin-button,
.stepper .text-input--number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper__button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  background: var(--paper-light);
  cursor: pointer;
}

.stepper__button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.stepper__button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Range. */
.range__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.range__value {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.range__input {
  --range-fill: 50%;
  width: 100%;
  height: 28px;
  margin: 4px 0 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.range__input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--range-fill), #dccbab var(--range-fill));
}

.range__input::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--range-fill), #dccbab var(--range-fill));
}

.range__input::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(70, 30, 20, 0.35);
  appearance: none;
}

.range__input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(70, 30, 20, 0.35);
}

.range__scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Toggle switch. */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-light);
  cursor: pointer;
}

.toggle .field__help {
  margin-bottom: 0;
}

.toggle__input {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: #b9a88c;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.toggle__input::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease;
}

.toggle__input:checked {
  background: var(--accent);
}

.toggle__input:checked::before {
  transform: translateX(20px);
}

/* Chips. */
.chips-input {
  display: flex;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 4px 4px 12px;
  border: 1px solid #dcc38e;
  border-radius: 999px;
  background: var(--brass-tint);
  font-size: 0.93rem;
}

.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip__remove {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
}

.chip__remove:hover {
  color: #fff;
  background: var(--accent);
}

.chip__remove-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

/* Advanced options. */
.advanced {
  border-top: 1px dashed var(--line-strong);
  padding-top: 14px;
}

.advanced > summary {
  width: fit-content;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.advanced[open] > summary {
  margin-bottom: 14px;
}

/* A details element does not lay out its content as a grid, so margins give the field gap of .panel__fields. */
.advanced > .field + .field {
  margin-top: 24px;
}

/* ------------------------------------------------------------------ style previews */

.style-preview {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 74px;
  margin-bottom: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 7px;
  overflow: hidden;
}

.style-preview__title {
  font-size: 1.35rem;
  line-height: 1.1;
  font-weight: 700;
}

.style-preview__line {
  display: block;
  height: 5px;
  width: 85%;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.4;
}

.style-preview__line--short {
  width: 55%;
}

.style-preview--auto {
  color: #fff;
  background: linear-gradient(120deg, #c9a46a 0%, #8e2b1f 35%, #1b1b1b 60%, #0f3550 85%, #4fd1e8 100%);
  font-family: var(--serif);
}

.style-preview--vintage {
  color: #5a3b1a;
  background:
    radial-gradient(circle at 80% 30%, rgba(120, 80, 30, 0.18) 0 12px, transparent 13px),
    radial-gradient(ellipse at 50% 50%, #f3e4c3, #e2c995);
  font-family: var(--mono);
}

.style-preview--noir {
  color: #f2f2f2;
  background: #151515;
  box-shadow: inset 5px 0 0 #b3261e;
  font-family: var(--serif);
}

.style-preview--modern {
  color: #1e293b;
  background: #fff;
  box-shadow: inset 0 5px 0 #2563eb;
  font-family: var(--sans);
}

.style-preview--victorian {
  color: #4a2f12;
  background: #f3ead7;
  box-shadow:
    inset 0 0 0 4px #f3ead7,
    inset 0 0 0 5px #7b5a2a,
    inset 0 0 0 7px #f3ead7,
    inset 0 0 0 8px #7b5a2a;
  font-family: var(--serif);
  font-style: italic;
  padding-left: 14px;
}

.style-preview--scifi {
  color: #57d6ec;
  background:
    repeating-linear-gradient(0deg, rgba(87, 214, 236, 0.13) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, rgba(87, 214, 236, 0.13) 0 1px, transparent 1px 12px), #0b1a2a;
  font-family: var(--mono);
}

.style-preview--fantasy {
  color: #3e5b25;
  background: radial-gradient(ellipse at 50% 50%, #f2e2b8 40%, #cfae6d 100%);
  font-family: var(--serif);
}

.style-preview--kids {
  color: #e4572e;
  background:
    radial-gradient(circle at 85% 25%, #ffd23f 0 10px, transparent 11px),
    radial-gradient(circle at 70% 75%, #3bb273 0 7px, transparent 8px), #fff4d6;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Trebuchet MS', var(--sans);
}

.style-preview--minimal {
  color: #222;
  background: #fff;
  font-family: var(--sans);
  font-weight: 300;
}

.style-preview--minimal .style-preview__title {
  font-weight: 300;
}

/* ------------------------------------------------------------------ summary */

.summary {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 16px 4px 8px;
  margin-top: -16px;
  scrollbar-width: thin;
}

.summary__card {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid #d6b97f;
  border-radius: 4px 16px 16px 16px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 85, 30, 0.035) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #f8ebcb, #f0dcae);
  box-shadow: var(--shadow);
}

.summary__card::before {
  content: '';
  position: absolute;
  top: -15px;
  left: -1px;
  width: 132px;
  height: 16px;
  border: 1px solid #d6b97f;
  border-bottom: 0;
  border-radius: 10px 14px 0 0;
  background: #f8ebcb;
}

.summary__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary__title {
  font-size: 1.55rem;
}

.summary__stamp {
  padding: 2px 8px;
  border: 2px solid rgba(142, 43, 31, 0.75);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(142, 43, 31, 0.8);
  transform: rotate(7deg);
}

.estimate {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 8px;
}

.estimate__item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 252, 244, 0.75);
  border: 1px solid rgba(200, 170, 110, 0.5);
}

.estimate__item--generation {
  grid-column: 1 / -1;
}

.estimate dt {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.estimate dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.summary__note {
  font-size: 0.82rem;
  color: var(--muted);
}

.warnings__title {
  margin-top: 18px;
  font-size: 1.1rem;
}

.warnings {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.warning,
.warnings__none {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.warning .icon,
.warnings__none .icon {
  margin-top: 1px;
}

.warnings__none {
  color: var(--ok);
  background: var(--ok-tint);
}

.warning--warning {
  color: var(--warn);
  background: var(--warn-tint);
  border-left: 3px solid #c48a1a;
}

.warning--info {
  color: var(--info);
  background: var(--info-tint);
  border-left: 3px solid #5d8aa8;
}

.warning__link {
  font-weight: 650;
  color: inherit;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ buttons */

.actions {
  display: grid;
  /* One button per row: two buttons side by side wrap long labels, as in Spanish, into cramped lines. */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 12px;
  font-weight: 650;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  color: var(--ink);
  background: var(--paper-light);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

.button:hover {
  background: #fff;
}

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

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--primary {
  min-height: 54px;
  font-size: 1.08rem;
  border-color: var(--accent-dark);
  color: #fff8ee;
  background: linear-gradient(180deg, #a3362a, var(--accent-dark));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 10px 20px -10px rgba(108, 30, 20, 0.8);
}

.button--primary:hover {
  background: linear-gradient(180deg, #b13d30, #7a2318);
}

.button--quiet {
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
}

.button--quiet:hover {
  background: rgba(255, 255, 255, 0.5);
}

.button--small {
  min-height: 44px;
  padding: 8px 16px;
  flex: none;
}

.file-button:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.load-hint {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.status:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.status .icon {
  margin-top: 2px;
}

.status span {
  flex: 1;
}

.status--success {
  color: var(--ok);
  background: var(--ok-tint);
}

.status--info {
  color: var(--info);
  background: var(--info-tint);
}

.status--error {
  color: var(--accent-dark);
  background: var(--accent-tint);
}

.status__action {
  flex: none;
  padding: 2px 10px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
}

.load-errors:not(:empty) {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1.5px solid #d08a80;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--accent-tint);
  font-size: 0.9rem;
}

.load-errors__title {
  display: flex;
  gap: 8px;
  font-weight: 650;
}

.load-errors__list {
  margin: 6px 0 0;
  padding-left: 1.3rem;
}

/* ------------------------------------------------------------------ next steps and prompt */

.next-steps {
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: var(--radius);
  color: #efe4d0;
  background: radial-gradient(ellipse at 100% 0%, rgba(176, 138, 62, 0.3), transparent 55%), var(--night);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease-out;
}

.next-steps__title {
  font-size: 1.35rem;
  color: #fbf3e4;
}

.next-steps__list {
  counter-reset: step;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.next-steps__list > li {
  counter-increment: step;
  position: relative;
  padding-left: 38px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.next-steps__list > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--night);
  background: #d9b878;
}

.next-steps__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.next-steps__link {
  padding: 4px 12px;
  border: 1px solid rgba(217, 184, 120, 0.6);
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.88rem;
  color: #f3dca8;
  text-decoration: none;
}

.next-steps__link:hover {
  color: var(--night);
  background: #d9b878;
}

.next-steps__link::after {
  content: ' \2197';
}

.next-steps__systems {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: #dccfb8;
}

.next-steps__systems strong {
  color: #fbf3e4;
}

.next-steps__note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.88rem;
  font-style: italic;
  color: #cfc2ab;
}

.prompt-panel {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.prompt-panel > summary {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

.prompt-panel__help {
  display: block;
  margin: 10px 0 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.prompt-panel__copy {
  width: 100%;
  margin-bottom: 10px;
}

.prompt-panel__text {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink);
  background: #fffdf8;
  resize: vertical;
}

/* ------------------------------------------------------------------ footer, phone bar, drop overlay */

.page-footer {
  max-width: 1232px;
  margin: 12px auto 0;
  padding: 16px 16px 40px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.mobile-summary-bar {
  display: none;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(28, 38, 49, 0.78);
  backdrop-filter: blur(3px);
}

.drop-overlay__card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 40px 48px;
  border: 3px dashed #d9b878;
  border-radius: 20px;
  font-family: var(--serif);
  font-size: 1.4rem;
  color: #fbf3e4;
  text-align: center;
}

.drop-overlay__icon {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: #d9b878;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 0;
    padding: 16px 0 0;
  }

  body {
    padding-bottom: 84px;
  }

  .mobile-summary-bar {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    color: #f6ecdc;
    background: var(--night);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
    text-decoration: none;
    transition: transform 0.25s ease;
  }

  .mobile-summary-bar.is-hidden {
    transform: translateY(160%);
  }

  .mobile-summary-bar__numbers {
    font-family: var(--serif);
    font-size: 1.02rem;
  }

  .mobile-summary-bar__action {
    flex: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff8ee;
    background: var(--accent);
  }
}

@media (max-width: 720px) {
  .masthead {
    padding: 20px 16px 76px;
  }

  .brand__seal {
    width: 48px;
    height: 48px;
  }

  .how-it-works {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .how-it-works__step {
    padding: 10px 12px;
  }

  .panel {
    padding: 18px 16px 20px;
  }

  .panel--collapsible {
    padding: 0;
  }

  .panel--collapsible > summary {
    padding: 18px 48px 18px 16px;
  }

  .panel--collapsible > summary::after {
    top: 26px;
    right: 20px;
  }

  .panel--collapsible[open] > summary::after {
    top: 32px;
  }

  .panel--collapsible > .panel__fields {
    padding: 0 16px 20px;
  }

  .panel__header {
    gap: 12px;
  }

  .panel__title {
    font-size: 1.35rem;
  }

  .choice-cards,
  .field--cards[data-field-path='format'] .choice-cards,
  .field--cards[data-field-path='host'] .choice-cards {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 10px;
  }

  .field--cards[data-field-path='format'] .choice-cards,
  .field--cards[data-field-path='host'] .choice-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .choice-card {
    padding: 12px;
  }

  /* An odd last card takes the whole row, so that no card sits alone in half a row. */
  .choice-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
