/* Scoped to the growth chapters; earlier minigames retain their own layout. */
.chapter-select { width: min(100%, 340px); margin: 8px auto 0; text-align: left; }
.chapter-select > summary {
  min-height: 44px;
  padding: 11px 14px;
  box-sizing: border-box;
  border: 1px solid #b9b2a4;
  border-radius: 4px 2px 3px 4px;
  background: #f8f5ed;
  color: #5e584e;
  font-size: 13px;
  cursor: pointer;
}
.chapter-select-list {
  display: grid;
  gap: 5px;
  max-height: min(240px, 35vh);
  overflow: auto;
  overscroll-behavior: contain;
  margin-top: 5px;
  padding: 3px;
}
.chapter-select-list button {
  width: 100%;
  min-height: 44px;
  margin: 0 !important;
  padding: 9px 12px;
  box-sizing: border-box;
  border: 1px solid #b9b2a4;
  border-radius: 3px;
  background: #f1eee5;
  color: #514b41;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
}
.chapter-select > summary:focus-visible, .chapter-select-list button:focus-visible { outline: 2px solid #827863; outline-offset: 1px; }
#homeMiniDialog.growth-mini-dialog {
  width: min(680px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  color: #393732;
  background: #f8f7f1;
}
.growth-mini-dialog > header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #d8d4ca;
  background: #f8f7f1;
}
.growth-mini-dialog > header h2 { margin: 0; font: 500 22px "Songti SC", serif; }
.growth-mini-dialog > header > div { display: flex; flex-shrink: 0; gap: 6px; }
.growth-mini-dialog > header button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #aaa396;
  border-radius: 4px 2px 4px 3px;
  background: #f8f7f1;
  color: #514d44;
  font-size: 12px;
}
.growth-mini-dialog #homeMiniInstructions { margin: 10px 16px; font-size: 12px; line-height: 1.5; color: #716b60; }
.growth-mini-dialog #homeMiniFeedback { min-height: 1.5em; margin: 8px 16px 2px; text-align: center; font-size: 12px; }
.growth-mini-dialog #homeMiniProgress { margin: 4px 16px 12px; text-align: center; letter-spacing: 7px; color: #81796b; font-size: 12px; }
#growthMiniGame { margin: 0 14px; }
#growthMiniGame[hidden], #growthMiniGame [hidden] { display: none !important; }
#growthMiniCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 380;
  background: #f8f7f1;
  border: 1px solid #d9d4c8;
  border-radius: 3px 5px 2px 4px;
  touch-action: none;
  cursor: default;
}
#growthMiniGame[data-kind="curl"] #growthMiniCanvas { cursor: grab; }
#growthMiniCanvas.is-dragging { cursor: grabbing; }
#growthMiniControls { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.growth-control-row { display: flex; justify-content: center; gap: 8px; }
.growth-button {
  min-width: 44px;
  min-height: 46px;
  padding: 8px 13px;
  border: 1px solid #9b9487;
  border-radius: 5px 3px 5px 2px;
  background: #eeece4;
  color: #47433a;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.growth-button:not(:disabled):hover { background: #e3dfd4; border-color: #665f52; }
.growth-button:disabled { opacity: .42; cursor: default; }
.growth-button.is-held, .growth-button[aria-pressed="true"] { background: #5d594f; color: #fbfaf4; }
.growth-button:focus-visible, #growthMiniCanvas:focus-visible { outline: 3px solid #827863; outline-offset: 3px; }
.growth-actions { order: 4; }
.growth-actions .growth-button { flex: 1; max-width: 230px; }
.growth-routes .growth-button { flex: 1; }
.growth-pad { display: grid; grid-template-columns: repeat(4, minmax(44px, 64px)); }
#growthMiniGame[data-kind="curl"] .growth-pad { grid-template-columns: repeat(2, minmax(44px, 110px)); }
.growth-pad .growth-button { font-size: 22px; touch-action: none; }
.growth-charge { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.growth-charge-meter {
  position: relative;
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border: 1px solid #aaa293;
  background: repeating-linear-gradient(90deg, #efede4 0 9%, #bdb5a5 9% 10%);
}
.growth-charge-meter i { display: block; height: 100%; width: 0; background: #625e5399; }
.growth-charge-target { position: absolute; top: 0; bottom: 0; border-left: 2px solid #555145; border-right: 2px solid #555145; background: #fff7c84d; pointer-events: none; }
.growth-charge [data-growth-hold] { min-height: 48px; touch-action: none; background: #575349; color: #f8f7f1; }
#growthMiniGame[data-kind="curl"] .growth-charge { grid-template-columns: 1fr; }
.growth-echo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.growth-echo .growth-button { min-height: 80px; padding: 7px; }
.growth-echo svg { display: block; width: 54px; height: 50px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.growth-echo [data-growth-action="replay"] { grid-column: 1 / -1; min-height: 44px; font-size: 28px; line-height: 1; }
.growth-echo [data-growth-action="enableSound"] { grid-column: 1 / -1; }
@media (max-width: 420px) {
  .growth-mini-dialog > header { padding: 9px 10px; flex-wrap: wrap; }
  .growth-mini-dialog > header h2 { font-size: 19px; }
  .growth-mini-dialog > header > div { margin-left: auto; }
  .growth-mini-dialog #homeMiniInstructions { margin: 7px 10px; font-size: 11px; }
  #growthMiniGame { margin: 0 9px; }
  #growthMiniControls { gap: 6px; padding-top: 7px; }
  .growth-button { padding: 7px 9px; }
  .growth-echo .growth-button { min-height: 76px; }
  .growth-echo [data-growth-action="replay"] { min-height: 44px; }
  .growth-mini-dialog #homeMiniFeedback { margin-top: 7px; }
}
@media (max-height: 480px) and (min-width: 600px) {
  #growthMiniCanvas { max-height: 210px; width: auto; max-width: 100%; margin: auto; }
  .growth-mini-dialog > header { padding-block: 6px; }
}
@media (max-height: 720px) {
  /* The stage clips its canvas, so the title overlay owns its own scrolling. */
  .is-title-screen .intro {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    place-items: start center;
    align-content: start;
    grid-auto-rows: max-content;
    padding-block: 16px;
  }
}
