/* Hallmark · shape: calendar board (content-native) · genre: playful · theme: Hum (deal 1/3, seed twenty-four-door-advent-calendar-5cfb·7b7694cd·2026-12-03·r0) · redesign: full
 * hero: Settled · nav: none, a garland masthead · footer: a torn pine ground · imagery: none, the 24 doors and drawn icons · signature: the calendar as one card-stock sheet, today's door in cranberry
 * axes: light/rounded-sans/chromatic-warm · posture: full-palette · contrast: pass · fold: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H5 E4 S3 R4 V4 · weakest: S, a calendar is a calendar; the signature is the paper board, the garland and the cranberry door */
/* Hallmark · dismissed 11 · the twenty-four doors are one control grid, not cards; the lift is the card-stock edge growing, the same signal everywhere by design */
/* Hallmark · answered F4 · one pine action, one cranberry destructive, the close and the die-cut sticker; the rest is card stock */
/* Hallmark · answered F5 · the gold coin is the theme's one die-cut sticker in the finish block; the close is a 44px paper control */
/* Hallmark · answered F7 · the pill is the theme's tag cut: day flag, game chip, residue chips and the paper bar are labels, not cards */
@import url("./tokens.css");
@import url("./base.css");

/* --------------------------------------------------------------------------
   Página
   -------------------------------------------------------------------------- */

body {
  background-color: var(--color-paper);
  background-image: var(--grain);
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page > main {
  flex: 1;
  width: 100%;
  padding: var(--space-xl) var(--gutter) 0;
}

.skip-link {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  background-color: var(--color-pine);
  color: var(--color-paper);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  translate: 0 -180%;
  transition: translate var(--dur-micro) var(--ease-snap);
}

.skip-link:focus-visible {
  translate: 0 0;
}

/* --------------------------------------------------------------------------
   La hoja de cartulina
   -------------------------------------------------------------------------- */

.sheet {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  background-color: var(--color-card);
  background-image: var(--grain);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sheet);
  animation: sheet-in var(--dur-long) var(--ease-out) both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* Banda de pino con borde rasgado */

.band {
  position: relative;
  height: 100px;
  background-color: var(--color-pine);
  background-image: var(--grain-light);
  color: var(--color-on-pine);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.band::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 26px;
  background-color: var(--color-card);
  background-image: var(--grain);
  clip-path: var(--tear);
  transform: scaleY(-1);
}

.band__wire {
  position: absolute;
  top: var(--space-md);
  left: var(--space-xl);
  right: var(--space-xl);
  height: 1px;
  background-color: var(--color-gold-line);
}

.band__garland {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 44px;
  padding-top: 32px;
  color: var(--color-gold);
}

.hang {
  position: relative;
  display: block;
}

.hang::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -16px;
  width: 1px;
  height: 16px;
  background-color: var(--color-gold-line);
}

.hang svg {
  width: 26px;
  height: 26px;
}

/* Cuerpo */

.sheet__body {
  position: relative;
  padding: var(--space-xl) 56px 48px;
}

.hero {
  padding-top: var(--space-sm);
  text-align: center;
}

.sticker {
  position: absolute;
  top: -28px;
  right: 40px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  padding: var(--space-sm);
  border: 6px solid var(--color-paper);
  border-radius: 50%;
  background-color: var(--color-accent-3);
  background-image: var(--grain-light);
  color: var(--color-paper);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 8px 18px -10px var(--color-shadow);
}

.hero h1 {
  margin-inline: auto;
  color: var(--color-ink);
}

.hero .lead {
  max-width: 40ch;
  margin: var(--space-sm) auto 0;
  color: var(--color-muted);
  font-size: var(--text-lead);
  font-weight: 500;
}

/* Progreso */

.progress {
  max-width: 430px;
  margin: var(--space-lg) auto 0;
}

.progress__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-2xs);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.progress__row .num {
  color: var(--color-ink-2);
  font-weight: 600;
}

.progress__bar {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background-color: var(--color-paper-3);
  box-shadow: inset 0 1px 2px var(--color-shadow-soft);
}

.progress__bar::-webkit-progress-bar {
  border-radius: var(--radius-pill);
  background: var(--color-paper-3);
}

.progress__bar::-webkit-progress-value {
  border-radius: var(--radius-pill);
  background-color: var(--color-accent);
  background-image: var(--grain-light);
}

.progress__bar::-moz-progress-bar {
  border-radius: var(--radius-pill);
  background-color: var(--color-accent);
  background-image: var(--grain-light);
}

.clock-note {
  max-width: 46ch;
  margin: var(--space-md) auto 0;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-input);
  background-color: var(--color-gold-soft);
  color: var(--color-ink-2);
  font-size: var(--text-xs);
  line-height: 1.45;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Puertas
   -------------------------------------------------------------------------- */

.doors {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-md);
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
}

.doors > li {
  min-width: 0;
}

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: var(--space-xs);
  border: 0;
  border-radius: var(--radius-stock);
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-stock);
  transition:
    translate var(--dur-micro) var(--ease-snap),
    box-shadow var(--dur-micro) var(--ease-snap),
    background-color var(--dur-micro) var(--ease-snap);
}

.door__num {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.3vw, 2.15rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--tracking-display);
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.door__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
}

.door__meta svg {
  width: 18px;
  height: 18px;
}

/* Cerrada */

.door[data-state='locked'] {
  background-color: var(--color-paper-2);
  box-shadow: 0 3px 0 var(--color-rule);
  color: var(--color-muted);
  cursor: not-allowed;
}

.door[data-state='locked'] .door__num {
  color: var(--color-muted);
}

.door[data-state='locked'] .door__meta {
  color: var(--color-muted);
  opacity: 0.8;
}

/* Disponible */

.door[data-state='open'] .door__meta {
  color: var(--color-accent-2);
}

/* Completada */

.door[data-state='done'] {
  background-color: var(--color-mint);
}

.door[data-state='done'] .door__num {
  color: var(--color-ink);
}

.door[data-state='done'] .door__meta {
  color: var(--color-pine);
}

/* Hoy */

.door[data-today='true'] {
  background-color: var(--color-accent-3);
  background-image: var(--grain-light);
  box-shadow: 0 5px 0 var(--color-cranberry-deep), 0 12px 18px -12px var(--color-shadow);
}

.door[data-today='true'] .door__num {
  color: var(--color-paper);
}

.door[data-today='true'] .door__meta {
  color: var(--color-gold);
}

.door__flag {
  position: absolute;
  top: -7px;
  right: -4px;
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-pill);
  background-color: var(--color-gold);
  color: var(--color-ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  transform: rotate(6deg);
  box-shadow: 0 2px 0 var(--color-gold-deep);
}

@media (hover: hover) {
  .door[data-state='open']:hover,
  .door[data-state='done']:hover {
    translate: 0 -2px;
    box-shadow: var(--shadow-stock-raised);
  }

  .door[data-today='true']:hover {
    translate: 0 -2px;
    box-shadow: 0 7px 0 var(--color-cranberry-deep), 0 16px 24px -14px var(--color-shadow);
  }
}

.door[data-state='open']:active,
.door[data-state='done']:active,
.door[data-today='true']:active {
  translate: 0 2px;
  box-shadow: var(--shadow-stock-pressed);
}

.door.is-locked-shake {
  animation: shake 0.42s var(--ease-in-out);
}

/* --------------------------------------------------------------------------
   Final
   -------------------------------------------------------------------------- */

.finish {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-rule);
  text-align: left;
}

.finish__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.finish__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--color-gold);
  color: var(--color-ink);
  box-shadow: 0 3px 0 var(--color-gold-deep);
}

.finish__icon svg {
  width: 26px;
  height: 26px;
}

.finish h2 {
  font-size: var(--text-title);
  line-height: 1.15;
}

.finish p {
  max-width: 46ch;
  margin-top: var(--space-2xs);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.load-error {
  max-width: 46ch;
  margin: var(--space-lg) auto;
  padding: var(--space-md);
  border-radius: var(--radius-input);
  background-color: color-mix(in oklab, var(--color-accent-2) 12%, var(--color-card));
  color: var(--color-ink);
  font-size: var(--text-sm);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Pie
   -------------------------------------------------------------------------- */

.foot {
  position: relative;
  margin-top: var(--space-3xl);
  padding: var(--space-2xl) 0 var(--space-xl);
  background-color: var(--color-pine);
  background-image: var(--grain-light);
  color: var(--color-on-pine);
}

.foot::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 26px;
  background-color: var(--color-paper);
  background-image: var(--grain);
  clip-path: var(--tear);
}

.foot__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.foot__note {
  max-width: 52ch;
  font-size: var(--text-sm);
}

.foot__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  flex: none;
}

.foot .link-button {
  flex: none;
  color: var(--color-gold);
}

.foot .link-button:hover {
  color: var(--color-paper);
}

/* --------------------------------------------------------------------------
   Diálogo
   -------------------------------------------------------------------------- */

dialog {
  width: min(600px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background-color: transparent;
  color: var(--color-ink);
  overflow: visible;
  font-family: var(--font-body);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background-color: var(--color-scrim);
  animation: veil-in var(--dur-short) var(--ease-out) both;
}

dialog[open] .sheet--dialog,
dialog[open] .sheet--compact {
  animation: sheet-up var(--dur-long) var(--ease-out) both;
}

@keyframes veil-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-up {
  from {
    opacity: 0;
    translate: 0 14px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.sheet--dialog {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 32px var(--space-lg);
  border-radius: var(--radius-card);
  background-color: var(--color-card);
  background-image: var(--grain);
  box-shadow: var(--shadow-dialog);
}

.sheet--compact {
  padding: var(--space-lg) 28px var(--space-lg);
  border-radius: var(--radius-card);
  background-color: var(--color-card);
  background-image: var(--grain);
  box-shadow: var(--shadow-dialog);
}

.dialog__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.dialog__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background-color: var(--color-accent-3);
  background-image: var(--grain-light);
  color: var(--color-paper);
  font-size: var(--text-xs);
  font-weight: 600;
  box-shadow: 0 2px 0 var(--color-cranberry-deep);
}

.tag--soft {
  background-color: var(--color-paper-3);
  background-image: var(--grain);
  color: var(--color-ink-2);
  box-shadow: 0 2px 0 var(--color-edge);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: calc(var(--space-2xs) * -1);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--color-card);
  color: var(--color-ink-2);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 3px 0 var(--color-edge);
  transition:
    translate var(--dur-micro) var(--ease-snap),
    box-shadow var(--dur-micro) var(--ease-snap);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  translate: 0 -1px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 4px 0 var(--color-edge);
}

.icon-button:active {
  translate: 0 2px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 1px 0 var(--color-edge);
}

.dialog-title {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: 1.1;
  text-wrap: balance;
}

.dialog-text {
  margin: 0 0 var(--space-lg);
  max-width: 52ch;
  color: var(--color-muted);
  font-size: var(--text-md);
}

.field-label {
  display: block;
  margin: var(--space-sm) 0 var(--space-2xs);
  color: var(--color-ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
}

.user-form .answer-input {
  width: 100%;
}

.user-form .actions {
  margin-top: var(--space-md);
}

.user-form .feedback {
  min-height: 1.2rem;
  margin-top: var(--space-xs);
}

.hero-question {
  margin: 0 0 var(--space-lg);
  max-width: 46ch;
  color: var(--color-ink-2);
  font-size: var(--text-md);
  line-height: 1.5;
}

/* Piezas del reto: objeto, fotos, letras, pista y residuos */

.object-photo {
  display: flex;
  justify-content: center;
  margin: 0 0 var(--space-md);
}

.object-photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-input);
  box-shadow: 0 3px 0 var(--color-edge);
}

.photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
  margin: 0 0 var(--space-md);
}

.photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-input);
  background-color: var(--color-paper-3);
  box-shadow: 0 3px 0 var(--color-edge);
}

.word-game {
  --tile-w: clamp(34px, 9vw, 44px);
  --tile-h: calc(var(--tile-w) * 1.15);
  margin-top: var(--space-sm);
}

.word-label {
  margin: 0 0 var(--space-xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.word-slots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.slot {
  display: grid;
  place-items: center;
  width: var(--tile-w);
  height: var(--tile-h);
  border: 2px dashed var(--color-rule);
  border-radius: 10px;
  transition:
    background-color var(--dur-micro) var(--ease-snap),
    border-color var(--dur-micro) var(--ease-snap);
}

.slot.is-filled {
  border-color: transparent;
}

.slot.is-drop {
  border-color: var(--color-pine);
  background-color: var(--color-gold-soft);
}

.word-pool {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  min-height: calc(var(--tile-h) + var(--space-md));
  margin-bottom: var(--space-md);
  padding: var(--space-xs);
  border-radius: var(--radius-input);
  background-color: var(--color-paper-2);
  background-image: var(--grain);
  box-shadow: inset 0 1px 2px var(--color-shadow-soft);
  transition: box-shadow var(--dur-micro) var(--ease-snap);
}

.word-pool.is-drop {
  box-shadow: inset 0 0 0 2px var(--color-pine);
}

.letter {
  display: grid;
  place-items: center;
  width: var(--tile-w);
  height: var(--tile-h);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 3px 0 var(--color-edge);
  transition:
    translate var(--dur-micro) var(--ease-snap),
    box-shadow var(--dur-micro) var(--ease-snap),
    opacity var(--dur-micro) var(--ease-snap);
}

@media (hover: hover) {
  .letter:hover {
    translate: 0 -1px;
    box-shadow: inset 0 0 0 1px var(--color-rule), 0 4px 0 var(--color-edge);
  }
}

.letter:active {
  cursor: grabbing;
  translate: 0 1px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 1px 0 var(--color-edge);
}

.letter.is-dragging {
  opacity: 0.35;
}

.letter--ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-toast);
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 10px 18px -10px var(--color-shadow);
}

.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.word-slots.is-wrong {
  animation: shake 0.42s var(--ease-in-out);
}

.word-fallback {
  margin: var(--space-sm) 0 0;
}

.manual-answer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
}

.hint {
  margin: 0 0 var(--space-md);
  color: var(--color-accent-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0 0 var(--space-md);
  padding: 0;
  list-style: none;
}

.items li {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background-color: var(--color-paper-2);
  background-image: var(--grain);
  color: var(--color-ink-2);
  font-size: var(--text-xs);
  box-shadow: inset 0 0 0 1px var(--color-rule);
}

/* Respuesta escrita */

.answer-form {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
}

.answer-form > .button {
  flex: none;
}

.answer-input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  padding: var(--space-sm) var(--space-md);
  border: 0;
  border-radius: var(--radius-input);
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-md);
  box-shadow: inset 0 0 0 1px var(--color-rule), inset 0 2px 3px var(--color-shadow-soft);
}

.answer-input::placeholder {
  color: var(--color-muted);
}

.answer-input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.answer-input.is-wrong {
  box-shadow: inset 0 0 0 2px var(--color-error);
  animation: shake 0.42s var(--ease-in-out);
}

.answer-input--area {
  width: 100%;
  min-height: 108px;
  line-height: 1.45;
  resize: vertical;
}

.answer-form--open {
  display: grid;
  gap: var(--space-sm);
}

.answer-form--open .button {
  justify-self: start;
}

/* Opciones */

.options {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 54px;
  padding: var(--space-sm) var(--space-md);
  border: 0;
  border-radius: var(--radius-input);
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 3px 0 var(--color-edge);
  transition:
    translate var(--dur-micro) var(--ease-snap),
    box-shadow var(--dur-micro) var(--ease-snap),
    background-color var(--dur-micro) var(--ease-snap);
}

.option__key {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--color-paper-3);
  color: var(--color-ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
}

@media (hover: hover) {
  .option:hover {
    translate: 0 -1px;
    box-shadow: inset 0 0 0 1px var(--color-rule), 0 5px 0 var(--color-edge);
  }
}

.option:active {
  translate: 0 2px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 1px 0 var(--color-edge);
}

.option.is-wrong {
  background-color: color-mix(in oklab, var(--color-accent-2) 14%, var(--color-card));
  box-shadow: inset 0 0 0 2px var(--color-accent-2), 0 3px 0 var(--color-edge);
  animation: shake 0.42s var(--ease-in-out);
}

.option.is-wrong .option__key {
  background-color: var(--color-accent-2);
  color: var(--color-paper);
}

.option.is-correct {
  background-color: var(--color-mint);
  box-shadow: inset 0 0 0 2px var(--color-pine), 0 3px 0 var(--color-mint-deep);
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.feedback {
  min-height: 1.3rem;
  margin: 0;
  color: var(--color-error);
  font-size: var(--text-sm);
  line-height: 1.45;
}

/* Éxito */

.success {
  position: relative;
  text-align: center;
}

.success__badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: var(--space-2xs) auto var(--space-md);
  border: 5px solid var(--color-paper);
  border-radius: 50%;
  background-color: var(--color-gold);
  color: var(--color-ink);
  box-shadow: 0 4px 0 var(--color-gold-deep), 0 12px 20px -14px var(--color-shadow);
  animation: badge-pop var(--dur-long) var(--ease-spring) both;
}

.success__badge svg {
  width: 32px;
  height: 32px;
}

@keyframes badge-pop {
  from {
    opacity: 0;
    scale: 0.7;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

.success .dialog-title {
  margin-bottom: var(--space-2xs);
}

.success__text {
  max-width: 46ch;
  margin: 0 auto var(--space-lg);
  color: var(--color-muted);
  font-size: var(--text-md);
}

.raffle {
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-rule);
}

.raffle__status {
  max-width: 48ch;
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  text-align: center;
}

.raffle__status--ok {
  color: var(--color-pine);
  font-weight: 600;
}

.raffle__status--error {
  color: var(--color-error);
}

.raffle__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.fineprint {
  margin: var(--space-sm) 0 0;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.success .actions {
  justify-content: center;
}

.success .link-button {
  margin-top: var(--space-sm);
}

/* Confeti de papel */

.confetti {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.success > :not(.confetti) {
  position: relative;
  z-index: 1;
}

.confetti span {
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background-color: var(--c, var(--color-gold));
  opacity: 0;
  animation: confetti-fly 1.35s var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}

.confetti span:nth-child(1) { --tx: -92px; --ty: 34px; --rot: -220deg; --c: var(--color-gold); }
.confetti span:nth-child(2) { --tx: 86px; --ty: 28px; --rot: 190deg; --c: var(--color-accent-2); --d: 0.03s; }
.confetti span:nth-child(3) { --tx: -68px; --ty: -46px; --rot: 160deg; --c: var(--color-pine); --d: 0.06s; }
.confetti span:nth-child(4) { --tx: 64px; --ty: -40px; --rot: -170deg; --c: var(--color-card); --d: 0.02s; }
.confetti span:nth-child(5) { --tx: -110px; --ty: -8px; --rot: 240deg; --c: var(--color-accent-2); --d: 0.08s; }
.confetti span:nth-child(6) { --tx: 108px; --ty: 2px; --rot: -200deg; --c: var(--color-gold); --d: 0.05s; }
.confetti span:nth-child(7) { --tx: -30px; --ty: 56px; --rot: 300deg; --c: var(--color-card); --d: 0.1s; }
.confetti span:nth-child(8) { --tx: 34px; --ty: 52px; --rot: -260deg; --c: var(--color-pine); --d: 0.04s; }
.confetti span:nth-child(9) { --tx: -74px; --ty: 58px; --rot: 180deg; --c: var(--color-pine); --d: 0.12s; }
.confetti span:nth-child(10) { --tx: 72px; --ty: 54px; --rot: -140deg; --c: var(--color-accent-2); --d: 0.09s; }
.confetti span:nth-child(11) { --tx: -44px; --ty: -58px; --rot: 220deg; --c: var(--color-gold); --d: 0.14s; }
.confetti span:nth-child(12) { --tx: 40px; --ty: -56px; --rot: -300deg; --c: var(--color-card); --d: 0.11s; }

@keyframes confetti-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) rotate(0deg);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), var(--ty)) rotate(var(--rot));
  }
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 48px;
  padding: var(--space-sm) var(--space-lg);
  border: 0;
  border-radius: var(--radius-input);
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 4px 0 var(--color-edge);
  transition:
    translate var(--dur-micro) var(--ease-snap),
    box-shadow var(--dur-micro) var(--ease-snap);
}

.button:hover {
  translate: 0 -1px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 6px 0 var(--color-edge);
}

.button:active {
  translate: 0 3px;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 1px 0 var(--color-edge);
}

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

.button--primary {
  background-color: var(--color-pine);
  background-image: var(--grain-light);
  color: var(--color-paper);
  box-shadow: 0 5px 0 var(--color-pine-deep), 0 14px 20px -14px var(--color-shadow);
  transition-timing-function: var(--ease-spring);
}

.button--primary:hover {
  box-shadow: 0 7px 0 var(--color-pine-deep), 0 18px 24px -14px var(--color-shadow);
}

.button--primary:active {
  box-shadow: 0 1px 0 var(--color-pine-deep);
}

.button--ghost {
  background-color: var(--color-card);
  color: var(--color-ink);
}

.button--danger {
  background-color: var(--color-accent-3);
  background-image: var(--grain-light);
  color: var(--color-paper);
  box-shadow: 0 4px 0 var(--color-cranberry-deep);
}

.button--danger:hover {
  box-shadow: 0 6px 0 var(--color-cranberry-deep);
}

.button--danger:active {
  box-shadow: 0 1px 0 var(--color-cranberry-deep);
}

.link-button {
  padding: var(--space-2xs) var(--space-2xs);
  border: 0;
  border-radius: var(--radius-input);
  background-color: transparent;
  color: var(--color-accent-2);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--color-ink);
}

/* --------------------------------------------------------------------------
   Avisos
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-lg);
  z-index: var(--z-toast);
  max-width: min(430px, calc(100% - 32px));
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-pill);
  background-color: var(--color-card);
  background-image: var(--grain);
  color: var(--color-ink);
  font-size: var(--text-sm);
  line-height: 1.4;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 6px 0 var(--color-edge),
    0 18px 30px -22px var(--color-shadow);
  opacity: 0;
  translate: -50% 12px;
  pointer-events: none;
  transition:
    opacity var(--dur-short) var(--ease-out),
    translate var(--dur-short) var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  translate: -50% 0;
}

.noscript {
  max-width: 46ch;
  margin: var(--space-lg) auto;
  padding: var(--space-md);
  border-radius: var(--radius-input);
  background-color: var(--color-gold-soft);
  color: var(--color-ink);
  font-size: var(--text-sm);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .sheet__body {
    padding: var(--space-xl) var(--space-xl) var(--space-xl);
  }

  .band__garland {
    gap: 32px;
  }
}

@media (max-width: 900px) {
  .doors {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sticker {
    right: var(--space-lg);
    width: 82px;
    height: 82px;
    font-size: var(--text-xs);
  }
}

@media (max-width: 640px) {
  .page > main {
    padding: var(--space-md) var(--space-sm) 0;
  }

  .sheet {
    border-radius: var(--radius-stock);
  }

  .band {
    height: 84px;
    border-radius: var(--radius-stock) var(--radius-stock) 0 0;
  }

  .band__wire {
    left: var(--space-md);
    right: var(--space-md);
  }

  .band__garland {
    gap: var(--space-lg);
  }

  .hang svg {
    width: 20px;
    height: 20px;
  }

  .sheet__body {
    padding: var(--space-lg) var(--space-md) var(--space-lg);
  }

  .sticker {
    display: none;
  }

  .hero .lead {
    font-size: var(--text-md);
  }

  .doors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-lg);
  }

  .door__num {
    font-size: 1.6rem;
  }

  .finish {
    text-align: center;
  }

  .finish__row {
    flex-direction: column;
    text-align: center;
  }

  .finish p {
    margin-inline: auto;
  }

  .foot {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
  }

  .foot__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .sheet--dialog {
    padding: var(--space-lg) var(--space-md) var(--space-md);
  }

  .sheet--compact {
    padding: var(--space-lg) var(--space-md);
  }

  .actions {
    flex-direction: column-reverse;
  }

  .actions .button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .answer-form:not(.answer-form--open) {
    flex-direction: column;
  }

  .answer-form .button {
    width: 100%;
  }

  .answer-form--open .button {
    justify-self: stretch;
  }

  .word-slots,
  .word-pool {
    gap: var(--space-2xs);
  }

  .object-photo img {
    max-height: 210px;
  }
}

@media (max-width: 360px) {
  .doors {
    gap: var(--space-xs);
  }

  .door__num {
    font-size: 1.4rem;
  }
}

/* --------------------------------------------------------------------------
   Preferencias
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: none;
  }

  .door[data-today='true'] .door__num {
    color: var(--color-paper);
  }
}

@media (forced-colors: active) {
  .door,
  .option,
  .button,
  .icon-button,
  .sheet,
  .toast {
    border: 1px solid CanvasText;
  }

  .door[data-today='true'] {
    outline: 3px solid Highlight;
    outline-offset: 2px;
  }
}
