/* These surfaces remain light even inside the green review container. */
.review-area.lab-active { display: block; scroll-margin-top: 90px; }
.lab-shell { width: min(100%, 650px); margin: auto; color: #fffefa; text-align: left; }
.lab-shell *, .lab-shell *::before, .lab-shell *::after { box-sizing: border-box; }
.lab-heading { display: grid; gap: 7px; margin-bottom: 20px; }
.lab-heading h2 { margin: 0; color: #fffefa; font-size: clamp(23px, 4.5vw, 30px); line-height: 1.2; text-wrap: balance; }
.lab-heading h2:focus { outline: 0; }
.lab-eyebrow { color: #f3dbaf; font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.lab-panel { margin: 14px 0; padding: 20px; border: 1px solid #e4e0d8; border-radius: 18px; background: #fffefa; color: #242522; }
.lab-panel > p { margin: 0 0 16px; color: #444c46; font-size: 15px; line-height: 1.6; }
.lab-panel > p:last-child { margin-bottom: 0; }
.lab-shell .lab-note { margin-top: 14px; color: #626b65; font-size: 13px; line-height: 1.5; }
.lab-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-width: 0; min-height: 46px; padding: 12px 16px; border: 1px solid transparent; border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1.3; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lab-button svg { flex: 0 0 23px; width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lab-button:hover:not(:disabled) { filter: brightness(.96); }
.lab-button:focus-visible, .lab-recorded audio:focus-visible { outline: 3px solid #c89648; outline-offset: 3px; }
.lab-button:disabled { cursor: default; opacity: .56; }
.lab-primary { width: 100%; background: #315f55; color: white; }
.lab-secondary { border-color: #bdd0c8; background: #dfede7; color: #284f45; }
.lab-link { padding: 8px 10px; background: transparent; color: #fffefa; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.lab-panel .lab-link, .lab-audio-status .lab-link { color: #315f55; }
.lab-exit { display: flex; width: fit-content; margin: 14px auto 0; background: transparent; color: #e5efea; font-size: 14px; }
.lab-progress { display: block; width: 100%; height: 6px; margin: 2px 0 18px; overflow: hidden; border: 0; border-radius: 9px; background: rgba(255,255,255,.2); appearance: none; }
.lab-progress::-webkit-progress-bar { background: rgba(255,255,255,.2); border-radius: 9px; }
.lab-progress::-webkit-progress-value { background: #f3d69e; border-radius: 9px; }
.lab-progress::-moz-progress-bar { background: #f3d69e; border-radius: 9px; }
.lab-tone-guide-grid, .lab-tone-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lab-tone-guide { display: grid; grid-template-rows: auto auto 1fr; gap: 5px; padding: 10px; background: #f3f6f2; border-radius: 12px; }
.lab-tone-guide strong { color: #294f48; font-size: 13px; }
.lab-tone-guide span { color: #59645d; font-size: 12px; line-height: 1.5; }
.lab-contour { width: 84px; height: 54px; fill: none; stroke: #315f55; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.lab-contour .lab-contour-grid { stroke: #dce4dc; stroke-width: 1; }
.lab-tone-stimulus { padding: 18px; text-align: center; }
.lab-audio-button { flex-direction: column; gap: 9px; width: 140px; min-height: 115px; margin: 0 auto; background: #dfede7; color: #294f48; }
.lab-audio-button svg { width: 35px; height: 35px; flex-basis: 35px; }
.lab-tone-option { display: grid; justify-items: center; gap: 1px; min-height: 120px; padding: 10px; border-color: #e4e0d8; background: #fffefa; color: #242522; }
.lab-tone-option .lab-contour { width: 70px; height: 47px; }
.lab-tone-option span { font-size: 12px; font-weight: 500; line-height: 1.3; }
.lab-tone-option:disabled:not(.is-correct):not(.is-wrong) { opacity: .7; }
.lab-button.is-correct { border-color: #49765a; background: #dfede1; color: #28543a; opacity: 1; }
.lab-button.is-wrong { border-color: #a95c53; background: #f5e3de; color: #743c35; opacity: 1; }
.lab-reference { display: grid; justify-items: center; gap: 5px; margin: 12px 0; color: #39403b; text-align: center; }
.lab-reference > strong { max-width: 100%; color: #242522; font: 600 clamp(27px, 6vw, 39px)/1.5 "Noto Serif SC", serif; overflow-wrap: anywhere; }
.lab-pinyin { color: #974a42; font-size: 17px; font-weight: 800; }
.lab-reference > span:last-child { font-size: 15px; }
.lab-audio-status { margin-top: 10px; color: #5e4940; }
.lab-audio-status p { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.lab-audio-status .lab-button { margin: 3px; }
.lab-dock { position: sticky; z-index: 12; bottom: 0; display: grid; gap: 12px; margin: 18px -6px 0; padding: 14px; border: 1px solid #dfded5; border-radius: 17px; background: #fffefa; color: #242522; box-shadow: 0 -5px 20px rgba(34,55,46,.1); }
.lab-feedback { display: grid; align-content: center; gap: 5px; padding: 12px 14px; border-radius: 11px; background: #f1eee7; color: #343f37; font-size: 14px; line-height: 1.45; }
.lab-feedback > strong { font-size: 16px; }
.lab-feedback.is-correct { background: #e1eee3; color: #28523d; }
.lab-feedback.is-wrong { background: #f5e3de; color: #753d37; }
.lab-feedback .lab-reference { grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 9px; margin: 0; }
.lab-feedback .lab-reference > strong { font-size: 25px; }
.lab-feedback .lab-reference > span:last-child { grid-column: 1/-1; font-size: 13px; }
.lab-feedback > small { padding-top: 5px; }
.lab-dock-label { text-align: center; font-size: 14px; font-weight: 700; }
.lab-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lab-speak-prompt { text-align: center; }
.lab-label { display: block; margin: 0 0 10px; color: #667167; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lab-speak-prompt > strong { display: block; margin-bottom: 12px; color: #242522; font-size: clamp(22px, 5vw, 28px); line-height: 1.35; }
.lab-record-button { min-width: 180px; min-height: 52px; margin: 5px auto; background: #f1e4da; color: #743f34; border-color: #dec5b9; }
.lab-record-button.is-recording { background: #a94f45; color: white; }
.lab-recorded { display: grid; gap: 8px; margin-top: 16px; text-align: left; }
.lab-recorded > span { color: #59645d; font-size: 12px; }
.lab-recorded audio { width: 100%; min-width: 0; height: 45px; }
.lab-story-list { display: grid; gap: 10px; }
.lab-story-choice { display: grid; justify-content: start; justify-items: start; gap: 5px; width: 100%; min-height: 83px; padding: 15px 18px; background: #fffefa; color: #242522; text-align: left; }
.lab-story-choice > span { color: #667066; font-size: 13px; font-weight: 400; }
.lab-story-toggles { display: flex; flex-wrap: wrap; gap: 7px; margin: 17px 0 10px; }
.lab-toggle { flex: 1; min-height: 42px; padding: 9px 12px; border-color: #d7ddd7; background: #fafaf6; color: #59645d; font-size: 13px; }
.lab-toggle[aria-pressed="true"] { background: #dfede7; color: #284f45; border-color: #789b8d; }
.lab-story-lines { display: grid; gap: 10px; }
.lab-story-line { display: grid; grid-template-columns: 25px minmax(0, 1fr) 34px; align-items: start; gap: 8px; padding: 12px 0; border-bottom: 1px solid #e7e8df; }
.lab-story-line:last-child { border-bottom: 0; }
.lab-speaker { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #dfede7; color: #315f55; font-size: 12px; font-weight: 800; }
.lab-story-line > div { display: grid; gap: 5px; font-size: 14px; color: #4f5b52; line-height: 1.4; }
.lab-story-line b { color: #242522; font: 600 24px/1.4 "Noto Serif SC", serif; overflow-wrap: anywhere; }
.lab-story-line .lab-pinyin { font-size: 14px; }
.lab-line-listen { min-height: 44px; width: 34px; padding: 7px; border: 0; background: transparent; color: #315f55; }
.lab-line-listen svg { width: 21px; height: 21px; flex-basis: 21px; }
.lab-answer-options { display: grid; gap: 10px; }
.lab-answer { min-height: 57px; border-color: #e4e0d8; background: #fffefa; color: #242522; }
.lab-done { text-align: center; }
.lab-done > strong { display: block; margin-bottom: 10px; color: #315f55; font-size: 36px; }
@media (max-width: 760px) {
  .review-area.lab-active { padding: 20px 15px; }
  .lab-heading { margin-bottom: 15px; }
  .lab-panel { padding: 16px; }
  .lab-has-dock { padding-bottom: var(--lab-dock-height, 95px); }
  .lab-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 24; max-height: 46dvh; overflow-y: auto; margin: 0; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border: 0; border-top: 1px solid #dedfd6; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(36,50,41,.13); }
  .lab-dock > .lab-button, .lab-dock > .lab-feedback, .lab-dock > .lab-pair { width: min(100%, 620px); margin-left: auto; margin-right: auto; }
  .lab-feedback { padding: 11px 14px; }
  .lab-tone-guide-grid { gap: 8px; }
  .lab-tone-guide { padding: 9px; }
  .lab-shell .lab-tone-options { gap: 9px; }
  .lab-tone-option { min-height: 106px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-shell *, .lab-dock { scroll-behavior: auto; transition: none; }
}
