:root {
  color-scheme: light;
  color: #4b2817;
  background: #473020;
  font-family: Georgia, 'Times New Roman', serif;
  --ink: #482617;
  --gold: #976524;
  --paper: #f6e3c5;
  --wine: #742e31;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

.album {
  max-width: 510px;
  min-height: 100svh;
  position: relative;
  margin: 0 auto;
  padding: 14px 12px 20px;
  text-align: center;
  background-color: #c19967;
  background-image: url('hochzeit-kulisse.jpg'), linear-gradient(#f7e4c5 0 30%, #895735 34%, #4b2d1b);
  background-size: 100% 100%;
  box-shadow: 0 0 38px #21120880;
}

.dedication { position: relative; padding-inline: 13px; }
.ornament {
  width: min(68%, 220px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--gold);
}
.ornament::before, .ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 38px; height: 27px; flex: none; }
.heart-rule { font-size: 1.2rem; line-height: 1; }

h1 {
  color: #4f2814;
  font-weight: normal;
  font-style: italic;
  font-size: clamp(2.01rem, 7.7vw, 2.8rem);
  margin: 2px 0 5px;
  line-height: 1.08;
  text-wrap: balance;
}
.subtitle {
  color: #5b3421;
  font-size: clamp(.58rem, 2.2vw, .78rem);
  font-weight: bold;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.cryptex { position: relative; margin: -12px -12px -7px; }
.cryptex canvas { display: block; width: 100%; aspect-ratio: 1.85; }
.cryptex canvas:not([data-renderer]) { visibility: hidden; }
.cryptex-startbild {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.wedding-bands {
  position: absolute;
  right: 6%;
  bottom: -5px;
  width: 27%;
  height: auto;
  pointer-events: none;
}

.card {
  position: relative;
  isolation: isolate;
  border: 1px solid #cf9b54;
  border-radius: 13px 10px 12px 8px;
  background: radial-gradient(ellipse at 45% 45%, #fff5e3 0, #f5e0c0 72%, #e6c496);
  padding: 17px clamp(13px, 4.5vw, 23px) 14px;
  box-shadow: 0 9px 22px #24120675, inset 0 0 21px #a9682433;
  color: var(--ink);
}
.card::before, .card::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 6px;
  border: 1px solid #ae762caa;
  border-radius: 8px 7px 8px 6px;
  pointer-events: none;
}
.card::after {
  z-index: -2;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.34' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .55 0 0 0 0 .29 0 0 0 0 .08 .30 .30 .30 0 -.28'/%3E%3C/filter%3E%3Cpath filter='url(%23p)' d='M0 0h170v170H0z'/%3E%3C/svg%3E");
  background-size: 340px auto;
  opacity: .62;
  mix-blend-mode: multiply;
}
.corners {
  position: absolute;
  inset: 5px 6px;
  pointer-events: none;
  color: #a6712a;
  font-size: 1.4rem;
  line-height: 1;
}
.corners span { position: absolute; }
.corners span:nth-child(1) { top: 0; left: 0; }
.corners span:nth-child(2) { top: 0; right: 0; transform: scaleX(-1); }
.corners span:nth-child(3) { bottom: 0; left: 0; transform: scaleY(-1); }
.corners span:nth-child(4) { bottom: 0; right: 0; transform: scale(-1); }

.memory {
  display: grid;
  grid-template-columns: 32% minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 3.5vw, 17px);
  margin: 0 0 13px;
  text-align: left;
}
.keepsake {
  position: relative;
  margin: 4px 0 0;
  padding: 5px 5px 9px;
  min-width: 0;
  background: #fdf0d7;
  border: 1px solid #cfab78;
  box-shadow: 2px 5px 9px #5c32164d;
  transform: rotate(-7deg);
}
.keepsake::before {
  content: '';
  position: absolute;
  z-index: 1;
  width: 43%;
  height: 13px;
  top: -6px;
  left: 28%;
  background: #d8ae6ba6;
  box-shadow: 0 1px 2px #a37a4340;
  transform: rotate(6deg);
}
.keepsake-art {
  width: 100%;
  aspect-ratio: .88;
  background-color: #9f7548;
  background-image: url('erinnerungen.jpg');
  background-size: 300% 200%;
  background-position: var(--photo-x, 0%) var(--photo-y, 0%);
}

h2 {
  position: relative;
  isolation: isolate;
  margin: 0 0 9px;
  padding: 6px 7px 7px;
  font-weight: normal;
  font-style: italic;
  color: #fff4dc;
  font-size: clamp(1.1rem, 4.6vw, 1.65rem);
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
}
h2::before {
  content: '';
  position: absolute;
  inset: 0 -3px;
  z-index: -1;
  background: linear-gradient(104deg, #a35649, #8d413a 56%, #a65e50);
  transform: rotate(-2deg);
  clip-path: polygon(2% 14%, 11% 7%, 36% 4%, 57% 5%, 92% 1%, 98% 9%, 95% 23%, 100% 26%, 97% 44%, 99% 64%, 95% 76%, 98% 85%, 82% 94%, 39% 93%, 19% 98%, 2% 94%, 4% 79%, 0 75%, 3% 49%, 0 41%);
}
.story {
  color: #583522;
  font-family: 'Segoe Print', 'Bradley Hand', Georgia, serif;
  font-style: italic;
  font-size: clamp(.71rem, 2.95vw, .88rem);
  line-height: 1.42;
  margin: 0;
}
.card .heart-rule { width: 68%; font-size: 1.15rem; margin-bottom: 9px; }
.question {
  color: var(--ink);
  font-size: clamp(1.2rem, 5vw, 1.72rem);
  line-height: 1.1;
  font-weight: bold;
  margin: 0 auto 12px;
  text-wrap: balance;
}
.answer-form { display: grid; justify-items: center; gap: 11px; }
.answer {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  border: 1px solid #9f724a;
  border-radius: 11px;
  background: #fff8eadb;
  box-shadow: inset 0 1px 0 white;
  padding: 0 11px;
  color: #805738;
}
.answer svg { width: 18px; height: 18px; flex: none; }
.answer input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  color: var(--ink);
  background: transparent;
  border: 0;
  font: 1rem system-ui, sans-serif;
}
.answer input::placeholder { color: #856650; opacity: 1; }
.answer:focus-within { outline: 2px solid #874839; outline-offset: 2px; }
.answer input:focus-visible { outline: none; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
.action {
  min-height: 46px;
  width: min(100%, 287px);
  border: 1px solid #ffe0a0;
  outline: 1px solid #85541e;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff1d8;
  background: radial-gradient(ellipse at 50% 0, #994b4c, var(--wine) 78%, #5a2024);
  box-shadow: inset 0 0 0 1px #d9a85a, inset 0 1px 4px #e9aa8a7a, 0 4px 8px #59291e4f;
  font-size: clamp(1rem, 4.2vw, 1.26rem);
}
.action:disabled { opacity: .77; cursor: wait; }
.next { margin-top: 9px; }
.message { margin: 9px 0 0; font: 500 .87rem/1.35 system-ui, sans-serif; }
.message:empty { display: none; }
.message.good { color: #385523; }
.message.bad { color: #8b251e; }
.progress {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 11px;
  margin-top: 12px;
  color: #6e492d;
  font: .68rem/1.25 system-ui, sans-serif;
}
.dots { display: flex; gap: 4px; }
.dot { width: 6px; height: 6px; background: #c7a875; border-radius: 50%; }
.dot.done { background: #597034; }
.reset {
  min-height: 44px;
  background: #3b2418c7;
  border: 1px solid #a87b50;
  border-radius: 999px;
  color: #ffedce;
  margin-top: 12px;
  padding: 5px 13px;
  font: .78rem system-ui, sans-serif;
}
.browser-note { color: #ffedce; background: #3b2418c7; border-radius: 7px; padding: 10px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
:focus-visible { outline: 3px solid #9a4e3d; outline-offset: 3px; }

body:has(.celebration[open]) { overflow: hidden; }
.celebration {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at 50% 27%, #9b612a4d, transparent 65%);
  color: #fff0d4;
  text-align: center;
}
.celebration::backdrop { background: #25150ff2; backdrop-filter: blur(5px); }
.celebration-content { position: relative; width: min(100%, 460px); margin: auto; padding: 18px 12px 14px; }
.celebration-names, .celebration-label {
  margin: 0 0 6px;
  color: #f3ce8c;
  font: bold .73rem/1.35 system-ui, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.celebration h2 {
  max-width: 8em;
  margin: 0 auto;
  padding: 3px 0;
  color: #ffe4ae;
  font: bold italic clamp(2.25rem, 10vw, 3.2rem)/.98 Georgia, serif;
}
.celebration h2::before { content: none; }
.celebration h2:focus { outline: none; }
.celebration-cryptex { display: block; width: 100%; margin: 2px auto -2px; }
.celebration-reactions { display: grid; justify-items: center; gap: 10px; margin: 8px 0 12px; }
.celebration-reactions img {
  display: block;
  width: min(45vw, 165px);
  height: auto;
  border: 3px solid #ddb578;
  border-radius: 12px;
  box-shadow: 0 5px 15px #160a068c;
}
.celebration-label { font-size: .63rem; letter-spacing: .11em; }
.celebration-code {
  width: fit-content;
  margin: 0 auto 7px;
  padding: 8px 16px 8px calc(16px + .25em);
  border: 1px solid #bd965a;
  border-radius: 12px;
  background: #3a2519;
  color: #fff1d1;
  font: bold 1.6rem Georgia, serif;
  letter-spacing: .25em;
}
.celebration-close {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  color: #f5d8aa;
  background: transparent;
  font: .77rem system-ui, sans-serif;
  text-decoration: underline;
}
.celebration-confetti { position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.celebration-confetti i {
  position: absolute;
  top: -10px;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * .65);
  background: var(--color);
  opacity: .84;
  animation: celebration-fall var(--duration) var(--delay) linear infinite;
}
.celebration-confetti i:nth-child(4n) { border-radius: 50%; }
@keyframes celebration-fall {
  from { transform: translate3d(0, 0, 0) rotate(0); }
  to { transform: translate3d(var(--drift), calc(100vh + 20px), 0) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) { .celebration-confetti { display: none; } }

.letter-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 1.5vw, 9px);
  width: min(100%, 360px);
  margin: 0 auto 12px;
  padding: 0;
  list-style: none;
}
.letter-tile {
  display: grid;
  gap: 1px;
  place-items: center;
  width: 100%;
  min-height: 46px;
  padding: 3px 2px;
  border: 1px solid #ae8156;
  border-radius: 6px;
  background: #f3dfb9;
  color: #684929;
}
.letter-tile:disabled { opacity: 1; cursor: default; }
.letter-tile.collected { background: #f8e9ca; }
#letter-tiles .letter-tile:not(:disabled) {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.letter-tile small { font: .68rem system-ui, sans-serif; }
.letter-tile strong { font: bold 1.2rem Georgia, serif; }
.final-tiles { margin-top: 10px; margin-bottom: 4px; }
.final-tiles .letter-tile { border-style: dashed; background: #fff6e2; }
.letter-tile[aria-pressed="true"], .letter-tile.drop-target {
  outline: 2px solid #8c5a28;
  outline-offset: 2px;
}
.letter-tile.placed {
  color: #284422;
  border: 1px solid #617340;
  background: #d8e5bb;
  box-shadow: inset 0 0 0 1px #edf5d5;
}
.letter-tile.wrong-tile { color: #7c251f; border-color: #9d382b; background: #f5c6b8; }
.letter-tile.drag-preview {
  position: fixed;
  z-index: 10;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 4px 10px #3b241861;
}
.tile-instructions { font: .92rem/1.35 system-ui, sans-serif; }
.keepsake img { display: block; width: 100%; height: 100%; object-fit: cover; }
.memory:has(.keepsake[hidden]) { display: block; }
.choices { display: grid; gap: 7px; width: 100%; margin: 0; padding: 0; border: 0; text-align: left; }
.choices label { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 10px; border: 1px solid #9f724a; border-radius: 9px; background: #fff8eadb; }
.choices input { accent-color: var(--wine); }
.hints, #video-slot details { margin: 9px 0; color: #5b3421; font: .84rem/1.45 system-ui, sans-serif; }
.hints summary, #video-slot summary { cursor: pointer; padding: 5px 0; }
.hints ul { text-align: left; padding-inline-start: 20px; }
#video-slot video { display: block; width: 100%; max-height: 220px; margin: 10px 0; border-radius: 8px; }
.final-order { color: #5b3421; margin: 0 0 9px; font: 600 .88rem/1.4 system-ui, sans-serif; }
.final-code { overflow-wrap: anywhere; }
.test-controls { margin: 12px; padding: 10px; background: #fff1d8; border-radius: 8px; color: #522c28; }
