@font-face { font-family: Carta; src: url("p052-Roman.woff") format("woff"); font-display: swap; }
@font-face { font-family: Carta; src: url("p052-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: Carta; src: url("p052-Italic.woff") format("woff"); font-style: italic; font-display: swap; }
:root {
  color-scheme: light;
  --ink: #402630;
  --quiet: #5f4149;
  --accent: #773548;
  --paper: #fff8ef;
  --border: #c8a6a6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f7eee1 url("papel-toile.webp") repeat center top / clamp(560px, 76vw, 960px) auto;
  color: var(--ink);
  font: 1.125rem/1.55 Carta, Georgia, serif;
}
main { width: min(100%, 620px); }
.card {
  padding: clamp(24px, 7vw, 56px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(#fff8efe4, #fff8efe4), url("papel-toile.webp") center / 560px auto, var(--paper);
  box-shadow: 0 16px 46px #38242810;
}
h1 {
  margin: 0 0 18px;
  color: var(--ink);
  font: 400 clamp(1.85rem, 6vw, 2.8rem)/1.12 Carta, Georgia, serif;
  letter-spacing: -.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
p { margin: 0 0 20px; color: var(--quiet); overflow-wrap: anywhere; }
button {
  width: 100%;
  min-height: 48px;
  margin-top: 9px;
  padding: 11px 16px;
  border: 1px solid #c4a2a6;
  border-radius: 7px;
  color: var(--ink);
  background: #fcf7f0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button:hover { background: #f0dfe0; }
button:focus-visible, textarea:focus-visible, h1:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; text-align: center; }
.primary:hover { background: #603443; }
.quiet { text-align: center; background: var(--paper); }
textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid #bfaeaa;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
label { display: block; margin-bottom: 8px; }
.ticket { margin: 14px 0 0; padding: 15px 17px; border: 1px solid #d4d8cc; border-radius: 7px; background: #f1f3ed; }
.ticket p { margin: 0; color: var(--ink); }
.ticket strong { display: block; margin-bottom: 4px; }
audio, video, img { display: block; max-width: 100%; margin: 0 0 16px; border-radius: 7px; }
audio { width: 100%; }

.opening { padding: 0; border: 0; background: none; box-shadow: none; text-align: center; }
.envelope {
  position: relative;
  isolation: isolate;
  display: block;
  width: min(100%, 490px);
  aspect-ratio: 1.58;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  perspective: 900px;
}
.envelope:hover { background: transparent; }
.envelope:disabled { cursor: default; }
.envelope:focus-visible { outline-offset: 9px; }
.envelope-back, .envelope-folds, .envelope-flap { position: absolute; inset: 0; }
.envelope-back { border-radius: 6px; background: #dac7b8; box-shadow: 0 24px 54px #47232a50, 0 3px 8px #50372438; }
.envelope-folds {
  z-index: 3;
  border-radius: 0 0 6px 6px;
  clip-path: polygon(0 0, 50% 61%, 100% 0, 100% 100%, 0 100%);
  background:
    repeating-linear-gradient(0deg, #795d4208 0 1px, transparent 1px 3px),
    linear-gradient(146deg, #e3cdb7, #f1e2cf 55%, #dfc7b0);
}
.envelope-flap {
  z-index: 4;
  height: 65%;
  clip-path: polygon(0 0, 100% 0, 53% 96%, 50% 100%, 47% 96%);
  border-radius: 6px 6px 0 0;
  background:
    repeating-linear-gradient(0deg, #795d4208 0 1px, transparent 1px 3px),
    linear-gradient(#f7ead9, #e6cfba);
  transform-origin: center top;
  transition: transform 1.15s .32s ease, z-index 0s .89s;
}
.letter-peek {
  position: absolute;
  z-index: 2;
  inset: 7% 7% 6%;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 8% 6% 5%;
  border: 1px solid var(--border);
  background: linear-gradient(#fff8efe4, #fff8efe4), url("papel-toile.webp") center / 560px auto, var(--paper);
  color: var(--ink);
  font-size: clamp(1rem, 4vw, 1.5rem);
  letter-spacing: -.025em;
  transition: transform 1s 1.12s cubic-bezier(.2,.6,.25,1);
}
.wax {
  position: absolute;
  z-index: 5;
  top: 59%;
  left: 50%;
  width: clamp(66px, 20vw, 91px);
  display: block;
  aspect-ratio: 1;
  margin: 0;
  padding: 3px;
  border: 1px solid #784350;
  border-radius: 46% 54% 49% 51% / 49% 44% 56% 51%;
  background: radial-gradient(circle at 32% 21%, #b57983, #874855 61%, #66303f);
  transform: translate(-50%, -50%) rotate(-8deg);
  box-shadow: inset 0 0 0 3px #dc9d9e43, 0 4px 7px #48263055;
  transition: transform .62s ease, opacity .6s ease;
}
.wax img { width: 100%; margin: 0; }
.envelope:hover:not(:disabled) .wax { background: radial-gradient(circle at 32% 21%, #c38890, #92515e 61%, #693141); transform: translate(-50%, -50%) rotate(-3deg) scale(1.05); }
.unsealed .wax { pointer-events: none; opacity: 0; transform: translate(-30%, -29%) rotate(16deg) scale(.8); }
.unsealed .envelope-flap { z-index: 1; transform: rotateX(180deg); }
.unsealed .letter-peek { transform: translateY(-56%); }
@media (max-width: 480px) {
  body { padding: 16px; }
  main:has(.card:not(.opening)) { align-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .wax, .letter-peek, .envelope-flap { transition: none; }
}

[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.card:not(.opening) {
  position: relative;
  background: linear-gradient(#fff8eff0, #fff8eff0), url("papel-toile.webp") center / 560px auto, #fff8ef;
  box-shadow: 2px 3px 0 #fff8ef, 4px 6px 0 #e9d5c7, 0 18px 44px #7e4d3430;
}
.turning { transform-origin: left center; animation: page-turn .58s ease both; }
@keyframes page-turn {
  from { transform: perspective(1100px) rotateY(-22deg) translateX(9px); opacity: .46; }
  to { transform: none; opacity: 1; }
}
.typing::after { content: "▏"; color: var(--accent); animation: caret .8s steps(2, jump-none) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.signed { margin: 20px 0 14px; }
.photo-placeholder {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 18px;
  border: 1px dashed #cba798;
  border-radius: 7px;
  background: #f7e9dd;
  text-align: center;
}
.portrait, .closing-photo { width: 100%; object-fit: cover; }
.signatures { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 20px; }
.signature { font: italic 1.65rem Carta, Georgia, serif; color: #633d46; }
.pawprints { font-size: 1rem; opacity: .75; }
.signature-image { max-width: 140px; max-height: 66px; margin: 0; object-fit: contain; }
.progress { margin: 0 0 10px; font-size: .875rem; }
.piece-count { margin: 10px 0 0; }
.puzzle {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  aspect-ratio: 2;
  border: 1px solid #c1a396;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 16px;
  background: #efe0d4;
}
.tile {
  min-width: 0;
  background-size: 400% 200%;
  box-shadow: inset 0 0 0 .5px #60434d42;
}
.answer { background: #fff7ef; }
input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #bfaeaa;
  border-radius: 7px;
  background: #fffaf4;
  color: inherit;
  font: inherit;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary:disabled { cursor: default; opacity: .55; }
.chase-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 170px;
  aspect-ratio: 1.8;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5e0d4 0 74%, #dfbcae 74% 75%, #e8cbb7 75%);
}
.runners {
  position: relative;
  width: 75%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
  animation: escape 4.2s ease-in-out both;
}
.police-lights {
  position: absolute;
  inset: 0;
  background: linear-gradient(108deg, #ce8f9d9c, transparent 45%, #8daab577);
  animation: siren 2s ease-in-out 2;
}
@keyframes escape {
  0% { transform: translateX(-85%) rotate(-3deg); }
  25% { transform: translate(6%, -4%) rotate(1deg); }
  47% { transform: translate(11%, 1%) rotate(-2deg); }
  72% { transform: translate(21%, -4%) rotate(1deg); }
  100% { transform: translateX(32%); }
}
@keyframes siren { 0%, 100% { opacity: .25; } 50% { opacity: .85; } }
.doors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(5px, 2vw, 14px); }
.door-option {
  padding: 3px;
  font-size: .83rem;
  text-align: center;
  border: 1px solid transparent;
  background: transparent;
}
.door-panel {
  position: relative;
  display: block;
  aspect-ratio: .69;
  margin: 0 auto 8px;
  border-radius: 42% 42% 3px 3px / 27% 27% 3px 3px;
  border: 4px double #72515c77;
  transform-origin: left;
  transition: transform .6s ease;
}
.door-panel::after {
  position: absolute;
  content: "";
  right: 15%;
  top: 57%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #79563f;
}
.rose { background: #d9a9b4; }
.sage { background: #c4c9b3; }
.peach { background: #e7c3b2; }
.chosen .door-panel { transform: perspective(450px) rotateY(-68deg); }
.gift { padding: 20px; border-radius: 7px; background: #f3e0d4; }
@media (prefers-reduced-motion: reduce) {
  .turning, .typing::after, .runners, .police-lights { animation: none; }
  .door-panel { transition: none; }
}

.intro-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.jigsaw { width: 100%; max-width: 420px; display: block; margin-inline: auto; }
.arrival { width: 100%; height: 100%; object-fit: cover; margin: 0; animation: arrive 3.2s ease-out both; }
@keyframes arrive {
  from { transform: scale(1.18) translateX(-7%); }
  to { transform: scale(1); }
}
.door-option[aria-pressed="true"] { border-color: var(--accent); background: #f4e2df; }
.door-option.chosen { opacity: .65; cursor: default; }
.door-status { margin-top: 12px; }
.prize-image { width: min(100%, 320px); aspect-ratio: 1; object-fit: contain; margin-inline: auto; }
.finale { width: min(100%, 420px); }
.finale .envelope-flap { animation: close-letter 1.65s ease both; }
@keyframes close-letter {
  from { transform: rotateX(180deg); }
  to { transform: rotateX(0); }
}
.ribbon, .ribbon-label { position: absolute; z-index: 6; left: 0; right: 0; top: 45%; }
.ribbon { height: 17%; background: linear-gradient(#a66577, #78384d 50%, #995267); animation: wrap-envelope 1s 1.1s both; }
.ribbon::after { content: ""; position: absolute; left: 46%; width: 8%; height: 590%; top: -265%; background: linear-gradient(90deg, #8b4258, #ac6477, #8b4258); }
.ribbon-label { width: max-content; max-width: 98%; margin: auto; transform: translateY(-12%); top: 47%; color: #fff9ef; background: #74344a; padding: 4px 10px; border-radius: 4px; animation: wrap-envelope 1s 1.1s both; font: italic clamp(.85rem, 4vw, 1.4rem) Carta, Georgia, serif; }
@keyframes wrap-envelope { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .arrival, .finale .envelope-flap, .ribbon, .ribbon-label { animation: none; }
}
.chase-stage .arrival { animation: house-approach 3.2s ease both; }
@keyframes house-approach {
  0%, 35% { opacity: 0; }
  70% { opacity: 1; }
  100% { opacity: 1; transform: scale(1.03); }
}
.running-party {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 63%;
  margin: 0;
  animation: run-to-house 2.25s ease-in both;
}
@keyframes run-to-house {
  0% { transform: translate(-80%, 6%); opacity: 1; }
  30% { transform: translate(0, 0); }
  55% { transform: translate(36%, 5%); }
  80% { transform: translate(58%, -5%) scale(.83); opacity: 1; }
  100% { transform: translate(65%, -10%) scale(.55); opacity: 0; }
}
.bow { z-index: 7; position: absolute; top: 26%; left: 50%; width: 54px; animation: wrap-envelope 1s 1.1s both; }
.bow::before, .bow::after { content: ""; position: absolute; width: 76%; height: clamp(15px, 6vw, 26px); background: linear-gradient(#b97585,#803a51); border: 1px solid #78384d; }
.bow::before { right: 100%; border-radius: 65% 50% 30% 55%; transform: rotate(23deg); }
.bow::after { left: 0; border-radius: 50% 65% 55% 30%; transform: rotate(-23deg); }
@media (prefers-reduced-motion: reduce) {
  .chase-stage .arrival, .bow { animation: none; }
  .running-party { display: none; }
}
.door-panel.rose { background: #8a233c; }
.door-panel.sage {
  border-radius: 3px;
  background: linear-gradient(#bfa566 0 2%, #50644c 2% 24%, #244733 24%);
}
.door-panel.peach { border-radius: 45% 45% 3px 3px / 13% 13% 3px 3px; background: #a84429; }
.door-panel.peach::before {
  content: ""; position: absolute; left: 32%; top: 33%; width: 34%; aspect-ratio: 1;
  border: 2px ridge #dc8d5e; transform: rotate(45deg);
}

@font-face { font-family: Roman; src: url("roman-regular.woff") format("woff"); font-display: swap; }
@font-face { font-family: Roman; src: url("roman-italic.woff") format("woff"); font-style: italic; font-display: swap; }
@font-face { font-family: Roman; src: url("roman-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
body { font-family: Roman, Georgia, serif; }
h1 { font-family: Roman, Georgia, serif; letter-spacing: -.045em; }
.birthday-title { text-align: center; font-style: italic; }
.primary, .quiet {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin: 18px auto 0;
  padding: 8px 20px;
  border-radius: 999px;
  background: #f8ede5;
  color: #71354a;
  border: 1px solid #cba9aa;
  font-weight: 400;
}
.primary:hover, .quiet:hover { background: #ecd9d6; }
.turning { animation: dissolve .34s ease-out both; }
@keyframes dissolve { from { opacity: .48; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.typewriter {
  position: relative;
  padding: 32px 15px 14px;
  border: 1px solid #ccb5aa;
  border-radius: 8px;
  background: #fff9ef;
}
.carriage {
  position: absolute;
  top: 11px;
  left: 12px;
  right: 12px;
  height: 5px;
  border-radius: 10px;
  background: #b79b8e;
  opacity: .85;
}
.carriage::after {
  content: "";
  display: block;
  width: 38px;
  height: 12px;
  margin-top: -3px;
  border-radius: 4px;
  background: linear-gradient(#a27569, #624137);
  transform: translateX(var(--carriage-x, 0));
  transition: transform .06s ease;
}
.typewriter .typing { margin: 0; min-height: 1.6em; }
.typing::after { content: none; }
.type-caret { display: inline-block; width: 2px; height: 1em; vertical-align: -.13em; background: var(--accent); animation: caret .8s steps(2, jump-none) infinite; }
.typed .carriage { opacity: .4; }
.chase-stage { aspect-ratio: 3 / 2; background: #e9d1b9; }
.scene-transition { width: 100%; height: 100%; object-fit: cover; margin: 0; animation: scene-in .5s ease both; }
@keyframes scene-in { from { opacity: .35; } to { opacity: 1; } }
.door-panel.rose, .door-panel.sage, .door-panel.peach {
  aspect-ratio: .47;
  border: 0;
  border-radius: 4px;
  background: var(--door) center / 100% 100% no-repeat;
}
.door-panel.rose { --door: url("puerta-rose.webp"); }
.door-panel.sage { --door: url("puerta-sage.webp"); }
.door-panel.peach { --door: url("puerta-peach.webp"); }
.door-panel::after, .door-panel.peach::before { content: none; }
.door-form { display: grid; gap: 6px; margin-top: 16px; }
.door-form label { margin: 4px 0 0; }
.door-form select { width: 100%; padding: 10px; font: inherit; border-radius: 7px; border: 1px solid #bfaeaa; background: #fffaf4; color: var(--ink); }
.card.closing-card { padding: 0; background: none; border: 0; box-shadow: none; }
.finale { position: relative; }
.finale .ribbon { top: 49%; height: 12%; background: linear-gradient(#aa6978, #79394c 54%, #a45f70); }
.finale .ribbon::after { height: 835%; top: -408%; }
.finale .bow { top: 43%; left: 50%; }
.finale .closing-seal {
  top: 54%; left: 50%; width: clamp(48px, 15vw, 72px);
  animation: wrap-envelope 1s 1.35s both;
}
.finale .ribbon-label {
  top: 76%; background: none; color: #633447; padding: 0; transform: translateY(0);
  font: italic clamp(1rem, 4.6vw, 1.4rem) Roman, Georgia, serif;
}
@media (prefers-reduced-motion: reduce) {
  .turning, .scene-transition, .type-caret, .finale .closing-seal { animation: none; }
}
.character-reveal {
  width: min(100%, 340px);
  aspect-ratio: auto;
  border: 1px solid var(--border);
  animation: scene-in .5s ease both;
}
@media (prefers-reduced-motion: reduce) {
  .character-reveal { animation: none; }
}

.typewriter { display: grid; }
.typewriter .typing, .type-measure {
  grid-area: 1 / 1;
  margin: 0;
  white-space: pre-wrap;
}
.type-measure { visibility: hidden; pointer-events: none; }
.read-all { border-color: transparent; background: transparent; font-size: .95rem; }
.finale {
  --velvet: repeating-linear-gradient(99deg, #fff2e70d 0 1px, #1908110d 1px 2px),
    linear-gradient(160deg, #bb788b 0%, #844257 22%, #63283f 58%, #95556a 90%, #73394f 100%);
}
.finale .ribbon {
  inset: 0 auto 0 44%;
  width: 12%;
  height: auto;
  background: var(--velvet);
  box-shadow: 2px 0 6px #4e233d38;
}
.finale .ribbon::after { content: none; }
.finale .bow {
  top: 31%;
  width: 0;
}
.finale .bow::before, .finale .bow::after {
  width: clamp(45px, 14vw, 81px);
  height: clamp(22px, 7vw, 41px);
  background: var(--velvet);
  border: solid 1px #6e374b;
  box-shadow: 1px 3px 5px #39152342, inset 0 2px 5px #f8bed049;
}
.finale .closing-seal { top: 37%; z-index: 8; }
.finale .ribbon-label {
  inset: 64% 0 auto;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  min-height: clamp(30px, 10vw, 51px);
  padding: 4px 14px;
  background: var(--velvet);
  border-radius: 1px;
  box-shadow: 0 3px 7px #441e2c38, inset 0 1px #e7b1bb75;
  color: #fff5e3;
  text-shadow: 0 1px 2px #2c1024;
  text-align: center;
}

body, h1, .finale .ribbon-label { font-family: Mansdefia, Roman, Georgia, serif; }
.jigsaw {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #efe0d4;
}
.door-panel.rose, .door-panel.sage, .door-panel.peach {
  position: relative;
  display: block;
  background: none;
  transform: none;
  perspective: 550px;
  border-radius: 0;
}
.door-panel.rose { --shape: polygon(0 100%, 0 25%, 3% 17%, 11% 10%, 23% 4%, 37% 1%, 50% 0%, 63% 1%, 77% 4%, 89% 10%, 97% 17%, 100% 25%, 100% 100%); }
.door-panel.sage { --shape: inset(0 round 2px); }
.door-panel.peach { --shape: polygon(0 100%, 0 13%, 9% 8%, 23% 3%, 36% 1%, 50% 0%, 64% 1%, 77% 3%, 91% 8%, 100% 13%, 100% 100%); }
.door-leaf, .door-interior {
  position: absolute;
  inset: 0;
  display: block;
  clip-path: var(--shape);
}
.door-leaf {
  background: var(--door) center / 100% 100% no-repeat;
  transform-origin: left center;
  transition: transform .94s cubic-bezier(.23,.55,.34,1), filter .85s;
}
.door-interior {
  overflow: hidden;
  background: radial-gradient(at 50% 30%, #dba56b, #512b26 90%);
  box-shadow: inset 0 0 12px #30121d;
}
.door-surprise { width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; }
.chosen .door-panel { transform: none; }
.chosen .door-leaf { transform: rotateY(-105deg); filter: brightness(.67); }
.already-open .door-leaf { transition: none; }
.typewriter {
  padding: 16px 12px 12px;
  gap: 0;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(120deg, #6e4b43, #40272b 68%);
  box-shadow: 0 5px 11px #3e23364a;
}
.typewriter .typing, .type-measure {
  padding: 18px 15px 26px;
  background: #fff8e9;
  color: #442c34;
  font-family: "Courier New", monospace;
  font-size: clamp(.9rem, 3vw, 1rem);
  border-radius: 3px 3px 0 0;
}
.typewriter .carriage {
  position: relative;
  grid-area: 2 / 1;
  inset: auto;
  height: 15px;
  margin-top: -8px;
  z-index: 1;
  background: linear-gradient(#775750, #282023 27%, #573942 58%, #22191c 94%);
  box-shadow: 0 -2px 5px #22191c70, 0 3px 7px #180f14;
}
.carriage::after { content: none; }
.type-striker {
  position: absolute;
  top: -8px;
  left: clamp(0px, var(--carriage-x, 0px), calc(100% - 19px));
  width: 19px;
  height: 14px;
  background: linear-gradient(#b99976, #67463f);
  border: 1px solid #412933;
  border-radius: 4px 4px 1px 1px;
  transform-origin: center bottom;
  transition: left .09s ease-out;
}
.type-keys {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  padding: 12px 6px 5px;
}
.type-keys span {
  display: grid;
  place-items: center;
  min-height: 18px;
  border: 1px solid #b9906f;
  border-radius: 50%;
  color: #fff4dc;
  box-shadow: 0 2px #211519;
  background: #5b3e44;
  font: 11px/1 monospace;
}
.typewriter.typed .carriage { opacity: .86; }
.finale .ribbon-label span {
  color: #fff0cb;
  text-shadow: .45px .7px #4a2239, -.3px -.4px #ffdeac, 0 1.7px #4e2639;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .finale .ribbon-label span {
    background: repeating-linear-gradient(104deg, #ffe8b6 0 1px, #e7bb84 1px 1.5px, #fff0cb 1.5px 2.3px);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 1px .3px #492137);
  }
}
@media (prefers-reduced-motion: reduce) {
  .door-leaf, .type-striker { transition: none; }
}

/* The printed paper slides behind the photographic chassis. */
.typewriter {
  display: block;
  isolation: isolate;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.machine-sheet {
  position: relative;
  width: 77%;
  margin: 0 auto -13%;
  display: grid;
  background: linear-gradient(90deg, #eedec2, #fff8e9 8% 91%, #ede0c6);
  border: 1px solid #d5b99f;
  box-shadow: 0 4px 14px #49293328;
  border-radius: 2px;
}
.machine-sheet .typing, .machine-sheet .type-measure {
  background: none;
  font-size: clamp(.78rem, 2.8vw, 1rem);
  padding: 14px clamp(9px, 3vw, 22px) clamp(42px, 12vw, 82px);
  overflow-wrap: anywhere;
}
.machine-chassis {
  display: block;
  position: relative;
  z-index: 2;
  width: 100%;
  height: auto;
  margin: 0;
  filter: drop-shadow(0 10px 12px #37252b42);
}
.turning { animation: editorial-enter .28s cubic-bezier(.22,.65,.35,1) both; }
@keyframes editorial-enter {
  from { opacity: .84; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}
.doors { grid-template-columns: repeat(var(--door-count, 3), minmax(0, 140px)); justify-content: center; }
.door-leaf {
  clip-path: none;
  background: none;
  transform-style: preserve-3d;
  overflow: visible;
}
.door-front, .door-back {
  position: absolute;
  inset: 0;
  clip-path: var(--shape);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.door-front {
  background: var(--door) center / 100% 100% no-repeat;
  box-shadow: inset 2px 1px 5px #ffdb9988, inset -4px -3px 6px #240d19cb;
  transform: translateZ(1px);
}
.door-panel.rose { --wood: #722235; }
.door-panel.sage { --wood: #284637; }
.door-panel.peach { --wood: #873f25; }
.door-back {
  transform: rotateY(180deg) translateZ(1px);
  background: repeating-linear-gradient(89deg, #0000 0 5px, #2e132138 6px, #0000 8px), var(--wood);
  box-shadow: inset 3px 3px 6px #fff5d45c, inset -5px -4px 8px #310f21c2;
}
.door-back::before, .door-back::after {
  content: "";
  position: absolute;
  inset: 27% 14% 44%;
  border: 3px ridge #ffffff38;
  box-shadow: inset 2px 3px 6px #160c20ab, 1px 2px 4px #140a1c8a;
}
.door-back::after { inset: 61% 14% 9%; }
.door-brass {
  position: absolute;
  z-index: 1;
  top: 51%;
  right: 7%;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(at 30% 24%, #ffe4a0, #9f6d35 48%, #593030);
  box-shadow: 1px 2px 4px #241322b3;
}
.door-option.chosen { opacity: 1; }
.chosen .door-leaf { transform: rotateY(-123deg); filter: none; }
.door-form .name-select {
  appearance: none;
  padding: 11px 40px 11px 14px;
  border-radius: 11px;
  border: 1px solid #b99094;
  background: linear-gradient(45deg, transparent 50%, #7b4152 50%) right 19px center / 5px 5px no-repeat,
    linear-gradient(135deg, #7b4152 50%, transparent 50%) right 14px center / 5px 5px no-repeat, #fff6e9;
  color: #613544;
  font: inherit;
}
.name-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.finale .ribbon-label span {
  -webkit-text-stroke: .25px #ffe8b8;
  letter-spacing: .025em;
  filter: drop-shadow(.45px 1.15px .35px #391b32);
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .finale .ribbon-label span {
    background-image: repeating-linear-gradient(123deg, #ffedc4 0 .85px, #ba8a5b .95px 1.35px, #f9d9a3 1.45px 2px);
  }
}
@media (prefers-reduced-motion: reduce) { .turning { animation: none; } }

#music-toggle {
  position: fixed;
  z-index: 10;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: auto;
  min-height: 42px;
  padding: 6px 14px;
  border-radius: 40px;
  background: #fff8ec;
  color: #613544;
  box-shadow: 0 3px 15px #40263028;
  font: 1rem Roman, Georgia, serif;
}
body:has(#music-toggle:not([hidden])) { padding-bottom: 70px; }
.machine-sheet {
  transform: translate(var(--travel, 0px), var(--feed, 0px));
  transition: transform .14s ease;
}
.physical-carriage {
  position: absolute;
  z-index: 3;
  bottom: clamp(105px, 53.5cqw, 310px);
  left: 12%;
  width: 76%;
  height: clamp(8px, 2.8vw, 16px);
  border-radius: 4px;
  background: linear-gradient(#686064, #221d22 34%, #413b3e 75%, #17151a);
  box-shadow: 0 -1px #bdaa91, 0 2px 4px #2c2225;
  transform: translateX(var(--travel, 0px));
  transition: transform .14s ease;
}
.typewriter { container-type: inline-size; }
.carriage-handle {
  position: absolute;
  left: -5%;
  bottom: 50%;
  width: 9%;
  height: 5px;
  border-radius: 8px;
  background: linear-gradient(#eee0ba, #6f6263);
  transform: rotate(-23deg);
}
.door-panel.rose, .door-panel.sage, .door-panel.peach { --door: none; }
.door-panel { isolation: isolate; filter: drop-shadow(2px 5px 4px #48263050); }
.door-front {
  background: repeating-linear-gradient(88deg, #fff1c900 0 5px, #fde4bf16 7px, #36142026 9px, transparent 11px),
    linear-gradient(105deg, #f8d4ae28, transparent 52%, #240e1b63), var(--wood);
  box-shadow: inset 3px 2px 6px #f9dab679, inset -5px -4px 7px #260f22b0;
}
.door-front::before, .door-front::after {
  content: "";
  position: absolute;
  inset: 25% 15% 48%;
  background: linear-gradient(120deg, #ffeab43d, #0000 45%, #12101755);
  border: 4px ridge #e4ad8a68;
  box-shadow: 1px 3px 4px #2f101fac, inset 2px 2px 5px #441d28a1;
  border-radius: 2px;
}
.door-front::after { inset: 59% 15% 10%; }
.rose .door-crown, .peach .door-crown {
  position: absolute;
  inset: 6% 18% 77%;
  border: 2px ridge #e4ad8a63;
  border-radius: 65% 65% 3% 3%;
}
.peach .door-front::before { inset: 30% 28% auto; aspect-ratio: 1; transform: rotate(45deg); }
.front-knob { right: 10%; }
@media (prefers-reduced-motion: reduce) {
  .machine-sheet, .physical-carriage { transition: none; }
}

body { letter-spacing: .048em; }
h1 { letter-spacing: .065em; }
.letter-peek { letter-spacing: .06em; }
button, input, .door-form select { letter-spacing: inherit; }
.machine-sheet .typing, .machine-sheet .type-measure { letter-spacing: .055em; }
.finale .ribbon-label span { letter-spacing: .065em; }
@media (max-width: 420px) {
  h1 { letter-spacing: .048em; }
  .finale .ribbon-label span { letter-spacing: .05em; }
}

body { font-size: clamp(1.28rem, 4.8vw, 1.62rem); }
h1 { font-size: clamp(2rem, 7vw, 3.1rem); overflow-wrap: anywhere; }
.progress { font-size: 1.08rem; }
.door-option { font-size: clamp(.96rem, 4vw, 1.24rem); }
.read-all { font-size: 1.12rem; }
#music-toggle { font-size: 1.08rem; }
.finale .ribbon-label { font-size: clamp(1.07rem, 4.9vw, 1.56rem); }
