:root {
  --red: #b91c1c;
  --red-dark: #7f1d1d;
  --green: #166534;
  --green-soft: #dcfce7;
  --gold: #d97706;
  --gold-soft: #fef3c7;
  --cream: #fff8ed;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #5b6472;
  --line: #eadfd2;
  --shadow: 0 18px 50px rgba(127, 29, 29, 0.10);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
    radial-gradient(circle at 30% 80%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
    linear-gradient(180deg, #fff8ed 0%, #fdf2df 50%, #f7ead6 100%);
  background-size: 180px 180px, 240px 240px, 220px 220px, 100% 100%;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }

/* Header */
.site-header {
  background: rgba(127, 29, 29, 0.97);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--red-dark);
  display: inline-grid;
  place-items: center;
  font-size: 19px;
}
.nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.nav a { color: #fde68a; font-weight: 600; }
.nav a:hover { color: #fff; }

/* Hero */
.hero { padding: 58px 0 22px; text-align: center; }
.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--red-dark);
}
.lede {
  margin: 0 auto;
  max-width: 760px;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--muted);
}
.lede strong { color: var(--ink); }

/* Builder */
.builder {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(340px, 1.15fr);
  gap: 24px;
  align-items: start;
  margin: 26px 0 46px;
}
.panel,
.result-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 24px; }
.panel h2 { margin: 0 0 4px; font-size: 20px; color: var(--red-dark); }
.panel .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 800; color: var(--muted); }
input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
input[type="text"]:focus { outline: 3px solid rgba(185, 28, 28, 0.25); border-color: var(--red); }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-size: 13px; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.vibes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vibe {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.vibe:hover { border-color: var(--gold); }
.vibe[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

button.primary {
  width: 100%;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.25);
}
button.primary:hover { filter: brightness(1.05); }
.hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* Result */
.result-wrap { padding: 22px; min-height: 420px; }
.gift-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
}
.gift-banner.hidden { display: none; }
.empty-result {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 24px;
  font-size: 15px;
}
.empty-result .big { font-size: 42px; display: block; margin-bottom: 8px; }
.empty-result.hidden { display: none; }

.elf-result {
  position: relative;
  border: 4px solid var(--red);
  border-radius: 18px;
  padding: 26px 24px 22px;
  background:
    radial-gradient(circle at 8% 12%, rgba(217, 119, 6, 0.10) 0 3px, transparent 3px),
    radial-gradient(circle at 92% 88%, rgba(22, 101, 52, 0.10) 0 3px, transparent 3px),
    #fffdf8;
  box-shadow: inset 0 0 0 3px var(--gold-soft);
  text-align: center;
}
.elf-result.hidden { display: none; }
.elf-result::before {
  content: "★";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.cert-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
}
.cert-recipient { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.cert-recipient strong { color: var(--ink); }
.elf-name {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
  color: var(--red-dark);
  overflow-wrap: anywhere;
}
.elf-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.elf-status {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.elf-meta {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed #e7d7c8;
  color: var(--muted);
  font-size: 12px;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.result-actions button {
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.result-actions button:hover { border-color: var(--red); color: var(--red-dark); }
.result-actions button.primary-action {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.result-actions button.primary-action:hover { color: #fff; filter: brightness(1.05); }
.reset { margin: 12px auto 0; display: block; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Content */
.content { max-width: 840px; margin: 0 auto 44px; }
.content h2 { margin: 38px 0 10px; font-size: 27px; letter-spacing: -0.02em; color: var(--red-dark); }
.content h3 { margin: 24px 0 8px; font-size: 19px; color: var(--red-dark); }
.content p, .content li { color: #374151; }
.content ul { padding-left: 22px; }
.content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.content th, .content td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.content th { background: #fff7ed; }
.faq { max-width: 840px; margin: 0 auto 52px; }
.faq h2 { margin: 0 0 12px; font-size: 27px; color: var(--red-dark); }
details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 800; }
details p { margin: 10px 0 0; color: #374151; }

.cta {
  max-width: 840px;
  margin: 0 auto 56px;
  padding: 24px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.cta p { margin: 0; font-weight: 800; }
.cta a.button {
  background: var(--gold-soft);
  color: var(--red-dark);
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

/* Footer */
.site-footer { background: #3b0d0d; color: #fde68a; padding: 28px 0 36px; font-size: 13px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: #fde68a; }

/* Responsive */
@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .hero { padding-top: 38px; }
  .vibes { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  @page { size: portrait; margin: 10mm; }
  body { background: #fff; }
  .site-header, .site-footer, .hero, .panel, .content, .faq, .cta, .result-actions,
  .gift-banner, .reset, .no-print { display: none !important; }
  .builder { display: block; margin: 0; }
  .result-wrap { border: 0; box-shadow: none; padding: 0; min-height: 0; }
  .empty-result { display: none !important; }
  .elf-result { border-color: #333; box-shadow: none; }
}
