@font-face {
  font-family: "Maguntia";
  src: url("fonts/unifraktur-maguntia-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Garamond";
  src: url("fonts/eb-garamond-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Garamond";
  src: url("fonts/eb-garamond-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --parchment: #e9dbb8;
  --parchment-dark: #cdb784;
  --parchment-shadow: #8a734a;
  --ink: #2a1c14;
  --ink-soft: #4a362a;
  --blood: #7a0f1a;
  --blood-deep: #4c0912;
  --brass: #8a6a2f;
  --brass-light: #c6a24f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Garamond", Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 15% 20%, rgba(138, 115, 74, 0.35), transparent 60%),
    radial-gradient(ellipse 50% 35% at 85% 75%, rgba(138, 115, 74, 0.3), transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 50%, var(--parchment), var(--parchment-dark) 85%);
  overflow-x: hidden;
  scrollbar-color: var(--blood) var(--parchment-dark);
}

body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track {
  background: var(--parchment-dark);
}

body::-webkit-scrollbar-thumb {
  background: var(--blood);
  border-radius: 999px;
}

::selection {
  background: var(--blood);
  color: var(--parchment);
}

:focus-visible {
  outline: 3px solid var(--blood);
  outline-offset: 3px;
  border-radius: 2px;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 48px 20px;
  box-sizing: border-box;
}

.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ad-content,
.card-content,
.quiz-content,
.prize-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

/* ---------- Candle decoration (global, replaces confetti) ---------- */

.candle-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.candle {
  position: absolute;
  width: 34px;
  height: auto;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
}

.candle .flame {
  fill: var(--brass-light);
  stroke: none;
  transform-origin: 50% 100%;
}

.candle--tl {
  top: 24px;
  left: 24px;
}

.candle--br {
  bottom: 24px;
  right: 24px;
  transform: rotate(180deg) scaleX(-1);
}

@media (prefers-reduced-motion: no-preference) {
  .candle .flame {
    animation: flicker 2.6s ease-in-out infinite;
  }
}

@keyframes flicker {
  0%, 100% { transform: scale(1) skewX(0deg); opacity: 1; }
  30% { transform: scale(1.05, 0.95) skewX(-2deg); opacity: 0.85; }
  55% { transform: scale(0.95, 1.08) skewX(2deg); opacity: 1; }
  80% { transform: scale(1.03, 0.97) skewX(-1deg); opacity: 0.9; }
}

/* ---------- Shared ornaments ---------- */

.section-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  fill: none;
  stroke: var(--blood);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-icon.laurel {
  width: 110px;
  height: auto;
  stroke: var(--brass);
}

.bat-ornament {
  width: 110px;
  height: auto;
  fill: var(--ink-soft);
  opacity: 0.8;
  margin-bottom: 4px;
}

/* ---------- Ad screen ---------- */

.ad-headline {
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.3;
  color: var(--blood-deep);
  margin: 0 0 16px;
}

.ad-subline {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.agb {
  margin-top: 44px;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
  background: rgba(233, 219, 184, 0.55);
  border: 1px solid var(--brass);
  box-shadow: inset 0 0 0 1px rgba(122, 15, 26, 0.15), 0 3px 10px rgba(42, 28, 20, 0.25);
  border-radius: 4px;
  padding: 20px 24px;
}

.agb h2 {
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--blood);
  margin: 0 0 6px;
}

.agb-note {
  font-style: italic;
  margin-top: 0;
}

/* ---------- Wax seal button ---------- */

.wax-seal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  padding: 16px 34px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: var(--parchment);
  background: radial-gradient(circle at 35% 30%, #a3222f, var(--blood) 55%, var(--blood-deep) 100%);
  box-shadow:
    0 3px 0 var(--blood-deep),
    0 6px 10px rgba(42, 28, 20, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.wax-seal svg {
  width: 18px;
  height: 18px;
  stroke: var(--parchment);
  stroke-width: 1.4;
  fill: none;
}

.wax-seal--small {
  font-size: 1rem;
  padding: 12px 26px;
  margin-top: 6px;
  align-self: center;
}

.wax-seal:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--blood-deep),
    0 3px 6px rgba(42, 28, 20, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.wax-seal:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.45;
  box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
  .wax-seal:not(:disabled) {
    animation: seal-breathe 3s ease-in-out infinite;
  }
}

@keyframes seal-breathe {
  0%, 100% { box-shadow: 0 3px 0 var(--blood-deep), 0 6px 10px rgba(42, 28, 20, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.25); }
  50% { box-shadow: 0 3px 0 var(--blood-deep), 0 8px 16px rgba(122, 15, 26, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.3); }
}

/* ---------- Reveal screen ---------- */

.reveal-content {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.reveal-frame {
  display: inline-block;
  padding: 10px;
  background: var(--parchment);
  border: 2px solid var(--brass);
  box-shadow:
    0 0 0 1px var(--blood) inset,
    0 10px 24px rgba(42, 28, 20, 0.45);
  border-radius: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal-frame {
    animation: reveal-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}

@keyframes reveal-in {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.reveal-frame img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  border-radius: 2px;
}

.reveal-caption {
  margin-top: 20px;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* ---------- Card screen ---------- */

.card-headline {
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: 1.8rem;
  color: var(--blood-deep);
  margin: 0 0 10px;
}

.card-subline {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

#form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

#form-card label {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 4px;
  display: block;
}

#form-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 2px;
  border: 1px solid var(--brass);
  background: rgba(255, 252, 240, 0.5);
  color: var(--ink);
  font-family: "Garamond", Georgia, serif;
  font-size: 1.05rem;
}

#form-card input::placeholder {
  color: #5c4a32;
}

.card-row {
  display: flex;
  gap: 14px;
}

.card-row > div {
  flex: 1;
}

/* ---------- Quiz screen ---------- */

.quiz-headline {
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: 2rem;
  color: var(--blood-deep);
  margin: 0 0 28px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.quiz-option {
  font-family: "Garamond", Georgia, serif;
  font-size: 1.15rem;
  padding: 16px;
  border-radius: 2px;
  border: 1px solid var(--brass);
  background: rgba(255, 252, 240, 0.4);
  color: var(--ink);
  cursor: pointer;
}

.quiz-option.selected {
  border-color: var(--blood);
  border-width: 2px;
  background: rgba(122, 15, 26, 0.12);
  color: var(--blood-deep);
  font-style: italic;
}

/* ---------- Prize screen ---------- */

.prize-headline {
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: 2.1rem;
  color: var(--blood-deep);
  margin: 0 0 32px;
}

.prize-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

@media (max-width: 520px) {
  .prize-grid {
    grid-template-columns: 1fr;
  }
}

.prize-card {
  background: rgba(255, 252, 240, 0.5);
  border: 1px solid var(--brass);
  box-shadow: inset 0 0 0 1px rgba(122, 15, 26, 0.12), 0 3px 10px rgba(42, 28, 20, 0.25);
  border-radius: 4px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.prize-card:hover,
.prize-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px rgba(122, 15, 26, 0.12), 0 6px 16px rgba(42, 28, 20, 0.35);
}

.prize-card h3 {
  margin: 0;
  font-family: "Maguntia", "UnifrakturMaguntia", serif;
  font-weight: 400;
  color: var(--blood);
  font-size: 1.2rem;
  word-break: break-word;
}

.prize-card .qr {
  background: #fdfaf0;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--brass);
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
}

.prize-card .qr img,
.prize-card .qr canvas,
.prize-card .qr table {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- Seal-burst (confetti, translated into the world's material) ---------- */

.particle-burst {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 10px;
  height: 7px;
  opacity: 1;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  animation: particle-fly var(--dur) cubic-bezier(0.16, 1, 0.3, 1) var(--delay) forwards;
}

.particle--dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.particle--flake {
  width: 8px;
  height: 8px;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

@keyframes particle-fly {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}
