:root {
  --ink: #24313f;
  --muted: #64727f;
  --paper: #fffaf1;
  --surface: #ffffff;
  --line: #e3dacd;
  --teal: #177e89;
  --gold: #f4b942;
  --rose: #c94f5d;
  --green: #5c8d3b;
  --go: #2f9e57;
  --blue: #2f6fb0;
  --shadow: 0 16px 38px rgba(36, 49, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, rgba(244, 185, 66, 0.16), transparent 36%),
    linear-gradient(240deg, rgba(23, 126, 137, 0.12), transparent 42%),
    #f7f0e4;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.topbar {
  min-height: 180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: center;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.94), rgba(255, 255, 255, 0.86)),
    url("data:image/svg+xml,%3Csvg width='220' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='220' height='120' fill='%23fffaf1'/%3E%3Ccircle cx='42' cy='42' r='22' fill='%23f4b942' fill-opacity='.28'/%3E%3Crect x='118' y='40' width='58' height='50' rx='4' fill='%23c94f5d' fill-opacity='.22'/%3E%3Cpath d='M104 92h88' stroke='%23177e89' stroke-width='8' stroke-linecap='round' stroke-opacity='.22'/%3E%3C/svg%3E");
  box-shadow: var(--shadow);
}

.topbar h1,
.section-heading h2,
.record-card h3 {
  margin: 0;
}

.version-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

/* Exit button floats in the lower-right corner (only on the Review page,
   since it lives inside that view), in the tab teal. */
#start-new {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  padding: 0 22px;
  min-height: 48px;
  border-radius: 999px;
  border: 0;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(36, 49, 63, 0.3);
}

#start-new:hover {
  filter: brightness(1.06);
}

.topbar h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
}

.topbar p {
  max-width: 650px;
  color: var(--muted);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.student-name-card {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  min-height: 46px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.name-question > span {
  color: var(--ink);
  font-size: 1.28rem;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.name-record-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--rose);
  color: #fff;
  font-weight: 900;
}

.name-record-action.is-recording {
  background: var(--go);
}

.name-record-action.is-recorded {
  background: var(--blue);
}

.name-audio-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tabs button {
  padding: 0 6px;
  font-size: 0.92rem;
  line-height: 1.15;
  text-align: center;
}

.tabs button,
.primary-action,
.secondary-action,
.record-action,
.icon-record-action,
.listen-action,
.play-action,
.download-action {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
}

.tabs button {
  background: transparent;
  color: var(--muted);
}

.tabs button.is-active,
.primary-action {
  background: var(--teal);
  color: #fff;
}

.secondary-action {
  background: #fffaf1;
  border-color: #d8cfbf;
  color: var(--ink);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.section-heading {
  margin: 22px 0 16px;
  display: grid;
  gap: 6px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.read-first-heading {
  margin-top: 18px;
}

/* Bright, kid-friendly instruction callout so children notice it. */
.section-heading .kid-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff3d0;
  border: 2px solid var(--gold);
  color: var(--ink);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 900;
  line-height: 1.35;
}

.kid-tip-icon {
  font-size: 1.5em;
  line-height: 1;
  flex: 0 0 auto;
}

.tip-listen {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: #fff;
  color: var(--teal);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.tip-listen.is-speaking {
  background: var(--teal);
}

.theater-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

/* Green Room progress bar — a filling journey toward the end. */
.greenroom-progressbar {
  height: 14px;
  margin: 0 0 14px;
  border-radius: 999px;
  background: #e9e0d0;
  border: 1px solid var(--line);
  overflow: hidden;
}

#greenroom-progress-fill,
#questions-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  transition: width 0.35s ease;
}

/* ---------------------------------------------------------------
   Warm-Up Words page
---------------------------------------------------------------- */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.word-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffaf1;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.word-card.is-done {
  border-color: #86c58c;
  background: #f3fbf3;
}

.word-pic {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
}

.word-pic svg { width: 100%; height: 100%; display: block; }

.word-pic .wp-bg { fill: #fff5df; }
.word-pic-sticks .wp-bg { fill: #f0e6d8; }
.word-pic-bricks .wp-bg { fill: #f6e0d6; }
.word-pic-huff .wp-bg { fill: #e7f1f6; }
.word-pic-puff .wp-bg { fill: #e4eef6; }

/* straw */
.wp-straw { stroke: #d7a12a; }
.wp-band { fill: #9a6a2f; }
/* sticks */
.wp-stick { stroke: #7a4a25; }
.wp-stick-hi { stroke: #b07a45; }
/* bricks */
.wp-brick rect { fill: #c4553f; stroke: #f6e0d6; stroke-width: 2; }
/* faces / air */
.wp-face { fill: #f6d7a8; stroke: #cf9f5f; stroke-width: 2; }
.wp-brow { stroke: #7a5a2f; stroke-width: 3; stroke-linecap: round; fill: none; }
.wp-eye { fill: #3a2f22; }
.wp-mouth { fill: none; stroke: #7a5a2f; stroke-width: 3; stroke-linecap: round; }
.wp-air { fill: none; stroke: #8fb7cc; stroke-width: 3; stroke-linecap: round; }
.wp-cloud circle { fill: #ffffff; stroke: #b9d2e2; stroke-width: 2; }

.word-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.word-label {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ink);
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

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

.word-listen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--teal, #2f7d8a);
  background: #fffaf1;
  color: var(--teal, #2f7d8a);
  font-weight: 900;
  cursor: pointer;
}

.word-listen:hover { background: #eef7f8; }

.word-listen.is-speaking {
  background: var(--teal, #2f7d8a);
  color: #fff;
}

.word-record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--red, #c65b5b);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.word-record .wr-icon {
  font-size: 1.25em;
  line-height: 1;
}

.word-card.is-recording .word-record {
  background: var(--go);
  animation: word-pulse 1s ease-in-out infinite;
}

/* The button is disabled mid-take, but should still read as active. */
.word-record:disabled {
  opacity: 1;
  cursor: default;
}

/* Big emoji icon on record buttons — colour + shape for early readers.
   !important neutralises the old CSS-drawn mic/dot so only the emoji shows. */
.rec-ico {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 1.3em;
  line-height: 1;
}

.rec-ico::before,
.rec-ico::after {
  display: none !important;
  content: none !important;
}

.icon-record-action,
.name-record-action {
  font-size: 1rem;
}

.word-card.is-done .word-record {
  background: var(--blue);
}

@keyframes word-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 87, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(47, 158, 87, 0); }
}

.word-status {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted);
  min-height: 1.1em;
}

.word-card.is-done .word-status { color: #2f7a3a; }

/* little star burst on success */
.word-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.word-stars span {
  position: absolute;
  left: 42px;
  top: 42px;
  font-size: 20px;
  animation: word-star 0.9s ease-out forwards;
}

@keyframes word-star {
  0% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(1.1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .word-card.is-recording .word-record { animation: none; }
  .word-stars span { animation-duration: 0.01s; }
}

.read-first-heading p {
  color: var(--ink);
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  font-weight: 900;
}

.practice-heading h2 {
  color: var(--ink);
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  font-weight: 900;
}

.recording-grid {
  display: grid;
  gap: 14px;
}

.simple-greenroom {
  position: relative;
  min-height: 420px;
  display: grid;
  align-items: end;
  overflow: hidden;
  padding: 92px 18px 28px;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(180deg, rgba(37, 49, 61, 0.15), rgba(37, 49, 61, 0.4)),
    linear-gradient(180deg, #7bc5d0 0%, #ddf2df 42%, #9f5b3e 43%, #6d3b2c 100%);
  box-shadow: var(--shadow);
}

.simple-greenroom::before,
.simple-greenroom::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 13%;
  background: repeating-linear-gradient(90deg, #9f2f42 0 18px, #c64f5d 18px 36px);
}

.simple-greenroom::before {
  left: 0;
}

.simple-greenroom::after {
  right: 0;
}

.greenroom-scenery {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 31%, rgba(92, 141, 59, 0.75) 0 36px, transparent 37px),
    radial-gradient(circle at 76% 29%, rgba(92, 141, 59, 0.7) 0 44px, transparent 45px),
    linear-gradient(180deg, transparent 0 42%, rgba(99, 145, 75, 0.62) 42% 57%, rgba(116, 83, 54, 0.28) 57% 100%);
}

.greenroom-scenery::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 178px;
  height: 28px;
  border-radius: 50%;
  background: rgba(36, 49, 63, 0.18);
  filter: blur(3px);
}

.greenroom-spotlight {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -40px;
  width: min(620px, 72%);
  height: 76%;
  transform: translateX(-50%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  background: rgba(255, 250, 214, 0.52);
  pointer-events: none;
}

.greenroom-scenery .pig-house {
  position: absolute;
  top: 70px;
  width: 150px;
  height: 116px;
  border-radius: 6px 6px 3px 3px;
  border: 2px solid rgba(55, 43, 31, 0.24);
  box-shadow:
    inset -22px 0 28px rgba(36, 49, 63, 0.18),
    inset 12px 0 18px rgba(255, 250, 241, 0.16),
    0 16px 0 rgba(36, 49, 63, 0.1),
    0 24px 34px rgba(36, 49, 63, 0.2);
}

.greenroom-scenery .pig-house::before {
  content: "";
  position: absolute;
  left: -14px;
  right: -14px;
  top: -66px;
  height: 76px;
  transform: none;
  border-radius: 10px 10px 3px 3px;
  clip-path: polygon(50% 0, 100% 76%, 94% 100%, 6% 100%, 0 76%);
  border: 0;
  box-shadow:
    inset -22px -10px 20px rgba(36, 49, 63, 0.22),
    inset 18px 10px 18px rgba(255, 250, 241, 0.18),
    0 7px 12px rgba(36, 49, 63, 0.16);
}

.greenroom-scenery .pig-house::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -13px;
  height: 14px;
  transform: none;
  border-radius: 50%;
  background: rgba(36, 49, 63, 0.22);
  border: 0;
  filter: blur(2px);
}

.greenroom-scenery .house-window {
  position: absolute;
  right: 18px;
  top: 28px;
  width: 27px;
  height: 25px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(36, 49, 63, 0.18) 46% 54%, transparent 54%),
    linear-gradient(180deg, transparent 46%, rgba(36, 49, 63, 0.18) 46% 54%, transparent 54%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(181, 218, 232, 0.74));
  border: 3px solid rgba(70, 49, 32, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 241, 0.28), 0 4px 6px rgba(36, 49, 63, 0.12);
}

.greenroom-scenery .house-door {
  position: absolute;
  left: 24px;
  bottom: 0;
  width: 36px;
  height: 58px;
  display: block;
  border-radius: 10px 10px 2px 2px;
  background:
    radial-gradient(circle at 72% 52%, #f4d27c 0 3px, transparent 4px),
    linear-gradient(90deg, rgba(255, 250, 241, 0.14), transparent 28%),
    #5f3b27;
  border: 3px solid rgba(36, 49, 63, 0.18);
  box-shadow: inset -8px 0 0 rgba(36, 49, 63, 0.16);
}

.greenroom-scenery .house-chimney {
  position: absolute;
  right: 28px;
  top: -62px;
  width: 20px;
  height: 38px;
  border-radius: 4px 4px 0 0;
  background: #6c4a32;
  border: 3px solid rgba(36, 49, 63, 0.16);
  z-index: -1;
}

.greenroom-scenery .straw-house {
  left: 13%;
  top: 74px;
  background:
    repeating-linear-gradient(105deg, rgba(107, 69, 18, 0.44) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(82deg, rgba(127, 86, 22, 0.28) 0 3px, transparent 3px 10px),
    radial-gradient(circle at 22% 30%, rgba(255, 246, 174, 0.44) 0 12px, transparent 13px),
    linear-gradient(90deg, #d49c2f, #f9df83 50%, #c78924);
  transform: perspective(500px) rotateY(5deg) rotate(-2deg);
}

.greenroom-scenery .straw-house::before {
  background:
    repeating-linear-gradient(104deg, #8e5d18 0 2px, #f7db74 2px 8px, #c99128 8px 12px),
    linear-gradient(180deg, rgba(255, 250, 241, 0.22), transparent);
}

.greenroom-scenery .stick-house {
  left: 50%;
  top: 70px;
  width: 158px;
  height: 124px;
  transform: translateX(-50%) perspective(500px) rotateY(-2deg) rotate(1deg);
  background:
    repeating-linear-gradient(92deg, #4f3121 0 5px, #a0693f 5px 15px, #70452c 15px 23px),
    radial-gradient(circle at 64% 22%, rgba(255, 235, 190, 0.22) 0 13px, transparent 14px),
    linear-gradient(90deg, #6e442a, #b87844 50%, #59341f);
}

.greenroom-scenery .stick-house::before {
  background:
    repeating-linear-gradient(86deg, #3f281b 0 5px, #9a643e 5px 15px, #6b432a 15px 22px);
}

.greenroom-scenery .brick-house {
  right: 12%;
  top: 70px;
  width: 166px;
  height: 132px;
  background:
    linear-gradient(90deg, rgba(255, 240, 225, 0.48) 2px, transparent 2px),
    linear-gradient(rgba(255, 240, 225, 0.48) 2px, transparent 2px),
    linear-gradient(90deg, transparent 0 14px, rgba(83, 34, 26, 0.25) 14px 17px, transparent 17px 28px),
    radial-gradient(circle at 30% 24%, rgba(255, 206, 180, 0.38) 0 14px, transparent 15px),
    linear-gradient(90deg, #9d392f, #d76a4b 52%, #8b3029);
  background-size: 28px 21px;
  transform: perspective(500px) rotateY(-5deg) rotate(2deg);
}

.greenroom-scenery .brick-house::before {
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.28) 2px, transparent 2px),
    linear-gradient(rgba(255, 250, 241, 0.28) 2px, transparent 2px),
    linear-gradient(90deg, #7f2c27, #b54a39 54%, #6f2722);
  background-size: 26px 19px;
}

.script-line-list {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 12px;
  width: min(860px, 100%);
  margin: 0 auto;
}

.script-line-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: 0 14px 30px rgba(36, 49, 63, 0.16);
}

.script-line-card.is-complete {
  border-color: rgba(92, 141, 59, 0.44);
  background: #f7fbf2;
}

/* Quick per-line praise pop (light — the big celebration is at Finish). */
.line-praise {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  padding: 6px 14px;
  border-radius: 999px;
  background: #eafaf0;
  border: 1px solid #86c58c;
  color: #2f7a3a;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(47, 122, 58, 0.18);
  animation: line-praise-pop 1.3s ease-out both;
}

@keyframes line-praise-pop {
  0% { transform: translateY(6px) scale(0.7); opacity: 0; }
  18% { transform: translateY(0) scale(1.1); opacity: 1; }
  75% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-10px) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .line-praise { animation-duration: 0.01s; }
}

.line-number {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #3e2a0b;
  font-weight: 900;
}

.line-stack {
  display: grid;
  gap: 8px;
}

.reader-line {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
}

.reader-line strong {
  color: var(--ink);
}

.student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.reader-line p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.45;
}

.reader-one-line {
  background: #eef7f8;
}

.student-line {
  background: #fff7e4;
}

.listen-action {
  padding: 0 14px;
  border-color: rgba(23, 126, 137, 0.28);
  background: var(--teal);
  color: #fff;
}

.icon-record-action {
  min-width: 104px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--rose);
  color: #fff;
}

.icon-record-action.is-recording {
  background: var(--go);
}

.icon-record-action.is-recorded {
  background: var(--blue);
}

.greenroom-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 0 0 8px 8px;
  background: #fffaf1;
  border: 1px solid var(--line);
  border-top: 0;
}

#greenroom-progress {
  min-width: 92px;
  text-align: center;
  color: var(--ink);
  font-weight: 900;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.passage-card {
  padding: 22px;
  border-radius: 8px;
  border: 1px solid rgba(23, 126, 137, 0.2);
  background: #fffdf8;
  box-shadow: 0 12px 26px rgba(36, 49, 63, 0.08);
}

.passage-card h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.passage-card p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.7;
}

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

.story-reader {
  position: relative;
  display: block;
  min-height: 560px;
  padding: 322px 28px 34px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(36, 49, 63, 0.12);
  background:
    linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 250, 241, 0.14)),
    #9fd4e0;
  box-shadow: var(--shadow);
}

.storybook-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  border: 0;
  background:
    linear-gradient(180deg, #b7dfe7 0 42%, #7fac65 42% 100%);
  box-shadow: none;
}

.storybook-scene .sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 45%),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(255, 255, 255, 0.16) 78px 80px);
}

.house {
  position: absolute;
  width: 132px;
  height: 105px;
  border-radius: 6px;
  border: 2px solid rgba(36, 49, 63, 0.2);
  box-shadow: 0 20px 22px rgba(36, 49, 63, 0.17);
}

.house::before {
  content: "";
  position: absolute;
  left: -13px;
  right: -13px;
  top: -55px;
  height: 62px;
  clip-path: polygon(50% 0, 100% 80%, 92% 100%, 8% 100%, 0 80%);
  border-radius: 8px 8px 2px 2px;
  box-shadow: inset -12px -8px rgba(36, 49, 63, 0.16);
}

.house::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 0;
  width: 34px;
  height: 52px;
  border-radius: 9px 9px 2px 2px;
  background:
    radial-gradient(circle at 75% 48%, #f4d27c 0 3px, transparent 4px),
    #5d3b28;
}

.house span {
  position: absolute;
  right: 10px;
  top: 24px;
  width: 62px;
  height: 36px;
  overflow: hidden;
  border-radius: 7px;
  border: 3px solid rgba(70, 49, 32, 0.3);
  background:
    linear-gradient(90deg, transparent 46%, rgba(36, 49, 63, 0.18) 46% 54%, transparent 54%),
    linear-gradient(180deg, transparent 46%, rgba(36, 49, 63, 0.18) 46% 54%, transparent 54%),
    #d8f0f3;
}

.house span::before {
  content: "";
  position: absolute;
  left: 7px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 45% 45%;
  background:
    radial-gradient(circle at 34% 38%, #3b2a31 0 1.5px, transparent 2px),
    radial-gradient(circle at 66% 38%, #3b2a31 0 1.5px, transparent 2px),
    radial-gradient(ellipse at 50% 62%, #e98294 0 5px, transparent 6px),
    #f5a9b7;
  box-shadow:
    19px 0 #f5a9b7,
    38px 0 #f5a9b7;
}

.straw-house span {
  right: 18px;
  top: 34px;
  width: 94px;
  height: 52px;
  border-width: 4px;
}

.straw-house span::before {
  left: 10px;
  bottom: -1px;
  width: 74px;
  height: 28px;
  border-radius: 0;
  background:
    radial-gradient(circle at 8px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(circle at 17px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(ellipse at 13px 18px, #e98294 0 6px, transparent 7px),
    radial-gradient(circle at 13px 14px, #f5a9b7 0 13px, transparent 14px),
    radial-gradient(circle at 36px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(circle at 45px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(ellipse at 41px 18px, #e98294 0 6px, transparent 7px),
    radial-gradient(circle at 41px 14px, #f5a9b7 0 13px, transparent 14px),
    radial-gradient(circle at 64px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(circle at 73px 10px, #3b2a31 0 2px, transparent 2.5px),
    radial-gradient(ellipse at 69px 18px, #e98294 0 6px, transparent 7px),
    radial-gradient(circle at 69px 14px, #f5a9b7 0 13px, transparent 14px);
  box-shadow: none;
}

.straw-house span::after {
  left: 10px;
  bottom: 22px;
  width: 7px;
  height: 11px;
  filter: drop-shadow(8px 0 #f09bab) drop-shadow(28px 0 #f09bab) drop-shadow(36px 0 #f09bab) drop-shadow(56px 0 #f09bab) drop-shadow(64px 0 #f09bab);
}

.house span::after {
  content: "";
  position: absolute;
  left: 10px;
  bottom: 12px;
  width: 5px;
  height: 8px;
  background: #f09bab;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(6px 0 #f09bab) drop-shadow(19px 0 #f09bab) drop-shadow(25px 0 #f09bab) drop-shadow(38px 0 #f09bab) drop-shadow(44px 0 #f09bab);
}

.stick-house span,
.brick-house span {
  width: 50px;
}

.stick-house span::before,
.stick-house span::after,
.brick-house span::before,
.brick-house span::after {
  display: none;
}

.straw-house {
  left: 2%;
  top: 164px;
  width: 174px;
  height: 136px;
  transform: rotate(-3deg);
  background:
    repeating-linear-gradient(102deg, #8e5d18 0 2px, #f7db74 2px 8px, #c99128 8px 12px),
    #f4c85f;
}

.straw-house::before {
  background:
    repeating-linear-gradient(105deg, #8e5d18 0 2px, #f7db74 2px 8px, #c99128 8px 12px);
}

.stick-house {
  left: 62%;
  top: 52px;
  transform: scale(0.58) rotate(2deg);
  background:
    repeating-linear-gradient(92deg, #4f3121 0 5px, #a0693f 5px 15px, #70452c 15px 23px),
    #8c5b36;
}

.stick-house::before {
  background:
    repeating-linear-gradient(86deg, #3f281b 0 5px, #9a643e 5px 15px, #6b432a 15px 22px);
}

.brick-house {
  right: -10%;
  top: 46px;
  width: 148px;
  height: 116px;
  transform: scale(0.62);
  background:
    linear-gradient(90deg, rgba(255, 240, 225, 0.48) 2px, transparent 2px),
    linear-gradient(rgba(255, 240, 225, 0.48) 2px, transparent 2px),
    linear-gradient(90deg, #9d392f, #d76a4b 52%, #8b3029);
  background-size: 28px 21px;
}

.brick-house::before {
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.28) 2px, transparent 2px),
    linear-gradient(rgba(255, 250, 241, 0.28) 2px, transparent 2px),
    linear-gradient(90deg, #7f2c27, #b54a39 54%, #6f2722);
  background-size: 26px 19px;
}

.wolf-illustration {
  position: absolute;
  left: 61%;
  top: 184px;
  width: 130px;
  height: auto;
  transform: scaleX(-1);
  filter: drop-shadow(0 15px 15px rgba(36, 49, 63, 0.22));
}

.wolf-body-shape,
.wolf-head-shape,
.wolf-ear {
  fill: #9d8b65;
  stroke: #4f432f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.wolf-tail-shape {
  fill: #a9956b;
  stroke: #4f432f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.wolf-back-fur,
.wolf-hair {
  fill: none;
  stroke: #4f432f;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wolf-ribs {
  fill: none;
  stroke: rgba(74, 60, 40, 0.36);
  stroke-width: 4;
  stroke-linecap: round;
}

.wolf-arm-left,
.wolf-arm-right,
.wolf-leg {
  fill: none;
  stroke: #69583c;
  stroke-width: 9;
  stroke-linecap: round;
}

.wolf-hand,
.wolf-paw {
  fill: #8f7d58;
  stroke: #4f432f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.wolf-snout {
  fill: #b6a47a;
  stroke: #4f432f;
  stroke-width: 3;
  stroke-linejoin: round;
}

.wolf-ear-inner {
  fill: #d3a68d;
  stroke: #4f432f;
  stroke-width: 2;
  stroke-linejoin: round;
}

.wolf-nose {
  fill: #2f2d32;
}

.wolf-eye-white {
  fill: #fffaf1;
  stroke: #4f432f;
  stroke-width: 2;
}

.wolf-eye {
  fill: #121a20;
}

.wolf-brow,
.wolf-whiskers,
.wolf-mouth-line,
.wolf-belly,
.breath-line {
  fill: none;
  stroke: #4f432f;
  stroke-width: 3;
  stroke-linecap: round;
}

.wolf-belly {
  stroke-width: 4;
}

.breath-line {
  stroke: #6a7480;
  stroke-width: 2;
}

.breath-cloud circle {
  fill: #f7fafb;
  stroke: #7e8790;
  stroke-width: 3;
}

/* ---------------------------------------------------------------
   Read First storybook composition
   Straw house (with three pigs) + wolf blowing right at it, then the
   stick and brick houses along the same ground line. All three houses
   are the same size. Scoped to .storybook-scene so the Green Room is
   untouched.
---------------------------------------------------------------- */

/* A stronger horizon so the ground reads clearly behind the houses */
.storybook-scene {
  background:
    linear-gradient(180deg, #bfe6ec 0 40%, #a7d3b0 40% 47%, #7fac65 47% 100%);
}

/* Soft clouds pinned high in the sky (vh-based so they stay near the
   top no matter how tall the scene grows with the story text). */
.storybook-scene .sky::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 150px;
  background:
    radial-gradient(22px 14px at 16% 46%, rgba(255, 255, 255, 0.9) 0 60%, transparent 62%),
    radial-gradient(30px 18px at 22% 60%, rgba(255, 255, 255, 0.9) 0 60%, transparent 62%),
    radial-gradient(26px 15px at 70% 34%, rgba(255, 255, 255, 0.8) 0 60%, transparent 62%),
    radial-gradient(20px 12px at 76% 46%, rgba(255, 255, 255, 0.8) 0 60%, transparent 62%);
}

/* All three houses share one size and one ground line, so they read
   as a matched row. Small rotations keep the storybook feel. */
.storybook-scene .straw-house,
.storybook-scene .stick-house,
.storybook-scene .brick-house {
  width: 188px;
  height: 150px;
  top: 150px;
  transform-origin: bottom center;
  z-index: 2;
  box-shadow: 0 18px 20px rgba(36, 49, 63, 0.18);
}

.storybook-scene .straw-house {
  left: 24px;
  transform: rotate(-2deg);
  z-index: 3;
}

/* The three little pigs peek from a centred window. */
.storybook-scene .straw-house span {
  left: 42px;
  right: auto;
  top: 44px;
  width: 104px;
  height: 58px;
  border-width: 4px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  padding: 6px 5px 0;
  box-sizing: border-box;
  overflow: hidden;
  background: linear-gradient(180deg, #eaf7f9, #cfeaef);
}

/* Retire the old flat gradient faces in favour of the SVG pigs. */
.storybook-scene .straw-house span::before,
.storybook-scene .straw-house span::after {
  content: none;
  display: none;
}

.storybook-scene .win-pig {
  width: 29px;
  height: auto;
  flex: 0 0 auto;
  transform: translateY(11px) rotate(-4deg);
}

.storybook-scene .win-pig:nth-child(2) {
  width: 32px;
  transform: translateY(6px);
  position: relative;
  z-index: 1;
}

.storybook-scene .win-pig:last-child {
  transform: translateY(11px) rotate(4deg);
}

.storybook-scene .pig-head,
.storybook-scene .pig-ear {
  fill: #f3a7b7;
  stroke: #cf7d90;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.storybook-scene .pig-cheek {
  fill: #ee8ea2;
  opacity: 0.6;
}

.storybook-scene .pig-snout {
  fill: #ef94a6;
  stroke: #cf7d90;
  stroke-width: 1.4;
}

.storybook-scene .pig-nostril { fill: #a9536a; }
.storybook-scene .pig-eye { fill: #2f2733; }
.storybook-scene .pig-eye-hl { fill: #ffffff; }

/* Wolf: pushed right up against the straw house, blowing at it. */
.storybook-scene .wolf-illustration {
  left: 188px;
  top: 202px;
  width: 184px;
  z-index: 4;
  filter: drop-shadow(0 16px 14px rgba(36, 49, 63, 0.28));
}

/* Greyer, more wolf-like coat for a realistic read. */
.storybook-scene .wolf-body-shape,
.storybook-scene .wolf-head-shape,
.storybook-scene .wolf-ear {
  fill: #8d8a82;
  stroke: #3c382f;
}

.storybook-scene .wolf-tail-shape {
  fill: #9a968c;
  stroke: #3c382f;
}

/* No outline on the snout so the muzzle blends into the head instead of
   reading as a second "face". */
.storybook-scene .wolf-snout {
  fill: #9c9a93;
  stroke: none;
}

/* Lower jaw gives the muzzle a real chin; teeth + a clearer mouth line
   make the face read at a glance. */
.storybook-scene .wolf-jaw {
  fill: #8d8a82;
  stroke: #3c382f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.storybook-scene .wolf-teeth {
  fill: #fff8ec;
  stroke: #3c382f;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.storybook-scene .wolf-mouth-line {
  stroke: #2f2b25;
  stroke-width: 3.4;
}

.storybook-scene .wolf-eye-shine {
  fill: #ffffff;
}

.storybook-scene .wolf-hand,
.storybook-scene .wolf-paw {
  fill: #7d7a72;
  stroke: #3c382f;
}

.storybook-scene .wolf-arm-left,
.storybook-scene .wolf-arm-right,
.storybook-scene .wolf-leg {
  stroke: #5e5b52;
}

.storybook-scene .wolf-back-fur {
  stroke: #3c382f;
}

/* Effortful blowing: the whole wolf leans and pulses.
   transform-origin x is kept at 50% so scaleX(-1) does not translate
   the wolf sideways; the lean comes from a small rotation about the
   lower body. */
.storybook-scene .blowing-wolf {
  transform-origin: 50% 72%;
  animation: wolf-blow 1.8s ease-in-out infinite;
}

@keyframes wolf-blow {
  0%, 100% { transform: scaleX(-1) rotate(0deg); }
  50% { transform: scaleX(-1) rotate(-4deg) scale(1.025); }
}

/* Gust of wind streaming from the wolf's mouth into the straw house.
   Right edge sits at the wolf's muzzle (~x210); streaks travel left and
   fade as they hit the straw wall (which ends near x212), just clear of
   the window so the pigs stay visible. */
.storybook-scene .wolf-gust {
  position: absolute;
  left: 172px;
  top: 218px;
  width: 44px;
  height: 62px;
  z-index: 5;
  pointer-events: none;
}

.storybook-scene .wolf-gust span {
  position: absolute;
  right: 0;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92));
  animation: wolf-gust 1.8s linear infinite;
}

.storybook-scene .wolf-gust span:nth-child(1) { top: 6px;  width: 32px; animation-delay: 0s; }
.storybook-scene .wolf-gust span:nth-child(2) { top: 22px; width: 42px; animation-delay: 0.45s; }
.storybook-scene .wolf-gust span:nth-child(3) { top: 38px; width: 36px; animation-delay: 0.9s; }
.storybook-scene .wolf-gust span:nth-child(4) { top: 52px; width: 26px; animation-delay: 1.35s; }

@keyframes wolf-gust {
  0%   { transform: translateX(16px) scaleX(0.5); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateX(-30px) scaleX(1.15); opacity: 0; }
}

/* Real-looking textures: staggered brick courses, and rounded upright
   sticks — drawn as tiny tiling SVGs so they read clearly as brick/stick. */
:root {
  --brick-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='38'%3E%3Crect width='46' height='38' fill='%23e7d3c5'/%3E%3Cg fill='%23c25c44'%3E%3Crect x='1.5' y='2' width='43' height='14.5' rx='2'/%3E%3Crect x='1.5' y='21' width='20' height='14.5' rx='2'/%3E%3Crect x='24.5' y='21' width='20' height='14.5' rx='2'/%3E%3C/g%3E%3C/svg%3E");
  --stick-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='40'%3E%3Crect width='26' height='40' fill='%233f2817'/%3E%3Crect x='1' y='-3' width='10' height='46' rx='5' fill='%238a5732'/%3E%3Crect x='13' y='-3' width='10' height='46' rx='5' fill='%2374492a'/%3E%3Crect x='4.5' y='-3' width='2.4' height='46' rx='1.2' fill='%23a97a49'/%3E%3Crect x='16.5' y='-3' width='2.4' height='46' rx='1.2' fill='%238f5f38'/%3E%3C/svg%3E");
}

/* Stick and brick houses: same size as the straw house, set further
   along the same ground line. */
.storybook-scene .stick-house {
  left: 486px;
  right: auto;
  transform: rotate(1.5deg);
  background: var(--stick-tex) 0 0 / 24px 40px, #6b4326;
}

.storybook-scene .stick-house::before {
  background: var(--stick-tex) 0 0 / 19px 30px, #5a3821;
}

.storybook-scene .brick-house {
  left: 792px;
  right: auto;
  transform: rotate(-1.5deg);
  background: var(--brick-tex) 0 0 / 44px 36px, #c25c44;
}

.storybook-scene .brick-house::before {
  background: var(--brick-tex) 0 0 / 34px 28px, #b3543f;
}

/* Same real textures for the Green Room houses. */
.greenroom-scenery .stick-house {
  background: var(--stick-tex), #6b4326;
  background-size: 22px 38px, auto;
}

.greenroom-scenery .stick-house::before {
  background: var(--stick-tex), #5a3821;
  background-size: 18px 30px, auto;
}

.greenroom-scenery .brick-house {
  background: var(--brick-tex), #c25c44;
  background-size: 40px 34px, auto;
}

.greenroom-scenery .brick-house::before {
  background: var(--brick-tex), #b3543f;
  background-size: 34px 28px, auto;
}

@media (prefers-reduced-motion: reduce) {
  .storybook-scene .blowing-wolf,
  .storybook-scene .wolf-gust span {
    animation: none;
  }
  .storybook-scene .blowing-wolf { transform: scaleX(-1) rotate(4deg); }
  .storybook-scene .wolf-gust span { opacity: 0.85; }
}

.pig {
  position: absolute;
  width: 74px;
  height: 92px;
  border-radius: 48% 48% 42% 42%;
  background:
    radial-gradient(circle at 34% 22%, #3b2a31 0 3px, transparent 4px),
    radial-gradient(circle at 66% 22%, #3b2a31 0 3px, transparent 4px),
    radial-gradient(ellipse at 50% 35%, #e98294 0 15px, transparent 16px),
    linear-gradient(180deg, #f5a9b7 0 52px, var(--shirt, #57a8d8) 52px 100%);
  border: 2px solid rgba(99, 49, 55, 0.18);
  box-shadow: 0 12px 16px rgba(36, 49, 63, 0.13);
}

.pig::before,
.pig::after {
  content: "";
  position: absolute;
  top: -13px;
  width: 26px;
  height: 28px;
  background: #f09bab;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.pig::before {
  left: 8px;
  transform: rotate(-18deg);
}

.pig::after {
  right: 8px;
  transform: rotate(18deg);
}

.pig span {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 26px;
  height: 15px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 50%, #8c4654 0 2px, transparent 3px),
    radial-gradient(circle at 65% 50%, #8c4654 0 2px, transparent 3px),
    #f7c0c9;
}

.pig-one {
  left: 4%;
  top: 300px;
  --shirt: #3f8fd2;
  transform: rotate(-4deg);
}

.pig-two {
  left: calc(50% - 46px);
  top: 300px;
  --shirt: #f1c84d;
  transform: rotate(2deg);
}

.pig-three {
  right: 4%;
  top: 300px;
  --shirt: #65a95c;
  transform: rotate(4deg);
}

.monologue-page {
  position: relative;
  z-index: 1;
  width: min(800px, 100%);
  margin: 0 auto;
  padding: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.monologue-page h3 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.grade-note {
  margin: 4px 0 18px;
  color: var(--muted);
  font-weight: 900;
}

#monologue-text {
  display: grid;
  gap: 13px;
}

#monologue-text p {
  margin: 0;
  font-size: clamp(1.08rem, 1.8vw, 1.28rem);
  line-height: 1.62;
}

.record-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(36, 49, 63, 0.07);
}

.record-card.is-complete {
  border-color: rgba(92, 141, 59, 0.42);
  background: #f7fbf2;
}

.record-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.record-topline span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef7f8;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.script-text {
  margin: 0;
  font-size: clamp(1.12rem, 2vw, 1.42rem);
  line-height: 1.55;
}

.script-text.is-short {
  color: var(--muted);
  font-size: 0.98rem;
}

.reader-one-panel {
  align-self: start;
  position: sticky;
  top: 86px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffaf1;
}

.reader-one-panel p {
  margin-top: 0;
}

.reader-one-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.38;
}

.duo-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.record-action {
  padding: 0 14px;
  background: var(--rose);
  color: #fff;
}

.record-action.is-recording {
  background: var(--go);
}

/* Review page: section headers + per-trial rows */
.review-group {
  margin: 20px 0 2px;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-group:first-child {
  margin-top: 4px;
}

.trial-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.trial-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fffaf1;
  border: 1px solid var(--line);
}

.trial-label {
  font-weight: 900;
  min-width: 60px;
  color: var(--ink);
}

.trial-row .status {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

/* Questions page */
.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffaf1;
  box-shadow: var(--shadow);
}

.question-card.is-complete {
  border-color: #86c58c;
  background: #f3fbf3;
}

.q-body {
  flex: 1 1 260px;
  min-width: 0;
}

.q-section {
  margin: 0 0 6px;
  color: var(--teal);
}

.q-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.q-body h3 {
  margin: 0;
  font-size: 1.15rem;
}

.q-sub {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  line-height: 1.4;
}

.q-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.play-action,
.download-action {
  padding: 0 14px;
  border-color: #d8cfbf;
  background: #fff;
  color: var(--ink);
}

.play-action:disabled,
.download-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.status {
  color: var(--muted);
  font-weight: 800;
}

.bottom-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.summary-strip article,
.download-panel {
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.summary-strip strong {
  display: block;
  font-size: 1.7rem;
}

.summary-strip span,
.download-panel p {
  color: var(--muted);
}

.download-panel {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.confetti-layer span {
  position: absolute;
  left: var(--x);
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  background: hsl(calc(var(--i) * 37), 78%, 58%);
  animation: confetti-fall var(--d) ease-out var(--delay, 0s) forwards;
  transform: rotate(calc(var(--i) * 21deg));
}

.confetti-layer span:nth-child(3n) {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.confetti-layer span:nth-child(4n) {
  width: 8px;
  height: 18px;
}

.confetti-message {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  padding: 16px 24px;
  border-radius: 8px;
  background: #fffaf1;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 900;
  animation: confetti-pop 0.5s ease-out both;
}

@keyframes confetti-pop {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0; }
  60% { transform: translateX(-50%) scale(1.08); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .topbar,
  .duo-layout,
  .trial-record-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .story-reader {
    padding: 322px 16px 24px;
  }

  .storybook-scene {
    position: absolute;
    inset: 0;
    min-height: 0;
  }

  .reader-one-panel {
    position: static;
  }

  .reader-line {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .simple-greenroom {
    min-height: 460px;
    padding-top: 118px;
  }

  .greenroom-scenery .pig-house {
    transform: scale(0.78);
  }

  .greenroom-scenery .straw-house {
    left: 3%;
  }

  .greenroom-scenery .stick-house {
    left: 50%;
    transform: translateX(-50%) scale(0.78);
  }

  .greenroom-scenery .brick-house {
    right: 3%;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    padding: 20px;
  }

  .tabs {
    gap: 4px;
    padding: 6px;
  }

  .tabs button {
    padding: 0 3px;
    font-size: 0.72rem;
  }

  .record-topline,
  .name-row,
  .line-actions,
  .download-panel,
  .bottom-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .name-row {
    display: flex;
  }

  .simple-greenroom {
    min-height: 500px;
    padding: 142px 12px 20px;
  }

  .simple-greenroom::before,
  .simple-greenroom::after {
    width: 7%;
  }

  .greenroom-scenery .pig-house {
    transform: scale(0.58);
  }

  .greenroom-scenery .straw-house {
    left: -6%;
  }

  .greenroom-scenery .stick-house {
    transform: translateX(-50%) scale(0.58);
  }

  .greenroom-scenery .brick-house {
    right: -6%;
  }

  .greenroom-nav {
    flex-wrap: wrap;
  }
}
