:root {
  color-scheme: dark;
  --background: #130a24;
  --surface: #201331;
  --border: #493562;
  --text: #fcf7ff;
  --muted: #c9b8de;
  --lime: #dcff66;
  --lavender: #dbb2ff;
  --pink: #ff9ee9;
  --cyan: #92ecff;
  font-family: "Trebuchet MS", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 20%, #321453 0%, transparent 57%),
    radial-gradient(ellipse at 82% 72%, #260e3d 0%, transparent 42%),
    var(--background);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  background-image: linear-gradient(#ac77ee11 1px, transparent 1px), linear-gradient(90deg, #ac77ee11 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse, black, transparent 82%);
  pointer-events: none;
}

button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 4px; }

.shell { max-width: 73rem; margin-inline: auto; padding: 0 clamp(1rem, 3.2vw, 2.5rem); }

.topbar {
  min-height: 4.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid #a172cf32;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .62rem;
  text-decoration: none;
  color: var(--text);
  font: 900 clamp(1.11rem, 3vw, 1.42rem)/1 system-ui, sans-serif;
  letter-spacing: -.055em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: #28123a;
  background: linear-gradient(155deg, #f8b5ff, #b37dff 70%);
  border-radius: .65rem;
  box-shadow: 0 0 20px #c369f14d;
}
.brand-accent { color: #dfa4ff; }

.help-button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .77rem;
  color: var(--muted);
  background: #251639;
  border: 1px solid #62477c;
  border-radius: .7rem;
  font-size: .88rem;
  font-weight: 700;
}
.help-button:hover { background: #3a2452; color: white; }
.help-button span:first-child { color: #f0c6ff; font-weight: 900; }

main { max-width: 48rem; margin-inline: auto; }
.intro { padding: clamp(1.65rem, 4vw, 2.65rem) 0 1.55rem; text-align: center; }
.intro .eyebrow {
  margin: 0 0 .45rem;
  color: var(--lavender);
  font-size: .77rem;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.eyebrow span { color: var(--lime); margin-inline: .33rem; }
.intro h1 {
  margin: 0;
  font: 950 clamp(2.6rem, 8.5vw, 5rem)/1.07 system-ui, sans-serif;
  letter-spacing: -.075em;
  text-shadow: 0 7px 30px #1a052a6e;
}
.intro h1 em { color: var(--lime); font-style: normal; text-shadow: 0 0 32px #c9ff453e; }
.intro p:last-child { margin: .75rem 0 0; color: #e3d4f1; font-size: 1rem; line-height: 1.45; }

.game {
  display: grid;
  gap: .85rem;
  padding: .85rem;
  border: 1px solid #9471bc65;
  border-radius: 1.45rem;
  background: #190e2ae8;
  box-shadow: 0 20px 70px #08041085, 0 0 52px #b15eeb16;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 1fr 1fr;
  gap: .55rem;
}
.rounds-stat, .stat {
  display: flex;
  gap: .25rem .72rem;
  padding: .63rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .77rem;
}
.rounds-stat { flex-wrap: wrap; align-content: center; justify-content: space-between; align-items: baseline; }
.stat { align-items: center; }
.stat-label { display: block; color: var(--muted); font-size: .79rem; font-weight: 700; }
.scoreboard strong { font: 850 1.14rem/1.1 system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-total { color: #bb9ad6; margin-left: .2em; font-weight: 600; font-size: .76em; }
.stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: .55rem;
  background: #352344;
  color: #eea8ff;
  font-size: 1.25rem;
}
.streak-icon { background: #3c2744; color: #ffd576; }
progress {
  appearance: none;
  display: block;
  width: 100%;
  height: .29rem;
  margin-top: .13rem;
  border: 0;
  border-radius: 2rem;
  background: #4a335c;
  color: var(--lime);
}
progress::-webkit-progress-bar { background: #4a335c; border-radius: 2rem; }
progress::-webkit-progress-value { background: var(--lime); border-radius: 2rem; }
progress::-moz-progress-bar { background: var(--lime); border-radius: 2rem; }

.name-card {
  isolation: isolate;
  position: relative;
  display: grid;
  align-items: center;
  min-height: 13.25rem;
  overflow: hidden;
  padding: 1.35rem 34% 1.6rem 5.2%;
  border: 1px solid #ae71ee;
  border-radius: 1rem;
  background:
    radial-gradient(ellipse at 87% 6%, #e493ff8c 0%, transparent 45%),
    radial-gradient(ellipse at 55% 110%, #4f51bc 0%, transparent 55%),
    linear-gradient(118deg, #5e258c, #5c2797 51%, #913dc0);
  box-shadow: inset 0 1px 0 #f4bcff77, inset 0 -7px 30px #330d703e;
}
.name-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: repeating-radial-gradient(ellipse at 79% 71%, transparent 0 27px, #f7ceff48 29px, transparent 31px 53px);
  mask-image: linear-gradient(90deg, transparent 8%, #0008 53%, black);
}
.name-copy { position: relative; z-index: 1; }
.entry-context {
  margin: 0 .06rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}
.name-card h2 {
  margin: 0;
  color: white;
  font: 950 clamp(2.08rem, 7.4vw, 4.6rem)/1.08 system-ui, sans-serif;
  letter-spacing: -.073em;
  overflow-wrap: anywhere;
  text-shadow: 0 .09em 0 #532979, 0 .12em .22em #240a55ad;
}
.name-card h2[data-length="long"] { font-size: clamp(1.68rem, 5.8vw, 3.3rem); }
.name-card h2[data-length="extra"] { font-size: clamp(1.58rem, 4vw, 2.5rem); }
.name-card h2:focus, #result-title:focus { outline: none; }
.mascot {
  position: absolute;
  z-index: 0;
  bottom: -16%;
  right: 2.3%;
  width: clamp(9rem, 36%, 15rem);
  height: auto;
  transform: rotate(7deg);
  filter: drop-shadow(0 0 1rem #fcceff64);
  pointer-events: none;
}
.card-sparkles { position: absolute; inset: 0; pointer-events: none; }
.card-sparkles span { position: absolute; color: #f3cbff; text-shadow: 0 0 12px #fff7; }
.card-sparkles span:nth-child(1) { top: 10%; left: 47%; font-size: 1.6rem; }
.card-sparkles span:nth-child(2) { bottom: 10%; left: 52%; font-size: 1rem; }
.card-sparkles span:nth-child(3) { top: 32%; right: 4%; font-size: 1.3rem; color: var(--lime); }
.card-sparkles span:nth-child(4) { top: 12%; right: 40%; font-size: .9rem; }
.card-sparkles span:nth-child(5) { bottom: 12%; left: 19%; font-size: .7rem; }

.actions { display: grid; gap: .9rem; padding: .25rem .06rem .05rem; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: .48rem; color: #f0e2fa; font-size: .89rem; font-weight: 800; }
legend span {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: .18rem;
  place-items: center;
  border-radius: .35rem;
  background: #392650;
  color: #e8bbff;
  font-size: .73rem;
}
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .46rem; }
.option { position: relative; display: grid; min-width: 0; cursor: pointer; --accent: var(--lime); }
.option.reject { --accent: #ffb0ca; }
.option.boy { --accent: var(--cyan); }
.option.girl { --accent: var(--pink); }
.option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.option > span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .35rem;
  min-height: 3rem;
  padding: .35rem .2rem;
  border: 1px solid #604476;
  border-radius: .65rem;
  box-shadow: inset 0 1px 0 #ffffff0f;
  background: #2a1a3e;
  color: #f7eafd;
  font-size: clamp(.85rem, 2.3vw, .98rem);
  font-weight: 800;
}
.option-icon { color: var(--accent); font-size: 1.14em; }
.option:hover > span { border-color: var(--accent); }
.option input:checked + span { background: var(--accent); border-color: var(--accent); color: #21132d; }
.option input:checked + span .option-icon { color: inherit; }
.option input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 3px; }

.primary-button {
  min-height: 3rem;
  border: 1px solid #eaffaa;
  border-radius: .68rem;
  background: linear-gradient(115deg, #eaff92, #d6ff55 65%, #d2fb61);
  color: #211630;
  box-shadow: 0 3px 0 #829e30, 0 5px 16px #abed1840;
  font-size: 1rem;
  font-weight: 900;
}
.primary-button span { margin-right: .25rem; }
.primary-button:not(:disabled):hover { filter: brightness(1.08); }
.primary-button:not(:disabled):active { transform: translateY(2px); }
.primary-button:disabled { border-color: #9da857; background: #a4af62; box-shadow: 0 3px 0 #6c743c; }

.feedback { text-align: center; }
.feedback h3 { margin: .05rem 0 .55rem; font-size: 1.25rem; }
.feedback p { margin: .35rem 0 .2rem; line-height: 1.5; }
.verdicts { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; padding: 0; margin: 0; list-style: none; }
.verdicts li { padding: .4rem .59rem; background: #2e2043; border: 1px solid #624b76; border-radius: .48rem; font-weight: 700; }
.verdicts .right { color: var(--lime); }
.verdicts .wrong { color: #ffb9cf; }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  margin: .95rem 0 1.3rem;
  color: var(--muted);
  font-size: .81rem;
}
.saved-dot { display: inline-block; vertical-align: .13em; width: .43rem; height: .43rem; margin-right: .37rem; border-radius: 50%; background: var(--lime); box-shadow: 0 0 11px #d6ff55a6; }
.footer[data-unsaved] .saved-dot { background: #ffd576; }

dialog {
  width: min(28rem, calc(100% - 2rem));
  padding: 1.45rem;
  border: 1px solid #ab7fe0;
  border-radius: 1rem;
  background: #28183c;
  color: var(--text);
  box-shadow: 0 1rem 5rem #0009;
}
dialog::backdrop { background: #0e061cd9; }
dialog h2 { margin: 0 2.25rem .75rem 0; }
dialog p { color: #e8d8f6; line-height: 1.52; }
dialog p:last-child { margin-bottom: 0; }
.close-dialog {
  position: absolute;
  top: .85rem;
  right: .85rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #79589a;
  border-radius: .45rem;
  background: #432b5e;
  color: var(--text);
  font-size: 1.45rem;
}

@media (max-width: 42rem) {
  .topbar { min-height: 3.7rem; }
  .game { padding: .65rem; border-radius: 1.15rem; }
  .name-card { min-height: 11rem; }
  .mascot { bottom: -11%; right: 1%; }
}

@media (max-width: 35rem) {
  .choices { grid-template-columns: 1fr; gap: .65rem; }
  .rounds-stat, .stat { padding: .48rem .47rem; gap: .15rem .4rem; }
  .scoreboard { gap: .35rem; grid-template-columns: 1.45fr .8fr .95fr; }
  .stat-label { font-size: .72rem; }
  .stat-icon { width: 1.25rem; height: 1.4rem; font-size: .88rem; background: none; }
  .scoreboard strong { font-size: 1rem; }
  .intro { padding-bottom: 1.2rem; }
  .intro p:last-child { padding-inline: .35rem; }
  .name-card { padding-right: 36%; }
}

@media (max-width: 22rem) {
  .shell { padding-inline: .7rem; }
  .stat-icon { display: none; }
  .mascot { width: 8rem; right: -1rem; }
  .name-card { padding-right: 30%; }
}
