body.stage-mode {
  height: 100svh;
  display: flex;
  flex-direction: column;
}
body.stage-mode .masthead {
  width: 100%;
  flex: 0 0 auto;
}
body.stage-mode main {
  flex: 1;
  min-height: 0;
  width: 100%;
}
body.stage-mode .stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 760px;
}
body.stage-mode .stage:fullscreen, body.stage-mode .stage.window-expanded {
  height: 100dvh;
  max-height: none;
}
/* The scene is static;
only the existing character presets animate above it. */
body.stage-mode .masthead {
  padding-block: 14px;
}
body.stage-mode main {
  max-width: 1328px;
  padding: 0 24px 20px;
}
body.stage-mode footer {
  display: none;
}
.stage {
  position: relative;
  isolation: isolate;
  height: min(760px, calc(100svh - 104px));
  min-height: 470px;
  overflow: hidden;
  border: 1px solid #a6c2a4;
  border-radius: 28px;
  background: url('assets/garden-cartoon.svg') center / cover, #A9C879;
  box-shadow: 0 15px 45px #314f3918;
}
.stage-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.stage-hud {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  align-items: center;
  gap: 16px;
  padding: 18px 26px 0;
}
.stage-prompt {
  width: 100%;
  max-width: 620px;
  justify-self: center;
  text-align: center;
  padding: 10px 18px;
  border-radius: 22px;
  background: #ffffffed;
  box-shadow: 0 3px 14px #25482f12;
}
.stage-prompt h1 {
  font-size: clamp(22px, 2.8vw, 36px);
  letter-spacing: -.04em;
  margin: 0;
}
.stage-prompt h1 span {
  color: var(--blue);
}
.stage-prompt p {
  font-size: 13px;
  margin: 5px 0 0;
  color: #3f5365;
}
.stage .score {
  padding: 8px 12px;
  min-width: 0;
  border-radius: 18px;
}
.stage .score strong {
  font-size: 30px;
  margin-top: 0;
}
.stage .score span {
  font-size: 9px;
}
.stage-clock {
  text-align: center;
  padding: 10px;
  border-radius: 18px;
  background: #ffffffed;
  color: #253d50;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stage-progress {
  padding: 8px 28px 0;
}
.stage .patch-info {
  margin: 0 0 7px;
  color: #253e32;
  font-size: 11px;
}
.stage .patch-info strong {
  color: #253e32;
}
.stage .time-track {
  margin: 0;
  height: 5px;
  background: #fff9;
}
.level-steps {
  display: flex;
  gap: 8px;
  padding: 8px 28px 0;
}
.level-steps > span {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #ffffffb3;
  border-radius: 10px;
  background: #f6faeed9;
  color: #496043;
  font-size: 11px;
  text-align: center;
}
.level-steps b {
  margin-right: 7px;
}
.level-steps [aria-current=step] {
  background: #254c35;
  border-color: #254c35;
  color: #fff;
}
.level-steps .complete {
  background: #d8edbb;
  border-color: #7c9f5d;
}
.stage .board {
  --hole-size: min(17cqw, 18cqh);
  --label-size: clamp(30px, min(5cqw, 9cqh), 40px);
  flex: 1;
  min-height: 0;
  position: relative;
  container-type: size;
  display: block;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.stage .board[data-holes="6"] {
  --hole-size: min(22cqw, 30cqh);
  --label-size: clamp(30px, min(5cqw, 12cqh), 56px);
}
.stage .hole {
  position: absolute;
  left: var(--wide-x);
  top: var(--wide-y);
  width: var(--hole-size);
  aspect-ratio: 240 / 290;
  transform: translate(-50%, -100%);
}
.stage .mole-button .word {
  font-size: var(--label-size);
  left: 0;
  right: 0;
  min-height: 34%;
}
@media (min-width: 601px) {
  .stage .board:not([data-holes="6"]) .word {
    left: -12%;
    right: -12%;
  }
}
.stage .game-bottom {
  min-height: 56px;
  padding: 0 24px 0;
  gap: 12px;
}
.stage #feedback {
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0;
  padding: 7px 12px;
  border-radius: 12px;
  background: #ffffffe8;
}
.stage .game-bottom .primary {
  min-height: 44px;
  padding: 10px 16px;
  gap: 8px;
  white-space: nowrap;
}
.stage-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 18px 14px;
}
.stage-controls > div {
  display: flex;
  gap: 7px;
}
.stage-controls button {
  min-height: 44px;
  border: 1px solid #bacddd;
  border-radius: 14px;
  background: linear-gradient(150deg, #ffffffed, #edf5ffed);
  color: var(--blue);
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 650;
  box-shadow: inset 0 1px #fff, 0 3px 8px #29462b13;
}
.stage-notice {
  position: absolute;
  z-index: 12;
  bottom: 68px;
  left: 20px;
  right: 20px;
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid #9eafbd;
  border-radius: 14px;
  font-size: 12px;
}
.stage-overlay {
  position: absolute;
  z-index: 6;
  inset: 0 0 62px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: #12322580;
}
.stage-panel {
  width: min(100%, 520px);
  max-height: 100%;
  overflow: auto;
  padding: 28px 34px;
  text-align: center;
}
.stage-panel h1 {
  font-size: clamp(32px, 4vw, 46px);
  margin-bottom: 14px;
}
.stage-panel h2 {
  font-size: 30px;
}
.stage-panel p {
  color: #43566b;
  font-size: 15px;
}
.stage-panel .eyebrow {
  font-size: 10px;
  margin-bottom: 10px;
}
.stage-panel .lead {
  font-size: 17px;
}
.stage-panel fieldset {
  margin-top: 18px;
  text-align: left;
}
.stage-panel .mode-options {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stage-panel .mode-options label {
  gap: 8px;
  padding: 12px;
  background: #ffffffa6;
}
.stage-panel .mode-options small {
  line-height: 1.4;
}
.stage-panel .primary {
  margin-top: 18px;
  min-width: 180px;
}
.stage-panel .back {
  margin: 4px auto 0;
}
.stage-panel .audio-note {
  font-size: 10px;
  margin: 12px 0 0;
}
.stage-panel .listen {
  font-size: 12px;
  padding: 8px 14px;
}
.stage .results {
  width: min(100%, 820px);
  max-height: 100%;
  overflow: auto;
  margin: 0;
  padding: 26px;
}
.stage .results h1 {
  font-size: 34px;
}
.stage .results .lead {
  font-size: 14px;
}
.stage .result-stats {
  margin-top: 16px;
  padding: 16px 6px;
}
.stage .result-stats > div {
  padding: 0 12px;
}
.stage .result-stats strong {
  font-size: 28px;
}
.stage .result-actions {
  margin: 18px 0;
  flex-wrap: wrap;
}
.stage .review-heading h2 {
  font-size: 24px;
}
.stage .review-grid {
  gap: 12px;
}
.stage .review-patch {
  padding: 16px;
}
.stage:fullscreen, .stage.window-expanded {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
}
.stage.window-expanded {
  position: fixed;
  inset: 0;
  z-index: 100;
}
body:has(.window-expanded) {
  overflow: hidden;
}
@media (max-width: 600px) {
  body.stage-mode .masthead {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  body.stage-mode .brand {
    width: auto;
    font-size: 23px;
  }
  body.stage-mode .brand span {
    display: none;
  }
  body.stage-mode .navigation-options {
    width: auto;
  }
  body.stage-mode #sound {
    display: none;
  }
  body.stage-mode main {
    padding: 0 8px 8px;
  }
  .stage {
    height: calc(100svh - 70px);
    border-radius: 20px;
    min-height: 470px;
    background-position: 50% 50%;
  }
  .stage-hud {
    grid-template-columns: 55px 1fr 55px;
    gap: 6px;
    padding: 12px 9px 0;
  }
  .stage-prompt {
    padding: 9px 5px;
    border-radius: 16px;
  }
  .stage-prompt h1 {
    font-size: 20px;
  }
  .stage-prompt p {
    font-size: 11px;
    margin-top: 4px;
  }
  .stage .score {
    padding: 9px 3px;
    border-radius: 13px;
  }
  .stage .score strong {
    font-size: 24px;
  }
  .stage .score span {
    font-size: 7px;
    letter-spacing: 0;
  }
  .stage-clock {
    font-size: 12px;
    padding: 12px 3px;
    border-radius: 13px;
  }
  .stage-progress {
    padding: 8px 14px 0;
  }
  .stage .patch-info {
    font-size: 10px;
  }
  .stage .board {
    --hole-size: min(26cqw, 20cqh);
    --label-size: clamp(26px, min(8cqw, 9cqh), 30px);
  }
  .stage .board[data-holes="6"] {
    --hole-size: min(35cqw, 20cqh);
    --label-size: clamp(30px, min(10cqw, 9cqh), 38px);
  }
  .stage .board[data-holes="6"] .word {
    left: -8%;
    right: -8%;
  }
  .stage .hole {
    left: var(--portrait-x);
    top: var(--portrait-y);
  }
  .level-steps {
    gap: 4px;
    padding: 7px 12px 0;
  }
  .level-steps > span {
    padding: 5px 2px;
    font-size: 9px;
  }
  .level-steps b {
    margin-right: 3px;
  }
  .stage .game-bottom {
    min-height: 50px;
    padding: 0 12px;
    gap: 5px;
  }
  .stage #feedback {
    font-size: 10px;
    padding: 6px 8px;
  }
  .stage .game-bottom .primary {
    font-size: 11px;
    min-width: 100px;
    padding: 8px;
  }
  .stage-controls {
    padding: 3px 10px 10px;
    gap: 4px;
  }
  .stage-controls > div {
    gap: 4px;
  }
  .stage-controls button {
    padding: 8px;
    font-size: 10px;
    border-radius: 12px;
  }
  .stage-overlay {
    padding: 12px;
    bottom: 60px;
  }
  .stage-panel {
    padding: 22px 18px;
    border-radius: 22px;
  }
  .stage-panel h1 {
    font-size: 32px;
  }
  .stage-panel .lead {
    font-size: 15px;
  }
  .stage-panel .mode-options {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .stage-panel .mode-options label {
    padding: 9px;
  }
  .stage-panel .mode-options strong {
    font-size: 13px;
  }
  .stage-panel .mode-options small {
    font-size: 11px;
    margin-top: 3px;
  }
  .stage-panel .primary {
    margin-top: 14px;
  }
  .stage .results {
    padding: 20px 16px;
  }
  .stage .results h1 {
    font-size: 29px;
  }
  .stage .result-stats strong {
    font-size: 25px;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  body.stage-mode .masthead {
    padding-block: 6px;
  }
  .stage {
    min-height: 320px;
    height: calc(100svh - 64px);
  }
  .stage-hud {
    padding-top: 8px;
    grid-template-columns: 65px 1fr 65px;
  }
  .stage-prompt {
    padding: 6px 12px;
  }
  .stage-prompt h1 {
    font-size: 23px;
  }
  .stage-prompt p {
    display: none;
  }
  .stage .score {
    padding: 4px 8px;
  }
  .stage .score strong {
    font-size: 22px;
  }
  .stage .game-bottom {
    min-height: 36px;
  }
  .stage-controls {
    padding-bottom: 6px;
  }
  .stage-panel {
    padding: 16px 24px;
  }
  .stage-panel .mode-options {
    grid-template-columns: 1fr 1fr;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  body.stage-mode .masthead {
    display: none;
  }
  body.stage-mode main {
    padding: 6px;
  }
  .stage .game-bottom {
    min-height: 0;
    padding: 0;
  }
  .stage #feedback {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    padding: 0;
    margin: 0;
  }
  .stage .game-bottom .primary {
    position: absolute;
    z-index: 4;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
  .stage .board,
  .stage .board[data-holes="6"] {
    --hole-size: min(13cqw, 27cqh);
    --label-size: 30px;
  }
  .stage .board[data-holes="6"] {
    --hole-size: min(12cqw, 50cqh);
  }
  .stage .hole {
    left: var(--short-x);
    top: var(--short-y);
  }
  .stage .board:not([data-holes="6"]) .word {
    left: -20%;
    right: -20%;
  }
}
.stage[data-screen=setup] .stage-hud,
.stage[data-screen=setup] .stage-progress,
.stage[data-screen=setup] .game-bottom {
  visibility: hidden;
}
@media (max-width: 600px), (max-height: 600px) {
  /* The symbol stays large on the denser fields; the score remains visible in the HUD. */
  .stage .board:not([data-holes="6"]) .hit-result > span:not(.hit-mark) {
    display: none;
  }
}


/* Leave room for wide letters as well as the expanded lesson compounds. */
.stage .mole-button .word {
  font-size: max(12px, calc(var(--label-size) * min(1, 3.4 / var(--word-length))));
}

/* Game surfaces use the garden palette; the shared hub keeps its liquid-glass theme. */
body.stage-mode {
  --blue: #276D69;
  --muted: #4C6258;
  color: #2C4643;
  background: #FFF8E8;
}
body.stage-mode .stage :is(.stage-prompt, .score, .stage-clock, #feedback) {
  background: #FFF8E8;
  color: #2C4643;
  box-shadow: none;
}
body.stage-mode .stage-controls button {
  background: #FFF8E8;
  border-color: #B7C69D;
  box-shadow: 0 2px 0 #7D9B6833;
}
body.stage-mode .stage .primary {
  background: #276D69;
  border-color: #276D69;
  box-shadow: 0 3px 0 #205853;
}
body.stage-mode .stage-overlay {
  background: #2C46435C;
  backdrop-filter: none;
}
body.stage-mode .stage :is(.stage-panel, .results) {
  background: #FFF8E8;
  border: 2px solid #E3D9BD;
  box-shadow: 0 8px 0 #2C464317;
  backdrop-filter: none;
}
body.stage-mode .stage-panel .mode-options label:has(:checked) {
  background: #E3ECCD;
  border-color: #52795A;
}
body.stage-mode .stage-panel .listen {
  color: #276D69;
  background: #F3EEDC;
  border-color: #C7D0AF;
}

/* Substantial heads on the two-row field, with labels above the rise window. */
@media (min-width: 601px) and (min-height: 601px) {
  .stage .board[data-holes="6"] { --hole-size: min(18cqw, 35cqh); }
  .stage .board:not([data-holes="6"]) { --hole-size: min(16cqw, 24cqh); }
}
@media (max-height: 600px) and (min-width: 601px) {
  .stage .board[data-holes="6"] { --hole-size: min(14cqw, 64cqh); }
  .stage .board:not([data-holes="6"]) { --hole-size: min(16cqw, 36cqh); }
}
.stage .level-steps b { margin: 0; }
