:root {
  color-scheme: light dark;
  --page: light-dark(#f5f1e7, #121d17);
  --paper: light-dark(#fffdf7, #18271e);
  --ink: light-dark(#17291e, #f8f3e6);
  --quiet: light-dark(#4d6053, #b9cabb);
  --line: light-dark(#dddccf, #42564a);
  --soft: light-dark(#edf1e6, #22392a);
  --accent: light-dark(#a62f39, #ffa5ac);
  --danger: light-dark(#8e202a, #ffc2c6);
  --forest: #173d2c;
  --forest-deep: #112f22;
  --gold: #eac279;
  --display: Georgia, 'Times New Roman', serif;
  --body: system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 1rem/1.55 var(--body); }
.topbar, .shell { width: min(100% - 2rem, 69rem); margin-inline: auto; }
.topbar { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--quiet); font-size: .88rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); font-size: 1.16rem; font-weight: 750; min-height: 44px; text-decoration: none; }
.shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .94fr); align-items: start; gap: clamp(1rem, 3vw, 2.1rem); padding-block: .6rem 1.7rem; }
.hero { position: relative; isolation: isolate; min-width: 0; overflow: hidden; min-height: 33rem; padding: clamp(1.7rem, 4.5vw, 3.3rem); border-radius: 1.7rem; background: radial-gradient(ellipse at 74% 75%, #315c43 0, transparent 55%), var(--forest); color: #fff6e3; }
.hero:has(.group-title) { min-height: 27rem; }
.hero-copy { position: relative; z-index: 2; }
.eyebrow { color: var(--gold); font-weight: 700; letter-spacing: .11em; text-transform: uppercase; font-size: .73rem; margin: 0 0 1rem; }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; letter-spacing: -.035em; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(3.6rem, 7vw, 6.65rem); }
h1.group-title { font-size: clamp(2.4rem, 5.2vw, 4.4rem); }
.hero-copy > p:last-child { color: #e3ebdf; max-width: 30ch; margin: 1.1rem 0 0; }
.art { position: absolute; pointer-events: none; right: 4%; bottom: 2%; width: clamp(11rem, 55%, 22rem); aspect-ratio: 1; display: grid; place-items: center; }
.art img { width: 88%; height: auto; transform: rotate(-12deg); filter: drop-shadow(0 14px 13px #05190f7a) brightness(1.22); }
.art img.shake { animation: shake .5s ease both; }
@keyframes shake { 0%, 100% { transform: rotate(-12deg); } 35% { transform: rotate(5deg); } 70% { transform: rotate(-20deg); } }
.spark { position: absolute; color: var(--gold); line-height: 1; }
.spark-one { top: 12%; left: 7%; font-size: 2rem; }
.spark-two { top: 21%; right: 3%; font-size: 2.4rem; }
.spark-three { bottom: 22%; right: 8%; font-size: 1.2rem; }
.panel { min-width: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); box-shadow: 0 18px 34px #1a32100a; border-radius: 1.7rem; padding: clamp(1.2rem, 3.4vw, 2.4rem); }
h2 { font-size: clamp(1.95rem, 4vw, 2.8rem); }
h3 { font-size: 1.3rem; }
p { margin: .65rem 0; overflow-wrap: anywhere; }
.muted, small, footer { color: var(--quiet); }
.small { font-size: .9rem; }
.stack { display: grid; gap: .9rem; margin-top: 1.35rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .7rem; }
label { display: block; font-weight: 680; font-size: .92rem; }
label small { font-weight: 400; }
input, textarea { display: block; width: 100%; min-height: 46px; margin-top: .35rem; padding: .65rem .75rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: .65rem; font: inherit; }
textarea { resize: vertical; }
button, .button { border: 1px solid transparent; border-radius: .7rem; background: var(--forest); color: #fff6e3; font: 680 .94rem/1.2 var(--body); min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: .68rem .95rem; cursor: pointer; text-align: center; text-decoration: none; }
button:hover, .button:hover { background: var(--forest-deep); }
button:disabled { opacity: .57; cursor: wait; }
.secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.secondary:hover { background: var(--soft); }
.text-button { min-height: 44px; padding-inline: .35rem; color: var(--ink); background: transparent; text-decoration: underline; text-underline-offset: .2em; }
.text-button:hover { background: var(--soft); }
:focus-visible { outline: 3px solid light-dark(#a96a21, #efc779); outline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .8rem; }
.actions > * { flex: 1 1 auto; }
.note { background: var(--soft); border-radius: .7rem; padding: .7rem .8rem; color: var(--quiet); font-size: .9rem; }
.error { color: var(--danger); font-weight: 600; }
.status { color: var(--quiet); font-size: .88rem; }
.divider { border-top: 1px solid var(--line); margin-top: 1.15rem; padding-top: .95rem; }
.roster { list-style: none; padding: 0; margin: .7rem 0; }
.roster li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; border-bottom: 1px solid var(--line); min-height: 2.9rem; }
.roster li span { min-width: 0; overflow-wrap: anywhere; }
.roster li small, .roster li button { flex-shrink: 0; }
.meta { display: flex; flex-wrap: wrap; gap: .45rem; margin: .9rem 0; }
.meta span { background: var(--soft); border-radius: 99px; padding: .35rem .68rem; font-size: .83rem; overflow-wrap: anywhere; }
details summary { min-height: 44px; display: list-item; padding-block: .65rem; cursor: pointer; font-weight: 600; }
details p { font-size: .9rem; }
.envelope { width: min(100%, 21rem); display: grid; margin: 1.15rem auto 0; background: #a52f39; color: #fff4df; border-radius: .85rem; overflow: hidden; box-shadow: 0 12px 24px #5b1a222b; }
.envelope:hover { background: #8f232f; }
.envelope-art { position: relative; display: grid; place-items: center; width: 100%; min-height: 8.3rem; }
.envelope-art::before { content: ''; position: absolute; inset: -.7rem -.95rem 16%; background: #7b2430; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.seal { color: #4a2a13; background: #edc678; border-radius: 50%; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; position: relative; }
.envelope > span:last-child { padding-bottom: .35rem; }
.result { position: relative; padding: 1.35rem 1.05rem; margin-top: 1.2rem; border: 1px dashed var(--line); border-radius: .85rem; background: var(--soft); text-align: center; }
.result-name { color: var(--ink); font: bold clamp(2rem, 6vw, 3rem)/1.05 var(--display); overflow-wrap: anywhere; }
footer { text-align: center; padding: 0 1rem 1.8rem; font-size: .82rem; }
dialog { width: min(31rem, 100% - 2rem); max-height: calc(100% - 2rem); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; }
dialog::backdrop { background: #081c13aa; }
@media (min-width: 90rem) { .topbar, .shell { width: min(100% - 4rem, 87rem); } .hero { min-height: 37rem; } }
@media (min-width: 124rem) { :root { font-size: 112.5%; } }
@media (max-width: 47.5rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .hero, .hero:has(.group-title) { min-height: 0; padding: 1.35rem 1.25rem 1.5rem; }
  .hero-copy { max-width: 78%; }
  .hero-copy > p:last-child { max-width: 25ch; font-size: .9rem; }
  .art { width: min(34%, 10rem); right: 1%; bottom: 2%; }
  .spark { scale: .75; }
}
@media (max-width: 24rem) { .fields { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }

/* Give custom titles their own space, including long group and family names. */
.hero:has(.group-title) .art {
  position: relative;
  right: auto;
  bottom: auto;
  width: min(48%, 15rem);
  margin: .4rem 0 0 auto;
}
h2[tabindex="-1"]:focus, .result-name:focus { outline: none; }
@media (max-width: 47.5rem) {
  .hero:has(.group-title) .hero-copy { max-width: 100%; }
  .hero:has(.group-title) .hero-copy > p:last-child { max-width: calc(100% - 6rem); min-height: 3.4rem; }
  .hero:has(.group-title) .art {
    position: absolute;
    right: .6rem;
    bottom: .45rem;
    width: 5.2rem;
    margin: 0;
  }
}
