:root {
  color-scheme: light;
  --ink: #243447;
  --muted: #65758a;
  --line: #dce8e0;
  --soft-line: #edf3ee;
  --bg: #f5faf5;
  --surface: #ffffff;
  --leaf: #22a96b;
  --leaf-dark: #127a49;
  --sun: #ffd84d;
  --sky: #3f8df3;
  --coral: #ff7d63;
  --violet: #7568e8;
  --mint: #dff7ea;
  --shadow: 0 18px 44px rgba(36, 52, 71, 0.13);
  --app-height: 100dvh;
  --app-width: 100vw;
  --bottom-safe: max(22px, env(safe-area-inset-bottom));
  --setup-control-height: 68px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: var(--app-height);
  min-height: 0;
  max-height: var(--app-height);
  overflow: hidden;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.44)),
    repeating-linear-gradient(90deg, rgba(34, 169, 107, 0.07) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(63, 141, 243, 0.06) 0 1px, transparent 1px 56px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 20px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 56px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.14;
}

h3 {
  margin-bottom: 12px;
  font-size: 34px;
  line-height: 1.12;
}

h4 {
  margin-bottom: 16px;
  font-size: 34px;
  line-height: 1.2;
}

.setup-screen {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background-color: #FDFBF7;
}

/* Ambient glow spots */
.setup-screen::before,
.setup-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  will-change: transform, opacity;
}

.setup-screen::before {
  width: 74vmin;
  height: 74vmin;
  top: -20%;
  left: -14%;
  background: radial-gradient(circle, rgba(170, 220, 195, 0.78) 0%, rgba(170, 220, 195, 0.30) 50%, transparent 72%);
  animation: ambientGlowA 8s ease-in-out infinite;
}

.setup-screen::after {
  width: 60vmin;
  height: 60vmin;
  bottom: -6%;
  right: -4%;
  background: radial-gradient(circle, rgba(255, 238, 188, 0.70) 0%, rgba(255, 238, 188, 0.24) 50%, transparent 72%);
  animation: ambientGlowB 10s ease-in-out infinite;
}

/* Extra ambient spot */
.setup-ambient-extra {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.setup-ambient-extra::before {
  content: "";
  position: absolute;
  width: 46vmin;
  height: 46vmin;
  top: 35%;
  left: 52%;
  border-radius: 50%;
  filter: blur(90px);
  background: radial-gradient(circle, rgba(175, 215, 230, 0.58) 0%, rgba(175, 215, 230, 0.18) 45%, transparent 70%);
  animation: ambientGlowC 9s ease-in-out infinite;
}

@keyframes ambientGlowA {
  0%, 100% { transform: scale(0.92); opacity: 0.65; }
  50%      { transform: scale(1.12); opacity: 1; }
}

@keyframes ambientGlowB {
  0%, 100% { transform: scale(0.88); opacity: 0.55; }
  50%      { transform: scale(1.15); opacity: 1; }
}

@keyframes ambientGlowC {
  0%, 100% { transform: scale(0.9); opacity: 0.55; }
  50%      { transform: scale(1.10); opacity: 0.9; }
}

/* ── Floating soft geometric shapes ── */
.setup-geo {
  position: absolute;
  display: block;
  pointer-events: none;
  border-radius: 50%;
  animation: geoFloat 8s ease-in-out infinite;
  z-index: 0;
}

.setup-geo--ring {
  background: transparent;
  border: 3.5px solid #a8d5c2;
  box-shadow:
    inset 0 4px 10px rgba(120, 180, 160, 0.22),
    0 8px 24px rgba(120, 170, 150, 0.22);
}

.setup-geo--sphere {
  background: #c8e8d8;
  box-shadow:
    inset 0 -10px 22px rgba(120, 185, 158, 0.40),
    inset 0 6px 14px rgba(255, 255, 255, 0.72),
    0 12px 32px rgba(120, 165, 145, 0.22);
}

.setup-geo--pill {
  border-radius: 999px;
  background: #f0e8cc;
  box-shadow:
    inset 0 -6px 14px rgba(185, 168, 130, 0.34),
    inset 0 5px 12px rgba(255, 255, 255, 0.68),
    0 10px 26px rgba(160, 140, 105, 0.20);
}

/* Position & size each geo */
.setup-geo-1 {
  width: 110px;
  height: 110px;
  top: 7%;
  right: 12%;
  animation-delay: 0s;
}

.setup-geo-2 {
  width: 170px;
  height: 64px;
  bottom: 10%;
  left: 5%;
  animation-delay: 1.5s;
}

.setup-geo-3 {
  width: 78px;
  height: 78px;
  top: 52%;
  left: 8%;
  animation-delay: 2.8s;
}

.setup-geo-4 {
  width: 56px;
  height: 56px;
  top: 12%;
  right: 26%;
  animation-delay: 3.6s;
  opacity: 0.70;
}

@keyframes geoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%      { transform: translateY(-14px) rotate(5deg); }
  55%      { transform: translateY(8px) rotate(-3deg); }
  80%      { transform: translateY(-4px) rotate(2deg); }
}

/* ── Setup welcome character + bubble ── */
.setup-welcome {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  padding-bottom: 40px;
}

.setup-welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.setup-welcome .character-container {
  width: min(260px, 34vw);
  animation: none;
}

.setup-welcome-bubble {
  position: relative;
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 22px;
  padding: 20px 30px;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  line-height: 1.5;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 6px 28px rgba(100, 80, 50, 0.07);
}

.setup-welcome-bubble::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid rgba(250, 248, 243, 0.82);
}

/* ── Onboarding intro screens ── */
.onboarding-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(24px, 4dvh, 48px) clamp(20px, 4vw, 60px);
  background: #FDFBF7;
  cursor: pointer;
  overflow: hidden;
}

.onboarding-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 56px);
  max-width: 960px;
  width: 100%;
  flex: 1;
}

.onboarding-character {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
}

.onboarding-character .character-container {
  width: min(240px, 34vw);
  animation: none;
}

.onboarding-bubble {
  flex: 1 1 auto;
  min-width: 0;
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: clamp(24px, 4dvh, 40px) clamp(24px, 4vw, 44px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 8px 36px rgba(100, 80, 50, 0.07);
  position: relative;
}

.onboarding-bubble::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-right: 16px solid rgba(250, 248, 243, 0.82);
}

.onboarding-bubble p {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 750;
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
}

.onboarding-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: clamp(12px, 2dvh, 24px);
  opacity: 0.6;
  animation: hintPulse 2.2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

.onboarding-hint span {
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 700;
  color: var(--ink);
}

.onboarding-dots {
  display: flex;
  gap: 10px;
}

.onboarding-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d0d8d4;
  transition: background 0.3s;
}

.onboarding-dots i.active {
  background: var(--leaf);
  transform: scale(1.3);
}

.onboarding-dots i.done {
  background: #a0c8b4;
}

.floating-stars {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.floating-stars i {
  position: absolute;
  width: 32px;
  height: 32px;
  background: var(--sun);
  clip-path: polygon(50% 0, 61% 34%, 96% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 4% 35%, 39% 34%);
  opacity: 0.55;
  animation: twinkle 2.4s ease-in-out infinite;
}

.floating-stars i:nth-child(1) {
  left: 10%;
  top: 16%;
}

.floating-stars i:nth-child(2) {
  right: 12%;
  top: 20%;
  background: var(--coral);
  animation-delay: 0.45s;
}

.floating-stars i:nth-child(3) {
  right: 18%;
  bottom: 14%;
  background: var(--sky);
  animation-delay: 0.8s;
}

.setup-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.75fr);
  gap: clamp(26px, 4vw, 54px);
  align-items: center;
  width: min(1100px, 94vw);
  padding: clamp(28px, 4dvh, 42px) clamp(34px, 5vw, 60px);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 40px rgba(120, 140, 130, 0.10), 0 2px 8px rgba(120, 140, 130, 0.06);
}


.brand-row,
.page-header,
.task-badge-row,
.task-footer,
.control-row,
.admin-toolbar,
.drawer-brand,
.drawer-task,
.domain-row,
.admin-row,
.audio-visual,
.results-actions {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 18px;
  margin-bottom: clamp(22px, 3dvh, 30px);
}

.logo-image {
  width: 104px;
  height: 104px;
  object-fit: contain;
  flex: 0 0 auto;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--leaf-dark);
  font-size: 14px;
  font-weight: 850;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(0, auto);
  gap: 15px;
}

.setup-left {
  min-width: 0;
}

.setup-play-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  min-height: 100%;
}

.play-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.play-orbit i {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 8px 18px rgba(36, 52, 71, 0.08);
  animation: floaty 2.8s ease-in-out infinite;
}

.play-orbit i:nth-child(1) {
  left: 10%;
  top: 18%;
}

.play-orbit i:nth-child(2) {
  right: 8%;
  top: 28%;
  background: var(--sky);
  animation-delay: 0.35s;
}

.play-orbit i:nth-child(3) {
  right: 20%;
  bottom: 12%;
  background: var(--coral);
  animation-delay: 0.7s;
}

.field {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.field > span {
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
  padding-left: 4px;
}

.field input,
.field select,
.transcript-input {
  width: 100%;
  min-width: 0;
  border: 3px solid var(--line);
  border-left: 5px solid var(--leaf);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input,
.field select {
  height: var(--setup-control-height);
  min-height: var(--setup-control-height);
  padding: 0 18px;
  font-size: 24px;
  font-weight: 900;
}

.field.invalid input,
.field.invalid select,
.field.invalid .segment-option {
  border-color: #ef4c3f;
  border-left-color: #ef4c3f;
  background: #fff3f0;
  box-shadow: 0 0 0 4px rgba(239, 76, 63, 0.14);
}

.field input:focus,
.field select:focus,
.transcript-input:focus {
  border-color: var(--leaf);
  border-left-color: var(--leaf-dark);
  box-shadow: 0 0 0 5px rgba(34, 169, 107, 0.18);
}

.segmented-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: var(--setup-control-height);
  gap: 12px;
}

.edu-segment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.segment-option {
  height: var(--setup-control-height);
  min-height: 0;
  border: 1.5px solid rgba(160, 170, 155, 0.30);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.70);
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(100, 90, 70, 0.06);
  transition: all 0.18s ease;
}

.segment-option:hover:not(.picked) {
  border-color: rgba(125, 165, 140, 0.50);
  background: rgba(240, 248, 242, 0.80);
  box-shadow: 0 2px 8px rgba(100, 140, 115, 0.10);
}

.segment-option.picked {
  border-color: #5a9b6e;
  background: linear-gradient(135deg, #5a9b6e 0%, #4a8560 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 2px 8px rgba(55, 115, 75, 0.16);
  font-weight: 850;
}

.voice-setup-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 35px;
}

.setup-age-note {
  margin: 16px 0 0;
  color: var(--leaf-dark);
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.setup-age-note.warning {
  color: #d7392f;
}

.setup-voice-button {
  z-index: 2;
  min-height: 66px;
  padding: 18px 42px;
  border: 3px solid var(--leaf);
  border-radius: 99px;
  background: #fff;
  color: var(--leaf);
  font-size: 26px;
  font-weight: 950;
  box-shadow: 0 6px 18px rgba(34, 169, 107, 0.12);
  transition: all 0.2s;
}

.setup-voice-button:hover {
  background: var(--leaf);
  color: #fff;
  transform: translateY(-2px);
}

.setup-voice-button.recording {
  border-color: #ff4757;
  background: #ff4757;
  color: #fff;
  animation: pulseRed 1.4s infinite;
}

.setup-voice-button.transcribing {
  border-color: #cddbd2;
  background: #f4f7f5;
  color: #758393;
  box-shadow: none;
  cursor: not-allowed;
}

.encouragement-toast {
  position: fixed;
  bottom: 12%;
  left: 50%;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 520px);
  padding: clamp(12px, 2vh, 20px) clamp(22px, 4vw, 42px);
  border: 3px solid var(--leaf);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(34, 169, 107, 0.24);
  color: var(--leaf-dark);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 950;
  line-height: 1.1;
  pointer-events: none;
  transform: translateX(-50%);
  animation: toastInOut 2.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.encouragement-toast .emoji {
  font-size: clamp(28px, 3.4vw, 38px);
}

.primary,
.secondary,
.confirm-button,
.utility-button,
.ghost,
.option,
.keypad button,
.drawer-item,
.drawer-hearing-link,
.drawer-section-toggle,
.drawer-task,
.admin-row,
.tap-button {
  border-radius: 8px;
  min-height: 46px;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.primary,
.secondary,
.confirm-button,
.tap-button {
  padding: 12px 20px;
  color: #fff;
  font-weight: 900;
}

.primary {
  background: var(--leaf);
  box-shadow: 0 5px 0 var(--leaf-dark);
}

.secondary {
  background: var(--sky);
  box-shadow: 0 5px 0 #2167bf;
}

.confirm-button {
  min-width: clamp(138px, 18vw, 190px);
  min-height: clamp(58px, 8dvh, 72px);
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 5px 0 #bf533e;
  font-size: clamp(22px, 2.5vw, 28px);
}

.confirm-button.answer-ready {
  animation: pulseRed 1.4s ease-in-out infinite;
}

.confirm-button.attention-nudge {
  animation: confirmNudge 0.82s ease-in-out infinite;
}

.utility-button {
  min-width: clamp(108px, 14vw, 150px);
  min-height: clamp(52px, 7dvh, 66px);
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: clamp(20px, 2.1vw, 24px);
  font-weight: 950;
  box-shadow: 0 4px 0 #cddbd2;
}

.replay-button {
  color: #1a6fba;
  border-color: #bad3eb;
  background: #f0f7ff;
  box-shadow: 0 4px 0 #bad3eb;
}

.ghost {
  padding: 11px 17px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.big-button {
  min-width: 178px;
  min-height: 76px;
  font-size: 28px;
}

.setup-start-button {
  position: relative;
  z-index: 1;
  display: grid;
  width: clamp(190px, 22vw, 280px);
  height: clamp(190px, 22vw, 280px);
  min-height: 0;
  place-items: center;
  align-content: center;
  border: 8px solid #e9fff1;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 28%, #52d889, var(--leaf) 68%, var(--leaf-dark));
  box-shadow:
    0 12px 0 var(--leaf-dark),
    0 24px 42px rgba(18, 122, 73, 0.24);
  color: #fff;
  text-align: center;
}

.setup-start-button span {
  display: block;
  font-size: clamp(40px, 5vw, 62px);
  font-weight: 1000;
  line-height: 0.98;
}

.setup-start-button small {
  display: block;
  margin-top: 4px;
  font-size: clamp(40px, 5vw, 62px);
  font-weight: 1000;
  line-height: 0.98;
}

.primary:hover,
.secondary:hover,
.confirm-button:hover,
.utility-button:hover,
.ghost:hover,
.option:hover,
.keypad button:hover,
.drawer-item:hover,
.drawer-hearing-link:hover,
.drawer-section-toggle:hover,
.drawer-task:hover,
.admin-row:hover {
  transform: translateY(-1px);
}

.primary:active,
.secondary:active,
.confirm-button:active,
.tap-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.app-shell {
  position: relative;
  width: 100%;
  height: var(--app-height);
  max-height: var(--app-height);
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.app-shell::before {
  left: 86px;
  bottom: 30px;
  width: 104px;
  height: 44px;
  border-radius: 999px;
  background: #e9f7ff;
  box-shadow: 34px 12px 0 #e9f7ff, -24px 14px 0 #e9f7ff;
  opacity: 0.68;
}

.app-shell::after {
  right: 110px;
  bottom: 84px;
  width: 42px;
  height: 42px;
  background: var(--sun);
  clip-path: polygon(50% 0, 61% 34%, 96% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 4% 35%, 39% 34%);
  opacity: 0.55;
  animation: twinkle 2.4s ease-in-out infinite;
}

.page-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: clamp(64px, 10dvh, 98px) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.page-header {
  justify-content: space-between;
  gap: 18px;
  padding: clamp(8px, 1.8dvh, 14px) clamp(16px, 2.5vw, 24px);
  border-bottom: 1px solid rgba(36, 52, 71, 0.08);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}

.icon-button {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(36, 52, 71, 0.1);
}

.header-title {
  flex: 1 1 auto;
  min-width: 0;
}

.header-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-prompt {
  display: -webkit-box;
  max-width: 920px;
  margin: 4px 0 0;
  overflow: hidden;
  color: #3e4d5e;
  font-size: clamp(16px, 2.1vw, 22px);
  font-weight: 820;
  line-height: 1.34;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.header-progress {
  width: 190px;
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9e3;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--leaf), var(--sun));
}

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

.drawer-mask {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(20, 31, 43, 0.24);
  transition: opacity 0.18s ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(360px, 86vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100dvh;
  padding: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 2px solid var(--soft-line);
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateX(-104%);
  transition: transform 0.22s ease;
  -webkit-overflow-scrolling: touch;
}

.drawer-panel > * {
  flex-shrink: 0;
}

.hidden-drawer.open {
  pointer-events: auto;
}

.hidden-drawer.open .drawer-mask {
  opacity: 1;
}

.hidden-drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-brand {
  gap: 12px;
  margin-bottom: 8px;
}

.drawer-logo {
  width: 58px;
  height: 58px;
  border: 2px solid #e3efe5;
  border-radius: 18px;
  object-fit: contain;
  background: #fff;
}

.drawer-brand div {
  display: grid;
  min-width: 0;
}

.drawer-brand strong {
  font-size: 22px;
}

.drawer-brand span {
  overflow: hidden;
  color: var(--muted);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-item {
  width: 100%;
  padding: 0 16px;
  border: 2px solid var(--soft-line);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-align: left;
}

.drawer-hearing-link,
.drawer-section-toggle {
  width: 100%;
  min-height: 62px;
  padding: 0 16px;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  font-weight: 950;
  text-align: left;
}

.drawer-hearing-link {
  background: var(--mint);
  color: var(--leaf-dark);
}

.drawer-hearing-link.active {
  border-color: var(--leaf);
  background: #dff5e8;
}

.drawer-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  color: var(--ink);
}

.drawer-section-toggle em {
  color: var(--leaf-dark);
  font-size: 16px;
  font-style: normal;
}

.drawer-section-toggle::after {
  content: "⌄";
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.drawer-section-toggle.open::after {
  transform: rotate(180deg);
}

.drawer-task-list {
  display: none;
  align-content: start;
  gap: 8px;
  overflow: visible;
  padding: 0 2px 18px 0;
}

.drawer-task-list.open {
  display: grid;
}

.drawer-spacer {
  flex: 1 1 auto;
  min-height: 18px;
}

.drawer-task {
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 2px solid transparent;
  background: #f8fbf8;
  color: var(--ink);
  text-align: left;
}

.drawer-task span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #e8efe9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.drawer-task strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-task.active {
  border-color: var(--leaf);
  background: #f0fbf4;
}

.drawer-task.done span {
  background: var(--leaf);
  color: #fff;
}

.admin-password-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-password-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 31, 43, 0.48);
}

.admin-password-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(560px, 94vw);
  gap: 18px;
  padding: clamp(22px, 5vw, 34px);
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 31, 43, 0.24);
}

.admin-password-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 6vw, 46px);
  font-weight: 1000;
  line-height: 1.12;
  text-align: center;
}

.admin-password-input {
  width: 100%;
  min-height: 72px;
  padding: 0 18px;
  border: 3px solid var(--line);
  border-left: 7px solid var(--leaf);
  border-radius: 10px;
  color: var(--ink);
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 950;
  text-align: center;
}

.admin-password-panel p {
  margin: 0;
  color: #c23b32;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 950;
  text-align: center;
}

.admin-password-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-password-actions button {
  min-height: 68px;
  font-size: clamp(24px, 4.8vw, 34px);
}

.single-page {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.hearing-page {
  display: grid;
  place-items: stretch center;
  padding: clamp(8px, 1.5dvh, 16px) clamp(10px, 2.5vw, 28px) var(--bottom-safe);
}

.hearing-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(14px, 2dvh, 22px);
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(20px, 3dvh, 34px) clamp(22px, 4vw, 48px);
  overflow: auto;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.08);
  -webkit-overflow-scrolling: touch;
}

.hearing-step-card {
  align-content: center;
}

.hearing-intro-card {
  place-items: center;
  align-items: center;
  min-height: 0;
}

.hearing-intro-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1fr);
  align-items: center;
  justify-content: center;
  gap: clamp(34px, 5vw, 86px);
  width: min(920px, 100%);
}

.hearing-intro-main {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(18px, 2.6dvh, 30px);
  min-width: 0;
  text-align: center;
}

.hearing-hero-icon {
  display: grid;
  place-items: center;
  width: clamp(210px, 20vw, 280px);
  aspect-ratio: 1;
  justify-self: center;
  border: 2px solid #d8e9ff;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5fbff, #ffffff);
  box-shadow: inset 0 -8px 0 rgba(63, 141, 243, 0.08);
}

.hearing-copy {
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 0;
}

.hearing-copy h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.05;
}

/* ── Hearing intro character guide ── */
.hearing-intro-wrapper,
.hearing-summary-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2.5dvh, 28px);
  width: 100%;
  overflow-y: auto;
  padding: clamp(8px, 1.5dvh, 16px);
}

.hearing-guide-character {
  display: flex;
  align-items: flex-end;
  gap: clamp(12px, 2vw, 24px);
}

.hearing-guide-character .character-container {
  width: min(180px, 26vw);
  animation: none;
}

.hearing-guide-bubble {
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: clamp(14px, 2dvh, 22px) clamp(16px, 2.5vw, 28px);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 750;
  color: var(--ink);
  line-height: 1.55;
  max-width: 480px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 6px 24px rgba(100, 80, 50, 0.07);
  position: relative;
}

.hearing-guide-bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  bottom: 30px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 11px solid rgba(250, 248, 243, 0.82);
}

/* ── Hearing guide 2 popup overlay ── */
.hearing-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlayFadeIn 0.25s ease both;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hearing-guide-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2.5dvh, 24px);
  width: min(560px, 90vw);
  padding: clamp(24px, 3.5dvh, 36px) clamp(24px, 4vw, 40px);
  background: #FDFBF7;
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 12px 48px rgba(80, 60, 30, 0.12);
  animation: popupBounce 0.4s 0.05s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes popupBounce {
  0%   { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hearing-guide-popup-char .character-container {
  width: min(180px, 28vw);
  animation: none;
}

.hearing-guide-popup-bubble {
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: clamp(16px, 2.5dvh, 24px) clamp(18px, 3vw, 28px);
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 750;
  color: var(--ink);
  line-height: 1.6;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 6px 24px rgba(100, 80, 50, 0.07);
}

.hearing-guide-popup-bubble p {
  margin: 0;
}

.hearing-guide-popup .big-button {
  min-width: 140px;
}

.hearing-instruction,
.hearing-summary-note {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
}

.hearing-check-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.hearing-check-button {
  min-width: clamp(150px, 14vw, 190px);
}

.hearing-env-status {
  display: inline-grid;
  min-height: 46px;
  place-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: #f7faf7;
  color: var(--muted);
  font-size: 18px;
  font-weight: 950;
}

.hearing-env-status.quiet {
  background: var(--mint);
  color: var(--leaf-dark);
}

.hearing-env-status.noisy {
  background: #fff1d2;
  color: #9a6400;
}

.hearing-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.hearing-start-button {
  min-width: clamp(210px, 18vw, 260px);
}

.hearing-stage-label {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--leaf-dark);
  font-size: 18px;
  font-weight: 950;
}

.hearing-ear-target {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  width: clamp(180px, 24vw, 240px);
  aspect-ratio: 1;
  padding: 14px;
  border: 3px solid #d8e9ff;
  border-radius: 8px;
  background: #f5fbff;
  overflow: hidden;
}

.hearing-focus-row .hearing-ear-target:not(.compact) {
  align-self: center;
  width: clamp(190px, 28vmin, 250px);
}

.hearing-focus-row {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 4vw, 52px);
  width: 100%;
}

.hearing-ear-target.left {
  border-color: #d8e9ff;
  background: linear-gradient(90deg, #e8f3ff 0 34%, #f8fcff 34% 100%);
}

.hearing-ear-target.right {
  border-color: #cdebd8;
  background: linear-gradient(90deg, #f8fff9 0 66%, #e9f9f0 66% 100%);
}

.hearing-ear-target::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 18px;
  border-radius: 999px;
  opacity: 0.95;
}

.hearing-ear-target.left::before {
  left: 14px;
  background: var(--sky);
  box-shadow: 20px 22px 0 rgba(63, 141, 243, 0.18), 20px -22px 0 rgba(63, 141, 243, 0.18);
}

.hearing-ear-target.right::before {
  right: 14px;
  background: var(--leaf);
  box-shadow: -20px 22px 0 rgba(41, 171, 110, 0.18), -20px -22px 0 rgba(41, 171, 110, 0.18);
}

.hearing-ear-target.compact {
  width: clamp(130px, 16vw, 170px);
}

.hearing-ear-target strong {
  color: var(--ink);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 1000;
}

.ear-illustration {
  width: min(150px, 78%);
  max-height: 72%;
  overflow: visible;
  z-index: 1;
}

.hearing-ear-target.right .ear-illustration {
  justify-self: end;
  margin-right: 26px;
}

.hearing-ear-target.compact .ear-illustration {
  width: min(110px, 74%);
}

.hearing-ear-target.left .ear-illustration {
  justify-self: start;
  margin-left: 26px;
  transform: scaleX(-1);
}

.ear-fill {
  fill: #ffd9b0;
}

.ear-line,
.ear-inner,
.sound-wave {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ear-line {
  stroke: #7d563b;
  stroke-width: 8;
}

.ear-inner {
  stroke: #9c6c4b;
  stroke-width: 7;
}

.sound-wave {
  stroke: var(--leaf);
  stroke-width: 8;
}

.hearing-ear-target.left .sound-wave {
  stroke: var(--sky);
}

  .hearing-play-button {
  margin: 2px 0;
}

.hearing-response-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 14px;
  width: min(620px, 100%);
}

.hearing-response-slot {
  display: grid;
  place-items: center;
  width: min(620px, 100%);
  min-height: clamp(86px, 12dvh, 112px);
  visibility: hidden;
  pointer-events: none;
}

.hearing-response-slot.ready {
  visibility: visible;
  pointer-events: auto;
}

.hearing-response-slot .hearing-response-grid {
  width: 100%;
}

.hearing-response-grid .option {
  min-height: clamp(76px, 11dvh, 98px);
  font-size: clamp(24px, 3vw, 32px);
}

.hearing-heard {
  border-color: #cdebd8;
  background: #f2fff7;
}

.hearing-missed {
  border-color: #f4c9bc;
  background: #fff8f5;
}

.hearing-test-card {
  width: 100%;
  align-content: stretch;
  grid-template-rows: auto minmax(170px, 1fr) auto minmax(96px, auto) minmax(36px, auto);
}

.hearing-meter-row {
  align-self: center;
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) repeat(2, minmax(150px, 1fr));
  gap: 14px;
  width: 100%;
  align-items: stretch;
}

.hearing-stimulus-panel {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 138px;
  padding: 14px;
  border: 2px solid #d9e6de;
  border-radius: 8px;
  background: #fff;
}

.hearing-stimulus-panel span,
.hearing-summary-item span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 950;
}

.hearing-stimulus-panel strong {
  color: var(--ink);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 1000;
  line-height: 1.05;
}

.hearing-message-slot {
  display: grid;
  min-height: 36px;
  place-items: center;
  text-align: center;
  visibility: hidden;
}

.hearing-message-slot.visible {
  visibility: visible;
}

.hearing-summary-card {
  position: relative;
  align-content: center;
  padding-bottom: clamp(54px, 8dvh, 78px);
}

.hearing-complete-animation {
  position: relative;
  display: grid;
  width: clamp(82px, 10vw, 118px);
  height: clamp(82px, 10vw, 118px);
  place-items: center;
}

.hearing-complete-ring {
  position: absolute;
  inset: 0;
  border: 6px solid rgba(34, 169, 107, 0.24);
  border-top-color: var(--leaf);
  border-radius: 999px;
  animation: hearingCompleteSpin 1.1s ease-out 1, hearingCompleteSettle 1.5s ease-in-out 1.1s infinite;
}

.hearing-complete-check {
  display: grid;
  width: 68%;
  height: 68%;
  place-items: center;
  border-radius: 999px;
  background: var(--leaf);
  box-shadow: 0 6px 0 var(--leaf-dark);
  color: #fff;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 1000;
  line-height: 1;
  transform: scale(0.74);
  animation: hearingCheckPop 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28) 0.35s forwards;
}

.hearing-result-panel {
  width: 100%;
  min-height: 210px;
}

.hearing-result-panel strong {
  font-size: clamp(48px, 8vw, 82px);
}

.hearing-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(860px, 100%);
}

.hearing-summary-item {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: clamp(146px, 20dvh, 190px);
  padding: 18px;
  border: 2px solid #d9e6de;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.hearing-summary-item strong {
  color: var(--leaf-dark);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 1000;
  line-height: 1.05;
}

.hearing-summary-actions {
  display: grid;
  place-items: center;
  width: 100%;
}

.hearing-continue-button {
  min-width: min(360px, 82vw);
  min-height: 92px;
  font-size: clamp(32px, 4vw, 44px);
}

.hearing-retest-link {
  position: absolute;
  right: 22px;
  bottom: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
}

.task-page {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(6px, 1.1dvh, 10px);
  padding: clamp(8px, 1.4dvh, 14px) clamp(112px, 12vw, 132px) var(--bottom-safe);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.task-copy {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 22px;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(36, 52, 71, 0.08);
}

.task-badge-row {
  gap: 10px;
  margin-bottom: 14px;
}

.domain-badge,
.step-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.domain-badge {
  background: var(--mint);
  color: var(--leaf-dark);
}

.step-badge {
  background: #fff1d2;
  color: #9a6400;
}

.prompt {
  margin-bottom: 10px;
  color: #3e4d5e;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.55;
}

.page-hint {
  color: var(--muted);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
}

.cute-helper {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.task-workspace {
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.task-footer {
  display: none;
}

.task-footer .primary,
.task-footer .ghost {
  min-width: 132px;
}

.edge-arrow {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: auto;
  padding: 16px 24px;
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(36, 52, 71, 0.18), 0 2px 6px rgba(36, 52, 71, 0.10);
  transform: translateY(-50%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.edge-arrow-left {
  left: clamp(14px, 2vw, 24px);
  border: 2.5px solid #c8dcd1;
  background: #ffffff;
  color: var(--leaf-dark);
  box-shadow: 0 4px 14px rgba(36, 52, 71, 0.12), 0 2px 4px rgba(36, 52, 71, 0.08);
}

.edge-arrow-right {
  right: clamp(14px, 2vw, 24px);
  background: var(--coral);
  color: #fff;
  box-shadow: 0 6px 0 #bf533e, 0 8px 20px rgba(255, 125, 99, 0.35);
}

.edge-arrow:not(:disabled):hover {
  transform: translateY(calc(-50% - 2px));
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.22);
}

.edge-arrow:not(:disabled):active {
  transform: translateY(calc(-50% + 3px));
  box-shadow: 0 2px 8px rgba(36, 52, 71, 0.14);
}

.edge-arrow-right:not(:disabled):active {
  box-shadow: 0 2px 0 #bf533e, 0 4px 10px rgba(255, 125, 99, 0.25);
}

.edge-arrow:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.edge-arrow svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.arrow-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.task-actions {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: clamp(52px, 7.2dvh, 68px);
  padding: 0 clamp(4px, 1vw, 10px);
}

.task-actions.spacer {
  min-height: 0;
}

.task-actions-left {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.task-actions-left:empty {
  display: block;
}

.trail-page,
.drawing-page,
.naming-page,
.memory-page,
.speech-page,
.abstraction-page,
.orientation-page,
.digit-page,
.vigilance-page,
.serial-page,
.fluency-page,
.wait-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.08);
}

.trail-page {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
}

.control-row {
  justify-content: center;
  gap: 12px;
}

.drawing-page {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  align-items: stretch;
}

.drawing-page.cube-page,
.drawing-page.clock-page {
  grid-template-columns: minmax(260px, 1fr) 44px minmax(0, 1.35fr);
}

.reference-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 2px solid #c3d5c9;
  border-left: 5px solid var(--leaf);
  border-radius: 10px;
  background: #f4fbf6;
}

.reference-label {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 1;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--leaf);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  transform: translateX(-50%);
  white-space: nowrap;
}

.reference-svg {
  width: min(520px, 100%);
  max-height: 98%;
}

.canvas-wrap {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.cube-page .canvas-wrap,
.clock-page .canvas-wrap {
  grid-template-rows: minmax(0, 1fr);
}

.canvas-surface {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.clock-reference-panel {
  border-color: #c8d4e4;
  border-left-color: var(--sky);
  background: #f5f9ff;
}

.clock-time-reference {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 28px 16px 10px;
  color: var(--ink);
  text-align: center;
}

.clock-time-reference strong {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(52px, 7vw, 112px);
  font-weight: 1000;
  line-height: 0.9;
  white-space: nowrap;
}

.clock-time-reference span {
  color: var(--muted);
  font-size: clamp(26px, 2.8vw, 42px);
  font-weight: 950;
  line-height: 1.1;
}

.task-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 2px solid #cfe0d7;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.task-canvas.locked {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.28);
}

.cube-canvas {
  border: 2.5px dashed var(--leaf);
  border-radius: 10px;
  box-shadow: inset 0 2px 12px rgba(34, 169, 107, 0.07);
}

.cube-arrow-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: var(--leaf);
  font-size: 36px;
  font-weight: 950;
  opacity: 0.72;
}

.trail-completion-modal {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(36, 52, 71, 0.22);
}

.trail-completion-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  width: min(460px, 92%);
  padding: 28px;
  border: 3px solid var(--leaf);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(36, 52, 71, 0.22);
  text-align: center;
}

.trail-completion-panel strong {
  color: var(--ink);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 1000;
  line-height: 1.1;
}

.trail-completion-panel p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 900;
}

.trail-completion-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
  width: min(340px, 100%);
}

.redraw-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
}

.naming-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  gap: 20px;
  padding: 24px;
}

.animal-emoji {
  display: grid;
  justify-self: center;
  width: min(260px, 100%);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #f6e8ba;
  border-radius: 8px;
  background: #fff7dc;
  font-size: 184px;
  line-height: 1;
  filter: drop-shadow(0 16px 16px rgba(36, 52, 71, 0.12));
}

.animal-photo {
  justify-self: center;
  width: min(360px, 100%);
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 16px 16px rgba(36, 52, 71, 0.12));
}

.animal-side {
  width: min(640px, 100%);
  min-width: 0;
}

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

.option {
  position: relative;
  min-height: 86px;
  padding: 10px 14px;
  border: 2px solid #d9e6de;
  background: #fff;
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
}

.option.picked {
  border-color: var(--leaf);
  background: var(--leaf);
  color: #fff;
  box-shadow: 0 6px 20px rgba(34, 169, 107, 0.32);
}

.option.picked::before {
  content: none;
}

.memory-page {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) minmax(0, auto);
  align-content: stretch;
  gap: 16px;
  padding: clamp(16px, 2.6dvh, 26px) clamp(20px, 3vw, 34px);
}

.memory-page.ready {
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: center;
}

.memory-page:not(.ready) {
  grid-template-rows: auto auto;
  place-content: center;
}

.memory-audio {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.memory-choice-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 950;
  text-align: center;
}

.memory-choice-panel span {
  display: grid;
  min-width: 86px;
  min-height: 48px;
  place-items: center;
  border-radius: 999px;
  background: var(--mint);
  color: var(--leaf-dark);
}

.memory-options {
  width: min(860px, 100%);
  justify-self: center;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-content: center;
}

.memory-options .option {
  min-height: clamp(62px, 9dvh, 76px);
  font-size: clamp(22px, 2.5vw, 26px);
}

.memory-wait-copy {
  margin: 0;
  color: var(--muted);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 950;
  text-align: center;
}

.memory-review-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(36, 52, 71, 0.26);
}

.memory-review-panel {
  display: grid;
  gap: 20px;
  justify-items: center;
  width: min(560px, 92vw);
  padding: clamp(26px, 5vw, 42px);
  border: 3px solid var(--leaf);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 54px rgba(36, 52, 71, 0.24);
  text-align: center;
}

.memory-review-panel strong {
  color: var(--ink);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 1000;
  line-height: 1.1;
}

.memory-review-panel p {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 950;
  line-height: 1.28;
}

.memory-review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 14px;
  width: min(390px, 100%);
}

.memory-review-button {
  min-height: 74px;
  font-size: clamp(26px, 3.5vw, 34px);
}

.task-warning,
.task-ok,
.vigilance-listening {
  justify-self: center;
  margin: 0;
  font-size: 22px;
  font-weight: 950;
}

.task-warning {
  color: #d7392f;
}

.task-ok {
  color: var(--leaf-dark);
}

.vigilance-listening {
  color: var(--muted);
}

.speech-page,
.abstraction-page,
.orientation-page,
.digit-page,
.vigilance-page,
.serial-page,
.fluency-page,
.wait-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: clamp(14px, 2.4dvh, 22px);
}

.audio-visual {
  justify-content: center;
  gap: 22px;
}

.speech-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.audio-wave-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.audio-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 180px;
  height: 96px;
  border: 2px solid #d8e9ff;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5fbff, #ffffff);
  box-shadow: inset 0 -6px 0 rgba(63, 141, 243, 0.06);
}

.audio-wave span {
  width: 12px;
  height: 28px;
  border-radius: 999px;
  background: var(--sky);
  opacity: 0.75;
  transform-origin: center;
}

.audio-wave span:nth-child(2),
.audio-wave span:nth-child(4) {
  height: 46px;
  background: var(--leaf);
}

.audio-wave span:nth-child(3) {
  height: 66px;
  background: var(--coral);
}

.audio-wave.active span {
  animation: wave 0.72s ease-in-out infinite;
}

.audio-wave.active span:nth-child(2) {
  animation-delay: 0.1s;
}

.audio-wave.active span:nth-child(3) {
  animation-delay: 0.2s;
}

.audio-wave.active span:nth-child(4) {
  animation-delay: 0.3s;
}

.audio-wave.active span:nth-child(5) {
  animation-delay: 0.4s;
}

.audio-progress {
  width: min(400px, 68%);
  min-width: min(280px, 88vw);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eef7;
  box-shadow: inset 0 2px 4px rgba(36, 52, 71, 0.06);
}

.audio-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--sky);
  transition: width 0.1s linear;
}

.digit-page.ready {
  grid-template-rows: auto auto auto minmax(0, auto);
}

.digit-answer-prompt {
  color: var(--ink);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 1000;
  line-height: 1.12;
  text-align: center;
}

.digit-example {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 900;
  text-align: center;
}

.voice-status {
  color: var(--muted);
  font-size: 20px;
  font-weight: 950;
}

.headphone-icon,
.mic-icon {
  position: relative;
  display: inline-block;
  width: 82px;
  height: 82px;
}

.headphone-icon::before {
  content: "";
  position: absolute;
  inset: 8px 10px 20px;
  border: 8px solid var(--sky);
  border-bottom: 0;
  border-radius: 46px 46px 10px 10px;
}

.headphone-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 14px;
  height: 30px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--sky) 0 20px, transparent 20px calc(100% - 20px), var(--sky) calc(100% - 20px));
}

.mic-icon::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 6px;
  width: 30px;
  height: 48px;
  border-radius: 18px;
  background: var(--coral);
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.1);
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 38px;
  width: 50px;
  height: 32px;
  border: 7px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 30px 30px;
}

.mic-icon.recording {
  animation: pulse 1s ease-in-out infinite;
}

.sound-button {
  min-width: 170px;
  min-height: 58px;
  font-size: 20px;
}

.transcript-input {
  width: min(560px, 96%);
  height: 112px;
  resize: none;
  padding: 14px;
  color: #3d4e5f;
  font-size: 28px;
  font-weight: 750;
  line-height: 1.25;
}

.live-transcript-box {
  width: min(680px, 96%);
  min-height: clamp(126px, 22dvh, 220px);
  max-height: 28dvh;
  padding: clamp(16px, 2.2dvh, 22px);
  overflow: auto;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #23384b;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.55;
  text-align: left;
  box-shadow: inset 0 -6px 0 rgba(34, 169, 107, 0.06);
  -webkit-overflow-scrolling: touch;
}

.live-transcript-final {
  color: #23384b;
}

.live-transcript-interim {
  color: #9aa8b5;
}

.live-transcript-placeholder {
  color: #9aa8b5;
  font-weight: 850;
}

.wait-card strong {
  font-size: 30px;
}

.wait-card span {
  color: var(--leaf-dark);
  font-size: 46px;
  font-weight: 950;
}

.digit-answer {
  display: flex;
  min-height: 58px;
  gap: 10px;
}

.digit-answer span {
  display: grid;
  width: 48px;
  height: 58px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--leaf-dark);
  font-size: 28px;
  font-weight: 950;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, clamp(64px, 8.4vw, 86px));
  gap: 12px;
  justify-content: center;
}

.digit-keypad {
  grid-template-columns: repeat(3, clamp(64px, 8.4vw, 86px));
}

.serial-keypad {
  grid-template-columns: repeat(3, clamp(64px, 8.4vw, 86px));
}

.keypad button {
  min-width: 0;
  min-height: clamp(48px, 7dvh, 62px);
  border: 2px solid #d7e4dc;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  font-weight: 950;
  box-shadow: 0 4px 0 #cddbd2;
}

.keypad-spacer {
  min-height: clamp(48px, 7dvh, 62px);
}

.keypad .key-wide {
  grid-column: span 2;
  color: var(--muted);
  font-size: 18px;
}

.keypad .key-action {
  color: var(--muted);
  font-size: 18px;
}

.keypad .confirm {
  border-color: var(--leaf);
  background: #ecfbf2;
  color: var(--leaf-dark);
}

.vigilance-page {
  gap: 22px;
}

.tap-instruction {
  color: var(--ink);
  font-size: 48px;
  font-weight: 1000;
  line-height: 1.1;
}

.circle-button,
.timer-button {
  width: 160px;
  height: 160px;
  border-radius: 999px;
  font-size: 28px;
}

.sound-button {
  width: 160px;
  min-width: 160px;
  height: 160px;
  min-height: 160px;
  padding: 0;
  font-size: 28px;
}

.tap-button {
  width: min(420px, 90%);
  min-height: 160px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 7px 0 #bf533e;
  font-size: 36px;
}

.tap-count,
.count-label {
  color: var(--muted);
  font-size: 18px;
  font-weight: 850;
}

.serial-page {
  grid-template-rows: auto auto auto;
}

.math-question {
  color: var(--ink);
  font-size: 46px;
  font-weight: 950;
}

.serial-display {
  display: grid;
  width: 220px;
  height: 72px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 34px;
  font-weight: 950;
}

.abstraction-page {
  gap: 26px;
  padding: clamp(18px, 3dvh, 42px) clamp(24px, 4vw, 54px);
}

.word-pair {
  display: flex;
  gap: clamp(18px, 3vw, 34px);
  justify-content: center;
  align-items: center;
}

.word-card {
  display: grid;
  min-width: clamp(150px, 22vw, 220px);
  min-height: clamp(118px, 20dvh, 170px);
  place-items: center;
  padding: 14px;
  border: 2px solid #f6e8ba;
  border-radius: 8px;
  background: #fff7dc;
}

.word-card span {
  font-size: clamp(42px, 7vw, 68px);
  line-height: 1;
}

.word-card strong {
  font-size: clamp(30px, 4.8vw, 48px);
  font-weight: 1000;
}

.abstraction-options {
  width: min(760px, 100%);
}

.guided-option {
  position: relative;
  overflow: visible;
}

.hand-cue {
  position: absolute;
  left: 12px;
  top: 50%;
  font-size: 42px;
  filter: drop-shadow(0 6px 8px rgba(36, 52, 71, 0.22));
  animation: handPoint 1.2s ease-in-out infinite;
  pointer-events: none;
}

.fluency-page .timer-button {
  border: 0;
  background: var(--leaf);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 7px 0 var(--leaf-dark);
}

.timer-button.running {
  background: var(--violet);
  box-shadow: 0 7px 0 #5147aa;
}

.pair-title,
.orientation-question {
  max-width: 88%;
  color: var(--ink);
  text-align: center;
  font-size: 34px;
  font-weight: 950;
  line-height: 1.22;
}

.location-text {
  max-width: 88%;
  margin-bottom: 0;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}

.orientation-page {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
}

.orientation-options {
  width: min(680px, 94%);
}

.results-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px;
}

.result-hero,
.domain-table,
.admin-table,
.json-preview,
.rubric-page-head,
.rubric-group {
  min-height: 0;
  overflow: hidden;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.08);
}

.result-hero {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(8px, 1.4dvh, 12px);
  padding: clamp(14px, 2.4dvh, 28px);
}

.result-hero.celebrate {
  background: linear-gradient(180deg, #fffdf2, #f0fff6);
}

.result-hero.soft-alert {
  background: linear-gradient(180deg, #fff8f5, #f7fbff);
}

.result-logo {
  position: relative;
  z-index: 1;
  width: clamp(96px, 14dvh, 150px);
  height: clamp(96px, 14dvh, 150px);
  object-fit: contain;
}

.confetti {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  width: 16px;
  height: 28px;
  border-radius: 4px;
  background: var(--sun);
  animation: confettiDrop 1.8s ease-in-out infinite;
}

.confetti i:nth-child(1) {
  left: 18%;
  top: 18%;
  background: var(--coral);
}

.confetti i:nth-child(2) {
  left: 36%;
  top: 10%;
  animation-delay: 0.18s;
}

.confetti i:nth-child(3) {
  right: 30%;
  top: 16%;
  background: var(--sky);
  animation-delay: 0.35s;
}

.confetti i:nth-child(4) {
  right: 18%;
  top: 28%;
  background: var(--leaf);
  animation-delay: 0.5s;
}

.confetti i:nth-child(5) {
  left: 48%;
  bottom: 18%;
  background: var(--violet);
  animation-delay: 0.75s;
}

.confetti i:nth-child(6) {
  left: 12%;
  bottom: 24%;
  background: var(--sky);
  animation-delay: 0.9s;
}

.confetti i:nth-child(7) {
  right: 12%;
  bottom: 18%;
  background: var(--sun);
  animation-delay: 1.05s;
}

.confetti i:nth-child(8) {
  right: 44%;
  bottom: 12%;
  background: var(--coral);
  animation-delay: 1.2s;
}

.result-sparkles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.result-sparkles i {
  position: absolute;
  width: 34px;
  height: 34px;
  background: var(--sun);
  clip-path: polygon(50% 0, 61% 34%, 96% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 4% 35%, 39% 34%);
  animation: twinkle 1.6s ease-in-out infinite;
}

.result-sparkles i:nth-child(1) {
  left: 26%;
  top: 24%;
}

.result-sparkles i:nth-child(2) {
  right: 25%;
  top: 22%;
  background: var(--sky);
  animation-delay: 0.3s;
}

.result-sparkles i:nth-child(3) {
  left: 30%;
  bottom: 24%;
  background: var(--coral);
  animation-delay: 0.6s;
}

.result-sparkles i:nth-child(4) {
  right: 31%;
  bottom: 26%;
  background: var(--leaf);
  animation-delay: 0.9s;
}

.result-hero span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 900;
}

.result-hero strong {
  position: relative;
  z-index: 1;
  color: var(--leaf-dark);
  font-size: clamp(58px, 11dvh, 94px);
  line-height: 0.9;
}

.result-hero em {
  margin-left: 8px;
  font-size: 34px;
  color: var(--muted);
  font-style: normal;
  font-weight: 950;
}

.result-hero p {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

/* ── Completion cheer: character + encouraging bubble ── */
.completion-cheer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  padding: 8px 16px;
  margin-top: 8px;
}

.completion-character {
  display: block;
  width: min(140px, 24vw);
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.10));
  animation: cheerBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cheerBounce {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.completion-bubble {
  position: relative;
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 800;
  padding: 16px 24px;
  border-radius: 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(160, 150, 130, 0.10),
    0 6px 28px rgba(100, 80, 50, 0.07);
  animation: bubblePop 0.45s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bubblePop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Bubble tail pointing left toward character */
.completion-bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 12px solid rgba(250, 248, 243, 0.82);
}

.radar-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(320px, 46dvh);
  aspect-ratio: 1;
  place-items: center;
}

.radar-pulse {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 169, 107, 0.20), rgba(34, 169, 107, 0));
  animation: radarPulse 1.9s ease-out infinite;
}

.radar-chart {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.radar-ring {
  fill: none;
  stroke: rgba(36, 52, 71, 0.18);
  stroke-width: 1.5;
}

.radar-axis {
  stroke: rgba(36, 52, 71, 0.14);
  stroke-width: 1.5;
}

.radar-area {
  fill: rgba(34, 169, 107, 0.28);
  stroke: var(--leaf);
  stroke-width: 4;
  stroke-linejoin: round;
  animation: radarGrow 0.72s ease-out both;
  transform-origin: center;
}

.radar-dot {
  fill: var(--coral);
  stroke: #fff;
  stroke-width: 2;
}

.radar-label {
  fill: #3d4e5f;
  font-size: 11px;
  font-weight: 900;
}

.result-medals {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.result-medals b {
  display: grid;
  min-width: 86px;
  min-height: 46px;
  place-items: center;
  border-radius: 999px;
  background: #fff1d2;
  color: #8a5a00;
  font-size: 18px;
  font-weight: 950;
}

.domain-table {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
}

.domain-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 8px;
  background: #f7faf7;
  font-weight: 850;
}

.results-actions {
  justify-content: flex-end;
  gap: 12px;
}

.admin-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 22px 24px 24px;
}

.admin-toolbar {
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.admin-table {
  display: block;
  padding: 12px;
  overflow: auto;
}

.admin-head,
.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(76px, 0.45fr) minmax(110px, 0.65fr) minmax(110px, 0.65fr) minmax(120px, 0.7fr) minmax(220px, 1.45fr);
  gap: 12px;
  align-items: center;
  min-width: 940px;
}

.admin-head {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-row {
  width: 100%;
  min-height: 50px;
  padding: 0 12px;
  border: 2px solid transparent;
  background: #f8fbf8;
  color: var(--ink);
  text-align: left;
}

.admin-row.active {
  border-color: var(--leaf);
  background: #eef9ef;
}

.admin-row span,
.admin-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-detail {
  min-height: 0;
  padding: 14px;
  overflow: auto;
  color: var(--ink);
}

.empty-detail {
  display: grid;
  align-content: start;
}

.detail-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 12px;
}

.detail-header span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.detail-header strong {
  font-size: 22px;
  font-weight: 950;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-summary div {
  min-height: 68px;
  padding: 10px 12px;
  border: 2px solid #e6f0e7;
  border-radius: 8px;
  background: #fbfefb;
}

.detail-summary span,
.detail-block h4 {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-summary strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-detail-list {
  display: grid;
  gap: 10px;
}

.item-detail {
  border: 2px solid #e5efe7;
  border-radius: 8px;
  background: #ffffff;
}

.item-detail summary,
.item-detail-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

.item-detail summary::-webkit-details-marker {
  display: none;
}

.item-detail summary span,
.item-detail-row span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.item-detail summary strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-detail summary em {
  color: var(--leaf-dark);
  font-style: normal;
  font-weight: 950;
}

.item-detail-row strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-detail-row em {
  color: var(--leaf-dark);
  font-style: normal;
  font-weight: 950;
}

.item-detail-row {
  cursor: default;
}

.item-answer-summary {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 0 12px 12px 64px;
}

.item-answer-summary > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.answer-part-list {
  display: grid;
  gap: 6px;
}

.answer-part {
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7faf7;
  color: #263a32;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
  word-break: break-word;
}

.answer-part span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.answer-part strong {
  min-width: 0;
  color: #263a32;
  font-size: 14px;
  font-weight: 900;
}

.answer-part small {
  grid-column: 2;
  color: #8b2f23;
  font-size: 12px;
  font-weight: 850;
}

.answer-part.wrong-answer {
  border: 1.5px solid #f1b4aa;
  background: #fff4f2;
}

.answer-part.wrong-answer strong {
  color: #b3261e;
}

.answer-part.correct-answer {
  border: 1.5px solid #d9eadc;
}

.admin-drawing-preview {
  display: grid;
  min-height: 160px;
  margin: 0 12px 12px 64px;
  place-items: center;
  border-radius: 8px;
  background: #f7faf7;
}

.admin-drawing-preview img {
  display: block;
  max-width: min(100%, 520px);
  max-height: 260px;
  border-radius: 6px;
  background: #fff;
}

.empty-drawing-preview {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-audio-preview {
  display: grid;
  gap: 8px;
  margin: 0 12px 12px 64px;
}

.admin-audio-preview label {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #f7faf7;
}

.admin-audio-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-audio-preview audio {
  width: 100%;
  min-width: 0;
}

.item-detail-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-chips span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f1f7f2;
  color: #566a5b;
  font-size: 12px;
  font-weight: 900;
}

.detail-block {
  display: grid;
  gap: 6px;
}

.detail-block h4 {
  margin: 0;
}

.detail-block pre,
.detail-empty {
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-radius: 8px;
  background: #f7faf7;
  color: #374b5e;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.drawing-preview {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #f7faf7;
}

.drawing-preview img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border: 2px solid #d9e6dc;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

.json-preview {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #374b5e;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.empty {
  margin: 22px 12px;
  color: var(--muted);
  font-weight: 850;
}

.design-page {
  display: grid;
  gap: 12px;
  grid-template-rows: minmax(260px, 1fr);
  padding: 12px;
  overflow: auto;
  background: #f5f8f6;
}

.moca-pdf-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.moca-pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.rubric-page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 18px 22px;
}

.rubric-page-head h3 {
  margin: 0;
}

.rubric-page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 22px;
  font-weight: 900;
}

.rubric-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  overflow: visible;
}

.rubric-group {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  min-width: 0;
  min-height: 230px;
  padding: 16px;
}

.rubric-group h4 {
  margin: 0;
  color: var(--leaf-dark);
  font-size: 26px;
}

.rubric-cards {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: visible;
}

.rubric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 14px;
  border: 2px solid #e3ece6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.rubric-card span {
  font-size: 22px;
  font-weight: 950;
}

.rubric-card em {
  flex: 0 0 auto;
  color: var(--leaf-dark);
  font-size: 16px;
  font-style: normal;
  font-weight: 950;
}

.rubric-card-body strong,
.rubric-modal-body strong {
  color: var(--leaf-dark);
  font-size: 17px;
  font-weight: 950;
}

.rubric-card-body p,
.rubric-modal-body p {
  margin: 0;
  color: #3d4e5f;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.55;
}

.rubric-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  padding: clamp(12px, 2vw, 28px);
}

.rubric-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 38, 51, 0.42);
}

.rubric-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  place-self: center;
  overflow: hidden;
  border: 3px solid #dfe9e3;
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 24px 70px rgba(24, 38, 51, 0.26);
}

.rubric-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  border-bottom: 2px solid #e8f0ea;
}

.rubric-modal-head span {
  color: var(--leaf-dark);
  font-size: 18px;
  font-weight: 950;
}

.rubric-modal-head h3 {
  margin: 4px 0 0;
  font-size: clamp(34px, 4vw, 48px);
}

.rubric-modal-body {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 28px;
  overflow: auto;
}

.rubric-modal-body section {
  display: grid;
  gap: 10px;
}

.rubric-modal-body strong {
  font-size: 24px;
}

.rubric-modal-body p {
  font-size: clamp(26px, 3.1vw, 34px);
  line-height: 1.55;
}

.rubric-sheet-image {
  width: min(420px, 100%);
  max-height: 260px;
  justify-self: center;
  border: 2px solid #dfe9e3;
  border-radius: 8px;
  object-fit: contain;
}

.rubric-sheet-image.large {
  width: min(780px, 100%);
  max-height: 430px;
}

.bounce-in {
  animation: bounceIn 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.pop-in {
  animation: popIn 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

.floaty {
  animation: floaty 2.4s ease-in-out infinite;
}

.pulse {
  animation: pulse 1.3s ease-in-out infinite;
}

@keyframes bounceIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.birth-date-selects {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
  gap: 12px;
}

.birth-date-unit-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.birth-date-unit-field select {
  padding-right: 34px;
  font-size: clamp(28px, 3.1vw, 36px);
  text-align: center;
  text-align-last: center;
}

.birth-date-unit-field > span {
  color: var(--ink);
  font-size: clamp(24px, 2.45vw, 32px);
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
}

.task-page {
  position: relative;
}

.task-actions {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-items: center;
}

.task-actions-left {
  justify-self: start;
}

.task-actions-right {
  justify-self: end;
}

.confirm-button {
  justify-self: center;
}

.task-skip-link {
  position: absolute;
  right: clamp(18px, 3vw, 34px);
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 7;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
}

.task-skip-link:hover {
  color: var(--leaf-dark);
}

.digit-keypad,
.serial-keypad,
.orientation-keypad {
  grid-template-columns: repeat(3, clamp(88px, 11vw, 122px));
  gap: 16px;
}

.digit-keypad button,
.serial-keypad button,
.orientation-keypad button {
  min-height: clamp(70px, 10dvh, 94px);
  font-size: clamp(30px, 4vw, 40px);
}

.digit-keypad .keypad-spacer,
.serial-keypad .keypad-spacer,
.orientation-keypad .keypad-spacer {
  min-height: clamp(70px, 10dvh, 94px);
}

.orientation-number-page {
  gap: 22px;
}

.orientation-number-display {
  display: grid;
  min-width: min(420px, 88%);
  min-height: clamp(72px, 12dvh, 104px);
  place-items: center;
  border: 3px solid var(--line);
  border-left: 7px solid var(--leaf);
  border-radius: 10px;
  background: #fff;
  color: var(--leaf-dark);
  font-size: clamp(42px, 8vw, 68px);
  font-weight: 1000;
}

.year-digit-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 14px;
  width: min(520px, 92%);
}

.year-digit-box {
  display: grid;
  min-height: clamp(84px, 13dvh, 118px);
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--leaf-dark);
  box-shadow: 0 4px 0 #cddbd2;
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 1000;
  line-height: 1;
}

.year-digit-box.active {
  border-color: var(--leaf);
  background: var(--mint);
  box-shadow: 0 4px 0 var(--leaf-dark);
}

.date-input-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 18px;
  width: min(520px, 92%);
}

.date-input-box {
  display: grid;
  gap: 8px;
  min-height: clamp(84px, 13dvh, 118px);
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 #cddbd2;
}

.date-input-box.active {
  border-color: var(--leaf);
  background: var(--mint);
  color: var(--leaf-dark);
  box-shadow: 0 4px 0 var(--leaf-dark);
}

.date-input-box span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.date-input-box strong {
  min-height: 1em;
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 1000;
  line-height: 1;
}

.clock-time-reference strong {
  font-size: clamp(118px, 15vw, 220px);
}

.result-hero {
  place-content: center;
  gap: 18px;
}

.results-page {
  grid-template-rows: minmax(0, 1fr);
}

.result-hero > p {
  color: var(--leaf-dark);
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 1000;
}

@media (max-width: 760px), (max-height: 620px) {
  .birth-date-selects {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr) minmax(0, 0.82fr);
    gap: 8px;
  }

  .task-actions {
    min-height: clamp(50px, 7svh, 62px);
    padding-inline: 48px;
  }

  .task-skip-link {
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    font-size: 12px;
  }

  .digit-keypad,
  .serial-keypad,
  .orientation-keypad {
    grid-template-columns: repeat(3, clamp(72px, 22vw, 96px));
    gap: 12px;
  }

  .digit-keypad button,
  .serial-keypad button,
  .orientation-keypad button,
  .digit-keypad .keypad-spacer,
  .serial-keypad .keypad-spacer,
  .orientation-keypad .keypad-spacer {
    min-height: clamp(62px, 11svh, 82px);
  }

  .clock-time-reference strong {
    font-size: clamp(74px, 18vw, 118px);
  }

  .year-digit-row {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
    gap: 10px;
    width: min(390px, 94%);
  }

  .year-digit-box {
    min-height: clamp(62px, 11svh, 82px);
    font-size: clamp(30px, 8vw, 44px);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.82);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes pulseRed {
  0% {
    transform: scale(1);
    box-shadow: 0 5px 0 #bf533e, 0 0 0 0 rgba(239, 76, 63, 0.36);
  }
  70% {
    transform: scale(1.035);
    box-shadow: 0 5px 0 #bf533e, 0 0 0 12px rgba(239, 76, 63, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 5px 0 #bf533e, 0 0 0 0 rgba(239, 76, 63, 0);
  }
}

@keyframes hearingCompleteSpin {
  from {
    transform: rotate(-180deg) scale(0.78);
    opacity: 0.4;
  }
  to {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes hearingCompleteSettle {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes hearingCheckPop {
  from {
    opacity: 0;
    transform: scale(0.74);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toastInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, 60px);
  }
  15%,
  85% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -28px);
  }
}

@keyframes confirmNudge {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 5px 0 #bf533e;
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 8px 0 #bf533e, 0 12px 22px rgba(242, 126, 92, 0.34);
  }
}

@keyframes wave {
  0%,
  100% {
    transform: scaleY(0.58);
  }
  50% {
    transform: scaleY(1.12);
  }
}

@keyframes confettiDrop {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.75;
  }
  50% {
    transform: translateY(14px) rotate(14deg);
    opacity: 1;
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: rotate(0deg) scale(0.92);
  }
  50% {
    transform: rotate(10deg) scale(1.08);
  }
}

@keyframes radarPulse {
  from {
    transform: scale(0.3);
    opacity: 0.78;
  }
  to {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes radarGrow {
  from {
    transform: scale(0.08);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes handPoint {
  0%,
  100% {
    transform: translate(-74%, -50%) rotate(-6deg);
  }
  50% {
    transform: translate(-54%, -50%) rotate(-6deg);
  }
}

@media (max-width: 960px) {
  .task-page {
    padding: 14px 108px 18px;
  }

  .drawing-page {
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  }

  .rubric-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (orientation: portrait) {
  .setup-panel {
    width: min(900px, 94vw);
    padding: 24px;
  }

  .page-shell {
    grid-template-rows: clamp(68px, 9dvh, 92px) minmax(0, 1fr);
  }

  .task-page {
    padding-inline: 100px;
    padding-bottom: var(--bottom-safe);
  }

  .drawing-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 0.42fr) minmax(0, 1fr);
  }

  .drawing-page.cube-page {
    grid-template-columns: minmax(220px, 0.95fr) 34px minmax(0, 1.05fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .reference-svg {
    width: min(380px, 92%);
  }

  .rubric-layout,
  .admin-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-logo {
    width: 104px;
    height: 104px;
  }

  .radar-card {
    width: min(300px, 36dvh);
  }
}

@media (max-width: 760px) {
  .setup-panel {
    grid-template-columns: minmax(0, 1fr);
    width: min(620px, 94vw);
  }

  .setup-play-zone {
    min-height: auto;
  }

  .setup-start-button {
    width: min(210px, 48vw);
    height: min(210px, 48vw);
  }

  .task-page {
    padding-inline: 64px;
  }

  .edge-arrow {
    min-width: 50px;
    padding: 8px;
  }

  .edge-arrow svg {
    width: 22px;
    height: 22px;
  }

  .edge-arrow .arrow-label {
    display: none;
  }

  .drawing-page.cube-page,
  .drawing-page.clock-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(170px, 0.42fr) 28px minmax(0, 1fr);
  }

  .cube-arrow-hint {
    width: 100%;
    transform: rotate(90deg);
  }
}

@media (max-height: 820px) {
  :root {
    --setup-control-height: 56px;
  }

  .setup-screen {
    padding: 14px;
  }

  .setup-panel {
    width: min(1020px, 94vw);
    padding: 22px;
  }

  .brand-row {
    gap: 14px;
    margin-bottom: 16px;
  }

  .logo-image {
    width: 78px;
    height: 78px;
  }

  h1 {
    font-size: 42px;
  }

  .setup-grid {
    gap: 10px;
  }

  .field {
    gap: 6px;
    font-size: 18px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 21px;
  }

  .big-button {
    min-height: 62px;
    font-size: 25px;
  }

  .setup-start-button {
    width: clamp(160px, 19vw, 220px);
    height: clamp(160px, 19vw, 220px);
  }

  .setup-start-button span {
    font-size: clamp(34px, 4.2vw, 48px);
  }

  .setup-start-button small {
    font-size: clamp(34px, 4.2vw, 48px);
  }

  .page-shell {
    grid-template-rows: 76px minmax(0, 1fr);
  }

  .page-header {
    padding-top: 8px;
    padding-bottom: 7px;
  }

  .header-prompt {
    -webkit-line-clamp: 1;
  }

  .task-page {
    padding-top: 7px;
    padding-bottom: var(--bottom-safe);
  }

  .task-copy {
    padding: 14px;
  }
}

@media (max-height: 720px) {
  .page-shell {
    grid-template-rows: 64px minmax(0, 1fr);
  }

  .page-header {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .icon-button {
    width: 48px;
    height: 48px;
  }

  h2 {
    font-size: 23px;
  }

  h3 {
    font-size: 28px;
  }

  .prompt {
    font-size: 18px;
  }

  .header-prompt {
    font-size: 16px;
  }

  .cute-helper {
    width: 72px;
    height: 72px;
  }

  .task-page {
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
  }

  .task-copy {
    padding: 18px;
  }

  .option {
    min-height: 52px;
    font-size: 22px;
  }

  .math-question {
    font-size: 38px;
  }

  .circle-button,
  .timer-button,
  .sound-button {
    width: 116px;
    height: 116px;
    min-width: 116px;
    min-height: 116px;
  }

  .task-actions {
    min-height: 50px;
  }

  .confirm-button,
  .utility-button {
    min-height: 46px;
    font-size: 20px;
  }

  .tap-button {
    min-height: 128px;
  }

  .transcript-input {
    height: 92px;
  }
}

@media (max-width: 640px), (max-height: 560px) {
  :root {
    --bottom-safe: max(10px, env(safe-area-inset-bottom));
    --setup-control-height: 52px;
  }

  body {
    font-size: 18px;
  }

  h1 {
    font-size: clamp(36px, 10vw, 44px);
  }

  h2 {
    font-size: clamp(20px, 5.8vw, 26px);
  }

  h3,
  h4 {
    font-size: clamp(22px, 6vw, 28px);
  }

  .setup-screen {
    place-items: stretch;
    padding: 10px;
    overflow: auto;
  }

  .floating-stars i {
    width: 22px;
    height: 22px;
  }

  .setup-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(104px, 0.72fr);
    gap: 10px;
    align-self: stretch;
    width: 100%;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
  }

  .setup-panel::after,
  .play-orbit {
    display: none;
  }

  .setup-left {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .brand-row {
    gap: 10px;
    margin-bottom: 10px;
  }

  .logo-image {
    width: 58px;
    height: 58px;
  }

  .setup-grid {
    gap: 7px;
    min-height: 0;
  }

  .field {
    gap: 4px;
    font-size: 17px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 19px;
  }

  .segmented-options {
    gap: 8px;
  }

  .setup-play-zone {
    min-height: 104px;
  }

  .setup-start-button {
    width: clamp(112px, 34vw, 150px);
    height: clamp(112px, 34vw, 150px);
    border-width: 5px;
    box-shadow:
      0 7px 0 var(--leaf-dark),
      0 14px 26px rgba(18, 122, 73, 0.2);
  }

  .setup-start-button span {
    font-size: clamp(28px, 8vw, 38px);
  }

  .setup-start-button small {
    margin-top: 2px;
    font-size: clamp(28px, 8vw, 38px);
  }

  .page-shell {
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .page-header {
    gap: 8px;
    padding: 6px 8px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .header-title h2 {
    font-size: clamp(20px, 5.6vw, 25px);
  }

  .header-prompt {
    margin-top: 1px;
    font-size: clamp(13px, 3.8vw, 16px);
    line-height: 1.2;
    -webkit-line-clamp: 1;
  }

  .header-progress {
    width: 66px;
    gap: 4px;
    font-size: 16px;
  }

  .progress-track {
    height: 7px;
  }

  .drawer-panel {
    width: min(320px, 88vw);
    gap: 7px;
    padding: 14px;
  }

  .drawer-logo {
    width: 46px;
    height: 46px;
  }

  .drawer-item {
    min-height: 42px;
    font-size: 18px;
  }

  .drawer-score {
    min-height: 58px;
    font-size: 26px;
  }

  .drawer-task {
    min-height: 42px;
    padding: 6px 9px;
  }

  .task-page {
    gap: 6px;
    padding: 6px 64px var(--bottom-safe);
  }

  .edge-arrow {
    min-width: 48px;
    height: auto;
    padding: 8px;
    font-size: 30px;
    border-width: 1px;
  }

  .edge-arrow svg {
    width: 22px;
    height: 22px;
  }

  .edge-arrow .arrow-label {
    font-size: 10px;
  }

  .edge-arrow-left {
    left: 6px;
  }

  .edge-arrow-right {
    right: 6px;
  }

  .task-actions {
    min-height: 46px;
    gap: 8px;
    padding: 0;
  }

  .task-actions-left {
    gap: 6px;
  }

  .confirm-button {
    min-width: 96px;
    min-height: 44px;
    padding: 8px 15px;
    font-size: 20px;
    box-shadow: 0 4px 0 #bf533e;
  }

  .utility-button {
    min-width: 78px;
    min-height: 42px;
    padding: 7px 12px;
    font-size: 18px;
    box-shadow: 0 3px 0 #cddbd2;
  }

  .trail-page,
  .drawing-page,
  .naming-page,
  .memory-page,
  .speech-page,
  .abstraction-page,
  .orientation-page,
  .digit-page,
  .vigilance-page,
  .serial-page,
  .fluency-page,
  .wait-card {
    border-width: 1px;
  }

  .trail-page {
    padding: 8px;
  }

  .drawing-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(118px, 0.32fr) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .drawing-page.cube-page,
  .drawing-page.clock-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(118px, 0.32fr) 22px minmax(0, 1fr);
  }

  .reference-svg {
    width: min(230px, 86%);
    max-height: 96%;
  }

  .clock-time-reference {
    gap: 6px;
    padding: 24px 10px 6px;
  }

  .clock-time-reference strong {
    font-size: clamp(48px, 12vw, 74px);
  }

  .clock-time-reference span {
    font-size: clamp(20px, 4vw, 28px);
  }

  .redraw-button {
    right: 8px;
    bottom: 8px;
  }

  .naming-page {
    gap: 10px;
    padding: 12px;
  }

  .animal-emoji {
    width: min(136px, 42vw);
    font-size: clamp(88px, 27vw, 120px);
  }

  .animal-side {
    width: 100%;
  }

  .animal-side h4 {
    margin-bottom: 8px;
    text-align: center;
  }

  .option-grid {
    gap: 8px;
  }

  .option {
    min-height: 52px;
    padding: 8px 10px;
    font-size: clamp(18px, 5vw, 22px);
  }

  .memory-page {
    gap: 8px;
    padding: 10px;
  }

  .memory-choice-panel {
    gap: 10px;
    font-size: clamp(20px, 5.6vw, 24px);
  }

  .memory-choice-panel span {
    min-width: 64px;
    min-height: 38px;
  }

  .memory-wait-copy {
    font-size: clamp(18px, 5vw, 23px);
  }

  .speech-page,
  .abstraction-page,
  .orientation-page,
  .digit-page,
  .vigilance-page,
  .serial-page,
  .fluency-page,
  .wait-card {
    gap: 10px;
    padding: 10px;
  }

  .audio-wave {
    width: 138px;
    height: 62px;
    gap: 7px;
  }

  .audio-wave span {
    width: 9px;
  }

  .voice-status {
    font-size: 17px;
  }

  .circle-button,
  .timer-button,
  .sound-button {
    width: 112px;
    height: 112px;
    min-width: 112px;
    min-height: 112px;
    font-size: 22px;
  }

  .digit-answer {
    min-height: 46px;
    gap: 6px;
  }

  .digit-answer span {
    width: 38px;
    height: 46px;
    font-size: 24px;
  }

  .keypad,
  .digit-keypad,
  .serial-keypad {
    grid-template-columns: repeat(3, clamp(54px, 15vw, 70px));
    gap: 8px;
  }

  .keypad button,
  .keypad-spacer {
    min-height: 44px;
  }

  .keypad button {
    font-size: 21px;
  }

  .tap-instruction {
    font-size: clamp(28px, 8vw, 38px);
    text-align: center;
  }

  .tap-button {
    width: min(260px, 90%);
    min-height: 112px;
    font-size: 28px;
  }

  .math-question {
    font-size: clamp(30px, 8vw, 38px);
  }

  .serial-display {
    width: 168px;
    height: 56px;
    font-size: 30px;
  }

  .word-pair {
    gap: 10px;
  }

  .word-card {
    min-width: min(132px, 40vw);
    min-height: 94px;
    padding: 8px;
  }

  .word-card span {
    font-size: clamp(32px, 10vw, 42px);
  }

  .word-card strong {
    font-size: clamp(23px, 7vw, 30px);
  }

  .hand-cue {
    left: 10px;
    top: 50%;
    font-size: 34px;
  }

  .pair-title,
  .orientation-question {
    max-width: 96%;
    font-size: clamp(24px, 7vw, 30px);
  }

  .transcript-input {
    width: 96%;
    height: 82px;
    font-size: 22px;
  }

  .results-page,
  .design-page,
  .admin-page {
    gap: 10px;
    padding: 10px;
    overflow: auto;
  }

  .results-page {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .design-page {
    overflow: auto;
  }

  .result-hero {
    gap: 6px;
    padding: 10px;
  }

  .result-logo {
    width: 76px;
    height: 76px;
  }

  .result-hero strong {
    font-size: clamp(46px, 13vw, 64px);
  }

  .result-hero p {
    font-size: 18px;
    text-align: center;
  }

  .radar-card {
    width: min(230px, 46dvh);
  }

  .result-medals {
    gap: 7px;
  }

  .result-medals b {
    min-width: 66px;
    min-height: 36px;
    font-size: 15px;
  }

  .results-actions {
    justify-content: center;
  }

  .results-actions .primary,
  .results-actions .ghost,
  .admin-toolbar .primary,
  .admin-toolbar .secondary {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 16px;
  }

  .admin-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
    overflow: auto;
  }

  .admin-toolbar {
    justify-content: start;
    overflow-x: auto;
  }

  .admin-head,
  .admin-row {
    grid-template-columns: minmax(128px, 1.2fr) minmax(56px, 0.45fr) minmax(78px, 0.6fr) minmax(78px, 0.6fr) minmax(88px, 0.6fr) minmax(160px, 1.3fr);
    gap: 6px;
    min-width: 672px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .detail-header {
    align-items: start;
    flex-direction: column;
  }

  .detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rubric-page-head {
    display: grid;
    gap: 4px;
    padding: 12px;
  }

  .rubric-page-head p {
    font-size: 16px;
  }

  .rubric-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .rubric-group {
    min-height: 0;
    padding: 12px;
  }

  .rubric-group h4 {
    font-size: 22px;
  }

  .rubric-card {
    min-height: 48px;
    padding: 10px;
  }

  .rubric-card span {
    font-size: 19px;
  }

  .rubric-card em {
    font-size: 13px;
  }

  .rubric-modal {
    padding: 8px;
  }

  .rubric-modal-head {
    padding: 14px;
  }

  .rubric-modal-head h3 {
    font-size: clamp(28px, 8vw, 36px);
  }

  .rubric-modal-body {
    gap: 14px;
    padding: 16px;
  }

  .rubric-modal-body p {
    font-size: clamp(22px, 6vw, 28px);
  }
}

@media (max-width: 430px) {
  :root {
    --setup-control-height: 48px;
  }

  .setup-screen {
    padding: 8px;
  }

  .setup-panel {
    padding: 12px;
  }

  .logo-image {
    width: 52px;
    height: 52px;
  }

  .setup-grid {
    gap: 6px;
  }

  .field {
    font-size: 16px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 18px;
  }

  .task-page {
    padding-inline: 58px;
  }

  .edge-arrow {
    min-width: 46px;
    height: auto;
    padding: 7px;
    font-size: 28px;
  }

  .edge-arrow svg {
    width: 20px;
    height: 20px;
  }

  .edge-arrow .arrow-label {
    display: none;
  }

  .confirm-button {
    min-width: 84px;
    min-height: 42px;
    padding: 7px 12px;
    font-size: 18px;
  }

  .utility-button {
    min-width: 68px;
    min-height: 40px;
    padding: 6px 10px;
    font-size: 17px;
  }

  .task-actions {
    gap: 6px;
  }

  .drawing-page,
  .drawing-page.cube-page,
  .drawing-page.clock-page {
    grid-template-rows: minmax(104px, 0.3fr) minmax(0, 1fr);
  }

  .option {
    min-height: 48px;
  }

  .memory-page .option {
    min-height: 44px;
    font-size: 17px;
  }

  .circle-button,
  .timer-button,
  .sound-button {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --setup-control-height: 44px;
  }

  .setup-panel {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.32fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
  }

  .brand-row {
    margin-bottom: 6px;
  }

  .logo-image {
    width: 44px;
    height: 44px;
  }

  h1 {
    font-size: 32px;
  }

  .setup-grid {
    gap: 5px;
  }

  .field {
    font-size: 15px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 17px;
  }

  .setup-start-button {
    width: 104px;
    height: 104px;
  }

  .setup-start-button span {
    font-size: 27px;
  }

  .setup-start-button small {
    font-size: 27px;
  }

  .page-shell {
    grid-template-rows: 50px minmax(0, 1fr);
  }

  .page-header {
    padding-block: 4px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .header-prompt {
    display: none;
  }

  .task-page {
    padding-top: 4px;
    padding-bottom: 6px;
  }

  .drawing-page {
    grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.4fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .drawing-page.cube-page {
    grid-template-columns: minmax(150px, 0.8fr) 26px minmax(0, 1.4fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .naming-page {
    grid-template-columns: minmax(120px, 0.5fr) minmax(0, 1fr);
  }

  .animal-emoji {
    width: min(128px, 30dvh);
    font-size: min(106px, 24dvh);
  }

  .option {
    min-height: 42px;
  }

  .circle-button,
  .timer-button,
  .sound-button {
    width: 92px;
    height: 92px;
    min-width: 92px;
    min-height: 92px;
  }
}

@supports (height: 100svh) {
  :root {
    --app-height: 100svh;
  }
}

html,
body,
#app,
.app-shell,
.page-shell {
  min-width: 0;
}

.setup-panel,
.setup-left,
.setup-grid,
.field,
.segmented-options,
.edu-segment-options {
  min-width: 0;
}

.segment-option {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-voice-button {
  max-width: 100%;
  white-space: normal;
}

#app {
  width: min(100vw, var(--app-width));
}

.single-page,
.task-page,
.task-workspace {
  min-width: 0;
}

.task-page {
  height: 100%;
  min-height: 0;
}

.task-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.task-workspace > * {
  min-width: 0;
  min-height: 0;
}

.edge-arrow {
  max-width: min(104px, calc(var(--app-width) * 0.18));
}

@media (max-width: 1024px), (max-height: 760px) {
  .page-shell {
    grid-template-rows: clamp(54px, 9svh, 82px) minmax(0, 1fr);
  }

  .task-page {
    padding-inline: clamp(58px, 9vw, 104px);
  }

  .task-actions {
    min-height: clamp(44px, 7svh, 58px);
  }

  .trail-page,
  .drawing-page,
  .naming-page,
  .memory-page,
  .speech-page,
  .abstraction-page,
  .orientation-page,
  .digit-page,
  .vigilance-page,
  .serial-page,
  .fluency-page,
  .wait-card {
    max-height: 100%;
  }

  .option {
    min-height: clamp(48px, 8svh, 72px);
  }

  .transcript-input {
    max-width: min(620px, 96%);
    height: clamp(78px, 18svh, 132px);
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  :root {
    --bottom-safe: max(28px, env(safe-area-inset-bottom));
  }

  .setup-screen {
    place-items: stretch;
    overflow-y: auto;
    padding: clamp(12px, 2.4vw, 24px);
  }

  .setup-panel {
    align-self: center;
    max-height: calc(var(--app-height) - 24px);
    overflow-y: auto;
  }

  .task-page {
    overflow-y: auto;
    padding-bottom: calc(var(--bottom-safe) + 8px);
  }

  .task-workspace {
    overflow: hidden;
  }
}

@media (max-width: 820px) and (orientation: portrait) {
  .setup-screen {
    place-items: stretch;
    padding: clamp(10px, 2.4vw, 20px);
    overflow-y: auto;
  }

  .setup-panel {
    align-self: center;
    max-height: calc(var(--app-height) - 20px);
    overflow-y: auto;
  }

  .task-page {
    padding-inline: clamp(52px, 8.5vw, 78px);
  }

  .edge-arrow {
    padding-inline: 8px;
  }

  .memory-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }
}

@media (max-width: 620px) and (orientation: portrait) {
  .setup-panel {
    justify-self: center;
    width: min(360px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    overflow-x: hidden;
  }

  .page-shell {
    grid-template-rows: clamp(50px, 7svh, 58px) minmax(0, 1fr);
  }

  .task-page {
    padding: 6px 52px max(8px, env(safe-area-inset-bottom));
  }

  .edu-segment-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voice-setup-row {
    margin-top: 18px;
  }

  .setup-voice-button {
    min-height: 58px;
    padding: 12px 20px;
    font-size: clamp(20px, 5.2vw, 24px);
  }

  .edge-arrow {
    max-width: 44px;
    min-width: 44px;
    padding: 7px;
  }

  .edge-arrow-left {
    left: 4px;
  }

  .edge-arrow-right {
    right: 4px;
  }

  .task-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 42px;
  }

  .confirm-button,
  .utility-button {
    min-height: 40px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  :root {
    --bottom-safe: max(6px, env(safe-area-inset-bottom));
  }

  .setup-screen {
    place-items: stretch;
    padding: 8px;
    overflow: hidden;
  }

  .setup-panel {
    align-self: stretch;
    align-items: start;
    width: 100%;
    max-height: calc(var(--app-height) - 16px);
    overflow-y: auto;
    padding: clamp(8px, 2.4svh, 14px) clamp(12px, 2.8vw, 18px);
  }

  .brand-row {
    margin-bottom: 6px;
  }

  .field {
    gap: 3px;
  }

  .field > span {
    font-size: 14px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 17px;
  }

  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .setup-grid .field:nth-child(4) {
    grid-column: 1 / -1;
  }

  .segmented-options,
  .edu-segment-options {
    gap: 7px;
  }

  .edu-segment-options {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .voice-setup-row {
    margin-top: 8px;
  }

  .setup-voice-button {
    min-height: 42px;
    padding: 7px 16px;
    font-size: 18px;
  }

  .page-shell {
    grid-template-rows: clamp(44px, 13svh, 58px) minmax(0, 1fr);
  }

  .page-header {
    min-width: 0;
    padding-block: 4px;
  }

  .header-title h2 {
    font-size: clamp(18px, 3svh, 24px);
  }

  .header-prompt {
    display: none;
  }

  .header-progress {
    width: 74px;
  }

  .task-page {
    gap: 4px;
    padding: 4px 56px max(5px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .task-actions {
    min-height: 38px;
  }

  .edge-arrow {
    top: calc(50% - 3px);
    min-width: 42px;
    max-width: 42px;
    padding: 7px;
  }

  .edge-arrow .arrow-label {
    display: none;
  }

  .edge-arrow svg {
    width: 20px;
    height: 20px;
  }

  .trail-page,
  .drawing-page,
  .naming-page,
  .memory-page,
  .speech-page,
  .abstraction-page,
  .orientation-page,
  .digit-page,
  .vigilance-page,
  .serial-page,
  .fluency-page,
  .wait-card {
    border-width: 1px;
  }

  .speech-page,
  .abstraction-page,
  .orientation-page,
  .digit-page,
  .vigilance-page,
  .serial-page,
  .fluency-page,
  .wait-card {
    gap: clamp(5px, 1.8svh, 10px);
    padding: clamp(6px, 1.7svh, 10px);
  }

  .drawing-page,
  .drawing-page.cube-page {
    gap: 8px;
    padding: 8px;
  }

  .circle-button,
  .timer-button,
  .sound-button {
    width: clamp(82px, 24svh, 106px);
    height: clamp(82px, 24svh, 106px);
    min-width: clamp(82px, 24svh, 106px);
    min-height: clamp(82px, 24svh, 106px);
  }

  .audio-wave {
    width: clamp(120px, 34svh, 154px);
    height: clamp(50px, 15svh, 72px);
  }

  .animal-emoji {
    width: min(132px, 34svh);
    font-size: min(108px, 28svh);
  }

  .option {
    min-height: clamp(38px, 11svh, 52px);
    padding-block: 6px;
    font-size: clamp(17px, 5svh, 22px);
  }

  .memory-page {
    gap: 6px;
    padding: 8px;
  }

  .memory-options {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .memory-options .option {
    min-height: clamp(38px, 11svh, 50px);
  }

  .keypad,
  .digit-keypad,
  .serial-keypad {
    grid-template-columns: repeat(3, clamp(50px, 15svh, 64px));
    gap: 6px;
  }

  .keypad button,
  .keypad-spacer {
    min-height: clamp(36px, 11svh, 48px);
  }

  .tap-button {
    min-height: clamp(90px, 28svh, 126px);
  }

  .transcript-input {
    height: clamp(58px, 18svh, 86px);
  }
}

@media (orientation: landscape) and (max-width: 1280px) and (max-height: 900px) {
  :root {
    --setup-control-height: 56px;
  }

  .setup-screen {
    place-items: stretch;
    padding: 12px;
    overflow-y: auto;
  }

  .setup-panel {
    align-self: center;
    width: min(1100px, calc(100vw - 24px));
    max-height: calc(var(--app-height) - 24px);
    padding: clamp(18px, 3svh, 28px) clamp(24px, 3.2vw, 38px);
    overflow-y: auto;
  }

  .brand-row {
    margin-bottom: 14px;
  }

  .logo-image {
    width: clamp(70px, 10svh, 90px);
    height: clamp(70px, 10svh, 90px);
  }

  h1 {
    font-size: clamp(42px, 7svh, 54px);
  }

  .setup-grid {
    gap: 10px;
  }

  .field {
    gap: 6px;
  }

  .field > span {
    font-size: 17px;
  }

  .field input,
  .field select,
  .segment-option {
    font-size: 21px;
  }

  .voice-setup-row {
    margin-top: 18px;
  }

  .setup-voice-button {
    min-height: 54px;
    padding: 11px 28px;
    font-size: 22px;
  }

  .setup-start-button {
    width: clamp(170px, 25svh, 220px);
    height: clamp(170px, 25svh, 220px);
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .page-shell {
    grid-template-rows: 42px minmax(0, 1fr);
  }

  .task-page {
    padding-inline: 48px;
  }

  .edge-arrow {
    min-width: 38px;
    max-width: 38px;
    padding: 6px;
  }

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

  .task-actions {
    min-height: 34px;
  }

  .confirm-button,
  .utility-button {
    min-height: 34px;
    padding-block: 5px;
    font-size: 16px;
  }

  .drawing-page {
    grid-template-columns: minmax(128px, 0.8fr) minmax(0, 1.45fr);
  }

  .drawing-page.cube-page,
  .drawing-page.clock-page {
    grid-template-columns: minmax(128px, 0.8fr) 20px minmax(0, 1.45fr);
  }

  .reference-label {
    top: 6px;
    font-size: 12px;
  }

  .clock-time-reference {
    gap: 4px;
    padding: 20px 8px 4px;
  }

  .clock-time-reference strong {
    font-size: clamp(44px, 13svh, 68px);
  }

  .clock-time-reference span {
    font-size: clamp(16px, 5svh, 24px);
  }

  .transcript-input {
    height: clamp(48px, 17svh, 72px);
  }
}

.setup-screen {
  place-items: stretch;
  padding: 0;
  overflow: hidden;
}

.setup-panel {
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  grid-template-columns: minmax(0, 1.18fr) minmax(220px, 0.62fr);
  gap: clamp(28px, 4.8vw, 76px);
  padding: clamp(28px, 5.2dvh, 76px) clamp(44px, 7.2vw, 118px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.setup-panel::after {
  display: none;
}

.setup-left {
  align-self: center;
}

.setup-play-zone {
  align-self: center;
  transform: translateX(clamp(-108px, -7vw, -44px));
}

.play-orbit {
  display: none;
}

@media (orientation: portrait), (max-width: 760px) {
  .setup-screen {
    overflow-y: auto;
  }

  .setup-panel {
    width: 100%;
    max-width: none;
    min-height: 100%;
    height: auto;
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(150px, auto);
    align-content: center;
    padding: clamp(22px, 4.6svh, 54px) clamp(20px, 6vw, 62px);
    overflow-y: auto;
  }

  .setup-play-zone {
    min-height: auto;
    transform: none;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .setup-panel {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(116px, 0.34fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    padding: clamp(10px, 3svh, 18px) clamp(18px, 5vw, 50px);
    overflow-y: auto;
  }
}

.task-actions {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-items: center;
}

.task-actions-left {
  justify-self: start;
}

.task-actions-right {
  justify-self: end;
}

.task-skip-link {
  position: absolute;
  right: clamp(18px, 3vw, 34px);
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 7;
  padding: 4px 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.digit-keypad,
.serial-keypad,
.orientation-keypad {
  grid-template-columns: repeat(3, clamp(88px, 11vw, 122px));
  gap: 16px;
}

.digit-keypad button,
.serial-keypad button,
.orientation-keypad button,
.digit-keypad .keypad-spacer,
.serial-keypad .keypad-spacer,
.orientation-keypad .keypad-spacer {
  min-height: clamp(70px, 10dvh, 94px);
}

.digit-keypad button,
.serial-keypad button,
.orientation-keypad button {
  font-size: clamp(30px, 4vw, 40px);
}

.clock-time-reference strong {
  font-size: clamp(118px, 15vw, 220px);
}

@media (max-width: 760px), (max-height: 620px) {
  .task-actions {
    padding-inline: 48px;
  }

  .task-skip-link {
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    font-size: 12px;
  }

  .digit-keypad,
  .serial-keypad,
  .orientation-keypad {
    grid-template-columns: repeat(3, clamp(72px, 22vw, 96px));
    gap: 12px;
  }

  .digit-keypad button,
  .serial-keypad button,
  .orientation-keypad button,
  .digit-keypad .keypad-spacer,
  .serial-keypad .keypad-spacer,
  .orientation-keypad .keypad-spacer {
    min-height: clamp(62px, 11svh, 82px);
  }

  .clock-time-reference strong {
    font-size: clamp(74px, 18vw, 118px);
  }
}

/* Login page polish */
.setup-panel {
  grid-template-columns: minmax(420px, 660px) minmax(0, 1fr);
  align-items: center;
  padding: clamp(28px, 5.2dvh, 70px) clamp(42px, 6.8vw, 112px);
}

.setup-left {
  display: grid;
  align-self: center;
  gap: clamp(18px, 2.2dvh, 26px);
  width: min(660px, 100%);
  padding: clamp(22px, 3.2dvh, 34px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.58));
  box-shadow: 0 22px 54px rgba(36, 52, 71, 0.14);
  backdrop-filter: blur(12px);
}

.brand-row {
  margin-bottom: 0;
}

.brand-row h1 {
  color: #263640;
  font-size: clamp(58px, 6.4vw, 78px);
  line-height: 1;
}

.setup-grid {
  gap: clamp(14px, 1.9dvh, 20px);
}

.field {
  gap: 10px;
}

.field > span {
  color: #4d6572;
  font-size: clamp(24px, 2.35vw, 30px);
  font-weight: 1000;
  line-height: 1.05;
}

.field input,
.field select {
  height: clamp(68px, 8dvh, 80px);
  min-height: clamp(68px, 8dvh, 80px);
  padding: 0 clamp(18px, 2vw, 24px);
  border: 2px solid rgba(189, 210, 204, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow:
    0 4px 0 rgba(174, 193, 184, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: #243447;
  font-size: clamp(26px, 2.8vw, 32px);
  font-weight: 950;
}

.field input:focus,
.field select:focus {
  border-color: var(--leaf);
  box-shadow:
    0 4px 0 rgba(18, 122, 73, 0.22),
    0 0 0 5px rgba(34, 169, 107, 0.18);
}

.birth-date-selects {
  gap: 14px;
}

.segmented-options {
  grid-auto-rows: clamp(68px, 8dvh, 80px);
  gap: 14px;
}

.edu-segment-options {
  gap: 12px;
}

.segment-option {
  height: clamp(68px, 8dvh, 80px);
  border: 2px solid rgba(189, 210, 204, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow:
    0 4px 0 rgba(174, 193, 184, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: #263640;
  font-size: clamp(24px, 2.45vw, 30px);
}

.segment-option:hover:not(.picked) {
  border-color: rgba(125, 165, 140, 0.50);
  background: rgba(240, 248, 242, 0.80);
}

.segment-option.picked {
  border-color: #5a9b6e;
  background: linear-gradient(135deg, #5a9b6e 0%, #4a8560 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 2px 8px rgba(55, 115, 75, 0.16);
}

.voice-setup-row {
  justify-content: stretch;
  margin-top: 0;
}

.setup-voice-button {
  width: 100%;
  min-height: clamp(64px, 7.4dvh, 74px);
  padding: 12px 22px;
  border: 2px solid rgba(34, 169, 107, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 0 rgba(18, 122, 73, 0.18);
  color: var(--leaf-dark);
  font-size: clamp(24px, 2.5vw, 30px);
}

.setup-start-button {
  display: flex;
  width: 100%;
  height: clamp(76px, 9dvh, 92px);
  min-height: clamp(76px, 9dvh, 92px);
  align-items: center;
  justify-content: center;
  margin-top: 0;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffe9a6, #ffc857);
  box-shadow:
    0 7px 0 rgba(183, 127, 43, 0.45),
    0 20px 34px rgba(87, 63, 26, 0.16);
  color: #263640;
  text-align: center;
}

.setup-start-button span {
  font-size: clamp(30px, 3vw, 38px);
  line-height: 1;
}

.setup-start-button small {
  display: none;
}

.setup-start-button::after {
  content: "→";
  display: grid;
  width: clamp(42px, 4vw, 54px);
  height: clamp(42px, 4vw, 54px);
  place-items: center;
  margin-left: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #263640;
  font-size: clamp(28px, 2.7vw, 34px);
  font-weight: 1000;
  line-height: 1;
}

@media (orientation: landscape) and (max-width: 1280px) and (max-height: 900px) {
  .setup-panel {
    grid-template-columns: minmax(380px, 610px) minmax(0, 1fr);
    padding: clamp(20px, 3.2svh, 34px) clamp(30px, 4.4vw, 56px);
  }

  .setup-left {
    gap: 14px;
    padding: clamp(18px, 2.4svh, 24px);
  }

  .brand-row h1 {
    font-size: clamp(48px, 7svh, 64px);
  }

  .setup-grid {
    gap: 11px;
  }

  .field > span {
    font-size: clamp(24px, 3svh, 28px);
  }

  .field input,
  .field select,
  .segment-option {
    height: clamp(58px, 8svh, 68px);
    min-height: clamp(58px, 8svh, 68px);
    font-size: clamp(26px, 3.4svh, 30px);
  }

  .setup-voice-button {
    min-height: clamp(54px, 7svh, 64px);
    font-size: clamp(21px, 3svh, 25px);
  }

  .setup-start-button {
    height: clamp(64px, 8svh, 76px);
    min-height: clamp(64px, 8svh, 76px);
  }

  .setup-start-button span {
    font-size: clamp(26px, 3.6svh, 32px);
  }
}

@media (orientation: portrait), (max-width: 760px) {
  .setup-screen {
    background-position: center, 48% center;
  }

  .setup-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    align-content: start;
    align-items: start;
    padding: clamp(10px, 2svh, 18px) clamp(12px, 4vw, 24px) 48px;
    overflow-y: auto;
  }

  .setup-left {
    align-self: start;
    width: 100%;
    gap: clamp(9px, 1.4svh, 13px);
    padding: clamp(12px, 3vw, 18px);
  }

  .brand-row h1 {
    font-size: clamp(42px, 11vw, 56px);
  }

  .field > span {
    font-size: clamp(20px, 5.4vw, 26px);
  }

  .field input,
  .field select,
  .segment-option {
    height: clamp(52px, 6.9svh, 62px);
    min-height: clamp(52px, 6.9svh, 62px);
    font-size: clamp(20px, 5.4vw, 26px);
  }

  .birth-date-selects {
    gap: 10px;
  }

  .birth-date-unit-field {
    gap: 6px;
  }

  .birth-date-unit-field select {
    padding-inline: 10px 28px;
    font-size: clamp(24px, 6vw, 30px);
  }

  .birth-date-unit-field > span {
    font-size: clamp(20px, 5.2vw, 26px);
  }

  .edu-segment-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-voice-button,
  .setup-start-button {
    min-height: clamp(54px, 6.8svh, 64px);
    font-size: clamp(20px, 5.2vw, 25px);
  }

  .setup-start-button {
    height: clamp(56px, 7.2svh, 66px);
  }

  .setup-start-button span {
    font-size: clamp(22px, 5.8vw, 28px);
  }

  .setup-start-button::after {
    width: clamp(34px, 8.8vw, 42px);
    height: clamp(34px, 8.8vw, 42px);
    margin-left: 12px;
    font-size: clamp(22px, 5.8vw, 28px);
  }
}

/* Full-screen tuning */
.setup-screen {
  padding: 0;
  background-image: none;
  isolation: isolate;
}

.setup-screen::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  background: url("./assets/village/login-hero-v3.webp") center / cover no-repeat;
}

.setup-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, rgba(196, 236, 241, 0.48) 0 30%, rgba(196, 236, 241, 0.08) 56%, transparent 78%);
  pointer-events: none;
}

.setup-panel {
  z-index: 1;
  padding: clamp(20px, 4dvh, 56px) clamp(24px, 5vw, 72px);
}

.setup-left {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.70), rgba(255, 255, 255, 0.46));
}

.page-shell {
  grid-template-rows: clamp(56px, 8.5dvh, 84px) minmax(0, 1fr);
}

.task-page {
  padding: clamp(6px, 1dvh, 10px) clamp(8px, 1.4vw, 18px) calc(var(--bottom-safe) + 4px);
  gap: clamp(4px, 0.8dvh, 8px);
}

.task-workspace {
  height: 100%;
}

.trail-page,
.drawing-page,
.naming-page,
.memory-page,
.speech-page,
.abstraction-page,
.orientation-page,
.digit-page,
.vigilance-page,
.serial-page,
.fluency-page,
.wait-card {
  border-radius: 6px;
}

.trail-page,
.drawing-page {
  padding: clamp(8px, 1.2dvh, 12px);
}

.drawing-page {
  gap: clamp(8px, 1.2vw, 14px);
}

.task-actions {
  min-height: clamp(46px, 6.8dvh, 60px);
}

@media (orientation: portrait), (max-width: 760px) {
  .setup-screen::before {
    background-position: 54% center;
  }

  .setup-screen::after {
    background: linear-gradient(180deg, rgba(196, 236, 241, 0.28), rgba(255, 250, 235, 0.10) 58%, rgba(255, 219, 150, 0.12));
  }

  .setup-panel {
    width: 100%;
    max-width: none;
    padding: clamp(10px, 2svh, 18px) clamp(10px, 3vw, 16px) 42px;
  }

  .setup-left {
    width: min(720px, 100%);
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.48));
  }

  .task-page {
    padding: clamp(4px, 0.8svh, 8px) clamp(6px, 1.8vw, 10px) calc(var(--bottom-safe) + 4px);
  }

  .task-actions {
    padding-inline: clamp(28px, 8vw, 48px);
  }
}

/* Latest clinician review adjustments */
:root {
  --login-edge-gap: clamp(16px, 2.3dvh, 28px);
}

.setup-panel {
  padding-top: max(var(--login-edge-gap), env(safe-area-inset-top));
  padding-bottom: max(var(--login-edge-gap), env(safe-area-inset-bottom));
}

.setup-left {
  max-height: calc(var(--app-height) - (var(--login-edge-gap) * 2));
}

.clock-time-reference {
  padding: clamp(16px, 2.6dvh, 26px) clamp(10px, 1.6vw, 18px);
}

.clock-time-reference strong {
  max-width: 100%;
  font-size: clamp(52px, 7vw, 112px);
  white-space: nowrap;
}

.date-input-with-units {
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr) auto;
  align-items: center;
  width: min(620px, 96%);
}

.date-input-with-units .date-input-box {
  width: 100%;
}

.date-unit {
  color: var(--ink);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 1000;
  line-height: 1;
}

.final-celebration {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 232, 150, 0.42), transparent 34%),
    linear-gradient(180deg, #fffdf2, #f0fff6);
}

.results-page {
  grid-template-rows: minmax(0, 1fr) auto;
}

.final-celebration strong {
  font-size: clamp(76px, 14dvh, 128px);
}

.final-celebration p {
  color: var(--leaf-dark);
  font-size: clamp(28px, 4vw, 46px);
}

.result-fireworks {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.result-fireworks i {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow:
    0 -42px 0 var(--sun),
    32px -30px 0 var(--sky),
    42px 0 0 var(--leaf),
    30px 32px 0 var(--violet),
    0 42px 0 var(--coral),
    -32px 30px 0 var(--sky),
    -42px 0 0 var(--sun),
    -30px -32px 0 var(--leaf);
  opacity: 0;
  animation: fireworkBurst 1.8s ease-out infinite;
}

.result-fireworks i:nth-child(1) {
  left: 24%;
  top: 28%;
}

.result-fireworks i:nth-child(2) {
  right: 22%;
  top: 24%;
  animation-delay: 0.45s;
}

.result-fireworks i:nth-child(3) {
  left: 50%;
  bottom: 30%;
  animation-delay: 0.9s;
}

.final-results-actions {
  justify-content: center;
}

.final-results-actions .primary {
  min-width: min(360px, 70vw);
  min-height: clamp(62px, 8dvh, 78px);
  border-radius: 999px;
  font-size: clamp(24px, 3vw, 32px);
}

.final-results-actions {
  gap: clamp(12px, 2vw, 22px);
  flex-wrap: wrap;
}

.final-results-actions .big-button {
  min-width: min(300px, 42vw);
  min-height: clamp(58px, 7.2dvh, 76px);
  border-radius: 999px;
  font-size: clamp(22px, 2.6vw, 30px);
}

.save-status {
  margin: 0;
  color: var(--leaf-dark);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 900;
  text-align: center;
}

.save-status.error {
  color: #c23b3b;
}

.continue-survey-button,
.final-results-actions .continue-survey-button {
  min-width: min(420px, 86vw);
  min-height: 88px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7d858, #e8b830);
  color: #4a3808;
  font-size: 2.25rem;
  box-shadow: 0 10px 0 #c49a18, 0 18px 32px rgba(180, 140, 20, 0.22);
}

.continue-survey-button:disabled,
.final-results-actions .continue-survey-button:disabled {
  box-shadow: none;
}

.post-survey-intro-page,
.post-survey-page,
.post-survey-done-page {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 24px;
  padding: 32px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 242, 0.96), rgba(239, 249, 255, 0.96));
}

.post-survey-intro-copy,
.post-survey-done-panel {
  display: grid;
  gap: 16px;
  width: min(960px, 94%);
}

.post-survey-intro-copy span,
.post-survey-done-panel span,
.post-survey-question-head span {
  color: var(--leaf-dark);
  font-size: 1.25rem;
  font-weight: 950;
}

.post-survey-intro-copy h2,
.post-survey-question,
.post-survey-done-panel h2 {
  max-width: 980px;
  margin: 0;
  color: var(--ink);
  font-size: 2.6rem;
  font-weight: 1000;
  line-height: 1.22;
}

.post-survey-start-button {
  min-width: min(360px, 78vw);
  min-height: 96px;
  border-radius: 8px;
  background: linear-gradient(180deg, #37b77f, #209a65);
  color: #fff;
  font-size: 2.35rem;
  box-shadow: 0 10px 0 #13764b, 0 18px 32px rgba(32, 154, 101, 0.22);
}

.post-survey-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1000px, 94%);
  color: var(--muted);
}

.post-survey-question-head strong {
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 1000;
}

.sus-likert-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  width: min(1080px, 96%);
}

.sus-likert-option {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 132px;
  padding: 18px 12px;
  border: 3px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1.18;
  box-shadow: 0 6px 0 rgba(36, 52, 71, 0.12);
}

.sus-likert-option strong {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font-size: 1.5rem;
}

.sus-likert-option.picked {
  border-color: var(--leaf);
  background: #effbf4;
  box-shadow: 0 6px 0 #97cdae;
}

.nasa-slider-panel {
  display: grid;
  gap: 22px;
  width: min(980px, 94%);
  padding: 26px;
  border: 3px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.08);
}

.nasa-value-readout {
  color: var(--leaf-dark);
  font-size: 4rem;
  font-weight: 1000;
  line-height: 1;
}

.nasa-slider {
  width: 100%;
  min-height: 52px;
  accent-color: var(--leaf);
}

.nasa-slider::-webkit-slider-thumb {
  width: 52px;
  height: 52px;
}

.nasa-slider::-moz-range-thumb {
  width: 52px;
  height: 52px;
}

.nasa-slider-labels {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 950;
  line-height: 1.2;
}

.nasa-slider-labels span:first-child {
  text-align: left;
}

.nasa-slider-labels span:last-child {
  text-align: right;
}

.post-survey-actions {
  display: flex;
  justify-content: center;
  width: min(900px, 94%);
}

.post-survey-actions .big-button {
  min-width: min(460px, 86vw);
  min-height: 82px;
  border-radius: 8px;
  font-size: 2rem;
}

.post-survey-score-strip {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.post-survey-score-strip b {
  padding: 12px 18px;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.3rem;
}

@media (max-width: 760px) {
  .post-survey-intro-page,
  .post-survey-page,
  .post-survey-done-page {
    gap: 12px;
    padding: 18px;
  }

  .post-survey-intro-copy h2,
  .post-survey-question,
  .post-survey-done-panel h2 {
    font-size: 2rem;
  }

  .post-survey-question-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .sus-likert-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sus-likert-option {
    min-height: 60px;
    grid-template-columns: 56px 1fr;
    justify-items: start;
    padding: 8px 10px;
    font-size: 1.25rem;
    text-align: left;
  }

  .sus-likert-option strong {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }

  .nasa-value-readout {
    font-size: 3.1rem;
  }

  .nasa-slider-labels {
    font-size: 1.35rem;
  }

  .continue-survey-button,
  .post-survey-start-button,
  .post-survey-actions .big-button {
    min-height: 68px;
    font-size: 1.8rem;
  }
}

@keyframes fireworkBurst {
  0% {
    transform: scale(0.15) rotate(0deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  68% {
    transform: scale(1) rotate(24deg);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.18) rotate(32deg);
    opacity: 0;
  }
}

@media (orientation: portrait), (max-width: 760px) {
  :root {
    --login-edge-gap: clamp(14px, 1.9svh, 20px);
  }

  .setup-panel {
    padding-top: max(var(--login-edge-gap), env(safe-area-inset-top));
    padding-bottom: max(var(--login-edge-gap), env(safe-area-inset-bottom));
  }

  .setup-left {
    max-height: calc(var(--app-height) - (var(--login-edge-gap) * 2));
  }

  .clock-time-reference strong {
    font-size: clamp(42px, 12vw, 78px);
  }

  .date-input-with-units {
    grid-template-columns: minmax(82px, 1fr) auto minmax(82px, 1fr) auto;
    gap: 10px;
  }

  .date-unit {
    font-size: clamp(26px, 7vw, 34px);
  }
}

/* Viewport safety pass: keep login and task screens inside the visible device area. */
:root {
  --screen-edge-y: max(14px, env(safe-area-inset-top), env(safe-area-inset-bottom));
  --screen-edge-x: clamp(8px, 1.4vw, 18px);
  --login-control: clamp(48px, 7.2svh, 72px);
  --login-button: clamp(54px, 8svh, 82px);
  --login-gap: clamp(7px, 1.25svh, 16px);
  --login-card-pad: clamp(12px, 2.2svh, 26px);
  --login-title: clamp(38px, 7.5svh, 72px);
}

.setup-screen {
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  padding: var(--screen-edge-y) var(--screen-edge-x);
  place-items: stretch;
  overflow: hidden;
}

.setup-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: clamp(12px, 1.8vw, 28px);
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.setup-left {
  align-self: center;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: var(--login-gap);
  justify-self: stretch;
  width: 100%;
  max-height: 100%;
  min-height: 0;
  padding: var(--login-card-pad);
  overflow: hidden;
}

.brand-row h1 {
  font-size: var(--login-title);
  line-height: 0.98;
}

.setup-grid {
  gap: var(--login-gap);
  min-height: 0;
}

.field {
  gap: clamp(3px, 0.55svh, 7px);
}

.field > span {
  font-size: clamp(18px, 3svh, 28px);
  line-height: 1;
}

.field input,
.field select,
.segment-option {
  height: var(--login-control);
  min-height: var(--login-control);
  font-size: clamp(20px, 3.3svh, 30px);
}

.birth-date-selects,
.segmented-options,
.edu-segment-options {
  gap: clamp(6px, 1svh, 12px);
}

.segmented-options {
  grid-auto-rows: var(--login-control);
}

.setup-voice-button,
.setup-start-button {
  min-height: var(--login-button);
}

.setup-voice-button {
  font-size: clamp(20px, 3.2svh, 28px);
}

.setup-start-button {
  height: var(--login-button);
}

.setup-start-button span {
  font-size: clamp(24px, 4svh, 36px);
}

.setup-start-button::after {
  width: clamp(34px, 5.4svh, 50px);
  height: clamp(34px, 5.4svh, 50px);
  font-size: clamp(24px, 3.6svh, 32px);
}

.volume-setup-screen {
  display: grid;
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  place-items: center;
  padding: var(--screen-edge-y) var(--screen-edge-x);
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(232, 249, 255, 0.86), rgba(255, 250, 235, 0.92)),
    url("./assets/village/login-hero-v3.webp") center / cover no-repeat;
}

.volume-setup-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.84fr);
  align-items: center;
  gap: clamp(22px, 4vw, 54px);
  width: min(1080px, 96vw);
  padding: clamp(24px, 5dvh, 58px);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 22px 54px rgba(36, 52, 71, 0.14);
  backdrop-filter: blur(10px);
}

.volume-setup-copy {
  display: grid;
  gap: clamp(12px, 2dvh, 20px);
  min-width: 0;
}

.volume-setup-copy span {
  color: var(--leaf-dark);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 1000;
}

.volume-setup-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.08;
}

.volume-setup-copy p {
  max-width: 680px;
  margin: 0;
  color: #4d6572;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 850;
  line-height: 1.45;
}

.volume-slider-card {
  display: grid;
  gap: clamp(18px, 3dvh, 30px);
  min-width: 0;
  padding: clamp(22px, 3.2dvh, 34px);
  border: 2px solid rgba(189, 210, 204, 0.72);
  border-radius: 8px;
  background: #fffdf7;
}

.volume-level-value {
  color: var(--coral-dark);
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
}

.volume-slider {
  width: 100%;
  accent-color: var(--coral);
}

.volume-slider-scale,
.volume-setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.volume-slider-scale span {
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 900;
}

.volume-setup-actions .big-button {
  flex: 1;
  min-width: 0;
}

.task-guide-page {
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.5dvh, 16px);
  overflow: hidden;
}

.task-guide-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(10px, 1.8dvh, 18px);
  width: min(940px, 100%);
  max-height: 100%;
  min-height: 0;
  padding: clamp(14px, 2.5dvh, 28px);
  overflow: hidden auto;
  border: 3px solid #d8e5dc;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdf7, #eefbf4);
  box-shadow: 0 8px 0 #c5d5c9, inset 0 -6px 0 rgba(34,169,107,0.05);
}

.task-guide-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(8px, 1.4dvh, 14px);
  width: 100%;
}

.task-guide-copy span {
  color: var(--leaf-dark);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 1000;
}

.task-guide-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 5.4vw, 68px);
  line-height: 1.08;
  text-align: center;
}

.task-guide-copy p {
  margin: 0;
  color: #3f5460;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  width: 100%;
}

.task-guide-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: clamp(12px, 2vw, 22px);
  width: min(620px, 100%);
}

.task-guide-actions .big-button:disabled {
  background: #eef2ef;
  color: #89958e;
  box-shadow: 0 5px 0 #c9d2cd;
}

.trail-guide-practice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: clamp(6px, 1dvh, 10px);
  padding-top: clamp(6px, 1dvh, 10px);
  border-top: 1.5px solid rgba(160, 170, 155, 0.25);
}

.trail-guide-practice strong {
  margin: 0;
  color: var(--leaf-dark);
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 850;
}

.trail-guide-board {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 3.6 / 1;
  border: 2px solid rgba(160, 170, 155, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.70);
  overflow: hidden;
}

.trail-guide-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.trail-guide-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trail-guide-lines path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trail-guide-lines .guide-arrow {
  stroke: rgba(32, 166, 107, 0.2);
  stroke-width: 8;
  stroke-dasharray: 12 12;
}

.trail-guide-lines .drawn {
  stroke: var(--leaf);
  stroke-width: 7;
}

.trail-guide-node {
  position: absolute;
  display: grid;
  width: clamp(72px, 10vmin, 104px);
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 1000;
  box-shadow: 0 5px 0 #cddbd2;
}

.trail-guide-node.picked {
  border-color: var(--leaf);
  background: #dff7ea;
  color: var(--leaf-dark);
}

.trail-guide-node:disabled {
  background: #f0f3f1;
  color: #9aa6a0;
}

.trail-guide-node.node-1 {
  left: 14%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.trail-guide-node.node-jia {
  left: 50%;
  top: 24%;
  transform: translate(-50%, -50%);
}

.trail-guide-node.node-2 {
  right: 14%;
  top: 50%;
  transform: translate(50%, -50%);
}

.trail-guide-finger {
  position: absolute;
  left: 32%;
  top: 34%;
  font-size: clamp(36px, 6vw, 58px);
  transform: rotate(-28deg);
  animation: trailGuideFinger 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes trailGuideFinger {
  0%,
  100% {
    transform: translate(0, 0) rotate(-28deg);
  }
  50% {
    transform: translate(42px, -22px) rotate(-22deg);
  }
}

@media (orientation: portrait), (max-width: 760px) {
  .volume-setup-panel {
    grid-template-columns: minmax(0, 1fr);
    width: min(680px, 100%);
    padding: clamp(18px, 4svh, 34px);
  }

  .volume-setup-copy h2,
  .task-guide-copy h2 {
    font-size: clamp(34px, 9vw, 52px);
  }

  .volume-setup-actions,
  .task-guide-actions {
    grid-template-columns: minmax(0, 1fr);
    flex-direction: column;
  }

  .task-guide-card {
    height: 100%;
    padding: clamp(14px, 3svh, 24px);
  }

  .trail-guide-board {
    aspect-ratio: 1.65 / 1;
  }
}

.app-shell {
  display: grid;
  width: 100%;
  height: var(--app-height);
  padding: var(--screen-edge-y) var(--screen-edge-x);
  overflow: hidden;
}

.page-shell {
  height: 100%;
  min-height: 0;
  grid-template-rows: clamp(56px, 8.2svh, 84px) minmax(0, 1fr);
  overflow: hidden;
}

.page-header {
  min-height: 0;
  padding: clamp(6px, 1svh, 10px) clamp(10px, 1.8vw, 18px);
}

.task-page {
  height: 100%;
  padding: clamp(5px, 0.9svh, 10px) clamp(8px, 1.4vw, 18px) clamp(5px, 0.9svh, 10px);
  overflow: hidden;
}

.task-workspace {
  overflow: hidden;
}

.task-actions {
  min-height: clamp(44px, 6.5svh, 58px);
}

.task-skip-link {
  right: calc(var(--screen-edge-x) + 2px);
  bottom: calc(var(--screen-edge-y) + 2px);
}

@media (orientation: landscape) and (max-height: 720px) {
  :root {
    --screen-edge-y: max(10px, env(safe-area-inset-top), env(safe-area-inset-bottom));
    --login-control: clamp(42px, 8.1svh, 58px);
    --login-button: clamp(44px, 8.2svh, 60px);
    --login-gap: clamp(4px, 0.9svh, 9px);
    --login-card-pad: clamp(9px, 1.8svh, 16px);
    --login-title: clamp(32px, 7.6svh, 50px);
  }

  .setup-panel {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-grid .field:nth-child(4) {
    grid-column: 1 / -1;
  }

  .edu-segment-options {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .field > span {
    font-size: clamp(16px, 3.1svh, 22px);
  }

  .field input,
  .field select,
  .segment-option {
    font-size: clamp(18px, 3.6svh, 24px);
  }

  .setup-start-button::after {
    display: none;
  }
}

@media (orientation: portrait), (max-width: 760px) {
  :root {
    --screen-edge-y: max(12px, env(safe-area-inset-top), env(safe-area-inset-bottom));
    --screen-edge-x: clamp(8px, 2.4vw, 14px);
    --login-control: clamp(46px, 6.4svh, 62px);
    --login-button: clamp(50px, 6.8svh, 64px);
    --login-gap: clamp(6px, 0.95svh, 10px);
    --login-card-pad: clamp(10px, 2.4vw, 16px);
    --login-title: clamp(36px, 6.8svh, 54px);
  }

  .setup-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .setup-left {
    align-self: start;
    width: min(720px, 100%);
    margin: 0 auto;
  }

  .field > span {
    font-size: clamp(18px, 4.6vw, 24px);
  }

  .field input,
  .field select,
  .segment-option {
    font-size: clamp(19px, 5vw, 25px);
  }

  .task-page {
    padding: clamp(4px, 0.7svh, 8px) clamp(6px, 1.8vw, 10px) clamp(4px, 0.7svh, 8px);
  }
}

/* Final device-safe task header pass. Keep titles clear of tablet/browser edges. */
:root {
  --screen-edge-top: max(22px, env(safe-area-inset-top));
  --screen-edge-bottom: max(14px, env(safe-area-inset-bottom));
  --task-header-height: clamp(78px, 10.5svh, 108px);
}

.app-shell {
  padding: var(--screen-edge-top) var(--screen-edge-x) var(--screen-edge-bottom);
}

.page-shell {
  grid-template-rows: var(--task-header-height) minmax(0, 1fr);
}

.page-header {
  min-height: var(--task-header-height);
  padding-block: clamp(10px, 1.4svh, 16px);
}

.header-title h2 {
  font-size: clamp(26px, 3.3svh, 38px);
}

.task-page {
  padding-top: clamp(8px, 1.1svh, 14px);
}

@media (orientation: landscape) and (max-height: 620px) {
  :root {
    --screen-edge-top: max(14px, env(safe-area-inset-top));
    --screen-edge-bottom: max(8px, env(safe-area-inset-bottom));
    --task-header-height: clamp(60px, 15svh, 76px);
  }

  .page-header {
    padding-block: clamp(6px, 1.4svh, 10px);
  }

  .header-title h2 {
    font-size: clamp(20px, 4svh, 28px);
  }
}

@media (orientation: portrait), (max-width: 760px) {
  :root {
    --screen-edge-top: max(20px, env(safe-area-inset-top));
    --screen-edge-bottom: max(12px, env(safe-area-inset-bottom));
    --task-header-height: clamp(72px, 8.8svh, 96px);
  }

  .final-results-actions .big-button {
    min-width: min(320px, 78vw);
  }
}

@media (orientation: portrait), (max-width: 760px) {
  .hearing-page {
    place-items: stretch;
    padding: 12px 14px var(--bottom-safe);
  }

  .hearing-card {
    width: 100%;
    min-height: 0;
    align-content: start;
    padding: clamp(16px, 2.4svh, 24px);
  }

  .hearing-step-card {
    align-content: center;
  }

  .hearing-intro-card,
  .hearing-meter-row,
  .hearing-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hearing-intro-card {
    align-content: center;
  }

  .hearing-intro-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(16px, 2.5svh, 24px);
    width: min(560px, 100%);
  }

  .hearing-hero-icon {
    width: min(180px, 58vw);
  }

  .hearing-ear-target,
  .hearing-ear-target.compact {
    width: min(190px, 60vw);
    justify-self: center;
  }

  .hearing-focus-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .hearing-response-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hearing-response-slot {
    min-height: clamp(146px, 22svh, 176px);
  }

  .hearing-response-grid .option {
    min-height: 70px;
  }

  .hearing-play-button {
    width: clamp(132px, 36vw, 160px);
    min-width: clamp(132px, 36vw, 160px);
    height: clamp(132px, 36vw, 160px);
    min-height: clamp(132px, 36vw, 160px);
  }

  .hearing-continue-button {
    min-height: 78px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .hearing-page {
    padding: 8px 64px var(--bottom-safe);
  }

  .hearing-card {
    min-height: 0;
    gap: 10px;
    padding: 14px 18px;
  }

  .hearing-step-card {
    align-content: center;
  }

  .hearing-test-card {
    align-content: stretch;
    grid-template-rows: auto minmax(0, 1fr) auto minmax(66px, auto) minmax(24px, auto);
  }

  .hearing-intro-layout {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 24px;
    width: min(620px, 100%);
  }

  .hearing-hero-icon {
    width: 132px;
  }

  .hearing-copy h3 {
    margin-bottom: 6px;
    font-size: clamp(28px, 7svh, 42px);
  }

  .hearing-instruction,
  .hearing-summary-note {
    font-size: clamp(16px, 4svh, 20px);
  }

  .hearing-ear-target {
    width: clamp(122px, 22svh, 150px);
  }

  .hearing-ear-target.compact {
    width: clamp(102px, 20svh, 130px);
  }

  .ear-illustration {
    width: min(96px, 72%);
  }

  .hearing-ear-target.compact .ear-illustration {
    width: min(82px, 70%);
  }

  .hearing-ear-target.right .ear-illustration {
    margin-right: 16px;
  }

  .hearing-ear-target.left .ear-illustration {
    margin-left: 16px;
  }

  .hearing-stimulus-panel {
    min-height: 104px;
  }

  .hearing-response-grid .option {
    min-height: 58px;
  }

  .hearing-response-slot {
    min-height: 66px;
  }

.hearing-play-button {
    width: clamp(112px, 22svh, 136px);
    min-width: clamp(112px, 22svh, 136px);
    height: clamp(112px, 22svh, 136px);
    min-height: clamp(112px, 22svh, 136px);
    font-size: 24px;
  }
}

.animal-count-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: min(620px, 92%);
  max-height: 92px;
  overflow-y: auto;
}

.animal-count-list span {
  padding: 4px 9px;
  border: 1.5px solid #d8e9ff;
  border-radius: 999px;
  background: #f6fbff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.15;
}

.fluency-upload-status {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.setup-title-row {
  width: 100%;
  justify-content: center;
  gap: clamp(10px, 1.8vw, 18px);
  flex-wrap: nowrap;
}

.setup-title-row > div {
  min-width: 0;
}

.setup-title-row h1 {
  white-space: nowrap;
}

.setup-title-row .setup-voice-button {
  flex: 0 0 auto;
  width: auto;
  min-height: clamp(42px, 5.2dvh, 52px);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .setup-title-row {
    gap: 8px;
  }

  .setup-title-row h1 {
    font-size: clamp(34px, 10vw, 44px);
  }

  .setup-title-row .setup-voice-button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 14px;
  }
}

.setup-grid {
  grid-template-columns: minmax(0, 1fr);
}

.participant-name-field,
.birth-date-field,
.sex-field,
.education-field {
  grid-column: 1 / -1;
}

.sex-field .segmented-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (orientation: landscape) and (max-height: 620px) and (min-width: 720px) {
  .setup-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.65fr);
  }

  .participant-name-field,
  .education-field {
    grid-column: 1 / -1;
  }

  .birth-date-field {
    grid-column: 1;
  }

  .sex-field {
    grid-column: 2;
  }
}

.hearing-copy h3 {
  display: grid;
  gap: 0.08em;
  justify-items: center;
}

.hearing-check-button {
  min-width: clamp(210px, 24vw, 280px);
  min-height: clamp(68px, 8dvh, 84px);
  border-radius: 8px;
  font-size: clamp(24px, 3vw, 34px);
}

.hearing-continue-button {
  min-width: min(460px, 88vw);
  min-height: clamp(96px, 13dvh, 124px);
  box-shadow:
    0 8px 0 var(--leaf-dark),
    0 18px 34px rgba(34, 169, 107, 0.22);
}

.final-results-actions .big-button:disabled,
.confirm-button:disabled {
  background: #d9dfdc;
  color: #7a8780;
  box-shadow: 0 4px 0 #b7c1bc;
  opacity: 0.86;
}

.naming-page {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: clamp(18px, 3vw, 36px);
  padding: clamp(18px, 3dvh, 34px) clamp(20px, 4vw, 48px);
}

.animal-visual-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.naming-page .animal-emoji {
  width: min(100%, 440px, 66vmin);
  max-height: 100%;
  font-size: clamp(160px, 28vw, 330px);
}

.naming-page .animal-side {
  display: grid;
  align-content: center;
  gap: clamp(16px, 2.4dvh, 26px);
  width: 100%;
  height: 100%;
}

.naming-page .animal-side h4 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.1;
  text-align: center;
}

.naming-page .option-grid {
  grid-template-columns: minmax(0, 1fr);
  width: min(520px, 100%);
  justify-self: center;
}

.naming-page .option {
  min-height: clamp(68px, 10dvh, 92px);
  font-size: clamp(24px, 3vw, 34px);
}

.keypad-split-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  align-content: stretch;
  gap: clamp(16px, 3vw, 34px);
  overflow: hidden;
}

.keypad-question-panel,
.keypad-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-content: center;
  justify-items: center;
  gap: clamp(14px, 2.4dvh, 24px);
}

.keypad-question-panel {
  padding: clamp(8px, 1.6vw, 18px);
}

.keypad-panel {
  padding: clamp(8px, 1.6vw, 18px);
}

.keypad-panel .keypad {
  width: min(520px, 100%);
  height: min(100%, 460px);
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  grid-auto-rows: minmax(58px, 1fr);
  gap: clamp(10px, 1.6vw, 16px);
}

.keypad-panel .keypad button,
.keypad-panel .keypad-spacer {
  height: 100%;
  min-height: 0;
}

.keypad-split-page .digit-answer-prompt,
.keypad-split-page .math-question,
.keypad-split-page .orientation-question {
  max-width: min(520px, 94%);
  text-align: center;
}

.keypad-split-page .digit-answer,
.keypad-split-page .serial-display,
.keypad-split-page .year-digit-row,
.keypad-split-page .date-input-pair {
  max-width: min(520px, 96%);
}

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

  .participant-name-field,
  .birth-date-field,
  .sex-field,
  .education-field {
    grid-column: 1 / -1;
  }
}

@media (orientation: portrait), (max-width: 760px) {
  .naming-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(120px, 0.45fr) minmax(0, 1fr);
  }

  .naming-page .animal-emoji {
    width: min(240px, 58vw);
    font-size: clamp(96px, 28vw, 170px);
  }

  .naming-page .option {
    min-height: 56px;
  }

  .keypad-split-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 0.42fr) minmax(0, 0.58fr);
    gap: 8px;
  }

  .keypad-question-panel,
  .keypad-panel {
    gap: 8px;
    padding: 6px;
  }

  .keypad-panel .keypad {
    width: min(430px, 100%);
    height: min(100%, 350px);
    grid-template-columns: repeat(3, minmax(54px, 1fr));
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .keypad-split-page {
    gap: 10px;
  }

  .keypad-question-panel,
  .keypad-panel {
    gap: 8px;
    padding: 4px;
  }

  .keypad-panel .keypad {
    height: min(100%, 300px);
    grid-template-columns: repeat(3, minmax(48px, 1fr));
    gap: 8px;
  }

  .naming-page .animal-emoji {
    width: min(100%, 280px, 58vmin);
    font-size: clamp(112px, 24vw, 220px);
  }
}

.birth-date-field .birth-date-unit-field select {
  font-size: clamp(30px, 3.4vw, 38px);
  font-weight: 1000;
}

.birth-date-field .birth-date-unit-field > span {
  font-size: clamp(24px, 2.6vw, 32px);
}

@media (orientation: portrait), (max-width: 760px) {
  .birth-date-field .birth-date-unit-field select {
    padding-inline: 8px 26px;
    font-size: clamp(26px, 7vw, 32px);
  }

  .birth-date-field .birth-date-unit-field > span {
    font-size: clamp(21px, 5.6vw, 27px);
  }
}

.education-field .edu-segment-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hearing-start-button {
  min-width: clamp(260px, 28vw, 360px);
  min-height: clamp(86px, 11dvh, 112px);
  box-shadow:
    0 8px 0 var(--leaf-dark),
    0 18px 34px rgba(34, 169, 107, 0.22);
}

.hearing-recheck-button {
  min-width: clamp(128px, 14vw, 170px);
  min-height: clamp(46px, 6dvh, 58px);
  padding-inline: 18px;
  border: 2px solid #d9e6de;
  background: #f6faf8;
  color: var(--muted);
  box-shadow: 0 3px 0 #cddbd2;
  font-size: clamp(17px, 2vw, 22px);
}

.keypad-split-page {
  gap: clamp(10px, 2vw, 24px);
  padding: clamp(12px, 2dvh, 22px);
}

.keypad-question-panel,
.keypad-panel {
  align-content: stretch;
  place-items: center;
}

.keypad-panel .keypad {
  width: min(100%, 520px);
  height: 100%;
  max-height: 520px;
  grid-auto-rows: minmax(0, 1fr);
  align-self: stretch;
}

.keypad-panel .keypad button,
.keypad-panel .keypad-spacer {
  min-height: 0;
}

.digit-question-panel {
  align-content: center;
}

.digit-mode-label {
  color: var(--ink);
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 1000;
  line-height: 1;
}

.answer-square-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 16px);
  width: 100%;
}

.answer-square {
  display: grid;
  width: clamp(76px, 9.5vmin, 112px);
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--leaf-dark);
  box-shadow: 0 4px 0 #cddbd2;
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 1000;
  line-height: 1;
}

.answer-square.empty {
  color: transparent;
}

.digit-answer-squares .answer-square {
  width: clamp(70px, 8.4vmin, 104px);
  height: auto;
}

.serial-page .math-question {
  max-width: min(560px, 96%);
  font-size: clamp(38px, 5.2vw, 66px);
  line-height: 1.12;
  text-align: center;
}

.serial-page .serial-display {
  width: clamp(190px, 22vmin, 270px);
  height: clamp(112px, 16vmin, 170px);
  font-size: clamp(48px, 7vw, 78px);
}

.date-input-with-units {
  width: auto;
  grid-template-columns: auto auto auto auto;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 16px);
}

.date-input-with-units .date-input-box {
  width: clamp(86px, 11vmin, 118px);
  min-height: 0;
  aspect-ratio: 1;
}

.date-input-with-units .date-input-box strong {
  font-size: clamp(38px, 6vw, 58px);
}

.abstraction-split-page {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: clamp(18px, 3vw, 36px);
  overflow: hidden;
}

.abstraction-visual-panel,
.abstraction-choice-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-content: center;
  justify-items: center;
}

.abstraction-split-page .word-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
  width: min(100%, 560px);
}

.abstraction-split-page .word-card {
  min-width: 0;
  min-height: clamp(180px, 34dvh, 280px);
}

.abstraction-split-page .word-card span {
  font-size: clamp(62px, 11vw, 112px);
}

.abstraction-split-page .word-card strong {
  font-size: clamp(34px, 5vw, 58px);
}

.abstraction-choice-panel .abstraction-options {
  width: min(520px, 100%);
  height: min(100%, 460px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.abstraction-choice-panel .option {
  min-height: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.orientation-choice-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: clamp(16px, 3vw, 34px);
  overflow: hidden;
}

.orientation-choice-question-panel,
.orientation-choice-option-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-content: center;
  justify-items: center;
  gap: clamp(14px, 2.4dvh, 24px);
}

.weekday-answer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 20px);
  color: var(--ink);
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 1000;
}

.orientation-answer-square {
  width: clamp(82px, 11vmin, 118px);
}

.orientation-answer-box {
  display: grid;
  width: min(520px, 92%);
  min-height: clamp(94px, 14dvh, 138px);
  place-items: center;
  padding: 14px 18px;
  border: 3px solid var(--line);
  border-left: 7px solid var(--leaf);
  border-radius: 10px;
  background: #fff;
  color: var(--leaf-dark);
  box-shadow: 0 4px 0 #cddbd2;
  font-size: clamp(30px, 4.2vw, 52px);
  font-weight: 1000;
  line-height: 1.15;
  text-align: center;
}

.orientation-answer-box.empty {
  color: transparent;
}

.orientation-choice-option-panel .orientation-options {
  width: min(520px, 100%);
}

.orientation-weekday-options {
  grid-template-columns: repeat(3, minmax(0, clamp(82px, 11vmin, 118px)));
  justify-content: center;
  gap: clamp(10px, 1.8vw, 16px);
}

.orientation-weekday-options .option {
  width: clamp(82px, 11vmin, 118px);
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  font-size: clamp(34px, 5vw, 54px);
}

.orientation-weekday-options .option:nth-child(7) {
  grid-column: 2;
}

.orientation-text-options {
  height: min(100%, 430px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.orientation-text-options .option {
  min-height: 0;
  font-size: clamp(22px, 2.6vw, 30px);
}

@media (orientation: portrait), (max-width: 760px) {
  .keypad-split-page,
  .abstraction-split-page,
  .orientation-choice-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 0.42fr) minmax(0, 0.58fr);
    gap: 8px;
    padding: 8px;
  }

  .answer-square,
  .digit-answer-squares .answer-square,
  .orientation-answer-square,
  .orientation-weekday-options .option {
    width: clamp(54px, 14vw, 78px);
    font-size: clamp(28px, 7vw, 42px);
  }

  .answer-square-row {
    gap: 7px;
  }

  .serial-page .serial-display {
    width: clamp(150px, 38vw, 210px);
    height: clamp(88px, 22vw, 124px);
  }

  .date-input-with-units .date-input-box {
    width: clamp(68px, 18vw, 88px);
  }

  .abstraction-split-page .word-card {
    min-height: clamp(104px, 20dvh, 150px);
  }

  .orientation-weekday-options {
    grid-template-columns: repeat(3, minmax(0, clamp(54px, 14vw, 78px)));
  }
}

/* Keep every numeric keypad on the same footprint as serial subtraction. */
.digit-page.ready.keypad-split-page,
.serial-page.keypad-split-page,
.orientation-number-page.keypad-split-page {
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
}

.keypad-panel {
  overflow: hidden;
}

.keypad-panel .digit-keypad,
.keypad-panel .serial-keypad,
.keypad-panel .orientation-keypad {
  width: min(100%, 520px);
  height: min(100%, 520px);
  max-width: 520px;
  max-height: 520px;
  align-self: stretch;
  justify-self: center;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(10px, 1.6vw, 16px);
}

.keypad-panel .digit-keypad button,
.keypad-panel .serial-keypad button,
.keypad-panel .orientation-keypad button,
.keypad-panel .digit-keypad .keypad-spacer,
.keypad-panel .serial-keypad .keypad-spacer,
.keypad-panel .orientation-keypad .keypad-spacer {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
}

.keypad-panel .digit-keypad button,
.keypad-panel .serial-keypad button,
.keypad-panel .orientation-keypad button {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
}

@media (orientation: portrait), (max-width: 760px) {
  .digit-page.ready.keypad-split-page,
  .serial-page.keypad-split-page,
  .orientation-number-page.keypad-split-page {
    grid-template-rows: minmax(0, 0.42fr) minmax(0, 0.58fr);
  }

  .keypad-panel .digit-keypad,
  .keypad-panel .serial-keypad,
  .keypad-panel .orientation-keypad {
    width: min(100%, 430px);
    height: min(100%, 360px);
    max-height: 360px;
    gap: clamp(8px, 2vw, 12px);
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .keypad-panel .digit-keypad,
  .keypad-panel .serial-keypad,
  .keypad-panel .orientation-keypad {
    width: min(100%, 430px);
    height: min(100%, 300px);
    max-height: 300px;
    gap: 8px;
  }
}

.drawer-panel {
  align-items: stretch;
}

.drawer-task-list {
  width: 100%;
  padding-right: 0;
}

.drawer-item,
.drawer-hearing-link,
.drawer-section-toggle,
.drawer-task {
  box-sizing: border-box;
  width: 100%;
}

.setup-skip-login {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 4;
  min-height: 32px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: rgba(87, 98, 110, 0.72);
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 750;
  line-height: 1;
  box-shadow: none;
}

.setup-skip-login:hover {
  color: rgba(49, 60, 72, 0.9);
  text-decoration: underline;
}

.digit-question-panel {
  grid-template-rows: minmax(72px, auto) minmax(112px, auto);
}

.digit-answer-squares {
  min-height: clamp(86px, 10vmin, 122px);
}

.answer-square.active {
  border-color: var(--leaf);
  background: #effbf4;
  box-shadow:
    0 4px 0 #97cdae,
    0 0 0 6px rgba(34, 169, 107, 0.16);
}

.secondary.circle-button.sentence-retry-button {
  border: 4px solid var(--leaf);
  background: #fff;
  color: var(--leaf-dark);
  box-shadow: 0 6px 0 #9bcdae;
  animation: none;
}

.post-survey-actions .confirm-button {
  min-width: min(520px, 88vw);
  min-height: clamp(78px, 10dvh, 96px);
  padding-inline: clamp(26px, 5vw, 54px);
  font-size: clamp(28px, 4vw, 40px);
}

.nasa-slider-labels {
  font-size: clamp(30px, 3.2vw, 42px);
}

@media (orientation: portrait), (max-width: 760px) {
  .post-survey-actions .confirm-button {
    min-height: 72px;
    font-size: clamp(26px, 6vw, 34px);
  }

  .nasa-slider-labels {
    font-size: clamp(24px, 6vw, 34px);
  }
}

/* ═══════════════════════════════════════════
   2.5D CHARACTER COMPONENT — Cotton-candy breathing, natural blink, lip-sync
   ═══════════════════════════════════════════ */
.character-container {
  position: relative;
  /* Base image: 304×375, keep natural ratio */
  width: min(280px, 38vw);
  aspect-ratio: 304 / 375;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

/* Base body image */
.character-base {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Eye layer — 98×45 on 304×375 base */
.character-eyes {
  position: absolute;
  top: 23.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  opacity: 1;
  transition: opacity 0.06s ease;
  pointer-events: none;
}

.character-eyes img {
  display: block;
  width: 100%;
  height: auto;
}

/* Mouth layer — 42×14 on 304×375 base */
.character-mouth {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  width: 15%;
  opacity: 1;
  transition: opacity 0.06s ease;
  pointer-events: none;
}

.character-mouth img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Character + Dialog Layout (character left, dialog right) ── */
.character-dialog-screen {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(8px, 1.2vw, 18px);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  padding: clamp(12px, 2dvh, 24px) clamp(4px, 0.8vw, 10px) clamp(12px, 2dvh, 24px) clamp(4px, 0.8vw, 8px);
}

.character-side {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  width: min(170px, 20vw);
  padding-left: 0;
}

/* Speech bubble dialog on the right */
.character-dialog-bubble {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #fff;
  border: 3px solid #d8e5dc;
  border-radius: 24px;
  padding: clamp(16px, 2.5dvh, 24px) clamp(16px, 2.5vw, 28px);
  box-shadow: 0 8px 0 #c5d5c9, 0 12px 28px rgba(26,46,63,0.10);
}

/* Speech bubble tail pointing left to character */
.character-dialog-bubble::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 80px;
  width: 0; height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-right: 18px solid #d8e5dc;
}

.character-dialog-bubble::after {
  content: "";
  position: absolute;
  left: -13px;
  top: 84px;
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 14px solid #fff;
}

.character-dialog-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 950;
  color: #1a2e3f;
  margin: 0 0 8px;
  line-height: 1.3;
}

.character-dialog-text {
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 750;
  color: #4a5b6a;
  line-height: 1.55;
  margin: 0 0 20px;
}

.character-dialog-btn {
  min-width: 180px;
  min-height: 52px;
  padding: 12px 36px;
  border: 3px solid #22a96b;
  border-radius: 999px;
  background: linear-gradient(135deg, #22a96b, #1a8a53);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 6px 0 #127a49, 0 8px 20px rgba(34,169,107,0.25);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.character-dialog-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #127a49, 0 12px 28px rgba(34,169,107,0.32);
}

.task-guide-actions--center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: auto;
  max-width: 100%;
}

.character-dialog-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #127a49, 0 4px 10px rgba(34,169,107,0.15);
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 640px) {
  .character-dialog-screen {
    flex-direction: column;
    justify-content: center;
  }
  .character-side {
    width: min(150px, 42vw);
  }
  .character-dialog-bubble::before,
  .character-dialog-bubble::after {
    left: 50%;
    top: -16px;
    transform: translateX(-50%) rotate(90deg);
  }
}
