:root {
  --paper: #E7DCC3;
  --paper-shadow: #C9B99A;
  --ink: #16110C;
  --red: #B23A26;
  --red-deep: #8E2A1A;
  --night: #1C2540;
  --jungle: #2C4034;
  --brass: #C79A3B;
  --bone: #F4EDDD;
  --display: "Passion One", "Arial Narrow", Impact, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --stencil: "Allerta Stencil", "Courier New", monospace;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#paper {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
  background: var(--paper);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  filter: saturate(.92) contrast(1.02);
}

.night-band {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 0;
  height: clamp(150px, 31svh, 430px);
  overflow: hidden;
  pointer-events: none;
  transform-origin: 50% 18%;
  transition: transform .26s steps(3, end), filter .2s steps(2, end);
}

.night-band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
}

#paper.menu-open .night-band {
  transform: scale(1.055);
}

#paper.hiwaga .night-band {
  transform: scale(1.14);
  filter: brightness(.58) contrast(1.18);
}

#paper::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  visibility: hidden;
  background:
    linear-gradient(114deg, transparent 0 45%, rgba(28, 37, 64, .44) 46% 54%, transparent 55% 100%),
    rgba(28, 37, 64, .26);
}

#paper.hiwaga::before {
  visibility: visible;
}

#paper::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 52%, rgba(90, 60, 30, .18) 100%),
    radial-gradient(circle at 3% 4%, rgba(120, 80, 40, .16), transparent 24%),
    radial-gradient(circle at 98% 96%, rgba(120, 80, 40, .15), transparent 22%);
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100svh;
}

.grass-band {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 4;
  height: clamp(42px, 10svh, 132px);
  pointer-events: none;
  overflow: hidden;
}

.grass-band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.sound-toggle {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 4px 10px;
  background: var(--bone);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(22, 17, 12, .32);
  font-family: var(--stencil);
  font-size: clamp(9px, 1.2vw, 12px);
  letter-spacing: .07em;
  line-height: 1;
  clip-path: polygon(0 10%, 5% 0, 94% 4%, 100% 0, 100% 90%, 95% 100%, 6% 96%, 0 100%);
}

.sound-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

.sound-toggle[aria-pressed="false"] .sound-label { text-decoration: line-through; }
.sound-toggle[aria-pressed="false"] .sound-dot {
  background: var(--paper-shadow);
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  width: 100%;
  animation: sheetIn .3s cubic-bezier(.2, .86, .24, 1) both;
}

@keyframes sheetIn {
  from { transform: translateX(5%) rotate(.6deg); }
  to { transform: translateX(0) rotate(0); }
}

/* ---------------------------------- menu --------------------------------- */

.screen.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(8px, 1.6svh, 24px) clamp(10px, 3.4vw, 48px) clamp(64px, 11svh, 140px);
}

.menu-head {
  width: min(100%, 1120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title-wrap {
  width: min(78vw, 54svh, 660px);
  margin-top: clamp(0px, .6svh, 8px);
  filter: drop-shadow(0 7px 0 rgba(22, 17, 12, .2));
}

.title-wrap img {
  width: 100%;
  height: auto;
}

.tagline {
  margin-top: clamp(3px, .8svh, 9px);
  padding: 3px 12px 2px;
  background: var(--paper-shadow);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(9px, 1.35vw, 14px);
  letter-spacing: .16em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.category-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4px;
  margin-top: clamp(7px, 1.4svh, 16px);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px 2px 3px;
  background: var(--bone);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(22, 17, 12, .28);
  font-size: clamp(7px, 1.05vw, 12px);
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1;
}

.category-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  background: var(--brass);
  border: 1px solid var(--ink);
}

.category-chip img {
  width: clamp(17px, 2.4vw, 27px);
  height: auto;
}

.difficulty-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(5px, 1.5vw, 18px);
  width: min(100%, 1000px);
  margin-top: clamp(8px, 1.9svh, 24px);
}

.plaque {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: clamp(5px, 1.2vw, 14px) clamp(4px, 1vw, 12px) clamp(6px, 1.4vw, 14px);
  background:
    repeating-linear-gradient(46deg, transparent 0 7px, rgba(22, 17, 12, .035) 7px 8px),
    var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: none;
  filter: drop-shadow(5px 5px 0 rgba(22, 17, 12, .26));
  clip-path: polygon(0 3%, 3% 1%, 12% 3%, 28% 1%, 55% 2%, 77% 0, 92% 2%, 100% 1%, 99% 97%, 95% 100%, 80% 98%, 62% 100%, 40% 98%, 18% 100%, 4% 97%, 1% 99%);
  transform: rotate(-.45deg);
  transition: transform .1s steps(2, end), background-color .1s steps(1, end);
}

.plaque:nth-child(2) { transform: rotate(.35deg); }
.plaque:nth-child(3) { transform: rotate(-.2deg); }

.plaque:active {
  transform: translate(2px, 2px) rotate(0);
  filter: drop-shadow(2px 2px 0 rgba(22, 17, 12, .26));
}

.plaque.selected {
  background:
    repeating-linear-gradient(46deg, transparent 0 7px, rgba(244, 237, 221, .05) 7px 8px),
    var(--red);
  color: var(--bone);
}

.plaque.selected[data-accent="easy"] { background-color: var(--night); }
.plaque.selected[data-accent="hard"] { background-color: var(--red-deep); }

.plaque .creature {
  width: 100%;
  height: clamp(52px, 11svh, 146px);
  object-fit: contain;
  object-position: center bottom;
}

.plaque.selected .creature {
  filter: grayscale(1) brightness(0) invert(1) sepia(.12) contrast(1.05);
}

.plaque .tier {
  margin-top: 1px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(19px, 4.1vw, 44px);
  line-height: .84;
  letter-spacing: .01em;
  text-transform: uppercase;
  text-align: center;
}

.plaque .gloss {
  font-family: var(--body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(10px, 1.7vw, 19px);
  line-height: 1.05;
  margin-top: 3px;
  text-align: center;
}

.plaque .meta {
  margin-top: 2px;
  font-family: var(--stencil);
  font-size: clamp(8px, 1.15vw, 12px);
  letter-spacing: .04em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.plaque .best {
  margin-top: auto;
  padding-top: 3px;
  font-family: var(--stencil);
  font-size: clamp(8px, 1.15vw, 12px);
  letter-spacing: .06em;
  color: var(--brass);
  text-shadow: 1px 1px 0 var(--ink);
  white-space: nowrap;
}

.plaque.selected .best {
  color: var(--bone);
  text-shadow: 1px 1px 0 rgba(22, 17, 12, .55);
}

.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(5px, 1svh, 10px);
  margin-top: auto;
  padding-top: clamp(9px, 1.8svh, 20px);
}

.ink-btn {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  width: min(48vw, 200px);
  aspect-ratio: 231 / 137;
  overflow: hidden;
  filter: drop-shadow(4px 4px 0 rgba(22, 17, 12, .3));
  transition: transform .08s steps(2, end);
}

.ink-btn img {
  width: 200%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  object-position: left center;
}

.ink-btn:active img {
  object-position: right center;
}

.ink-btn:active {
  transform: translate(2px, 2px);
  filter: drop-shadow(2px 2px 0 rgba(22, 17, 12, .3));
}

.hint {
  max-width: 52ch;
  font-family: var(--body);
  font-size: clamp(10px, 1.3vw, 14px);
  line-height: 1.25;
  text-align: center;
  color: #3A2C1E;
}

.hint kbd {
  display: inline-block;
  padding: 0 4px;
  background: var(--bone);
  border: 1px solid var(--ink);
  font-family: var(--stencil);
  font-size: .92em;
  line-height: 1.35;
}

/* ---------------------------------- game --------------------------------- */

.screen.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) clamp(8px, 3vw, 40px) clamp(52px, 9svh, 112px);
}

.hud {
  width: min(100%, 1000px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.hud-left {
  display: flex;
  align-items: flex-start;
  gap: clamp(4px, 1vw, 10px);
}

.amulet-wrap {
  position: relative;
  flex: none;
  width: clamp(58px, 11.5vw, 102px);
  filter: drop-shadow(3px 3px 0 rgba(22, 17, 12, .26));
}

.amulet-wrap img {
  width: 100%;
  height: auto;
}

.amulet-score {
  position: absolute;
  inset: 27% 9% 31%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--stencil);
  font-size: clamp(12px, 2.2vw, 24px);
  line-height: 1;
  letter-spacing: .01em;
}

.streak-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 5px 3px;
  min-width: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(22, 17, 12, .26);
}

.streak-candles {
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.streak-candles img {
  width: clamp(10px, 1.9vw, 17px);
  height: auto;
  opacity: .24;
  filter: grayscale(1) brightness(.7);
}

.streak-candles img.lit {
  opacity: 1;
  filter: none;
}

.streak-label {
  font-family: var(--body);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(9px, 1.3vw, 13px);
  line-height: 1;
  white-space: nowrap;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 1px;
}

.q-count {
  padding: 2px 7px 1px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(22, 17, 12, .26);
  font-family: var(--stencil);
  font-size: clamp(12px, 2vw, 22px);
  line-height: 1.1;
  white-space: nowrap;
}

.progress-row {
  width: min(100%, 760px);
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: clamp(4px, .9svh, 9px);
  padding: 3px 5px;
  background: rgba(231, 220, 195, .9);
  border: 1px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(22, 17, 12, .2);
}

.pip {
  flex: 1 1 0;
  max-width: 24px;
  height: 6px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.pip.done { background: var(--ink); }
.pip.correct { background: var(--brass); }
.pip.wrong { background: var(--red); }

.game-main {
  width: min(100%, 1000px);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(2px, .6svh, 8px);
}

.stage {
  position: relative;
  width: 100%;
  max-width: 760px;
}

.card {
  position: relative;
  width: 100%;
  aspect-ratio: 1024 / 673;
  transform: rotate(-.55deg);
  filter: drop-shadow(7px 9px 0 rgba(22, 17, 12, .28));
  animation: cardIn .28s cubic-bezier(.18, .86, .26, 1) both;
}

@keyframes cardIn {
  from { transform: translateX(9%) rotate(1.1deg); }
  to { transform: translateX(0) rotate(-.55deg); }
}

.card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.card-top {
  position: absolute;
  left: 8.5%;
  right: 8.5%;
  top: 4.4%;
  height: 12.6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.q-number {
  font-family: var(--stencil);
  font-size: clamp(10px, 1.7vw, 19px);
  line-height: 1;
  letter-spacing: .04em;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--stencil);
  font-size: clamp(7px, 1.1vw, 12px);
  line-height: 1;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: right;
}

.cat-badge img {
  width: clamp(13px, 1.9vw, 22px);
  height: auto;
}

.card-body {
  position: absolute;
  left: 8.5%;
  right: 8.5%;
  top: 18.5%;
  bottom: 9%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-body-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, .7vw, 7px);
}

.question {
  font-family: var(--body);
  font-weight: 500;
  font-size: clamp(17px, 2.2vw, 29px);
  line-height: 1.16;
  letter-spacing: 0;
  margin: 0;
}

.lamp {
  position: absolute;
  right: -1.5%;
  top: -13%;
  z-index: 5;
  width: clamp(44px, 8.6vw, 84px);
  pointer-events: none;
}

.lamp-window {
  position: relative;
  width: 100%;
  aspect-ratio: 246 / 680;
  overflow: hidden;
}

.lamp-window img {
  position: absolute;
  top: 0;
  left: 0;
  width: 400%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  object-position: var(--lamp-x, 0%) 0;
  transform-origin: 50% 100%;
  animation: lampFlicker 2.2s steps(5, end) infinite;
}

@keyframes lampFlicker {
  0%, 100% { transform: translateY(0) scaleY(1); }
  45% { transform: translateY(-1px) scaleY(1.015); }
  70% { transform: translateY(0) scaleY(.995); }
}

.lamp.low .lamp-window {
  filter: sepia(.5) saturate(1.5) hue-rotate(-14deg) contrast(1.1);
}

.lamp.low .lamp-window img {
  animation-duration: .7s;
}

.lamp.flare .lamp-window img {
  animation: lampFlare .45s steps(3, end) both;
}

@keyframes lampFlare {
  0% { filter: none; }
  35% { filter: brightness(1.7) saturate(1.3); }
  100% { filter: none; }
}

.lamp-seconds {
  position: relative;
  z-index: 2;
  width: max-content;
  min-width: 2.4ch;
  margin: -8px auto 0;
  padding: 1px 4px;
  background: var(--bone);
  border: 1px solid var(--ink);
  font-family: var(--stencil);
  font-size: clamp(9px, 1.4vw, 15px);
  line-height: 1.05;
  text-align: center;
}

.guide {
  position: absolute;
  right: -4%;
  bottom: -8%;
  z-index: 4;
  width: clamp(76px, 18vw, 148px);
  pointer-events: none;
  filter: drop-shadow(3px 3px 0 rgba(22, 17, 12, .24));
  animation: guideIn .22s steps(3, end) both;
}

@keyframes guideIn {
  from { transform: translateY(6%) rotate(2deg); }
  to { transform: translateY(0) rotate(0); }
}

.guide img {
  width: 100%;
  height: auto;
}

.answers {
  width: min(100%, 860px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 1.2vw, 13px);
  margin-top: clamp(8px, 1.5svh, 16px);
}

.answer {
  position: relative;
  aspect-ratio: 455 / 236;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  filter: drop-shadow(3px 4px 0 rgba(22, 17, 12, .26));
  animation: tileIn .26s cubic-bezier(.18, .9, .22, 1) both;
  transition: transform .08s steps(2, end);
}

.answer:nth-child(2) { animation-delay: .035s; }
.answer:nth-child(3) { animation-delay: .07s; }
.answer:nth-child(4) { animation-delay: .105s; }

@keyframes tileIn {
  0% { transform: translateY(-9%) scale(1.045); }
  62% { transform: translateY(1.5%) scale(.995); }
  100% { transform: translateY(0) scale(1); }
}

.answer:active { transform: translate(2px, 2px); }

.answer .tile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.answer .letter {
  position: absolute;
  left: 4%;
  top: 50%;
  transform: translateY(-50%);
  width: 26%;
  height: 64%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--stencil);
  font-size: clamp(18px, 3.6vw, 30px);
  line-height: 1;
  z-index: 2;
}

.answer .text {
  position: absolute;
  left: 38%;
  right: 3.5%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-family: var(--body);
  font-weight: 500;
  font-size: clamp(13px, 1.6vw, 20px);
  line-height: 1.1;
  color: var(--ink);
}

.answer.long .text {
  font-size: clamp(9px, 1.15vw, 15px);
  -webkit-line-clamp: 4;
  line-height: 1.05;
}

.answer.locked { filter: drop-shadow(2px 3px 0 rgba(22, 17, 12, .18)) grayscale(.35); }
.answer.selected { z-index: 3; }
.answer.focused { transform: translateY(-2px); }
.answer[aria-disabled="true"] { pointer-events: none; }

.stamp {
  position: absolute;
  left: -3%;
  bottom: 1%;
  z-index: 6;
  width: clamp(78px, 18vw, 165px);
  pointer-events: none;
  filter: drop-shadow(2px 3px 0 rgba(22, 17, 12, .2));
  animation: stampIn .24s steps(3, end) both;
}

@keyframes stampIn {
  0% { transform: scale(1.45) rotate(-7deg); }
  62% { transform: scale(.95) rotate(2deg); }
  100% { transform: scale(1) rotate(-1.2deg); }
}

.fact {
  width: min(100%, 860px);
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: clamp(5px, 1.1svh, 12px);
  padding: clamp(5px, 1vw, 11px) clamp(8px, 1.5vw, 16px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-top-width: 5px;
  filter: drop-shadow(3px 3px 0 rgba(22, 17, 12, .24));
  font-family: var(--body);
  font-size: clamp(10px, 1.35vw, 17px);
  line-height: 1.18;
  animation: factIn .22s steps(3, end) both;
}

@keyframes factIn {
  from { transform: translateY(-5px); clip-path: inset(0 0 100% 0); }
  to { transform: translateY(0); clip-path: inset(0); }
}

.fact .answer-word {
  flex: none;
  font-family: var(--stencil);
  font-size: .9em;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.fact .fact-text { min-width: 0; }

.hiwaga-caption {
  width: 100%;
  padding: 1px 8px;
  background: var(--night);
  color: var(--bone);
  border: 2px solid var(--ink);
  font-family: var(--body);
  font-style: italic;
  font-size: clamp(9px, 1.25vw, 14px);
  text-align: center;
  letter-spacing: .03em;
  line-height: 1.2;
}

.hiwaga-caption strong {
  font-family: var(--display);
  font-style: normal;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* -------------------------------- countdown ------------------------------ */

.screen.countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4svh, 48px) clamp(14px, 4vw, 40px) clamp(72px, 14svh, 170px);
}

.countdown-sheet {
  position: relative;
  width: min(86vw, 430px);
  padding: clamp(14px, 4vw, 34px) clamp(16px, 4vw, 38px) clamp(16px, 4vw, 34px);
  text-align: center;
  background:
    repeating-linear-gradient(46deg, transparent 0 7px, rgba(22, 17, 12, .04) 7px 8px),
    var(--paper);
  border: 4px solid var(--ink);
  filter: drop-shadow(6px 7px 0 rgba(22, 17, 12, .3));
  clip-path: polygon(0 2%, 8% 0, 27% 2%, 46% 0, 66% 2%, 84% 0, 100% 2%, 99% 97%, 90% 100%, 70% 98%, 52% 100%, 31% 98%, 12% 100%, 1% 97%);
  animation: sheetIn .24s steps(3, end) both;
}

.countdown-tier {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(30px, 8.5vw, 62px);
  line-height: .86;
  text-transform: uppercase;
}

.countdown-gloss {
  margin-top: 3px;
  font-family: var(--body);
  font-style: italic;
  font-size: clamp(13px, 2.2vw, 21px);
}

.countdown-number {
  margin: clamp(2px, 1svh, 8px) 0 0;
  font-family: var(--stencil);
  font-size: clamp(76px, 24vw, 180px);
  line-height: .9;
  color: var(--red);
  text-shadow: 4px 4px 0 var(--ink);
  animation: countIn .22s steps(3, end) both;
}

@keyframes countIn {
  from { transform: scale(1.28) rotate(-2deg); }
  to { transform: scale(1) rotate(0); }
}

.countdown-caption {
  margin-top: 5px;
  font-family: var(--body);
  font-style: italic;
  font-size: clamp(11px, 1.5vw, 16px);
  line-height: 1.2;
}

.countdown-guide {
  position: absolute;
  right: -4%;
  bottom: -26%;
  width: clamp(72px, 17vw, 128px);
  filter: drop-shadow(3px 3px 0 rgba(22, 17, 12, .24));
  pointer-events: none;
}

/* --------------------------------- results ------------------------------- */

.screen.results {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(8px, 1.8svh, 26px) clamp(10px, 3.4vw, 44px) clamp(76px, 13svh, 160px);
}

.results-sheet {
  width: min(100%, 900px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2svh, 14px);
  padding: clamp(9px, 1.8vw, 24px) clamp(8px, 1.8vw, 26px) clamp(10px, 2vw, 28px);
  background:
    repeating-linear-gradient(46deg, transparent 0 7px, rgba(22, 17, 12, .035) 7px 8px),
    var(--paper);
  border: 3px solid var(--ink);
  clip-path: polygon(0 1%, 4% 0, 19% 1.5%, 43% 0, 66% 1.5%, 87% 0, 100% 1%, 99% 98%, 91% 100%, 72% 98.5%, 51% 100%, 29% 98.5%, 10% 100%, 1% 98%);
  filter: drop-shadow(6px 7px 0 rgba(22, 17, 12, .28));
}

.results-kicker {
  font-family: var(--stencil);
  font-size: clamp(9px, 1.3vw, 13px);
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 2px 10px;
  background: var(--paper-shadow);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.results-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 22px);
  padding-top: 2px;
}

.results-medal {
  position: relative;
  width: clamp(66px, 14vw, 120px);
  flex: none;
  filter: drop-shadow(4px 4px 0 rgba(22, 17, 12, .25));
}

.results-top .amulet-score {
  font-size: clamp(15px, 3.2vw, 32px);
}

.results-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.results-score-label {
  font-family: var(--stencil);
  font-size: clamp(9px, 1.3vw, 14px);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.results-score {
  font-family: var(--stencil);
  font-size: clamp(38px, 10vw, 92px);
  line-height: 1;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--brass);
}

.verdict {
  margin-top: 2px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(20px, 4.2vw, 44px);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .01em;
}

.verdict-line {
  max-width: 44ch;
  font-family: var(--body);
  font-style: italic;
  font-size: clamp(12px, 1.6vw, 18px);
  line-height: 1.2;
  text-align: center;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 1.2vw, 12px);
  width: 100%;
  max-width: 620px;
}

.stat {
  min-width: 0;
  padding: 5px 8px 4px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(22, 17, 12, .24);
  text-align: center;
}

.stat .stat-label {
  display: block;
  font-family: var(--stencil);
  font-size: clamp(8px, 1.1vw, 11px);
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.stat .stat-value {
  display: block;
  font-family: var(--stencil);
  font-size: clamp(17px, 3.2vw, 32px);
  line-height: 1.05;
}

.medallions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(4px, 1.4vw, 14px);
  width: 100%;
  align-items: flex-start;
}

.medallion {
  width: clamp(56px, 12vw, 98px);
  text-align: center;
  opacity: .32;
  filter: grayscale(1);
}

.medallion.earned { opacity: 1; filter: none; }

.medallion img { width: 100%; height: auto; }

.medallion span {
  display: block;
  margin-top: 1px;
  font-family: var(--stencil);
  font-size: clamp(8px, 1.05vw, 11px);
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.05;
}

.board {
  width: min(100%, 620px);
  background: var(--paper);
  border: 3px solid var(--ink);
  filter: drop-shadow(4px 4px 0 rgba(22, 17, 12, .26));
  padding: 6px 10px 7px;
  clip-path: polygon(0 1%, 5% 0, 22% 2%, 45% 0, 68% 2%, 88% 0, 100% 2%, 99% 98%, 86% 100%, 64% 98%, 42% 100%, 21% 98%, 5% 100%, 0 98%);
}

.leaderboard-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 3px;
  font-family: var(--display);
  font-size: clamp(14px, 2.2vw, 24px);
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.leaderboard-title small {
  font-family: var(--stencil);
  font-size: .5em;
  letter-spacing: .06em;
}

.leaderboard-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 3px;
}

.board-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: clamp(10px, 1.3vw, 15px);
  line-height: 1.25;
}

.board-row .rank {
  flex: none;
  width: 2ch;
  font-family: var(--stencil);
  text-align: right;
}

.board-row .who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-row .who a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.board-row .value {
  margin-left: auto;
  font-family: var(--stencil);
  white-space: nowrap;
}

.board-row.mine .who { font-weight: 700; }
.board-row.mine .value { color: var(--red); }

.board-empty {
  padding: 4px 0;
  font-style: italic;
  font-size: clamp(10px, 1.3vw, 14px);
  text-align: center;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 1.6vw, 16px);
  width: 100%;
  margin-top: clamp(2px, 1svh, 10px);
}

.results-actions .ink-btn { width: min(38vw, 195px); }

.final-creature {
  position: fixed;
  right: -9vw;
  bottom: clamp(34px, 8svh, 110px);
  z-index: 3;
  width: clamp(110px, 22vw, 260px);
  pointer-events: none;
  filter: drop-shadow(-4px 4px 0 rgba(22, 17, 12, .22));
}

.final-creature img { width: 100%; height: auto; }

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
  font-family: var(--body);
  font-size: 20px;
  z-index: 20;
}

/* ---------------------------- wide game layout --------------------------- */

@media (min-width: 700px) and (min-aspect-ratio: 5/4) {
  .game-main {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: clamp(8px, 1.6vw, 20px);
    margin-top: clamp(2px, .8svh, 10px);
  }

  .stage {
    grid-column: 1;
    grid-row: 1;
    width: min(100%, calc(56svh * 1.521));
    max-width: none;
    justify-self: center;
  }

  .answers {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
    align-self: center;
  }

  .fact {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0;
  }

  .answer .text { font-size: clamp(12px, 1.35vw, 20px); }
}

@media (min-width: 700px) and (min-aspect-ratio: 5/4) {
  .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 900px; }
  .medallions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(4px, .8vw, 10px); }
  .results-sheet {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    align-items: start;
    column-gap: clamp(10px, 2vw, 28px);
    row-gap: clamp(5px, 1svh, 10px);
  }
  .results-kicker { grid-column: 1 / -1; justify-self: center; }
  .results-top { grid-column: 1; grid-row: 2; }
  .verdict, .verdict-line { grid-column: 1; }
  .stats-row { grid-column: 2; grid-row: 2; max-width: none; align-self: start; }
  .medallions { grid-column: 2; }
  .board-slot { grid-column: 2; width: 100%; }
  .results-actions { grid-column: 1; grid-row: 5; justify-content: flex-start; }
  .results-sheet > .hint { grid-column: 1; grid-row: 6; }
  .results-sheet { position: relative; }
}

@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .screen.menu { padding-bottom: clamp(56px, 8svh, 100px); }
  .title-wrap { width: min(48vw, 34svh, 560px); }
  .plaque .creature { height: clamp(80px, 13svh, 155px); }
  .ink-btn { width: min(42vw, 180px); }
}

/* -------------------------------- small / tall --------------------------- */

@media (max-height: 640px) {
  .title-wrap { width: min(70vw, 36svh, 520px); }
  .plaque .creature { height: clamp(38px, 8svh, 86px); }
  .plaque .tier { font-size: clamp(16px, 3.4vw, 34px); }
  .plaque .gloss { font-size: clamp(9px, 1.4vw, 15px); }
  .plaque .meta, .plaque .best { font-size: clamp(7px, 1vw, 10px); }
  .menu-actions { margin-top: 5px; }
  .ink-btn { width: min(50vw, 250px); }
  .screen.game { padding-bottom: clamp(34px, 7svh, 60px); }
  .answers { margin-top: 5px; }
}

@media (max-height: 640px) and (min-aspect-ratio: 5/4) {
  .screen.results { padding-top: 6px; padding-bottom: 42px; }
  .results-sheet { padding: 6px 10px 8px; row-gap: 3px; column-gap: 12px; }
  .card-body { right: 21%; }
  .question { font-size: clamp(14px, 1.9vw, 22px); }
  .results-medal { width: 70px; }
  .results-score { font-size: clamp(30px, 7vw, 62px); }
  .results-score-label { font-size: 8px; }
  .verdict { font-size: clamp(17px, 3.2vw, 32px); }
  .verdict-line { font-size: 10px; line-height: 1.1; }
  .results-actions { gap: 8px; margin-top: 0; }
  .results-actions .ink-btn { width: min(22vw, 140px); }
  .medallion { width: clamp(44px, 8vw, 70px); }
  .medallion span { font-size: 7px; }
  .board { padding: 4px 8px 5px; }
  .leaderboard-title { font-size: 13px; }
  .board-row { font-size: 9px; }
  .stat { padding: 3px 5px; }
  .stat .stat-value { font-size: 16px; }
  .stat .stat-label { font-size: 7px; }
  .results-sheet > .hint { font-size: 9px; }
}

@media (max-height: 520px) {
  .hint { display: none; }
  .title-wrap { width: min(38vw, 28svh, 240px); }
  .tagline { margin-top: 2px; padding: 1px 8px; font-size: 8px; }
  .category-row { margin-top: 3px; gap: 3px; }
  .category-chip { padding: 1px 4px 1px 3px; font-size: 7px; }
  .category-chip img { width: 13px; }
  .difficulty-row { margin-top: 4px; gap: 6px; }
  .plaque { padding: 3px 4px 4px; }
  .plaque .creature { height: clamp(26px, 7svh, 52px); }
  .plaque .tier { font-size: clamp(15px, 3vw, 27px); }
  .plaque .gloss { margin-top: 1px; font-size: 9px; }
  .plaque .meta { font-size: 7px; }
  .plaque .best { display: none; }
  .screen.menu { padding: 4px 10px 46px; }
  .menu-actions { margin-top: 4px; padding-top: 0; gap: 2px; }
  .ink-btn { width: min(30vw, 150px); }
  .screen.results { padding-bottom: 48px; }
  .results-sheet { padding: 7px 10px 9px; }
}

@media (max-width: 370px) {
  .category-row { flex-wrap: wrap; }
  .category-chip { font-size: 7px; padding-right: 5px; }
  .category-chip img { width: 14px; }
  .plaque .meta { font-size: 7px; }
  .plaque .gloss { font-size: 9px; }
  .answer .text { font-size: 12px; left: 38%; }
  .answer .letter { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
