:root {
  --night: #1c1233;
  --night-deep: #120b24;
  --night-2: #261847;
  --dusk: #3a2768;
  --sheet: #f4f1ff;
  --sheet-shade: #cdc3ee;
  --muted: #b5a7da;
  --pumpkin: #ff7a1a;
  --pumpkin-deep: #c24e06;
  --candle: #ffd36e;
  --parchment: #fff4dc;
  --slime: #8fe388;
  --blood: #ff5c7a;
  --hill-back: #1a0f33;
  --hill-front: #0f0822;
  --display: 'Jolly Lodger', 'Grandstander', cursive;
  --text: 'Grandstander', 'Trebuchet MS', sans-serif;
  --gap: 30px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--night-deep); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sheet);
  font: 400 17px/1.55 var(--text);
  background:
    radial-gradient(circle at 88% 4%, rgba(255, 233, 170, .16), transparent 30rem),
    radial-gradient(ellipse 60% 40% at 10% 100%, rgba(255, 122, 26, .12), transparent),
    linear-gradient(180deg, var(--night-deep) 0%, var(--night) 45%, #2a1640 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

a { color: inherit; }

:focus-visible { outline: 3px solid var(--candle); outline-offset: 3px; }

/* Candy-corn scrollbars (Chromium). The transparent border insets the thumb from its track. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--candle), var(--pumpkin)) padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffe08f, #ff8a33) padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.board ol::-webkit-scrollbar-track,
.name-list::-webkit-scrollbar-track {
  border: 3px solid transparent;
  border-radius: 99px;
  background: rgba(255, 255, 255, .07) padding-box;
}

/* ---------- Icons: Tabler SVGs used as masks so they take the text colour ---------- */

.i {
  display: inline-block;
  flex: none;
  width: 1.2em;
  height: 1.2em;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.i-search { --icon: url(vendor/tabler/search.svg); }
.i-check { --icon: url(vendor/tabler/check.svg); }
.i-x { --icon: url(vendor/tabler/x.svg); }
.i-eye { --icon: url(vendor/tabler/eye.svg); }
.i-logout { --icon: url(vendor/tabler/logout.svg); }
.i-mail { --icon: url(vendor/tabler/mail.svg); }
.i-arrow-left { --icon: url(vendor/tabler/arrow-left.svg); }
.i-arrow-right { --icon: url(vendor/tabler/arrow-left.svg); transform: scaleX(-1); }

/* ---------- Night sky and graveyard ---------- */

.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

.stars {
  position: absolute;
  inset: 0;
  opacity: .55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 34% 62%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 58% 28%, #fff, transparent),
    radial-gradient(1px 1px at 76% 74%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 42%, #fff, transparent),
    radial-gradient(1px 1px at 22% 88%, #fff, transparent);
  background-size: 420px 340px;
}
.stars.twinkle {
  background-image:
    radial-gradient(2px 2px at 8% 40%, #ffe9a8, transparent),
    radial-gradient(2px 2px at 46% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 52%, #ffe9a8, transparent);
  background-size: 560px 420px;
  animation: twinkle 3.5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .15; } to { opacity: .9; } }

.moon {
  position: absolute;
  top: 56px;
  right: 7vw;
  width: 120px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 62%, rgba(90, 60, 20, .1) 0 10px, transparent 11px),
    radial-gradient(circle at 62% 34%, rgba(90, 60, 20, .09) 0 15px, transparent 16px),
    radial-gradient(circle at 70% 72%, rgba(90, 60, 20, .08) 0 7px, transparent 8px),
    radial-gradient(circle at 40% 35%, #fffbea, #f3e2a6 70%, #e2c97c);
  box-shadow: 0 0 80px 24px rgba(255, 228, 150, .2);
}

.bat { position: absolute; animation: bat-drift 7s ease-in-out infinite; }
.bat-big { --r: -14deg; top: 170px; right: calc(7vw + 128px); width: 58px; }
.bat-small { --r: 12deg; top: 40px; right: calc(7vw + 168px); width: 34px; animation-delay: -2s; }
.bat-tiny { --r: -6deg; top: 210px; right: calc(7vw - 10px); width: 26px; animation-delay: -4.5s; }
@keyframes bat-drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--r)); }
  50% { transform: translate(10px, -12px) rotate(calc(var(--r) * -1)); }
}

.web { position: absolute; top: -34px; left: -34px; width: 190px; opacity: .45; }

.spider {
  position: absolute;
  top: 0;
  left: max(150px, 10vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: spider-drop 1.8s cubic-bezier(.3, 1.45, .5, 1) .5s both;
}
.spider::before { content: ''; width: 1.5px; height: 120px; background: rgba(244, 241, 255, .45); }
.spider img { width: 46px; margin-top: -6px; }
@keyframes spider-drop { from { transform: translateY(-190px); } }

.leaf { position: absolute; top: -40px; width: 26px; opacity: .65; animation: leaf-fall 18s linear infinite; }
.leaf-1 { left: 8%; animation-delay: -2s; }
.leaf-2 { left: 27%; width: 22px; animation-duration: 22s; animation-delay: -11s; }
.leaf-3 { left: 52%; animation-duration: 20s; animation-delay: -6s; }
.leaf-4 { left: 71%; width: 30px; animation-duration: 24s; animation-delay: -16s; }
.leaf-5 { left: 90%; width: 20px; animation-delay: -9s; }
@keyframes leaf-fall {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(50px, 27vh) rotate(100deg); }
  50% { transform: translate(-20px, 54vh) rotate(190deg); }
  75% { transform: translate(40px, 81vh) rotate(280deg); }
  100% { transform: translate(0, 110vh) rotate(360deg); }
}

/* The hills stretch to fit, so graves are placed in % of the ground box to stay on the slopes. */
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 160px; }
.hill { position: absolute; inset: 0; width: 100%; height: 100%; }
.hill-back path { fill: var(--hill-back); }
.hill-front path { fill: var(--hill-front); }
.headstone { position: absolute; transform: rotate(var(--r, 0deg)); }

/* Distant graves are silhouettes in the colour of the far hill. */
.far-grave { position: absolute; background: var(--hill-back); }
.far-grave.tomb { width: 14px; height: 20px; border-radius: 7px 7px 1px 1px; }
.far-grave.cross { width: 4px; height: 24px; }
.far-grave.cross::before { content: ''; position: absolute; top: 6px; left: -5px; width: 14px; height: 4px; background: inherit; }
.fog {
  position: absolute;
  left: -15%;
  right: -15%;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(205, 195, 238, .2), transparent 70%);
  animation: fog-drift 26s ease-in-out infinite alternate;
}
.fog-back { height: 150px; bottom: 30px; }
.fog-front { height: 90px; bottom: -30px; animation-duration: 34s; animation-direction: alternate-reverse; }
@keyframes fog-drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }

/* ---------- Layout ---------- */

main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.credits {
  position: relative;
  z-index: 1;
  padding: 24px 16px 36px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  text-shadow: 0 1px 4px var(--night-deep);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--pumpkin);
  box-shadow: 0 4px 0 var(--pumpkin-deep);
  color: #2b1203;
  font: 700 17px/1.1 var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { background: #ff8a33; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pumpkin-deep); }
.btn:disabled { opacity: .65; cursor: progress; }
.btn.quiet { background: transparent; box-shadow: inset 0 0 0 2px var(--dusk); color: var(--sheet); }
.btn.quiet:hover { background: rgba(255, 255, 255, .06); }
.btn.quiet:active { transform: translateY(1px); }

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .07); color: var(--sheet); }

/* ---------- Top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 -16px;
  padding: 10px 16px;
  background: rgba(22, 13, 42, .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand { display: flex; align-items: center; gap: 10px; font: 400 28px/1 var(--display); white-space: nowrap; }
.brand img { width: 38px; height: 38px; }

.progress { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 14px; font-weight: 600; white-space: nowrap; }

/* The progress meter is a stick of candy corn. */
.meter {
  width: min(240px, 26vw);
  height: 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .06);
  overflow: hidden;
}
.meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--parchment) 0 30%, var(--candle) 30% 62%, var(--pumpkin) 62%);
  transition: width .3s;
}

.bar-note { flex: 1; color: var(--muted); font-size: 15px; text-align: right; }

/* ---------- Sign-in ---------- */

.hero { padding: 64px 0 16px; text-align: center; }

.title {
  margin: 0;
  color: var(--sheet);
  font: 400 clamp(68px, 13vw, 164px)/.84 var(--display);
  text-shadow: 0 0 28px rgba(205, 195, 238, .35), 0 5px 0 var(--dusk);
}
.title > span { display: block; }
.title span span { display: inline-block; transform: rotate(var(--r)); }

.teaser {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  max-width: 760px;
  margin: 36px auto 0;
  padding: 0;
  list-style: none;
}
.teaser li:nth-child(even) { margin-top: 28px; }

.lede { max-width: 33em; margin: 32px auto; color: var(--muted); font-size: 19px; }

.signin { max-width: 540px; margin: 0 auto; text-align: left; }
.signin label { display: block; margin: 0 0 8px; font-weight: 700; }
.signin-row { display: flex; gap: 12px; }

.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--sheet);
  color: #6a5a99;
}
.field:focus-within { outline: 3px solid var(--candle); outline-offset: 3px; }
.field input {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--night);
  font: 600 18px var(--text);
}

.error { min-height: 1.6em; margin: 10px 0 0; color: #ff8aa0; font-weight: 600; }
.played { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- Floating ghost ---------- */

.portal {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1.05;
}
.ghost-img {
  position: relative;
  z-index: 1;
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(5, 0, 15, .45));
  user-select: none;
  animation: float 5.5s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -.7s);
}
.shadow {
  position: absolute;
  bottom: 1%;
  left: 28%;
  width: 44%;
  height: 7%;
  border-radius: 50%;
  background: rgba(5, 0, 15, .55);
  filter: blur(3px);
  animation: shadow 5.5s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -.7s);
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}
@keyframes shadow {
  0%, 100% { transform: scaleX(1); opacity: .9; }
  50% { transform: scaleX(.8); opacity: .5; }
}

/* ---------- Cards: arched haunted windows ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 40px var(--gap);
  margin: 0;
  padding: 12px 8px 0;
  list-style: none;
}

.slot { position: relative; display: flex; justify-content: center; }
.slot:nth-child(4n + 1) { --tilt: -1.5deg; }
.slot:nth-child(4n + 2) { --tilt: 1deg; }
.slot:nth-child(4n + 3) { --tilt: 2deg; }
.slot:nth-child(4n) { --tilt: -.5deg; }

.card,
.card-glass {
  border-radius: 50% 50% 18px 18px / 84px 84px 18px 18px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 42%, rgba(255, 190, 90, .22), transparent 70%),
    radial-gradient(circle at 50% 108%, rgba(143, 227, 136, .12), transparent 45%),
    linear-gradient(180deg, #3b2569 0%, #2a1a4c 62%, #21133b 100%);
  box-shadow:
    inset 0 0 0 2px rgba(205, 195, 238, .2),
    inset 0 0 0 8px rgba(10, 4, 24, .28),
    inset 0 0 0 10px rgba(205, 195, 238, .08),
    0 16px 28px rgba(5, 0, 15, .5);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 200px;
  padding: 22px 14px 16px;
  border: 0;
  color: inherit;
  font: inherit;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease, box-shadow .2s ease;
}
button.card { cursor: pointer; }
button.card:disabled { cursor: default; }
.results-cards button.card:not(:disabled) { cursor: zoom-in; }
button.card:not(:disabled):hover,
button.card:focus-visible {
  transform: rotate(0) translateY(-6px);
  box-shadow:
    inset 0 0 0 2px rgba(255, 211, 110, .6),
    inset 0 0 0 8px rgba(10, 4, 24, .28),
    inset 0 0 0 10px rgba(255, 211, 110, .12),
    0 0 34px rgba(255, 122, 26, .35),
    0 20px 32px rgba(5, 0, 15, .55);
}
button.ghost:hover .ghost-img { animation-duration: 1.4s; }

/* Ghost number on a little pumpkin, stuck over the corner of the arch. */
.num {
  position: absolute;
  top: 6px;
  left: -8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border-radius: 48% 48% 44% 44%;
  background:
    linear-gradient(90deg, transparent 30%, rgba(160, 60, 0, .35) 30% 34%, transparent 34% 66%, rgba(160, 60, 0, .35) 66% 70%, transparent 70%),
    var(--pumpkin);
  box-shadow: inset 0 -4px 0 rgba(160, 60, 0, .45), 0 3px 6px rgba(0, 0, 0, .35);
  color: #2b1203;
  font: 400 23px/1 var(--display);
  transform: rotate(-10deg);
}
.num::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 6px;
  height: 9px;
  border-radius: 2px;
  background: #5c9e31;
  transform: translateX(-50%) rotate(14deg);
}

.sticker { position: absolute; z-index: 3; pointer-events: none; }
.sticker img { display: block; width: 100%; }
.sticker-bat { top: -10px; right: -16px; width: 46px; transform: rotate(16deg); }
.sticker-pumpkin { bottom: -14px; right: -14px; width: 44px; transform: rotate(8deg); }
.sticker-candy { bottom: -10px; left: -14px; width: 38px; transform: rotate(-24deg); }
.sticker-candle { bottom: -8px; right: -10px; width: 30px; }
.sticker-owl { top: 18px; right: -18px; width: 42px; transform: rotate(6deg); }
.sticker-lollipop { bottom: -12px; left: -12px; width: 38px; transform: rotate(-12deg); }
.sticker-skull { bottom: -10px; right: -12px; width: 34px; transform: rotate(14deg); }
.sticker-leaf { top: 30px; left: -14px; width: 30px; transform: rotate(-30deg); }
.sticker-spider { top: 0; right: 26%; width: 26px; display: flex; flex-direction: column; align-items: center; }
.sticker-spider::before { content: ''; width: 1.5px; height: 30px; background: rgba(244, 241, 255, .5); }
.sticker-spider img { margin-top: -3px; }

.tag {
  position: relative;
  z-index: 2;
  max-width: 100%;
  margin-top: 8px;
  padding: 6px 12px;
  border: 2px dashed rgba(181, 167, 218, .5);
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  transform: rotate(calc(var(--tilt, 0deg) * -1.5));
}
.ghost.is-named .tag { border: 2px solid var(--candle); background: var(--candle); color: #2b1a05; box-shadow: 0 3px 0 #c9962c; }

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

.intro { max-width: 46em; margin: 36px 0 44px; }
.intro h1 { margin: 0 0 10px; font: 400 clamp(40px, 6vw, 60px)/1 var(--display); }
.intro p { margin: 0; color: var(--muted); font-size: 18px; }

/* ---------- Picker dialog ---------- */

dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--night-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 0 0 2px var(--dusk);
  color: var(--sheet);
}
dialog::backdrop { background: rgba(10, 5, 20, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

.picker {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px 28px;
  max-height: calc(100dvh - 32px);
  padding: 20px 24px 24px;
}
.picker-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picker-head h2 { margin: 0; font: 400 40px/1 var(--display); }
.picker-ghost {
  grid-row: 2 / span 3;
  align-self: start;
  display: grid;
  place-items: center;
  padding: 26px 20px 18px;
}
.picker-ghost .portal { width: min(100%, 62vh); }
.picker-ghost .ghost-img { width: 92%; height: 92%; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: var(--muted);
}
.search:focus-within { outline: 3px solid var(--candle); outline-offset: 2px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--sheet);
  font: 600 17px var(--text);
}

.name-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  max-height: 56vh;
  margin: 0;
  padding: 2px;
  overflow: auto;
  list-style: none;
}
.name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  color: var(--sheet);
  font: 600 16px/1.25 var(--text);
  text-align: left;
  cursor: pointer;
}
.name:hover { background: var(--dusk); }
.name small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.name.is-taken { color: var(--muted); }
.name.is-current { border-color: var(--candle); background: rgba(255, 211, 110, .12); }
.name.is-current .i { color: var(--candle); }
.name-list .empty { grid-column: 1 / -1; padding: 12px; color: var(--muted); }

.picker-foot { grid-column: 2; }

.confirm { display: grid; justify-items: center; gap: 4px; padding: 28px; text-align: center; }
#confirm { width: min(460px, calc(100vw - 32px)); }
.confirm img { width: 76px; }
.confirm h2 { margin: 6px 0 0; font: 400 40px/1 var(--display); }
.confirm p { margin: 8px 0 18px; color: var(--muted); }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- Results ---------- */

.results-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  gap: 40px;
  margin: 56px 0 72px;
}

.verdict { display: flex; align-items: center; gap: 40px; }

.grave { position: relative; isolation: isolate; flex: none; width: 220px; padding-bottom: 22px; }
.grave::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: -34px;
  right: -34px;
  bottom: 0;
  height: 56px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #263b2c;
}
.stone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 4 / 5;
  padding: 24px 16px;
  border-radius: 110px 110px 10px 10px;
  background:
    radial-gradient(circle at 24% 78%, rgba(80, 120, 70, .45) 0 14px, transparent 15px),
    radial-gradient(circle at 34% 86%, rgba(80, 120, 70, .4) 0 10px, transparent 11px),
    linear-gradient(160deg, #a49cc0, #6a628a 75%);
  box-shadow: inset -12px -10px 0 rgba(20, 10, 40, .18), 0 18px 30px rgba(0, 0, 0, .45);
  color: #2a2342;
  text-align: center;
}
.here { font-size: 14px; font-weight: 700; }
.score { font: 400 96px/.85 var(--display); text-shadow: 0 2px 0 rgba(255, 255, 255, .28); }
.score small { font-size: .45em; }
.rank-title { font-size: 17px; font-weight: 800; line-height: 1.2; }
.grave-pumpkin { position: absolute; right: -30px; bottom: 4px; z-index: 1; width: 74px; }

.verdict-text h1 { margin: 0 0 12px; font: 400 clamp(36px, 5vw, 52px)/1 var(--display); }
.verdict-text p { margin: 0; color: var(--muted); }

.board {
  position: relative;
  padding: 16px 14px 16px 20px;
  border-radius: 20px;
  background: rgba(38, 24, 71, .82);
  box-shadow: inset 0 0 0 2px var(--dusk), 0 16px 30px rgba(5, 0, 15, .4);
}
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 6px 12px 0; }
.board h2 { margin: 0; font: 400 38px/1 var(--display); }
.board-head span { color: var(--muted); font-size: 15px; white-space: nowrap; }

/* Five rows tall, about the height of the tombstone beside it; the rest scrolls. */
.board ol {
  --row: 42px;
  display: grid;
  grid-auto-rows: var(--row);
  gap: 4px;
  max-height: calc(5 * var(--row) + 4 * 4px);
  margin: 0;
  padding: 0 8px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.board li {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) minmax(40px, 90px) 3.4em;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-radius: 10px;
}
.board li.you { background: rgba(255, 211, 110, .13); box-shadow: inset 0 0 0 2px rgba(255, 211, 110, .5); }
.place { color: var(--muted); font: 400 24px/1 var(--display); text-align: center; }
.board li.top .place { color: var(--candle); }
.who { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.who em {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--candle);
  color: #2b1a05;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  vertical-align: 2px;
}
.bar-track { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--parchment) 0 30%, var(--candle) 30% 62%, var(--pumpkin) 62%);
}
.pts { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }

.reveal-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 32px; }
.reveal-head h2 { margin: 0 0 6px; font: 400 clamp(40px, 6vw, 60px)/1 var(--display); }
.reveal-head p { max-width: 36em; margin: 0; color: var(--muted); }

/* The photo waits behind the ghost until the sheets come off. */
.photo {
  position: absolute;
  inset: 4% 6% 6%;
  width: 88%;
  height: 90%;
  border: 4px solid var(--sheet);
  border-radius: 50% 50% 10px 10px / 34% 34% 10px 10px;
  background: var(--dusk);
  object-fit: cover;
  box-shadow: 0 8px 16px rgba(5, 0, 15, .45);
  visibility: hidden;
}
.is-unmasked .photo { visibility: visible; }
.is-unmasked .ghost-img,
.is-unmasked .shadow {
  pointer-events: none;
  animation: ghost-off 1s cubic-bezier(.45, -.35, .6, .4) calc(var(--i) * 45ms) forwards;
}
@keyframes ghost-off {
  to { transform: translateY(-130%) rotate(16deg) scale(.8); opacity: 0; visibility: hidden; }
}

.right .card { box-shadow: inset 0 0 0 2px rgba(143, 227, 136, .55), inset 0 0 0 8px rgba(10, 4, 24, .28), 0 16px 28px rgba(5, 0, 15, .5); }
.wrong .card { box-shadow: inset 0 0 0 2px rgba(255, 92, 122, .6), inset 0 0 0 8px rgba(10, 4, 24, .28), 0 16px 28px rgba(5, 0, 15, .5); }

.result-tag { display: grid; justify-items: center; gap: 2px; padding: 8px 10px; border: 0; background: var(--parchment); color: #2b1a2e; box-shadow: 0 3px 0 #d8c9a4; }
.result-tag b { font-size: 16px; font-weight: 800; }
.said { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.wrong .said { color: #a3123a; }
.stat { color: #6d5d84; font-size: 13px; font-weight: 500; line-height: 1.3; }
.badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #1c1233; font-size: 13px; }
.right .badge { background: var(--slime); }
.wrong .badge { background: var(--blood); }

/* ---------- Photo viewer ---------- */

.viewer {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px 28px;
  max-height: calc(100dvh - 32px);
  padding: 20px 24px 24px;
}
.viewer .picker-head { grid-column: 1 / -1; }
.viewer-photo {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 74vh;
  border-radius: 14px;
  background: var(--night-deep);
  object-fit: contain;
}
.viewer-side { display: grid; align-content: start; justify-items: center; gap: 16px; }
.viewer-ghost { display: grid; place-items: center; width: 170px; aspect-ratio: 1 / 1.1; padding: 18px 14px 10px; }
.viewer-ghost img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(5, 0, 15, .45)); }
.viewer-info { width: 100%; border-radius: 10px; }
.viewer-nav { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; }
.viewer-nav .btn { padding: 12px 16px; font-size: 20px; }
.viewer-count { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--sheet);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  color: var(--night);
  font-weight: 700;
  transform: translate(-50%, 160%);
  transition: transform .25s;
}
#toast.show { transform: translate(-50%, 0); }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .results-top { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .picker { grid-template-columns: minmax(0, 1fr); padding: 16px; overflow: auto; }
  .picker-head h2 { font-size: 32px; }
  .picker-ghost { grid-row: auto; justify-self: center; width: min(78vw, 340px); padding: 18px 14px 12px; }
  .picker-ghost .portal { width: 100%; }
  .picker-foot { grid-column: 1; }
  .name-list { max-height: none; overflow: visible; }
  .viewer { grid-template-columns: minmax(0, 1fr); padding: 16px; overflow: auto; }
  .viewer-photo { height: auto; max-height: 56vh; }
  .viewer-ghost { width: 120px; }
}

@media (max-width: 640px) {
  :root { --gap: 22px; }
  .wide-only { display: none; }
  .moon { top: 64px; right: 16px; width: 70px; }
  .bat-big { top: 120px; right: 90px; width: 40px; }
  .bat-small, .bat-tiny, .spider, .leaf-4, .leaf-5 { display: none; }
  .web { width: 130px; }
  .ground { height: 110px; }
  .headstone { scale: .7; }
  .hero { padding-top: 96px; }
  .teaser { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .teaser li:nth-child(n + 4) { display: none; }
  .signin-row { flex-direction: column; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 34px var(--gap); }
  .card { padding: 18px 10px 12px; }
  .verdict { flex-direction: column; text-align: center; }
}

@media (max-width: 420px) {
  .name-list { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .leaf { display: none; }
  .is-unmasked .ghost-img, .is-unmasked .shadow { visibility: hidden; }
}
