:root {
  color-scheme: dark;
  font-family: Georgia, serif;
  background: #21130f;
  --art: url("assets/wunschzettel-vorlage.png");
}

* { box-sizing: border-box; }

body { margin: 0; }

.preview {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 25%, #37415b, transparent 62%),
    linear-gradient(#38261c, #391913);
}

.wish-dialog {
  width: min(96vw, 36rem);
  max-width: none;
  max-height: 96dvh;
  padding: 0;
  border: 0;
  color: #522609;
  background: transparent;
  scrollbar-width: thin;
}

.wish-dialog::backdrop { background: #100807a8; }

.wish-sheet {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 32% 32% 6% 6% / 15% 15% 4% 4%;
  padding: 34% 5% 0;
}

.wish-sheet::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 14% 2% 2%;
  border: clamp(5px, 1.4cqw, 9px) solid #89401a;
  border-radius: 5%;
  background: radial-gradient(ellipse at 50% 33%, #fff0cb 10%, #ffe1af 65%, #eeb879);
  box-shadow: inset 0 0 0 2px #e6a14e, inset 0 0 1.5rem #8d40084d;
}

.crest, .village, .base {
  position: absolute;
  pointer-events: none;
  background: var(--art) no-repeat;
  background-size: 100% auto;
}

.crest {
  inset: 0 0 auto;
  height: 42cqw;
  background-position: center -26.4cqw;
  clip-path: polygon(2% 61%, 6% 48%, 12% 39%, 20% 39%, 28% 28%, 36% 24%, 37% 7%, 41% 0, 45% 0, 50% 10%, 54% 3%, 60% 0, 64% 5%, 64% 23%, 72% 27%, 80% 39%, 87% 37%, 94% 46%, 98% 62%, 97% 100%, 87% 100%, 86% 76%, 14% 76%, 13% 100%, 3% 100%);
}

.wish-heading { position: relative; text-align: center; }

h1 {
  margin: 0;
  color: #a71d0d;
  font: bold italic clamp(20px, 6.5cqw, 40px)/1.08 Georgia, serif;
  text-shadow: 0 1px #fff3cc;
}

.wish-heading p {
  display: inline-block;
  margin: .55em 0 0;
  padding: .2em 1em;
  border-radius: 2em;
  background: linear-gradient(90deg, #edb363, #ffdda4, #edb363);
  font-weight: bold;
  font-size: clamp(16px, 4.65cqw, 25px);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  margin: .23em 0 .45em;
  color: #ad6515;
  font-size: clamp(17px, 5cqw, 28px);
}

.divider::before, .divider::after {
  content: "";
  width: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c07c36, transparent);
}

.wish-list, .materials {
  list-style: none;
  padding: 0;
  margin: 0;
}

.wish-list { display: grid; gap: 3cqw; }

.wish-row {
  display: grid;
  grid-template-columns: 19cqw minmax(0, 1fr) auto minmax(24cqw, auto);
  align-items: center;
  gap: 2cqw;
  min-height: 17cqw;
  padding: 0 1.8cqw 0 0;
  border-radius: 3.8cqw;
  border: 1px solid #d6a46180;
  background: linear-gradient(#fff0cc, #f8dca9);
  box-shadow: inset 0 1px #fff9e6, 0 1px #bd80362e;
  font-size: clamp(16px, 5.2cqw, 29px);
}

.wish-row strong { overflow-wrap: anywhere; }

.quantity {
  padding: .2em .45em;
  border-radius: 1em;
  background: #f7d396;
  color: #a3160c;
  font: 800 1em/1.1 system-ui, sans-serif;
  white-space: nowrap;
}

.materials { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1cqw; }
.materials li { position: relative; }

.sprite {
  display: block;
  width: calc(var(--sprite-width) * var(--scale));
  height: calc(var(--sprite-height) * var(--scale));
  background: var(--art) no-repeat
    calc(var(--sprite-x) * var(--scale) * -1)
    calc(var(--sprite-y) * var(--scale) * -1) /
    calc(851 * var(--scale)) calc(1847 * var(--scale));
}

.train, .doll {
  --scale: .126cqw;
  --sprite-x: 70;
  --sprite-width: 149;
  --sprite-height: 145;
  clip-path: polygon(3% 12%, 30% 7%, 29% 4%, 55% 0, 57% 5%, 90% 2%, 100% 86%, 96% 92%, 11% 100%, 6% 94%);
}

.train { --sprite-y: 669; }
.doll { --sprite-y: 829; }

.wood, .yarn, .paint {
  --scale: .116cqw;
  --sprite-width: 70;
  --sprite-height: 64;
}
.wood {
  --sprite-x: 550;
  --sprite-y: 874;
  clip-path: polygon(5% 53%, 15% 45%, 15% 20%, 28% 8%, 77% 8%, 92% 17%, 96% 44%, 100% 52%, 100% 74%, 89% 84%, 15% 84%, 1% 72%);
}
.yarn {
  --sprite-x: 620;
  --sprite-y: 875;
  clip-path: polygon(15% 75%, 26% 73%, 18% 55%, 20% 28%, 33% 10%, 60% 1%, 80% 7%, 94% 28%, 98% 52%, 89% 73%, 72% 80%, 41% 81%, 30% 93%, 9% 92%, 7% 84%);
}
.paint {
  --sprite-x: 685;
  --sprite-y: 712;
  --sprite-width: 55;
  clip-path: polygon(6% 28%, 19% 16%, 30% 12%, 32% 5%, 56% 2%, 72% 7%, 75% 13%, 89% 19%, 95% 32%, 96% 89%, 83% 97%, 18% 98%, 3% 89%);
}

.material-count {
  position: absolute;
  right: -.2em;
  bottom: -.05em;
  min-width: 1.15em;
  text-align: center;
  border-radius: 40%;
  border: 1px solid #b88e56;
  background: #ffe8c7;
  font: bold clamp(12px, 2.9cqw, 17px)/1.15 system-ui, sans-serif;
}

.wish-footer {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: end;
  min-height: clamp(150px, 58cqw, 290px);
  isolation: isolate;
  padding-bottom: 14cqw;
}

.village {
  z-index: -1;
  width: 100%;
  bottom: 17cqw;
  height: 22cqw;
  background-size: 110% auto;
  background-position: center -162cqw;
  opacity: .8;
  mask-image: linear-gradient(transparent, black 44%, black 70%, transparent);
}

.base {
  inset: auto -5.55% 0;
  height: 15cqw;
  background-position: center -199.5cqw;
  clip-path: polygon(2% 2%, 20% 0, 27% 31%, 45% 37%, 50% 17%, 55% 37%, 72% 31%, 80% 0, 98% 2%, 98% 74%, 95% 94%, 84% 100%, 15% 100%, 5% 94%, 2% 74%);
}

.wish-footer::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: auto -5.55% 13cqw;
  height: 18cqw;
  background: var(--art) no-repeat center -184cqw / 100% auto;
  clip-path: polygon(2% 100%, 2% 54%, 5% 41%, 8% 23%, 12% 19%, 16% 25%, 20% 53%, 21% 100%, 79% 100%, 80% 58%, 84% 38%, 89% 19%, 94% 29%, 97% 44%, 98% 65%, 98% 100%, 79% 100%, 21% 100%);
}

.gold-button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: .3em 1.15em .38em;
  border: 4px ridge #ffc850;
  border-radius: 3em;
  background: linear-gradient(#83ba26, #318014 52%, #14551c);
  box-shadow: inset 0 0 0 2px #1c5819, 0 4px 8px #7234098c;
  color: #fffce9;
  text-shadow: 0 2px #174318;
  font: 750 clamp(22px, 6.5cqw, 37px)/1.2 system-ui, sans-serif;
}

.gold-button:hover { filter: brightness(1.13); }
.gold-button:focus-visible { outline: 3px solid #fff4bb; outline-offset: 3px; }

.play {
  width: .87em;
  height: .93em;
  background: linear-gradient(#fff2ab, #f8a82a);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-height: 700px) {
  .wish-footer { min-height: 27cqw; }
}

.preview-actions {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  padding: 1rem;
  text-align: center;
}

.preview-actions a {
  color: #fffce9;
  text-underline-offset: .25em;
}
