@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/dm-serif-display-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/dm-serif-display-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --pine: #0f3b2d;
  --pine-2: #17543f;
  --pine-tint: #e2efe7;
  --berry: #a52038;
  --berry-2: #c0304b;
  --berry-tint: #f8e1e4;
  --gold: #c39033;
  --gold-light: #ead09a;
  --gold-tint: #f8edd5;
  --cream: #f4ecdc;
  --paper: #fffaf0;
  --ink: #1c2a23;
  --muted: #5d6a62;
  --line: #e3d4b6;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(rgb(255 255 255 / 0.85) 1.2px, transparent 1.6px),
    radial-gradient(rgb(255 255 255 / 0.6) 1px, transparent 1.4px);
  background-size: 28px 28px, 28px 28px;
  background-position: 0 0, 14px 14px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

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

/* Demo bar */
.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 14px;
  padding: 2px 14px;
  background: #0a2a20;
  color: var(--cream);
  font-size: 14px;
}
.demo-bar__note { margin: 0; display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.demo-bar__note strong { padding: 1px 10px; border-radius: 999px; background: var(--gold); color: #1a1408; font-weight: 700; letter-spacing: 0.02em; }
.demo-bar__actions { display: flex; gap: 4px; margin-left: auto; }
.demo-bar__reset, .demo-bar__made {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--cream);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.demo-bar__made { color: var(--gold-light); }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 20px 86px;
  color: var(--cream);
  background:
    radial-gradient(90% 70% at 85% 10%, rgb(195 144 51 / 0.22), transparent 60%),
    radial-gradient(120% 90% at 10% 0%, #1f6149 0%, var(--pine) 55%, #0a2a20 100%);
}
.snow { position: absolute; inset: 0; width: 100%; height: 100%; fill: #fff; }
.gifts { display: none; }
.gifts__sparkle { fill: var(--gold-light); }
.hero__inner { position: relative; max-width: 1100px; margin: 0 auto; }
.hero__group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 8px 0 4px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 13vw, 104px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.hero h1 em { color: var(--gold-light); font-style: italic; }
.hero__when { margin: 0; font-size: 17px; color: rgb(244 236 220 / 0.86); }
.hero__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 24px 0 0; max-width: 520px; }
.hero__facts div {
  padding: 12px 12px 10px;
  border: 1px solid rgb(234 208 154 / 0.35);
  border-radius: 16px;
  background: rgb(10 42 32 / 0.45);
  backdrop-filter: blur(2px);
}
.hero__facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: rgb(244 236 220 / 0.7); }
.hero__facts dd { margin: 2px 0 0; font-family: var(--serif); font-size: 36px; line-height: 1; color: var(--gold-light); }

/* Page */
.shell { position: relative; max-width: 1100px; margin: -58px auto 0; padding: 0 16px 48px; }

.status {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 48px -28px rgb(10 42 32 / 0.7);
}
.status__ribbon {
  position: absolute;
  top: -1px;
  right: 26px;
  width: 26px;
  height: 58px;
  background: var(--berry);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.status__kicker { display: flex; align-items: center; gap: 8px; margin: 0 40px 6px 0; color: var(--berry); font-weight: 650; font-size: 14px; }
.status h2 { margin: 0 40px 0 0; font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.1; }
.status__note { margin: 10px 0 0; color: var(--muted); }
.meter { height: 12px; margin-top: 14px; border-radius: 999px; background: var(--gold-tint); overflow: hidden; box-shadow: inset 0 0 0 1px rgb(195 144 51 / 0.3); }
.meter span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), #d9ab54); }
.status__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  font-weight: 650;
  font-size: 16px;
  transition: transform 0.12s ease, background 0.2s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; }
.btn--berry { background: var(--berry); color: #fff; box-shadow: 0 8px 18px -10px rgb(165 32 56 / 0.8); }
.btn--berry:hover:not(:disabled) { background: var(--berry-2); }
.btn--line { border-color: var(--pine); color: var(--pine); background: transparent; }
.btn--line:hover { background: var(--pine-tint); }
.btn--small { min-height: 44px; padding: 0 14px; border-color: var(--line); background: #fff; color: var(--pine); font-size: 14px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Shuffle state */
.status--shuffle { text-align: center; }
.status--shuffle h2 { margin: 6px 0 0; }
.status--shuffle p { margin: 6px 0 0; color: var(--muted); }
.hat { display: flex; justify-content: center; gap: 8px; height: 64px; align-items: flex-end; }
.hat span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--pine);
  color: var(--gold-light);
  font-family: var(--serif);
  font-size: 22px;
  animation: hop 0.7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.09s);
}
@keyframes hop { 50% { transform: translateY(-20px) rotate(12deg); } }

/* Drawn state */
.reveal-pick { display: grid; gap: 10px; margin-top: 16px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field__label { padding: 0; font-weight: 650; font-size: 15px; }
.field__hint { font-size: 13px; color: var(--muted); }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
}
.field input:focus, .field select:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 3px rgb(23 84 63 / 0.18); }
.field fieldset input + input, fieldset.field input + input { margin-top: 2px; }

.envelope {
  position: relative;
  margin-top: 18px;
  padding: 16px 16px 0;
  border-radius: 18px;
  background: linear-gradient(160deg, #8e1a2f, var(--berry));
  overflow: hidden;
  min-height: 200px;
  transition: min-height 0.5s ease;
}
.envelope__card {
  position: relative;
  z-index: 1;
  min-height: 150px;
  padding: 18px 18px 22px;
  border-radius: 12px;
  background: var(--paper);
  transform: translateY(54px);
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.envelope__front {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  height: 128px;
  background: linear-gradient(180deg, #b62841, #9d1d34);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  transition: transform 0.55s ease, opacity 0.55s ease;
}
.seal {
  position: absolute;
  top: 34%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #e7c27c, var(--gold));
  color: #5c3f0b;
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.25);
}
.seal .icon { width: 26px; height: 26px; }
.envelope--open { min-height: 0; padding-bottom: 16px; }
.envelope--open .envelope__card { transform: none; }
.envelope--open .envelope__front { transform: translateY(100%); opacity: 0; }
.envelope__sealed { margin: 0; text-align: center; font-family: var(--serif); font-size: 22px; color: var(--muted); }
.envelope__to { margin: 0; color: var(--muted); font-weight: 600; }
.envelope__name { margin: 2px 0 10px; font-family: var(--serif); font-size: 42px; line-height: 1.05; color: var(--berry); }
.envelope__wishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.envelope__wishes li { display: flex; gap: 10px; align-items: flex-start; }
.envelope__wishes .icon { margin-top: 2px; color: var(--pine-2); }
.envelope__none { margin: 0; color: var(--muted); }
.envelope__budget { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-weight: 650; color: var(--pine); }

/* Layout */
.layout { display: grid; gap: 28px; margin-top: 30px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 30px; }
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }

/* Gift tags */
.tags { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.tags li { min-width: 0; }
.tag {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  width: 100%;
  min-height: 150px;
  padding: 34px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 18px 18px;
  background: var(--paper);
  text-align: left;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 12px 24px -18px rgb(10 42 32 / 0.65);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}
.tag:hover { transform: rotate(0deg) translateY(-3px); box-shadow: 0 18px 30px -18px rgb(10 42 32 / 0.6); }
.tag::before { content: ""; position: absolute; inset: 0 0 auto; height: 22px; background: var(--band); }
.tag--berry { --band: var(--berry); }
.tag--pine { --band: var(--pine-2); }
.tag--gold { --band: var(--gold); }
.tag__eyelet {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 0 0 3px var(--gold-light);
}
.tag__initial {
  position: absolute;
  right: 8px;
  bottom: -14px;
  font-family: var(--serif);
  font-size: 84px;
  line-height: 1;
  color: var(--band);
  opacity: 0.12;
}
.tag__label { font-family: var(--serif); font-size: 23px; line-height: 1.1; }
.tag__name { font-size: 14px; color: var(--muted); }
.tag__wishes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pine-tint);
  color: var(--pine);
  font-size: 13px;
  font-weight: 650;
}
.tag__wishes--none { background: var(--berry-tint); color: var(--berry); }
.tag__pair { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.tag__pair .icon { color: var(--berry); width: 14px; height: 14px; }
.tag--add {
  border: 2px dashed var(--gold);
  background: rgb(255 250 240 / 0.6);
  box-shadow: none;
  justify-items: start;
}
.tag--add::before { display: none; }
.tag--add .tag__name { font-size: 13px; }
.tag__plus {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -16px 0 8px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
}
.tags--shuffling li { animation: jiggle 0.32s ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -0.05s); }
@keyframes jiggle { from { transform: translate(-3px, 2px) rotate(-3deg); } to { transform: translate(3px, -3px) rotate(3deg); } }

/* Cards on the side */
.side { display: grid; gap: 20px; align-content: start; min-width: 0; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); }
.rules h2 { margin: 0 0 12px; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.rules ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rules li { display: flex; gap: 12px; align-items: flex-start; }
.rules li strong { display: block; }
.rules li span:last-child { color: var(--muted); font-size: 15px; }
.rules li strong { color: var(--ink); font-size: 16px; }
.rules__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--gold-tint); color: #8a6420; }
.emails .section-head h2 { font-size: 26px; }
.emails__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.emails__list li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.emails__list li:last-child { border-bottom: 0; }
.emails__dot { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; color: #fff; font-family: var(--serif); font-size: 17px; }
.dot--berry { background: var(--berry); }
.dot--pine { background: var(--pine-2); }
.dot--gold { background: var(--gold); }
.emails__who { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.emails__who small { display: inline-flex; align-items: center; gap: 4px; color: var(--pine-2); font-weight: 600; }
.emails__who small .icon { width: 14px; height: 14px; }

/* Make your own */
.own { margin-top: 34px; padding: 22px; border: 1.5px dashed var(--gold); border-radius: 22px; background: rgb(255 250 240 / 0.7); }
.own__label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--berry); }
.own__words { margin: 8px 0; font-family: var(--serif); font-size: 23px; line-height: 1.3; }
.own__note { margin: 0; color: var(--muted); font-size: 14px; }

/* Dialogs */
.dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgb(10 42 32 / 0.6);
}
.dialog::backdrop { background: rgb(10 42 32 / 0.6); }
.dialog__body { padding: 20px 20px 22px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dialog__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; }
.dialog__close { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.dialog__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.wish__list { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 18px; }
.wish__list li::marker { color: var(--berry); font-family: var(--serif); }
.wish__none { margin: 0; color: var(--muted); }
.wish__pair { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--berry-tint); color: var(--berry); font-weight: 600; font-size: 15px; }
.mail { display: grid; gap: 14px; }
.mail__head { margin: 0; display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.mail__head div { display: grid; grid-template-columns: 68px 1fr; gap: 8px; }
.mail__head dt { color: var(--muted); }
.mail__head dd { margin: 0; font-weight: 600; }
.mail__body { padding: 4px 4px 0; }
.mail__body p { margin: 0 0 10px; }
.mail__body ul { margin: 0 0 10px; padding-left: 20px; }
.mail__sign { font-family: var(--serif); font-size: 22px; color: var(--berry); }
.mail__demo { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--gold-tint); color: #7a5716; font-size: 14px; font-weight: 600; }
.form { display: grid; gap: 16px; }
.form__problem { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--berry-tint); color: var(--berry); font-weight: 600; }
.form__actions { display: flex; justify-content: flex-end; }
fieldset.field { gap: 8px; }

/* Toast */
.toast-region { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 20; display: grid; justify-items: center; pointer-events: none; }
.toast { margin: 0 16px; padding: 12px 18px; border-radius: 14px; background: var(--pine); color: var(--cream); font-weight: 600; box-shadow: 0 16px 30px -14px rgb(10 42 32 / 0.8); animation: toast-in 0.25s ease; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

@media (min-width: 640px) {
  .tags { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reveal-pick { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}

@media (min-width: 980px) {
  .hero { padding: 56px 32px 112px; }
  .gifts { display: block; position: absolute; right: max(32px, calc(50% - 560px)); bottom: 96px; width: 360px; height: auto; }
  .hero__facts { gap: 14px; }
  .hero__facts dd { font-size: 44px; }
  .shell { margin-top: -72px; padding: 0 28px 64px; }
  .status { padding: 30px 32px 28px; max-width: 760px; }
  .status h2 { font-size: 40px; }
  .layout { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 36px; align-items: start; }
  .tags { gap: 20px 16px; }
}

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