@font-face {
  font-family: "Fredoka";
  src: url("assets/fredoka-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("assets/fredoka-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --topbar-h: 84px;
  --worktop-y: 52dvh;
  --sopo-w: min(64vw, 360px);
  --counter-clearance: clamp(25px, 8dvh, 72px);
  --ok-size: clamp(56px, 8dvh, 76px);
  --ok-safe-bottom: max(8px, env(safe-area-inset-bottom));
  --ok-row-height: calc(var(--ok-size) + var(--ok-safe-bottom) + 8px);
  --ice-deep: #075f80;
  --ice: #0d9dbe;
  --ice-light: #bff4f5;
  --cream: #fff8e6;
  --paper: #fff7dd;
  --paper-deep: #ecd3a0;
  --wood: #88512e;
  --wood-deep: #46291d;
  --ink: #292b34;
  --ink-soft: #5e5c55;
  --blue-ink: #123c6b;
  --gold: #f5c448;
  --gold-deep: #a86b12;
  --green: #3da834;
  --error: #8a5729;
  --focus: #fff9da;
  --shadow: 0 10px 24px rgba(40, 35, 28, 0.2);
  --choice-gap: clamp(8px, 1.5vw, 17px);
  --numeral-choice-height: clamp(98px, 14dvh, 150px);
  --parcel-choice-height: clamp(142px, 25dvh, 220px);
  --parcel-frame-width: min(100%, 190px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: #148fb0 url("assets/post-counter-portrait.webp") center / cover no-repeat;
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

body[data-stage="quantity"] {
  --worktop-y: 45dvh;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 8px rgba(5, 76, 101, 0.9);
}

button:disabled,
a[aria-disabled="true"] {
  cursor: default;
  filter: saturate(0.45);
  opacity: 0.5;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 120;
  top: 8px;
  left: 50%;
  padding: 12px 18px;
  border-radius: 10px;
  color: #fff;
  background: var(--ice-deep);
  box-shadow: var(--shadow);
  transform: translate(-50%, -180%);
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

.app {
  position: relative;
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--ok-row-height);
  width: 100%;
  height: 100dvh;
  isolation: isolate;
}

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.5vw, 20px);
  min-width: 0;
  padding: 7px clamp(8px, 2vw, 26px) 5px;
}

.controls {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(2px, 0.55vw, 7px);
  padding: 3px clamp(4px, 0.7vw, 8px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 237, 196, 0.12), rgba(56, 31, 20, 0.38));
  box-shadow: 0 5px 16px rgba(42, 28, 20, 0.2);
}

.wood-control {
  position: relative;
  display: inline-grid;
  flex: 0 0 56px;
  place-items: center;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  text-decoration: none;
  transition: transform 120ms ease, filter 120ms ease;
}

.wood-control:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.wood-control:active {
  transform: translateY(1px) scale(0.97);
}

.wood-control img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  pointer-events: none;
}

.wood-control span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  color: #fff9df;
  font-size: 9px;
  font-weight: 600;
  line-height: 10px;
  text-shadow: 0 1px 2px #352014;
  white-space: nowrap;
}

.wood-control[aria-pressed="true"] img {
  filter: sepia(0.18) saturate(0.75);
}

.progress-wrap {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(7px, 1.2vw, 14px);
  min-width: 0;
}

.mail-progress,
.star-progress {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: clamp(2px, 0.45vw, 5px);
}

.mail-progress {
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(77, 45, 25, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 239, 196, 0.2);
}

.mail-prop {
  position: relative;
  display: block;
  width: clamp(18px, 2.1vw, 25px);
  aspect-ratio: 1.35;
  overflow: hidden;
  border: 2px solid #e0bd7d;
  border-radius: 2px;
  background: #f9edce;
  box-shadow: 0 2px 2px rgba(50, 30, 18, 0.22);
  opacity: 0.72;
  transform: rotate(-3deg);
}

.mail-prop:nth-child(even) {
  transform: rotate(3deg);
}

.mail-prop::before,
.mail-prop::after {
  position: absolute;
  content: "";
}

.mail-prop::before {
  top: -1px;
  left: 50%;
  width: 72%;
  height: 72%;
  border-right: 1px solid #bb9463;
  border-bottom: 1px solid #bb9463;
  transform: translateX(-50%) rotate(45deg);
}

.mail-prop::after {
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  background: #187da2;
}

.mail-prop.current {
  border-color: #fff1a8;
  background: #fff9e6;
  box-shadow: 0 0 0 2px #f4c645, 0 2px 3px rgba(50, 30, 18, 0.25);
  opacity: 1;
}

.mail-prop.complete {
  border-color: #eac455;
  background: #fff4c9;
  opacity: 1;
}

.mail-prop.complete::after {
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 10px solid #f4c645;
  border-left: 10px solid transparent;
}

.star-progress {
  padding: 3px 4px;
  border-radius: 10px;
  background: rgba(71, 43, 28, 0.25);
}

.star-prop {
  display: block;
  width: clamp(18px, 2vw, 23px);
  height: auto;
  opacity: 0.72;
}

.star-prop.earned {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(250, 207, 75, 0.74));
}

.game-board {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: max(0px, calc(var(--worktop-y) - var(--topbar-h))) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(10px, 3vw, 30px) 4px;
}

.sopo-column {
  z-index: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 0;
}

.sopo-frame {
  position: relative;
  display: grid;
  width: var(--sopo-w);
  aspect-ratio: 5 / 4;
  place-items: end center;
  filter: drop-shadow(0 13px 12px rgba(35, 77, 83, 0.22));
  transform: translateY(26px);
}

.sopo-frame::before {
  position: absolute;
  z-index: 0;
  inset: -12% -18% -2%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 48%,
    rgba(255, 253, 238, 0.9) 0%,
    rgba(191, 244, 245, 0.65) 42%,
    transparent 78%
  );
  filter: blur(14px);
  pointer-events: none;
}

.sopo-frame::after {
  position: absolute;
  z-index: 0;
  bottom: -1px;
  left: 18%;
  width: 64%;
  height: 14px;
  content: "";
  background:
    radial-gradient(ellipse 34% 66% at 21% 50%, rgba(54, 31, 18, 0.3), transparent 78%),
    radial-gradient(ellipse 34% 66% at 79% 50%, rgba(54, 31, 18, 0.28), transparent 78%);
  filter: blur(1.5px);
  opacity: 0.72;
  pointer-events: none;
}

.sopo-video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 0;
  filter: drop-shadow(0 0 10px rgba(255, 253, 225, 0.9));
}

.sopo-video.is-static {
  filter:
    saturate(0.98)
    drop-shadow(0 0 10px rgba(255, 253, 225, 0.9));
}

.task-panel {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  max-width: 760px;
  min-width: 0;
  min-height: 0;
  margin-inline: auto;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: visible;
}

.task-heading-row {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.level-label,
.task-count {
  margin: 0;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1;
}

.instruction-note {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: min(100%, 500px);
  min-height: 52px;
  margin: 0 auto 9px;
  padding: 6px 10px 6px 20px;
  border-radius: 4px 5px 6px 4px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.52), transparent 40%),
    repeating-linear-gradient(0deg, rgba(153, 111, 63, 0.035) 0 1px, transparent 1px 5px),
    #fff4d7;
  box-shadow: 0 3px 0 #cfad73, 0 7px 12px rgba(65, 43, 26, 0.2);
  transform: rotate(-0.25deg);
}

.instruction-note::before {
  position: absolute;
  top: 7px;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  content: "";
  background: radial-gradient(circle at 35% 30%, #fff1b1, #b8791b 48%, #70400f 100%);
  box-shadow: 0 2px 3px rgba(57, 32, 14, 0.35);
}

.speech-bubble {
  min-width: 0;
}

.speech-bubble p {
  margin: 0;
  color: #3d332d;
  font-size: clamp(15px, 1.5vw, 20px);
  font-weight: 600;
  line-height: 1.1;
}

.spoken-word {
  margin-top: 3px !important;
  color: var(--ice-deep) !important;
  font-size: 0.75em !important;
  letter-spacing: 0.02em;
}

.listen-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.listen-button,
.small-button,
.primary-button,
.secondary-button {
  border: 0;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.listen-button:hover,
.small-button:hover,
.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.listen-button:active,
.small-button:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.98);
}

.listen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 56px;
  min-width: 56px;
  min-height: 48px;
  padding: 4px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(#096a82, #07516d);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 3px 0 rgba(6, 61, 79, 0.35);
  font-size: 14px;
  font-weight: 600;
}

.listen-button img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.listen-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.listen-button.is-playing img {
  animation: listen-pulse 780ms ease-in-out infinite alternate;
}

.chosen-numeral {
  display: inline-flex;
  min-width: 58px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--blue-ink);
  background:
    linear-gradient(135deg, transparent 43%, rgba(153, 109, 58, 0.12) 44% 48%, transparent 49%),
    #fff9e7;
  box-shadow: inset 0 0 0 1px #d5b677, 0 2px 0 rgba(103, 66, 34, 0.17);
}

.chosen-numeral strong {
  color: #332d2a;
  font-size: 29px;
  line-height: 0.86;
}

.mini-label {
  display: block;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.chosen-numeral .mini-label {
  display: none;
}

.choices {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(var(--choice-columns, 2), minmax(0, 1fr));
  gap: var(--choice-gap);
  align-items: stretch;
  width: 100%;
  min-height: 0;
  margin-inline: auto;
}

.choice {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 0;
  border: 0;
  outline: 0 solid transparent;
  background: transparent;
  touch-action: none;
  user-select: none;
  transition: transform 120ms ease, filter 120ms ease, outline-color 120ms ease;
}

.choice:hover {
  filter: brightness(1.035);
  transform: translateY(-2px);
}

.choice:active {
  transform: translateY(1px) scale(0.992);
}

.choice[aria-pressed="true"],
.choice.selected {
  outline: 4px solid var(--ice-deep);
  outline-offset: 3px;
  filter: drop-shadow(0 8px 7px rgba(9, 76, 101, 0.3));
  transform: translateY(-2px);
}

.choice[aria-pressed="true"]::after,
.choice.selected::after {
  position: absolute;
  z-index: 3;
  top: 5px;
  left: 7px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  content: "";
  background: var(--ice-deep);
  box-shadow: 0 2px 5px rgba(32, 40, 43, 0.34);
}

.choice.dragging {
  opacity: 0.64;
  transform: scale(0.975);
}

.numeral-choice,
.demo-choice.demo-numeral {
  height: var(--numeral-choice-height);
  background: url("assets/number-envelope.webp") center / 100% 100% no-repeat;
}

.numeral-choice strong {
  position: absolute;
  top: 19%;
  left: 50%;
  color: #322b29;
  font-size: clamp(47px, 7.5vw, 88px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.78;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateX(-50%);
}

.option-word {
  position: absolute;
  right: 16%;
  bottom: 11%;
  left: 16%;
  color: #174b64;
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-transform: capitalize;
}

.option-listen {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 5px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.option-listen img {
  width: 30px;
  height: 30px;
}

.parcel-choice,
.demo-choice.demo-parcel {
  height: var(--parcel-choice-height);
}

.parcel-paper {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.55vw, 6px);
  padding: 6px 12px;
  overflow: visible;
  background: transparent url("assets/parcel-box.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 7px 5px rgba(67, 43, 25, 0.23));
}

.parcel-paper::before {
  content: none;
}

.parcel-paper::after {
  content: none;
}

.ten-frame {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 160px);
  max-width: 160px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(2px, 0.35vw, 4px);
  aspect-ratio: 5 / 2;
  padding: clamp(3px, 0.45vw, 5px);
  border: 2px solid rgba(11, 89, 119, 0.88);
  border-radius: 4px;
  background:
    repeating-linear-gradient(90deg, transparent 0 19%, rgba(51, 102, 112, 0.08) 19% 20%),
    #fff8de;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.choice .ten-frame,
.demo-choice .ten-frame {
  width: var(--parcel-frame-width);
  max-width: none;
}

.ten-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: visible;
  border: 1px solid rgba(18, 95, 121, 0.32);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.52);
}

.ten-cell.filled {
  background: rgba(255, 241, 194, 0.7);
}

.ten-cell img {
  display: block;
  width: 90%;
  height: 90%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.confirm-row {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.5vw, 18px);
  align-items: center;
  width: min(100%, 540px);
  min-height: 92px;
  margin: 12px auto 0;
  padding: clamp(12px, 2vh, 19px) clamp(18px, 4vw, 42px) clamp(10px, 1.8vh, 17px);
  background: url("assets/receiving-tray.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 8px 8px rgba(43, 45, 40, 0.25));
}

.answer-tray,
.demo-tray {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 64px;
  place-items: center;
  padding: 3px 4px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 248, 225, 0.11);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.tray-label {
  position: absolute;
  top: -2px;
  left: 50%;
  color: rgba(255, 250, 224, 0.9);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-shadow: 0 1px 2px #174552;
  text-transform: uppercase;
  transform: translateX(-50%);
  white-space: nowrap;
}

.answer-tray-slot,
.demo-tray-slot {
  display: grid;
  min-width: min(170px, 100%);
  min-height: 54px;
  place-items: center;
}

.answer-tray:not(.has-answer) .answer-tray-slot::before,
.demo-tray:not(.has-answer) .demo-tray-slot::before {
  display: block;
  width: min(150px, 90%);
  aspect-ratio: 1.75;
  border: 2px dashed rgba(255, 248, 218, 0.58);
  border-radius: 2px;
  content: "";
  background:
    linear-gradient(145deg, transparent 49%, rgba(255, 248, 218, 0.38) 50% 52%, transparent 53%),
    rgba(255, 248, 218, 0.08);
  box-shadow: inset 0 0 12px rgba(7, 68, 88, 0.14);
}

.answer-tray.drop-active,
.demo-tray.drop-active {
  background: rgba(183, 238, 244, 0.3);
  box-shadow: 0 0 0 5px rgba(116, 225, 239, 0.62), inset 0 0 18px rgba(255, 255, 255, 0.28);
}

.answer-tray .tray-candidate {
  pointer-events: none;
}

.answer-tray .numeral-choice,
.demo-tray .demo-choice.demo-numeral {
  width: min(150px, 100%);
  height: 70px;
}

.answer-tray .numeral-choice strong,
.demo-tray .demo-choice.demo-numeral strong {
  font-size: 39px;
}

.answer-tray .numeral-choice .option-word {
  display: none;
}

.answer-tray .parcel-choice,
.answer-tray .demo-choice.demo-parcel,
.demo-tray .demo-choice.demo-parcel {
  width: min(240px, 100%);
  height: clamp(60px, 8dvh, 78px);
}

.answer-tray .parcel-paper,
.demo-tray .parcel-paper {
  flex-direction: row;
  gap: 3px;
  padding: 5px 9px;
}

.answer-tray .ten-frame,
.demo-tray .ten-frame {
  width: min(108px, calc(50% - 2px));
  max-width: none;
  padding: 2px;
  border-width: 1px;
}

.answer-tray .ten-cell img,
.demo-tray .ten-cell img {
  min-width: 0;
  min-height: 0;
}

.confirm-button {
  position: relative;
  display: grid;
  width: var(--ok-size);
  height: var(--ok-size);
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: transparent;
  filter: drop-shadow(0 6px 0 rgba(28, 92, 20, 0.3));
  transition: transform 120ms ease, filter 120ms ease;
}

.confirm-button:hover {
  filter: drop-shadow(0 8px 0 rgba(28, 92, 20, 0.3)) brightness(1.05);
  transform: translateY(-2px);
}

.confirm-button:active {
  transform: translateY(2px) scale(0.97);
}

.confirm-button[aria-disabled="true"] {
  filter: saturate(0.35) brightness(0.82);
  opacity: 0.62;
}

.confirm-button img {
  width: var(--ok-size);
  height: var(--ok-size);
  object-fit: contain;
}

.confirm-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.confirm-button.drop-active {
  box-shadow: 0 0 0 7px rgba(79, 210, 77, 0.45);
}

.bottom-ok-dock {
  position: relative;
  z-index: 80;
  display: grid;
  grid-row: 3;
  grid-template: 1fr / 1fr;
  place-items: start center;
  min-width: 0;
  min-height: 0;
  padding-top: 8px;
  pointer-events: none;
}

.bottom-ok-dock > * {
  grid-area: 1 / 1;
}

.bottom-ok-dock .confirm-button {
  pointer-events: auto;
}

.bottom-ok-dock .demo-confirm {
  pointer-events: none;
}

.feedback {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.feedback.error,
.feedback.success {
  z-index: 8;
  top: calc(100% + 3px);
  width: auto;
  height: auto;
  padding: 5px 12px;
  margin: 0;
  overflow: visible;
  clip: auto;
  border-radius: 4px;
  background: #fff5d8;
  box-shadow: 0 3px 8px rgba(57, 40, 28, 0.23);
  transform: translateX(-50%);
}

.feedback.error {
  color: var(--error);
  font-weight: 600;
}

.feedback.success {
  color: #80520e;
  font-weight: 600;
}

.drag-ghost {
  position: fixed;
  z-index: 90;
  display: grid;
  min-width: 66px;
  min-height: 50px;
  place-items: center;
  padding: 7px 12px;
  border: 3px solid var(--ice-deep);
  border-radius: 5px;
  color: var(--blue-ink);
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(18, 54, 56, 0.28);
  font-size: 24px;
  font-weight: 600;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
}

.corner-rune {
  position: fixed;
  z-index: 130;
  bottom: 3px;
  left: 3px;
  display: block;
  width: clamp(18px, 2.2vw, 24px);
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.overlay {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(7, 47, 60, 0.5);
  backdrop-filter: blur(3px);
}

.opening-overlay {
  background: #c9f0ef;
  backdrop-filter: none;
}

.opening-scene,
.opening-shade {
  position: absolute;
  inset: 0;
}

.opening-scene picture,
.opening-scene img {
  display: block;
  width: 100%;
  height: 100%;
}

.opening-scene img {
  object-fit: cover;
  object-position: center;
}

.opening-shade {
  background:
    linear-gradient(180deg, transparent 35%, rgba(6, 46, 57, 0.08) 56%, rgba(8, 43, 51, 0.46)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.16), transparent 32%);
  pointer-events: none;
}

.opening-title-frame {
  position: absolute;
  top: 6%;
  left: 50%;
  width: min(86vw, 620px);
  padding: clamp(10px, 2vw, 20px) clamp(18px, 4vw, 44px);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent),
    #88562f;
  box-shadow:
    inset 0 0 0 3px rgba(255, 226, 164, 0.24),
    0 12px 24px rgba(35, 27, 20, 0.3);
  transform: translateX(-50%) rotate(-0.35deg);
}

.opening-title-frame h2 {
  color: #fff7dd;
  font-size: clamp(31px, 5.5vw, 60px);
  text-align: center;
  text-shadow: 0 3px 0 rgba(67, 37, 20, 0.48);
}

.opening-actions {
  position: absolute;
  bottom: max(4vh, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  width: min(90vw, 560px);
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
}

.opening-actions p {
  margin: 0;
  padding: 8px 15px;
  border-radius: 999px;
  color: #fffdf0;
  background: rgba(23, 49, 53, 0.62);
  box-shadow: 0 2px 8px rgba(22, 33, 34, 0.2);
  font-size: clamp(14px, 1.8vw, 19px);
  text-align: center;
}

.play-button {
  display: inline-flex;
  min-width: clamp(150px, 22vw, 220px);
  min-height: 66px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 10px 26px;
  border: 4px solid #ffe39b;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #f2bc3e, #c77d13);
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.35), 0 7px 0 #7d4c13, 0 13px 26px rgba(40, 29, 19, 0.28);
  font-size: clamp(25px, 3.5vw, 38px);
  font-weight: 600;
  text-shadow: 0 2px 0 rgba(111, 66, 20, 0.55);
}

.play-button:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.play-button:active {
  transform: translateY(4px);
}

.play-symbol {
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 21px solid #fff;
  filter: drop-shadow(0 2px 0 rgba(111, 66, 20, 0.45));
}

.demo-overlay {
  display: block;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.demo-overlay .overlay-scene {
  position: absolute;
  top: auto;
  right: max(10px, 2.6vw);
  bottom: var(--counter-clearance);
  display: flex;
  width: min(63vw, 820px);
  height: auto;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

.demo-heading {
  width: max-content;
  max-width: 100%;
  margin: 0 0 7px;
  padding: 5px 16px;
  border-radius: 3px;
  background: #fff1cf;
  box-shadow: 0 2px 0 #cba86d, 0 4px 8px rgba(60, 39, 24, 0.18);
  transform: rotate(-0.5deg);
}

.demo-heading h2 {
  color: #49372e;
  font-size: clamp(14px, 1.5vw, 19px);
}

.demo-board {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 0 0 auto;
  flex-direction: column;
}

.demo-step {
  display: flex;
  min-height: 0;
  flex: 0 0 auto;
  flex-direction: column;
}

.demo-prompt {
  display: flex;
  align-items: baseline;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  padding: 3px 8px;
  color: #3d332d;
  background: #fff4d7;
  text-shadow: none;
}

.demo-prompt span {
  font-size: clamp(11px, 1.3vw, 14px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.demo-prompt strong {
  color: #123c6b;
  font-size: clamp(19px, 2.5vw, 28px);
  line-height: 1;
  text-transform: capitalize;
}

.demo-options {
  display: grid;
  grid-template-columns: repeat(var(--choice-columns, 3), minmax(0, 1fr));
  gap: var(--choice-gap);
  align-items: stretch;
  min-height: 0;
  margin: 3px 0 9px;
}

.demo-choice {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 4px rgba(57, 39, 25, 0.2));
  transition: transform 120ms ease, outline-color 120ms ease;
}

.demo-choice.demo-numeral strong {
  position: absolute;
  top: 19%;
  left: 50%;
  color: #322b29;
  font-size: clamp(38px, 6.5vw, 70px);
  line-height: 0.8;
  transform: translateX(-50%);
}

.demo-choice.demo-parcel .parcel-paper {
  width: 100%;
  height: 100%;
}

.demo-choice.selected,
.demo-choice.is-target.selected {
  outline: 4px solid var(--ice-deep);
  outline-offset: 3px;
}

.demo-source-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.demo-numeral-placeholder {
  height: var(--numeral-choice-height);
}

.demo-parcel-placeholder {
  height: var(--parcel-choice-height);
}

.demo-destination-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--choice-gap);
  align-items: center;
  width: min(100%, 540px);
  min-height: 92px;
  margin: 12px auto 0;
  padding: clamp(12px, 2vh, 19px) clamp(18px, 4vw, 42px) clamp(10px, 1.8vh, 17px);
  background: url("assets/receiving-tray.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 5px rgba(43, 45, 40, 0.22));
}

.demo-tray .demo-choice {
  pointer-events: none;
}

.demo-confirm {
  position: relative;
  display: grid;
  width: var(--ok-size);
  height: var(--ok-size);
  place-items: center;
  color: #fff;
  filter: drop-shadow(0 5px 0 rgba(28, 92, 20, 0.3));
}

.demo-confirm img {
  width: var(--ok-size);
  height: var(--ok-size);
  object-fit: contain;
}

.demo-confirm span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.demo-confirm.demo-confirmed {
  filter: drop-shadow(0 0 8px #ffe36d) brightness(1.12);
}

.demo-success {
  position: absolute;
  right: 22%;
  bottom: calc(100% + 3px);
  margin: 0;
  padding: 3px 10px;
  border-radius: 4px;
  color: #71480f;
  background: #fff5cf;
  box-shadow: 0 2px 6px rgba(48, 35, 22, 0.23);
  font-size: 14px;
  font-weight: 600;
}

.demo-hand {
  position: absolute;
  z-index: 8;
  width: clamp(46px, 6vw, 70px);
  height: auto;
  pointer-events: none;
  transform: translate(-14%, -74%) rotate(-7deg);
  transition: left 260ms ease, top 260ms ease;
}

.demo-hand.is-static {
  transition: none;
  animation: none;
}

.demo-caption {
  min-height: 24px;
  margin: 7px 0 0;
  color: #fffdf1;
  font-size: clamp(12px, 1.4vw, 16px);
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 3px rgba(28, 44, 44, 0.68);
}

.demo-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 48px;
  margin-top: 4px;
}

.demo-dots {
  display: flex;
  gap: 5px;
}

.demo-dots span {
  display: block;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: rgba(16, 82, 95, 0.62);
}

.demo-dots .active {
  background: #ffe06a;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.secondary-button,
.primary-button,
.small-button {
  min-height: 48px;
  padding: 9px 18px;
  border-radius: 7px;
  font-weight: 600;
}

.secondary-button {
  color: #422e22;
  background: linear-gradient(#fff8dc, #ead3a0);
  box-shadow: inset 0 0 0 2px #b9894d, 0 3px 0 #946333;
}

.primary-button {
  color: #fff;
  background: linear-gradient(#168aa8, #086982);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 3px 0 #05485b;
}

.small-button {
  min-height: 48px;
  color: var(--blue-ink);
  background: #fff4d1;
  box-shadow: inset 0 0 0 2px #ba8d51, 0 3px 0 rgba(115, 73, 35, 0.25);
}

.postcard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr);
  width: min(94vw, 760px);
  max-height: min(88dvh, 610px);
  overflow: hidden;
  border: 5px solid #76502f;
  border-radius: 9px;
  background: #fff7dd;
  box-shadow: inset 0 0 0 2px #ffe1a7, 0 20px 50px rgba(30, 33, 29, 0.34);
}

.postcard-art {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(10, 111, 139, 0.16)),
    #8ddde3;
}

.postcard-art::before {
  position: absolute;
  inset: 52% 0 0;
  content: "";
  background:
    repeating-linear-gradient(3deg, rgba(84, 43, 21, 0.15) 0 2px, transparent 2px 18px),
    #b87542;
}

.postcard-art img {
  position: absolute;
  z-index: 2;
  right: -3%;
  bottom: 3%;
  width: 92%;
  height: 67%;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(30, 63, 65, 0.2));
}

.mailbox {
  position: absolute;
  z-index: 3;
  bottom: 16%;
  left: 7%;
  width: 42%;
  height: 20%;
  border: 5px solid #6e4028;
  border-radius: 50% 50% 5px 5px;
  background: #196b8a;
  box-shadow: inset 0 5px rgba(255, 255, 255, 0.15), 0 5px 0 rgba(70, 42, 25, 0.22);
}

.mailbox::after {
  position: absolute;
  right: 12%;
  bottom: -65%;
  width: 7px;
  height: 70%;
  content: "";
  background: #6e4028;
}

.stamp {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  color: #fff5d9;
  background: #176d91;
  box-shadow: inset 0 0 0 3px #a7e3e5;
  font-size: 10px;
  font-weight: 600;
}

.stamp.one {
  top: 9%;
  right: 8%;
  width: 56px;
  aspect-ratio: 1;
  transform: rotate(5deg);
}

.stamp.two {
  top: 18%;
  right: 23%;
  width: 42px;
  aspect-ratio: 1;
  transform: rotate(-7deg);
}

.postcard-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: clamp(22px, 4vw, 48px);
}

.postcard-copy h2,
.reward-panel h2,
.finale-copy h2 {
  color: var(--blue-ink);
  font-size: clamp(27px, 4vw, 43px);
}

.level-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.level-button {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(#b6814d, #704326);
  box-shadow: inset 0 2px rgba(255, 238, 198, 0.3), 0 4px 0 #4d2b18;
}

.level-button[aria-current="true"] {
  color: #4b331e;
  background: linear-gradient(#ffe889, #e9b72e);
}

.help-overlay {
  overflow: auto;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(7, 47, 60, 0.38);
  backdrop-filter: none;
}

.help-sheet {
  position: relative;
  display: flex;
  width: min(94vw, 900px);
  max-height: min(90dvh, 760px);
  flex-direction: column;
  gap: clamp(8px, 1.4vmin, 14px);
  overflow: auto;
  padding: clamp(3px, 0.8vmin, 8px) clamp(5px, 1.2vmin, 12px) clamp(8px, 1.4vmin, 14px);
  border: clamp(24px, 4vmin, 42px) solid transparent;
  border-image: url("assets/help-board-tray.webp") 17% fill /
    clamp(24px, 4vmin, 42px) round;
  background: transparent;
  box-shadow: 0 18px 44px rgba(31, 36, 32, 0.33);
}

.close-button {
  position: absolute;
  z-index: 4;
  top: 7px;
  right: 7px;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #9c663c, #6d4228);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 4px 0 #4b2b18;
  font-size: 38px;
  line-height: 1;
}

.help-header {
  display: flex;
  min-height: 64px;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 0 62px 0 2px;
}

.help-sopo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 3px solid #fff0c4;
  border-radius: 50%;
  background: #bce9e9;
  box-shadow: 0 3px 0 rgba(89, 56, 29, 0.28);
  object-fit: contain;
}

.help-header h2 {
  margin: 0;
  color: #4b2f1f;
  font-size: clamp(23px, 3.2vmin, 31px);
  line-height: 1.05;
}

.parent-note {
  margin: 0 0 10px;
  color: #4a4540;
  font-size: 16px;
  line-height: 1.35;
}

.help-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.12fr) auto minmax(0, 1fr);
  gap: clamp(6px, 1.3vw, 16px);
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0 4px;
  list-style: none;
}

.help-step {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 5px;
  color: #3c312b;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.help-step-art {
  width: clamp(62px, 8.6vw, 86px);
  height: clamp(58px, 8.2vw, 78px);
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgba(62, 42, 25, 0.18));
}

.help-step-parcel {
  width: clamp(72px, 9.5vw, 94px);
  height: clamp(62px, 8.4vw, 82px);
}

.help-envelope-art {
  position: relative;
  display: grid;
  width: clamp(78px, 10vw, 108px);
  place-items: center;
}

.help-envelope-art img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgba(62, 42, 25, 0.18));
}

.help-envelope-art strong {
  position: absolute;
  top: 16%;
  left: 50%;
  color: #43332a;
  font-size: clamp(26px, 3.8vw, 37px);
  line-height: 1;
  transform: translateX(-50%);
}

.help-step-arrow {
  color: #8f6139;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1;
  opacity: 0.68;
}

.help-live {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
}

.help-audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audio-status {
  margin: 0;
  color: #692f2b;
  font-size: 13px;
}

.audio-status:empty {
  display: none;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: #fff1c9;
  box-shadow: inset 0 0 0 2px #aa7e49, 0 3px 0 rgba(100, 64, 32, 0.22);
}

.icon-button img {
  width: 34px;
  height: 34px;
}

.help-thousands {
  display: grid;
  grid-template-columns: minmax(128px, 0.48fr) minmax(0, 1.52fr);
  gap: clamp(8px, 1.5vw, 15px);
  align-items: center;
  min-width: 0;
  padding: 6px 8px;
  border-top: 1px solid rgba(130, 89, 49, 0.3);
  border-bottom: 1px solid rgba(130, 89, 49, 0.3);
  background: rgba(255, 251, 229, 0.44);
}

.help-chosen-number,
.help-answer-count {
  min-width: 0;
}

.help-number-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.help-numeral {
  color: #302b29;
  font-size: clamp(40px, 5vw, 52px);
  line-height: 1;
}

.help-parcel {
  min-width: 0;
}

.help-parcel .parcel-paper {
  gap: 5px;
  height: auto;
  min-height: 112px;
  flex-direction: row;
}

.help-parcel .ten-frame {
  width: min(112px, 48%);
}

.help-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.help-compare > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid #d3b782;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.38);
}

.parts-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
  color: #45413d;
  font-size: 14px;
}

.part-ten {
  font-weight: 600;
}

.part-one {
  width: 18px;
  height: 14px;
  object-fit: contain;
}

.help-option-listen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: clamp(7px, 1.4vw, 13px);
  min-width: 0;
}

.help-number-choice {
  position: relative;
  display: grid;
  min-width: 96px;
  min-height: 108px;
  place-items: center;
  padding: 10px 12px 13px;
  border: 0;
  color: #2f2a29;
  background: transparent url("assets/number-envelope.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 4px rgba(65, 43, 25, 0.2));
  transition: transform 120ms ease, filter 120ms ease;
}

.help-number-choice:hover {
  filter: drop-shadow(0 7px 5px rgba(65, 43, 25, 0.23)) brightness(1.04);
  transform: translateY(-2px);
}

.help-number-choice:active {
  transform: translateY(1px);
}

.help-choice-digit {
  font-size: clamp(38px, 5vw, 52px);
  font-weight: 600;
  line-height: 1;
}

.help-choice-headphones {
  position: absolute;
  right: 12px;
  bottom: 9px;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.help-grownups {
  border-top: 1px solid rgba(136, 91, 50, 0.34);
  padding-top: 2px;
}

.help-grownups:not([open]) .help-grownups-body {
  display: none;
}

.help-grownups summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  width: fit-content;
  padding-inline: 4px;
  color: #493426;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.help-grownups-body {
  padding: 0 4px 4px;
}

.help-grownups-body .help-audio-actions {
  margin-bottom: 7px;
}

.help-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding-top: 1px;
}

.help-watch {
  min-width: 180px;
  min-height: 56px;
  font-size: 18px;
}

.help-back-button {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  filter: drop-shadow(0 5px 0 rgba(28, 92, 20, 0.3));
  transition: transform 120ms ease, filter 120ms ease;
}

.help-back-button:hover {
  filter: drop-shadow(0 7px 0 rgba(28, 92, 20, 0.3)) brightness(1.05);
  transform: translateY(-2px);
}

.help-back-button:active {
  transform: translateY(1px);
}

.help-back-button img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

@media (orientation: portrait) {
  .help-sheet {
    width: min(94vw, 540px);
  }

  .help-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .help-step {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 60px;
    justify-items: start;
    text-align: left;
  }

  .help-step > * {
    grid-column: 1;
    justify-self: center;
  }

  .help-step > span:last-child {
    grid-column: 2;
    align-self: center;
    justify-self: start;
  }

  .help-step-art {
    width: 62px;
    height: 55px;
  }

  .help-step-parcel {
    width: 68px;
  }

  .help-envelope-art {
    width: 76px;
  }

  .help-step-arrow {
    width: 82px;
    height: 13px;
    justify-self: start;
    padding-left: 0;
    font-size: 22px;
    line-height: 0.45;
    text-align: center;
    transform: rotate(90deg);
  }

  .help-thousands {
    grid-template-columns: minmax(108px, 0.42fr) minmax(0, 1.58fr);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .help-sheet {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr) 64px;
    gap: 7px;
    max-height: 90dvh;
    min-height: 0;
    overflow: hidden;
  }

  .help-header {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 40px;
  }

  .help-sopo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .help-header h2 {
    font-size: 23px;
  }

  .help-steps {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    min-height: 0;
  }

  .help-live {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    overflow: auto;
  }

  .help-step-art {
    width: 52px;
    height: 48px;
  }

  .help-step-parcel {
    width: 56px;
    height: 50px;
  }

  .help-envelope-art {
    width: 64px;
  }

  .help-grownups {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
    max-height: 100%;
    overflow: auto;
  }

  .help-footer {
    grid-column: 2;
    grid-row: 3;
    min-height: 64px;
    align-self: center;
  }

  .help-watch {
    min-width: 0;
    padding-inline: 14px;
  }

  .help-number-choice {
    min-height: 94px;
  }
}

.reward-panel {
  position: relative;
  width: min(92vw, 570px);
  padding: clamp(27px, 5vw, 48px);
  border: 5px solid #86562f;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 5%, rgba(255, 231, 121, 0.48), transparent 30%),
    #fff7de;
  box-shadow: inset 0 0 0 2px #ffe3a2, 0 20px 46px rgba(30, 33, 29, 0.34);
  text-align: center;
}

.burst-star {
  width: min(38vw, 190px);
  height: auto;
  margin-top: -24%;
  filter: drop-shadow(0 7px 8px rgba(107, 70, 23, 0.23));
}

.reward-panel h2 {
  margin-top: 5px;
}

.reward-panel p {
  margin: 12px 0 22px;
  color: #5c554c;
}

.finale-overlay {
  overflow: auto;
}

.finale-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.75fr) minmax(320px, 1.25fr);
  width: min(94vw, 940px);
  max-height: 90dvh;
  overflow: auto;
  border: 5px solid #7b4d2c;
  border-radius: 10px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 217, 101, 0.38), transparent 28%),
    #fff7dc;
  box-shadow: inset 0 0 0 2px #ffe3a4, 0 20px 48px rgba(30, 33, 29, 0.35);
}

.finale-sopo {
  min-height: 280px;
  overflow: hidden;
  background:
    radial-gradient(circle at 45% 48%, rgba(255, 255, 255, 0.7), transparent 31%),
    linear-gradient(160deg, #8ae3e9, #daf9f3);
}

.finale-sopo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.finale-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 13px;
  padding: 28px;
}

.finale-copy > p:not(.audio-status) {
  margin: 0;
  color: #504a43;
  line-height: 1.35;
}

.finale-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.finale-stars img {
  width: clamp(22px, 2.8vw, 32px);
  height: auto;
}

.finale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app[data-state="paused"] .topbar #pause-button,
.app[data-state="help"] .topbar #help-button {
  filter: brightness(1.16) drop-shadow(0 0 5px #ffe783);
}

.app[data-state="demo"] .task-panel {
  visibility: hidden;
}

@keyframes listen-pulse {
  to {
    transform: scale(1.08);
    filter: drop-shadow(0 0 4px rgba(255, 231, 111, 0.75));
  }
}

@keyframes hand-point {
  from {
    transform: translate(-14%, -74%) rotate(-7deg);
  }
  to {
    transform: translate(-14%, -68%) rotate(-4deg);
  }
}

.demo-hand:not(.is-static) {
  animation: hand-point 700ms ease-in-out infinite alternate;
}

@media (orientation: landscape) {
  body {
    background-image: url("assets/post-counter-landscape.webp");
  }

  .game-board {
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 52%) minmax(0, 1fr);
    gap: clamp(6px, 1.4vw, 20px);
    padding: 0 clamp(14px, 2.5vw, 36px) 4px;
  }

  .sopo-column {
    position: absolute;
    top: auto;
    bottom: calc(38dvh - var(--ok-row-height));
    left: 24vw;
    align-items: flex-start;
    justify-content: flex-start;
    width: min(25vw, 400px);
    pointer-events: none;
  }

  .sopo-frame {
    width: 100%;
    transform: translateY(0);
  }

  .task-panel {
    display: contents;
  }

  .game-board .instruction-note {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
  }

  .parcel-choice .parcel-paper {
    gap: 5px;
    padding: 6px clamp(8px, 1vw, 12px);
  }

  .demo-choice.demo-parcel .parcel-paper {
    padding: 6px clamp(8px, 1vw, 12px);
  }

  .parcel-choice .ten-cell img,
  .demo-options .demo-choice .ten-cell img {
    min-width: 18px;
    min-height: 18px;
  }

  .game-board .choices {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
  }

  .game-board .confirm-row {
    position: absolute;
    z-index: 2;
    top: calc(62dvh - var(--topbar-h) + 16px);
    left: 5vw;
    width: min(40vw, 540px);
    margin: 0;
  }

  .demo-overlay .overlay-scene {
    left: 52vw;
    right: 2.5vw;
    bottom: var(--ok-row-height);
    width: auto;
  }

  .demo-overlay .demo-destination-row {
    position: fixed;
    top: calc(62dvh + 16px);
    left: 5vw;
    width: min(40vw, 540px);
    margin: 0;
  }
}

@media (orientation: landscape) and (max-width: 1100px) {
  .game-board {
    grid-template-columns: minmax(0, 44%) minmax(0, 1fr);
  }

  .sopo-column {
    left: 23vw;
    width: clamp(190px, 20vw, 400px);
  }

  .demo-overlay .overlay-scene {
    left: 44vw;
    right: 2.5vw;
    width: auto;
  }
}

@media (orientation: portrait) {
  .demo-overlay .overlay-scene {
    top: var(--worktop-y);
    right: 10px;
    bottom: auto;
    left: 10px;
    width: auto;
  }
}

@media (orientation: portrait) and (max-width: 700px) {
  :root {
    --choice-gap: 7px;
    --parcel-choice-height: clamp(88px, 10dvh, 96px);
    --parcel-frame-width: clamp(140px, 45%, 190px);
  }

  .choices[data-stage="quantity"],
  .demo-parcel-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .choices[data-stage="quantity"] .parcel-paper,
  .demo-parcel-options .parcel-paper {
    flex-direction: row;
    gap: clamp(2px, 1.2vw, 8px);
    padding: 6px 10px;
  }
}

@media (orientation: portrait) and (min-width: 501px) {
  body[data-stage="quantity"] {
    background-position: center bottom;
    background-size: auto calc(100% + 150px);
  }
}

@media (orientation: portrait) and (min-width: 501px) and (min-height: 800px) and (max-height: 1000px) {
  body[data-stage="quantity"] {
    --worktop-y: 37dvh;
  }
}

@media (orientation: portrait) and (max-width: 500px) {
  :root {
    --topbar-h: 94px;
    --worktop-y: 47dvh;
    --sopo-w: min(62vw, 250px);
    --choice-gap: 6px;
    --numeral-choice-height: clamp(98px, 14dvh, 122px);
    --parcel-choice-height: clamp(88px, 11.2dvh, 100px);
  }

  body {
    background-position: center bottom;
    background-size: auto calc(100% + 100px);
  }

  body[data-stage="quantity"] {
    --worktop-y: 31dvh;
    background-size: auto calc(100% + 300px);
  }

  .topbar {
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 2px 8px;
    padding: 3px 7px;
  }

  .controls {
    gap: 3px;
    padding: 2px 5px;
  }

  .progress-wrap {
    flex: 0 0 100%;
    justify-content: center;
    gap: 7px;
  }

  .mail-progress {
    padding: 3px 5px;
  }

  .mail-prop {
    width: 18px;
  }

  .star-prop {
    width: 18px;
  }

  .game-board {
    padding-inline: clamp(8px, 2.8vw, 14px);
  }

  .sopo-frame {
    width: var(--sopo-w);
  }

  .instruction-note {
    min-height: 48px;
    margin-bottom: 6px;
    padding: 5px 7px 5px 18px;
  }

  .speech-bubble p {
    font-size: clamp(13px, 3.7vw, 16px);
  }

  .listen-button {
    width: 56px;
    min-width: 56px;
    min-height: 48px;
    padding: 4px;
    font-size: 12px;
  }

  .listen-button img {
    width: 34px;
    height: 34px;
  }

  .chosen-numeral {
    min-width: 48px;
    min-height: 44px;
    padding-inline: 5px;
  }

  .chosen-numeral strong {
    font-size: 26px;
  }

  .numeral-choice strong {
    font-size: clamp(43px, 13vw, 60px);
  }

  .confirm-row {
    min-height: 80px;
    margin-top: 9px;
    padding: 10px 18px 8px;
  }

  .answer-tray,
  .demo-tray {
    min-height: 58px;
  }

  .answer-tray-slot,
  .demo-tray-slot {
    min-height: 50px;
  }

  .confirm-button {
    width: var(--ok-size);
    height: var(--ok-size);
  }

  .confirm-button img {
    width: var(--ok-size);
    height: var(--ok-size);
  }

  .confirm-button span {
    font-size: 21px;
  }

  .feedback.error,
  .feedback.success {
    max-width: 90vw;
    white-space: normal;
  }

  .demo-overlay .overlay-scene {
    top: var(--worktop-y);
    right: 9px;
    bottom: auto;
    left: 9px;
    width: auto;
  }

  .demo-heading {
    margin-bottom: 4px;
    padding: 4px 12px;
  }

  .demo-prompt {
    min-height: 24px;
  }

  .demo-options {
    margin-bottom: 6px;
  }

  .demo-destination-row {
    min-height: 80px;
    margin-top: 0;
    padding: 9px 18px 7px;
  }

  .demo-caption {
    margin-top: 4px;
  }

  .demo-footer {
    min-height: 48px;
  }

  .demo-footer .secondary-button {
    min-height: 48px;
  }

  .postcard,
  .help-sheet,
  .finale-panel {
    grid-template-columns: minmax(0, 1fr);
    width: min(94vw, 520px);
  }

  .postcard-art {
    min-height: 170px;
  }

  .postcard-copy {
    padding: 18px;
  }

  .finale-sopo {
    min-height: 165px;
  }

  .finale-copy {
    padding: 19px;
  }

  .opening-title-frame {
    top: 4%;
  }
}

@media (orientation: portrait) and (min-width: 371px) and (max-width: 500px) and (min-height: 701px) and (max-height: 800px) {
  body[data-stage="quantity"] {
    --worktop-y: 28dvh;
  }
}

@media (orientation: portrait) and (max-width: 430px) and (max-height: 670px) {
  :root {
    --numeral-choice-height: 96px;
    --parcel-choice-height: 70px;
    --choice-gap: 2px;
  }

  body[data-stage="quantity"] {
    --worktop-y: 28dvh;
  }

  .sopo-frame {
    width: var(--sopo-w);
  }

  .instruction-note {
    min-height: 40px;
    margin-bottom: 0;
  }

  .speech-bubble p {
    font-size: 13px;
  }

  .listen-button {
    width: 56px;
    min-width: 56px;
  }

  .choices {
    margin-top: 0;
  }

  .answer-tray:not(.has-answer) .answer-tray-slot::before {
    width: min(112px, 82%);
  }

  .confirm-row,
  .demo-destination-row {
    min-height: 72px;
    margin-top: 4px;
    padding-block: 5px;
  }

  .answer-tray,
  .demo-tray {
    min-height: 54px;
  }

  .answer-tray-slot,
  .demo-tray-slot {
    min-height: 46px;
  }

  .demo-heading,
  .demo-caption {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
  }

  .demo-footer {
    min-height: 48px;
  }
}

@media (orientation: portrait) and (min-width: 431px) and (max-width: 500px) and (max-height: 780px) {
  :root {
    --parcel-choice-height: 84px;
  }

  .instruction-note {
    min-height: 44px;
    margin-bottom: 4px;
  }

  .confirm-row,
  .demo-destination-row {
    min-height: 76px;
    margin-top: 6px;
    padding-block: 7px;
  }

  .answer-tray,
  .demo-tray {
    min-height: 54px;
  }

  .answer-tray-slot,
  .demo-tray-slot {
    min-height: 46px;
  }
}

@media (max-width: 370px) {
  .controls {
    gap: 2px;
  }

  .instruction-note {
    gap: 4px;
    padding-left: 16px;
  }

  .speech-bubble p {
    font-size: 12px;
  }

  .listen-button {
    width: 56px;
    min-width: 56px;
    padding: 4px;
  }

  .listen-button img {
    width: 31px;
    height: 31px;
  }

  .chosen-numeral {
    min-width: 43px;
  }

  :root {
    --parcel-choice-height: 78px;
  }

  .confirm-row {
    min-height: 80px;
    padding-inline: 14px;
  }

  .confirm-button,
  .confirm-button img {
    width: var(--ok-size);
    height: var(--ok-size);
  }
}

@media (orientation: landscape) and (max-height: 460px) {
  :root {
    --topbar-h: 64px;
    --numeral-choice-height: clamp(72px, 23dvh, 92px);
    --parcel-choice-height: 142px;
    --parcel-frame-width: min(100%, 150px);
  }

  body {
    background-size: max(116vw, 174dvh) auto;
    background-position: left -8vw center;
  }

  .topbar {
    padding: 3px clamp(7px, 2vw, 16px);
  }

  .controls {
    padding: 1px 4px;
  }

  .wood-control,
  .wood-control img {
    width: 56px;
    height: 56px;
  }

  .wood-control span {
    display: none;
  }

  .mail-prop {
    width: 18px;
  }

  .star-prop {
    width: 18px;
  }

  .game-board {
    grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
    gap: 8px;
    padding: 0 clamp(8px, 2vw, 18px);
  }

  .sopo-column {
    top: auto;
    bottom: calc(38dvh - var(--ok-row-height));
    left: 12vw;
    width: 200px;
  }

  .sopo-frame {
    width: 100%;
  }

  .instruction-note {
    min-height: 48px;
    margin-bottom: 2px;
    padding: 2px 7px 2px 17px;
  }

  .speech-bubble p {
    font-size: 13px;
  }

  .listen-button {
    width: 56px;
    min-width: 56px;
    min-height: 48px;
    padding: 4px;
    font-size: 12px;
  }

  .listen-button img {
    width: 34px;
    height: 34px;
  }

  .numeral-choice strong {
    font-size: clamp(38px, 7vw, 58px);
  }

  .choice[aria-pressed="true"]::after,
  .choice.selected::after {
    width: 18px;
    height: 18px;
  }

  .parcel-choice .parcel-paper {
    gap: 1px;
    padding: 4px 6px;
  }

  .ten-frame {
    padding: 3px;
  }

  .confirm-row {
    min-height: 64px;
    margin-top: 0;
    padding: 3px 18px;
  }

  .game-board .confirm-row,
  .demo-overlay .demo-destination-row {
    width: min(calc(32vw - 36px), 540px);
    margin: 0;
  }

  .answer-tray {
    min-height: 48px;
  }

  .demo-tray {
    min-height: 50px;
  }

  .answer-tray-slot {
    min-height: 44px;
  }

  .demo-tray-slot {
    min-height: 44px;
  }

  .answer-tray:not(.has-answer) .answer-tray-slot::before {
    width: 70px;
  }

  .answer-tray .demo-choice.demo-parcel,
  .demo-tray .demo-choice.demo-parcel {
    width: min(185px, 100%);
    height: 56px;
  }

  .confirm-button,
  .confirm-button img {
    width: var(--ok-size);
    height: var(--ok-size);
  }

  .confirm-button span {
    font-size: 20px;
  }

  .demo-overlay .overlay-scene {
    top: auto;
    left: 36vw;
    right: 2.5vw;
    bottom: var(--ok-row-height);
    width: auto;
  }

  .demo-heading h2 {
    font-size: 13px;
  }

  .demo-prompt {
    min-height: 18px;
  }

  .demo-options {
    margin: 1px 0 3px;
  }

  .demo-destination-row {
    min-height: 68px;
    margin-top: 0;
    padding: 5px 16px 4px;
  }

  .demo-confirm,
  .demo-confirm img {
    width: var(--ok-size);
    height: var(--ok-size);
  }

  .demo-caption {
    min-height: 18px;
    margin-top: 2px;
    font-size: 12px;
  }

  .demo-footer {
    min-height: 48px;
    margin-top: 0;
  }

  .demo-heading,
  .demo-caption {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
  }

  .demo-footer .secondary-button {
    min-height: 48px;
    padding-block: 7px;
  }
}

@media (orientation: landscape) and (min-height: 461px) and (max-height: 700px) {
  :root {
    --topbar-h: 72px;
    --numeral-choice-height: clamp(82px, 18dvh, 112px);
    --parcel-choice-height: clamp(150px, 29dvh, 175px);
    --parcel-frame-width: min(100%, 160px);
  }

  .topbar {
    padding-block: 4px;
  }

  .instruction-note {
    min-height: 46px;
    margin-bottom: 6px;
  }

  .confirm-row,
  .demo-destination-row {
    min-height: 82px;
  }

  .confirm-row {
    margin-top: 9px;
  }
}

@media (orientation: landscape) and (min-height: 461px) {
  .answer-tray .demo-choice.demo-parcel,
  .demo-tray .demo-choice.demo-parcel {
    width: min(280px, 100%);
    height: clamp(82px, 10dvh, 96px);
  }

  .answer-tray .ten-frame,
  .demo-tray .ten-frame {
    width: min(129px, calc(50% - 2px));
    max-width: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .opening-title-frame {
    top: 8px;
    padding-block: 8px;
  }

  .opening-title-frame h2 {
    font-size: 28px;
  }

  .opening-actions {
    bottom: 6px;
    width: min(90vw, 680px);
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .demo-hand {
    animation: none !important;
  }
}
