* { box-sizing: border-box; }
@font-face {
  font-family: "Rounded Mplus Start";
  src: url("art/mplus-rounded-1c-start.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
#loadingCurtain { position: fixed; inset: 0; z-index: 21; background: #090d09; }
#titleLoading { position: fixed; inset: 0; z-index: 20; overflow: hidden; background: #a9d6ee url("art/loading-background.webp") center / cover no-repeat; color: #75401b; font-family: system-ui, -apple-system, "Noto Sans JP", sans-serif; text-align: center; }
#titleLoading[hidden] { display: none; }
.loading-scene { position: relative; width: min(100%, 560px); height: 100%; margin: auto; }
.loading-squirrel { position: absolute; top: 36%; left: 50%; width: min(64%, 48svh); height: 34%; transform: translateX(-50%); object-fit: contain; filter: drop-shadow(0 7px 7px #8e602555); }
.loading-progress { position: absolute; top: 67%; left: 0; display: flex; width: 100%; align-items: center; flex-direction: column; padding: 0 8px; }
.loading-progress strong { font-size: clamp(22px, 4svh, 32px); line-height: 1.35; letter-spacing: .04em; text-shadow: 0 2px 2px #fff1c8; }
.loading-bar { position: relative; width: 100%; aspect-ratio: 2172 / 724; margin-top: 4px; background: url("art/loading-bar.webp") center / contain no-repeat; }
.loading-fill-track { position: absolute; top: 41%; left: 12%; width: 76%; height: 18%; overflow: hidden; border-radius: 999px; clip-path: inset(0 100% 0 0); }
.loading-fill-track img { position: absolute; top: -175%; left: -3.5%; display: block; width: 111%; height: auto; max-width: none; }
.loading-percent { margin-top: -2px; font-size: clamp(20px, 3.6svh, 30px); font-weight: 800; line-height: 1.2; text-shadow: 0 2px 2px #fff1c8; }
.loading-detail { margin-top: 6px; font-size: clamp(13px, 2.2svh, 18px); font-weight: 700; letter-spacing: .03em; text-shadow: 0 2px 2px #fff1c8; }
#titleLoading button { margin-top: 14px; padding: 9px 20px; border: 3px solid #78401b; border-radius: 24px; background: linear-gradient(#fff5c8, #ecb462); box-shadow: 0 3px 3px #70432166; color: #5b2b11; font: 800 16px system-ui, sans-serif; }
#titleLoading button[hidden] { display: none; }
@media (orientation: landscape) and (max-height: 600px) {
  .loading-scene { width: min(100%, 820px); }
  .loading-squirrel { top: 28%; left: 26%; width: min(40%, 48svh); height: 76%; }
  .loading-progress { top: 30%; left: 49%; width: 49%; }
  .loading-progress strong { font-size: clamp(20px, 6svh, 30px); }
  .loading-bar { margin-top: 10px; }
  .loading-percent { font-size: clamp(18px, 5svh, 26px); }
  .loading-detail { font-size: clamp(12px, 3svh, 16px); }
}
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  color: #4a240e;
  font-family: system-ui, -apple-system, "Noto Sans JP", sans-serif;
  font-weight: 700;
  background: #729f4c url("art/forest.webp") center center / cover no-repeat fixed;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body.calm-background { background-image: linear-gradient(#17331b88, #17331b88), url("art/forest.webp"); }
body.gameplay-background { background-image: url("art/gameplay-forest.webp"); }
body.gameplay-background.calm-background { background-image: linear-gradient(#17331b88, #17331b88), url("art/gameplay-forest.webp"); }
@media (max-width: 600px) {
  body { background-image: url("art/forest-mobile.webp"); background-attachment: scroll; }
  body.calm-background { background-image: linear-gradient(#17331b88, #17331b88), url("art/forest-mobile.webp"); }
  body.gameplay-background { background-image: url("art/gameplay-forest.webp"); }
  body.gameplay-background.calm-background { background-image: linear-gradient(#17331b88, #17331b88), url("art/gameplay-forest.webp"); }
}
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-touch-callout: none; }
button:focus-visible, summary:focus-visible { outline: 4px solid #fff1a5; outline-offset: 3px; }
button:active { transform: translateY(3px); }

/* タイトル画面は盤面と切り離し、参考画像の看板を主役にする。 */
.home-screen {
  display: none;
  width: min(100%, 760px);
  min-height: 100svh;
  margin: auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: clamp(9px, 1.5vh, 18px);
}
.home .home-screen { display: flex; }
.home button:disabled { opacity: .7; cursor: progress; }
.home .wrap { display: none; }
.level-select .wrap { display: none; }
.level-select-screen { display: none; height: 100svh; overflow-y: auto; background: #729f4c url("art/forest-mobile.webp") center / cover no-repeat; }
.level-select .level-select-screen { display: block; }
.level-select-inner { display: flex; flex-direction: column; align-items: center; gap: 3px; width: min(100%, 390px); min-height: 100%; margin: auto; padding: 0 8px 10px; }
.level-select-inner h1 { position: relative; z-index: 1; width: 100%; margin: 0 0 -45px; line-height: 0; }
.level-select-inner h1 img { display: block; width: 100%; height: auto; }
.level-select-board { position: relative; width: min(calc(100% + 28px), 100vw); padding: 56px 38px 39px; }
#levelBoardArt { position: absolute; inset: 0; display: block; background: url("art/difficulty-board.webp") center / 100% 100% no-repeat; transform-origin: center top; }
.level-select-note, .level-select-choices { position: relative; }
.level-select-note { position: relative; width: 100%; aspect-ratio: 3 / 1; container-type: inline-size; }
.level-select-note img { display: block; width: 100%; height: 100%; }
.level-select-note p { position: absolute; inset: 18% 9%; display: grid; place-content: center; margin: 0; color: #51250c; font-size: 4cqw; line-height: 1.3; text-align: center; white-space: pre-line; text-shadow: 0 1px #fff5d4; }
.level-select-choices { display: grid; gap: 0; width: 100%; }
.level-select-choices button { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; line-height: 0; filter: drop-shadow(0 3px 3px #2b1b0b9c); }
.level-select-choices button img { display: block; width: 100%; height: auto; }
.level-select-choices button:hover, .level-select-choices button:focus-visible { filter: drop-shadow(0 0 7px #ffe168) drop-shadow(0 3px 3px #2b1b0b9c); }
.level-select-choices button.last { filter: drop-shadow(0 0 7px #ffe168) drop-shadow(0 3px 3px #2b1b0b9c); }
.level-select-choices button:active { filter: brightness(1.07); }
.level-select-back { min-height: 44px; padding: 5px 25px; border: 4px solid #78401b; border-radius: 30px; background: linear-gradient(#fff5c8, #ecb462); box-shadow: inset 0 2px #fff8dc, 0 4px #4f2b14; color: #5b2b11; font-size: 18px; font-weight: 900; }
/* タイトルを画面の上端から見せ、難易度の選択肢は後から表示する。 */
.level-select .level-select-inner h1 img { animation: level-select-title-enter .75s both; }
.level-select .level-select-board { animation: level-select-content-enter .35s .45s both; }
.level-select .level-select-back { animation: level-select-back-enter .35s .45s both; }
@keyframes level-select-title-enter {
  0% { transform: translateY(calc(-100% - 8px)); animation-timing-function: cubic-bezier(.22, .7, .28, 1); }
  85% { transform: translateY(5px); }
  100% { transform: translateY(0); }
}
@keyframes level-select-content-enter {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes level-select-back-enter {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .level-select .level-select-inner h1 img, .level-select .level-select-board, .level-select .level-select-back { animation: none; }
}
@media (orientation: portrait) {
  .level-select-inner { justify-content: flex-start; width: min(100%, 42.5svh, 390px); padding: 0 8px; }
  .level-select-inner h1 { width: min(65vw, 270px); margin-bottom: -55px; }
  .level-select-board { width: min(calc(100% + 40px), 100vw); padding: 26px 36px 14px; }
}
@media (orientation: portrait) and (max-height: 650px) {
  .level-select-inner { width: min(100%, 300px); }
}
@media (min-width: 601px) { .level-select-screen { background-image: url("art/forest.webp"); } }
@media (orientation: landscape) and (max-height: 600px) {
  .level-select-inner { display: grid; grid-template-columns: minmax(0, 32%) minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; gap: 0 8px; width: min(100%, 720px); padding: 0 10px 5px; }
  .level-select-inner h1 { grid-column: 1; grid-row: 1; align-self: end; margin: 0 auto -3px; }
  .level-select-board { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 100%; padding: 24px; }
  #levelBoardArt { background: none; border-image: url("art/difficulty-board.webp") 110 fill / 24px / 0 stretch; }
  .level-select-note { width: min(100%, 360px); margin: auto; }
  .level-select-choices { grid-template-columns: 1fr 1fr; gap: 0; }
  .level-select-back { grid-column: 1; grid-row: 2; justify-self: center; min-height: 35px; padding: 2px 18px; font-size: 14px; }
}
.stage-map .wrap { display: none; }
.stage-advance-curtain { position: fixed; inset: 0; z-index: 19; background: #090d09; opacity: 0; }
.stage-advance-curtain[hidden] { display: none; }
.stage-map-screen { display: none; min-height: 100svh; align-items: center; justify-content: center; overflow: hidden; background: #476c32; }
.stage-map .stage-map-screen { display: flex; }
.stage-map-page { position: relative; width: min(100vw, 177.78svh); height: min(100svh, 56.25vw); overflow: hidden; background: #496e34; box-shadow: 0 0 35px #19280c99; --stage-footer-height: calc(78px + env(safe-area-inset-bottom)); }
.stage-map-scene { position: absolute; inset: 0; }
.stage-map-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage-map-water { display: none; position: absolute; z-index: 0; left: 53.135%; top: 13.158%; width: 46.865%; height: 86.842%; background: url("art/stage-map-water.webp") center / 100% 100% no-repeat; pointer-events: none; }
.stage-map-scene.water-active .stage-map-water { display: block; }
.stage-map-scene.bridge-water .stage-map-water { display: block; left: 0; top: 0; width: 53.135%; height: 100%; background-image: url("art/stage-map-bridge-water.webp"); }
.stage-map-path { position: absolute; z-index: 1; inset: 0; pointer-events: none; }
.stage-map-stone { position: absolute; width: clamp(16px, 4vw, 22px); aspect-ratio: 582 / 417; transform: translate(-50%, -50%); background: url("art/stage-path-stone.webp") center / contain no-repeat; filter: drop-shadow(0 1px 1px #5b401777); }
.stage-map-stone.crossing-only { display: none; }
.stage-map-page.crossing .stage-map-stone.crossing-only { display: block; }
.stage-map-curtain { position: absolute; z-index: 6; inset: 0; background: #090d09; opacity: 0; pointer-events: none; }
.stage-map-header { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; min-height: 18%; padding: 1% 2%; background: linear-gradient(#1e3518cb, #1e351800); }
.stage-map-header h1 { display: grid; place-items: center; width: clamp(190px, 34%, 280px); aspect-ratio: 2 / 1; margin: 0 auto; padding-bottom: 3px; background: url("art/stage-title-sign.webp") center / contain no-repeat; color: #fff6d6; font-size: clamp(17px, 4.7svh, 25px); text-align: center; text-shadow: 0 2px 4px #19240e, 0 0 7px #19240e; white-space: nowrap; }
.stage-map-header button { position: absolute; top: 11%; left: 2%; width: clamp(90px, 17%, 150px); aspect-ratio: 207 / 108; padding: 0; border: 0; background: url("art/stage-back-button.webp") center / contain no-repeat; color: transparent; }
.stage-map-nodes { position: absolute; z-index: 2; inset: 0; }
.stage-map-node { position: absolute; display: grid; place-items: center; width: clamp(42px, 13svh, 66px); aspect-ratio: 1; padding: 0 0 5px; transform: translate(-50%, -50%); border: 0; background: url("art/stage-stump.webp") center / contain no-repeat; color: #fff8e8; font-size: clamp(20px, 6svh, 29px); font-weight: 900; line-height: 1; text-shadow: -1px -1px #542a15, 1px 2px #542a15, 0 0 5px #542a15; }
.stage-map-node:active { transform: translate(-50%, calc(-50% + 3px)); }
.stage-map-node.locked { background-image: url("art/stage-lock.webp"); cursor: default; }
.stage-map-node.selected { filter: drop-shadow(0 0 7px #ffe260) drop-shadow(0 0 4px #ffe260); }
.stage-map-node small { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid #5d3719; border-radius: 50%; background: #ecbf3c; color: #4a280e; font-size: 15px; text-shadow: none; }
.stage-map-squirrel { position: absolute; z-index: 3; width: clamp(48px, 13svh, 70px); aspect-ratio: 1; transform: translate(-50%, -63%); background: url("art/squirrel-right.webp") 0 0 / 200% 200% no-repeat; filter: drop-shadow(1px 3px 2px #2a210f); pointer-events: none; }
.stage-map-squirrel.walking { background-size: 200% 200%; animation: stage-map-walk .44s steps(1) infinite; }
.stage-map-squirrel.idle { background-image: url("art/squirrel-idle.webp"); background-size: 400% 200%; animation: stage-map-idle 3.2s steps(1) infinite; }
@keyframes stage-map-walk { 0%, 100% { background-position: 0 0; } 25% { background-position: 100% 0; } 50% { background-position: 0 100%; } 75% { background-position: 100% 100%; } }
@keyframes stage-map-idle { 0%, 12.4% { background-position: 0 0; } 12.5%, 24.9% { background-position: 33.333% 0; } 25%, 37.4% { background-position: 66.667% 0; } 37.5%, 49.9% { background-position: 100% 0; } 50%, 62.4% { background-position: 0 100%; } 62.5%, 74.9% { background-position: 33.333% 100%; } 75%, 87.4% { background-position: 66.667% 100%; } 87.5%, 100% { background-position: 100% 100%; } }
.stage-map-page.advancing .stage-map-footer { visibility: hidden; }
.stage-map-footer { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: clamp(3px, 1vw, 12px); height: var(--stage-footer-height); padding: 4px 7px max(4px, env(safe-area-inset-bottom)); background: linear-gradient(#1e351800, #1e3518d9); }
.stage-map-footer button { min-width: 64px; aspect-ratio: 1619 / 971; padding: 3px .75em; border: 0; background: url("art/stage-step-button.webp") center / contain no-repeat; color: #4d240e; font-size: clamp(13px, 3.4svh, 18px); font-weight: 900; white-space: nowrap; }
.stage-map-footer #stageMapPrev, .stage-map-footer #stageMapNext { width: clamp(112px, 20%, 130px); font-size: clamp(18px, 4svh, 24px); }
.stage-map-footer span { min-width: 52px; color: #fff7de; font-size: clamp(13px, 3.7svh, 17px); font-weight: 900; text-align: center; text-shadow: 0 2px 4px #17210e; }
.stage-map-footer button:disabled { visibility: hidden; }
.stage-map-page.crossing .stage-map-footer { opacity: 0; pointer-events: none; }
.stage-map-page.crossing .stage-map-nodes, .stage-map-page.crossing .stage-map-header { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .stage-map-squirrel.walking, .stage-map-squirrel.idle { animation: none; }
  .stage-map-water { background-image: url("art/stage-map-water-still.webp"); }
  .stage-map-scene.bridge-water .stage-map-water { background-image: url("art/stage-map-bridge-water-still.webp"); }
}
.home-logo {
  display: block;
  width: min(100%, 700px);
  max-height: min(43svh, 410px);
  object-fit: contain;
  filter: drop-shadow(0 12px 10px #30231388);
}
.home-modes { display: grid; width: min(68%, 500px); gap: clamp(10px, 1.5vh, 18px); }
.home-mode {
  display: grid;
  grid-template-columns: 86px 1fr 62px;
  align-items: center;
  width: 100%;
  min-height: clamp(92px, 11svh, 118px);
  padding: 9px 16px;
  border: 5px solid #6e3519;
  border-radius: 25px;
  background: repeating-linear-gradient(176deg, #ffffff13 0 2px, transparent 2px 20px), linear-gradient(160deg, #ffdf92, #e9a852 75%, #bb742d);
  box-shadow: inset 0 3px #fff6d0, inset 0 -5px #ba762e, 0 6px #4c260f, 0 12px 15px #25190d85;
  color: #4e250e;
  text-align: left;
}
.home-mode:active { box-shadow: inset 0 2px #fff6d0, 0 2px #4c260f; }
.home .home-mode:disabled { opacity: 1; cursor: default; }
.home-mode:disabled:active { box-shadow: inset 0 3px #fff6d0, inset 0 -5px #ba762e, 0 6px #4c260f, 0 12px 15px #25190d85; }
.home-icon { font-size: clamp(41px, 5vw, 57px); line-height: 1; filter: drop-shadow(1px 3px 1px #6b401e66); text-align: center; }
.home-copy strong { display: block; font-size: clamp(22px, 3.1vw, 31px); line-height: 1.22; font-weight: 900; letter-spacing: -.035em; white-space: nowrap; text-shadow: 0 1px #fff0be; }
.home-copy small { display: block; margin-top: 4px; font-size: clamp(12px, 1.65vw, 17px); font-weight: 700; color: #704328; }
.home-arrow { font-size: 30px; line-height: 1; text-shadow: 0 2px #fff3c7; }
.home-footer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; width: min(68%, 500px); margin-top: 5px; }
.home-footer button {
  min-height: clamp(76px, 9svh, 103px);
  padding: 7px 3px;
  border: 4px solid #653514;
  border-radius: 20px;
  background: repeating-linear-gradient(170deg, #ffe3a315 0 2px, transparent 2px 18px), linear-gradient(#ae6c34, #7b421d);
  box-shadow: inset 0 3px #dca267, inset 0 -4px #5c2a12, 0 5px #42220f, 0 10px 14px #2c210e77;
  color: #fff1d3;
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 900;
  text-shadow: 0 2px #47200e;
}
.home-footer button span { display: block; font-size: clamp(27px, 4vw, 39px); line-height: 1.05; }

/* タイトルの着地後にモードを順に出し、2枚目と一緒に下部ボタンも出し始める。 */
.home.home-ready .home-logo { animation: home-logo-enter .9s linear backwards; }
.home.home-ready .home-mode {
  animation: home-button-enter .55s cubic-bezier(.2, .8, .2, 1) backwards;
}
.home.home-ready .home-footer button {
  animation: home-footer-enter .48s cubic-bezier(.2, .8, .2, 1) backwards;
}
.home .home-mode:nth-child(1) { animation-delay: 1s; }
.home .home-mode:nth-child(2) { animation-delay: 1.16s; }
.home .home-mode:nth-child(3) { animation-delay: 1.32s; }
.home .home-footer button:nth-child(1) { animation-delay: 1.16s; }
.home .home-footer button:nth-child(2) { animation-delay: 1.24s; }
.home .home-footer button:nth-child(3) { animation-delay: 1.32s; }
@keyframes home-logo-enter {
  0% { transform: translateY(-70svh); animation-timing-function: cubic-bezier(.6, 0, 1, 1); }
  62% { transform: translateY(0) scale(1.06, .91); animation-timing-function: cubic-bezier(.1, .8, .2, 1); }
  78% { transform: translateY(-18px) scale(.98, 1.03); animation-timing-function: cubic-bezier(.5, 0, .9, 1); }
  92% { transform: translateY(0) scale(1.01, .98); }
  100% { transform: translateY(0); }
}
@keyframes home-button-enter {
  from { opacity: 0; transform: translateX(-100vw); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes home-footer-enter {
  from { opacity: 0; transform: translateY(11svh); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .home.home-ready .home-logo, .home.home-ready .home-mode, .home.home-ready .home-footer button { animation: none; }
  .level-select .level-select-inner { animation: none; }
}

/* プレイ画面。盤面と、数値・次のブロックをまとめた情報パネルを配置する。 */
.wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 174px;
  grid-template-rows: 100px auto auto auto;
  gap: 11px 13px;
  align-content: start;
  width: min(98vw, 760px, calc((100svh - 275px) * .625 + 209px));
  margin: 0 auto;
  padding: max(13px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
}
.title-row { position: absolute; top: 18px; left: 9px; z-index: 2; }
.brand, .sub { display: none; }
.menu-btn {
  width: 53px; height: 59px; padding: 0;
  border: 4px solid #67371a; border-radius: 14px;
  background: linear-gradient(#d99655, #905122);
  box-shadow: inset 0 2px #f0bd78, 0 4px #49240e, 0 6px 9px #1423128a;
  color: #fff6d9; font-size: 30px; font-weight: 900; text-shadow: 0 2px #6e3818;
}
.hud {
  grid-column: 1; grid-row: 1;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  margin-left: 63px;
  padding: 9px;
  border: 5px solid #713915; border-radius: 17px;
  background: repeating-linear-gradient(173deg, #ffd29117 0 2px, transparent 2px 21px), linear-gradient(#c48642, #85451d);
  box-shadow: inset 0 2px #f2c379, inset 0 -3px #623017, 0 5px #4a250f, 0 9px 12px #11291677;
}
.hud > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; padding: 3px 1px;
  border: 2px solid #623113; border-radius: 10px;
  background: linear-gradient(#4b2818, #6a391c);
  box-shadow: inset 0 2px 5px #20100a, 0 1px #dfaa64;
  color: #fff1c5; font-size: clamp(11px, 1.25vw, 17px); line-height: 1.12; white-space: nowrap;
  text-shadow: 0 2px #381c11;
}
.hud b { display: block; color: #fff9e7; font-size: clamp(21px, 2.7vw, 30px); font-weight: 900; line-height: 1.23; }
.hud b.hurry { color: #ffb6a4; }
.hud-next { gap: 1px; }
#next { display: block; width: min(100%, 78px); height: auto; }
.board-assembly { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) 39px; min-width: 0; }
.accelerator { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; margin: 3px 0 3px -2px; padding: 8px 3px 7px; border: 6px ridge #b57537; border-left: 0; border-radius: 0 13px 13px 0; background: linear-gradient(90deg, #653419, #925024 45%, #6a3618); box-shadow: 3px 0 0 #5f3017, 0 7px #592b14, 4px 13px 20px #14220f99; color: #fff1c5; font-size: 10px; font-weight: 900; line-height: 1; text-shadow: 0 1px #381c11; }
.accelerator-label { writing-mode: vertical-rl; letter-spacing: .1em; }
.accelerator-track { position: relative; flex: 1; width: 15px; min-height: 20px; overflow: hidden; border: 2px solid #411d0d; border-radius: 8px; background: #46240f; box-shadow: inset 0 2px 4px #190d08; }
#acceleratorFill { position: absolute; right: 0; bottom: 0; left: 0; display: block; height: 0; border-radius: inherit; background: linear-gradient(0deg, #f3a843, #ffdd68); }
.accelerator b { color: #fff9e7; font-size: 9px; white-space: nowrap; }
.sidebar { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; align-self: start; padding-top: 30px; }
.special-card {
  padding: 9px;
  border: 5px solid #713915; border-radius: 18px;
  background: repeating-linear-gradient(173deg, #ffd29117 0 2px, transparent 2px 21px), linear-gradient(#b67537, #80441f);
  box-shadow: inset 0 2px #e8ae64, inset 0 -3px #623017, 0 5px #4a250f, 0 9px 12px #11291677;
  color: #fff3d2; text-shadow: 0 2px #4c250f;
}
.special-card { text-align: center; }
.special-card strong { display: block; font-size: 15px; white-space: nowrap; }
.special-art { display: grid; place-items: center; height: 114px; margin: 9px 0; border: 3px solid #5d3018; border-radius: 12px; background: linear-gradient(#563019, #321d16); }
.special-art img { display: block; width: 96px; filter: drop-shadow(0 0 10px #b7e4ff); }
.special-card span.label { display: block; font-size: 20px; font-weight: 900; }
.special-card small { display: block; margin-top: 7px; font-size: 13px; line-height: 1.4; font-weight: 700; }
.special-card small b { color: #ffe351; }
#game {
  display: block; width: 100%; height: auto; aspect-ratio: 10 / 16;
  border: 11px ridge #b57537; border-radius: 13px;
  background: #17212c;
  box-shadow: 0 0 0 4px #5f3017, inset 0 0 0 3px #e8b36d, 0 7px #592b14, 0 13px 20px #14220f99;
  touch-action: none;
  -webkit-user-drag: none;
}
.controls {
  grid-column: 1; grid-row: 3;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px;
  padding: 8px;
  border: 5px solid #6b3618; border-radius: 17px;
  background: linear-gradient(#a56530, #79411c);
  box-shadow: inset 0 2px #e9b26d, 0 5px #4c240f, 0 9px 11px #13221377;
}
.controls button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; min-height: 87px; padding: 3px;
  border: 4px solid #9b5a24; border-radius: 15px;
  background: linear-gradient(#ffe2a1, #ebb264 75%, #d48b3a);
  box-shadow: inset 0 3px #fff2c7, inset 0 -4px #b8772e, 0 3px #572d14;
  color: #5b2d12; font-size: 48px; font-weight: 900; line-height: 1;
  text-shadow: 0 2px #fff3ce;
}
.controls button small { font-size: 16px; line-height: 1.1; font-weight: 900; }
.controls [data-action="drop"] { grid-column: 1 / -1; flex-direction: row; gap: .35em; min-height: 62px; font-size: 29px; }
.controls [data-action="down"] { display: none; }
.help { grid-column: 1; grid-row: 4; margin: -3px 0 0; color: #fff9de; font-size: 12px; text-align: center; text-shadow: 0 2px 3px #1c290e, 0 1px #243917; }
.touch-help { display: none; }
@media (pointer: coarse) { .touch-help { display: inline; } .key-help { display: none; } }

/* 選択・ポーズ・結果画面もタイトルの木と同じ素材感にする。 */
#overlay { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 12px; background: #102918a6; }
#overlay.stage-intro-overlay { background: #102918a6; }
.stage-intro-active .stage-map-header, .stage-intro-active .stage-map-footer { z-index: auto; pointer-events: none; }
.stage-intro-active .stage-map-header button { visibility: hidden; pointer-events: none; }
.stage-intro-active .stage-map-footer button { position: relative; z-index: 11; pointer-events: auto; }
#panel {
  width: min(92vw, 470px); max-height: calc(100svh - 24px); overflow: auto;
  padding: 17px 20px 21px; border: 7px solid #713817; border-radius: 23px;
  background: repeating-linear-gradient(175deg, #ffffff11 0 2px, transparent 2px 24px), linear-gradient(#ffe8af, #e4a964);
  box-shadow: inset 0 0 0 4px #ffedbe, inset 0 0 0 7px #b97b39, 0 8px #49230f, 0 20px 35px #0d1b0c99;
  text-align: center;
}
.timeup-heading[hidden] { display: none; }
.gameover-heading[hidden] { display: none; }
#panel.result-panel { width: min(94vw, 420px); max-height: 100svh; padding: 0 8px 12px; border: 0; background: none; box-shadow: none; }
.timeup-heading { position: relative; z-index: 1; display: block; width: 76%; height: auto; margin: 0 auto -18%; filter: drop-shadow(0 3px 4px #743b1f88); }
.gameover-heading { position: relative; z-index: 1; width: 76%; aspect-ratio: 2.2 / 1; margin: 0 auto -2%; filter: drop-shadow(0 3px 4px #743b1f88); }
.gameover-heading img { position: absolute; z-index: 1; top: -6%; left: 31%; width: 38%; height: auto; }
.gameover-heading strong { position: absolute; right: 0; bottom: 3%; left: 0; display: grid; min-height: 48%; place-items: center; padding: 4px 7px; border: 5px solid #6b3518; border-radius: 50% 50% 23% 23% / 35% 35% 22% 22%; background: linear-gradient(#ffda80, #e69a43 68%, #b86c2b); box-shadow: inset 0 3px #fff2ba, inset 0 -4px #91501d, 0 5px #51250e; color: #fff2a4; font-size: clamp(20px, 6.2vw, 30px); font-weight: 900; line-height: 1; white-space: nowrap; -webkit-text-stroke: 1px #a63315; text-shadow: 0 3px #8e260f, 2px 2px #8e260f, -2px 2px #8e260f; }
#panel.result-panel h2 { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.result-board { position: relative; width: 100%; aspect-ratio: 1086 / 1448; container-type: inline-size; }
.result-board > img { display: block; width: 100%; height: 100%; }
/* 曲線文字の実描画中心を、板の見出し枠中心（高さ14.5%）に合わせる。 */
.result-board-title { position: absolute; top: 11%; left: 19%; width: 62%; height: 9%; overflow: visible; fill: #71360e; filter: drop-shadow(0 1px #fff1c3); }
.result-board-title text { font: 900 59px system-ui, -apple-system, "Noto Sans JP", sans-serif; }
.result-row { position: absolute; left: 18%; right: 20%; height: 7%; transform: translateY(-50%); display: grid; grid-template-columns: 4cqw minmax(0, 1fr) auto; align-items: center; gap: .7cqw; margin: 0; color: #562b12; text-align: left; }
/* 文字領域の中心を、背景画像に描かれた各枠の中心に合わせる。 */
.result-row-1 { top: 29.35%; }
.result-row-2 { top: 38.4%; }
.result-row-3 { top: 47.25%; }
.result-row span { line-height: 1; }
.result-icon { color: #b56b24; font-size: 4cqw; text-align: center; }
.result-label { font-size: 3.7cqw; white-space: nowrap; }
.result-value { font-size: 4cqw; font-weight: 900; white-space: nowrap; }
.result-feature { position: absolute; top: 66.5%; left: 17%; right: 17%; height: 16%; transform: translateY(-50%); display: grid; place-content: center; margin: 0; color: #79310e; font-size: 4cqw; font-weight: 900; line-height: 1.1; }
.result-feature strong { font-size: 7.6cqw; }
#panelBody .result-note { position: absolute; top: 85.9%; left: 17%; right: 17%; height: 10%; transform: translateY(-50%); display: grid; place-content: center; margin: 0; color: #6b3515; font-size: 4.25cqw; font-weight: 900; line-height: 1.2; }
#panel.result-panel .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#panel.result-panel .choices button { font-size: clamp(15px, 4.3vw, 19px); }
#panel.result-panel .choices button:first-child { border-color: #b55f17; background: linear-gradient(#ffe877, #f4a52b); }
#panel.result-panel .choices button:nth-child(2) { border-color: #1b5b9f; background: linear-gradient(#9fe8ff, #318edb); color: #fff; text-shadow: 0 2px #164e88; }
#panel.result-panel .extra-choices button { background: linear-gradient(#fff8db, #e4ad63); }
@media (max-height: 650px) {
  #panel.result-panel .choices { margin-top: 8px; }
  #panel.result-panel .extra-choices { margin-top: 8px; }
}
@media (orientation: portrait) and (max-height: 800px) {
  #panel.result-panel { width: min(94vw, 50svh); }
}
@media (orientation: portrait) and (max-height: 700px) {
  #panel.result-panel { width: min(94vw, 48svh); }
}
@media (orientation: landscape) and (max-height: 600px) {
  #panel.result-panel { display: grid; width: min(96vw, 500px); grid-template-columns: min(47svh, 240px) minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 12px; overflow: visible; }
  #panel.result-panel .timeup-heading, #panel.result-panel .gameover-heading { grid-column: 1; grid-row: 1; }
  #panel.result-panel .gameover-heading strong { border-width: 3px; font-size: 13px; -webkit-text-stroke-width: .5px; text-shadow: 0 2px #8e260f, 1px 1px #8e260f, -1px 1px #8e260f; }
  #panel.result-panel #panelBody { grid-column: 1; grid-row: 2; }
  #panel.result-panel .choices { grid-column: 2; grid-row: 2; align-self: center; grid-template-columns: 1fr !important; margin: 0 0 70px; }
  #panel.result-panel .extra-choices { grid-column: 2; grid-row: 2; align-self: center; margin: 70px 0 0; }
}
.panel-mascot {
  display: block; width: 94px; height: 94px; margin: -7px auto -2px;
  filter: drop-shadow(0 3px 2px #7f492d66);
}
.panel-mascot canvas { display: block; width: 100%; height: 100%; }
.panel-mascot[hidden] { display: none; }
#panel h2 { margin: 0 0 7px; color: #693411; font-size: 24px; font-weight: 900; text-shadow: 0 2px #fff0c4; }
#panelBody p { margin: 7px 0; line-height: 1.5; }
#panelBody.left { text-align: left; font-size: 14px; }
#panelBody .goal { padding: 7px; border: 2px solid #b8742b; border-radius: 10px; background: #fff2b8; font-weight: 900; }
.choices { display: grid; gap: 9px; margin-top: 13px; }
.choices button, .extra-choices button {
  min-height: 49px; padding: 9px 7px; border: 3px solid #8f4e23; border-radius: 13px;
  background: linear-gradient(#fff3d2, #eeb86f);
  box-shadow: inset 0 2px #fffbed, 0 3px #6d3719;
  color: #5a2b12; font-size: 17px; font-weight: 900; line-height: 1.2;
}
.choices button small { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; }
.choices button.primary { background: linear-gradient(#ffe88d, #f4a644); }
.choices button.last { outline: 3px solid #93501d; outline-offset: 2px; }
.choices button.extra-hard { font-size: 14px; }
.extra-choices { display: flex; justify-content: center; gap: 8px; margin-top: 13px; }
.extra-choices[hidden] { display: none; }
.extra-choices button { min-height: 39px; font-size: 14px; }

/* 開始前の説明はステージ用の木枠に載せる。 */
#panel.stage-intro-panel {
  position: relative;
  width: min(96vw, 480px, 70.5svh);
  max-height: 94svh;
  aspect-ratio: 1086 / 1448;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: url("art/stage-intro-board.webp") center / 100% 100% no-repeat;
  box-shadow: none;
  container-type: inline-size;
}
/* 木札の中央を板の上端（画像高さの約 2.5%）に揃える。 */
#panel.stage-intro-panel h2 {
  position: absolute;
  z-index: 1;
  top: -6%;
  left: 13%;
  display: grid;
  place-items: center;
  width: 74%;
  height: 17%;
  margin: 0;
  padding: 0 4%;
  background: url("art/stage-intro-title.webp") center / 100% 100% no-repeat;
  color: #fff2ca;
  font-size: 5.8cqw;
  text-shadow: -1px -1px #713714, 1px 2px #713714, 0 0 3px #713714;
}
.stage-intro-headline[hidden], .stage-intro-hero[hidden], .stage-intro-goal[hidden] { display: none; }
#panel.stage-intro-panel .stage-intro-headline {
  position: absolute;
  top: 15%;
  left: 9%;
  display: grid;
  place-items: center;
  width: 82%;
  height: 6%;
  color: #542408;
  font-size: clamp(14px, 5cqw, 23px);
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}
#panel.stage-intro-panel .stage-intro-hero {
  position: absolute;
  top: 21.5%;
  left: 9.5%;
  width: 81%;
  height: 11.5%;
  background: url("art/stage-intro-forest.webp") center 62% / cover no-repeat;
}
.stage-intro-visuals { position: absolute; inset: 8% 7%; display: flex; align-items: center; justify-content: center; gap: 2%; }
.stage-intro-visuals > img { width: auto; max-width: calc(85% / var(--icon-count)); height: 70%; object-fit: contain; filter: drop-shadow(0 3px 3px #18361f9c); }
.stage-intro-big-rock { flex: none; width: auto; max-width: calc(85% / var(--icon-count)); height: 70%; aspect-ratio: 1; background: url("art/big-rock-burst.webp") 0 0 / 200% 200% no-repeat; filter: drop-shadow(0 3px 3px #18361f9c); }
.stage-intro-scene-badge[hidden] { display: none; }
.stage-intro-scene-badge { position: absolute; top: 7%; right: 7%; padding: 2px 7px; border: 2px solid #8f4a19; border-radius: 999px; background: #fff2c3; color: #6a320c; font-size: clamp(9px, 2.5cqw, 12px); line-height: 1; }
#panel.stage-intro-panel #panelBody {
  position: absolute;
  top: 33.5%;
  right: 9%;
  bottom: 32%;
  left: 9%;
  display: flex;
  flex-direction: column;
  gap: .4cqw;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #a7773f #f5dfa9;
  overscroll-behavior: contain;
  text-align: left;
}
#panel.stage-intro-panel #panelBody p {
  flex: none;
  min-height: 5.5cqw;
  margin: 0;
  padding: 2cqw 4cqw;
  border: 0;
  background: none;
  color: #542808;
  font-size: clamp(10.5px, 3cqw, 15px);
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
#panel.stage-intro-panel .stage-intro-scroll-cue {
  position: absolute;
  z-index: 1;
  top: 66%;
  right: 10%;
  display: grid;
  place-items: center;
  width: 6cqw;
  height: 6cqw;
  border-radius: 50%;
  background: #fff0c8;
  box-shadow: 0 1px 3px #743e1b;
  color: #7a3e16;
  font-size: 3.5cqw;
  pointer-events: none;
}
#panel .stage-intro-scroll-cue[hidden] { display: none; }
#panel.stage-intro-panel .stage-intro-goal {
  position: absolute;
  top: 68%;
  left: 9%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2%;
  width: 82%;
  height: 16%;
  padding: 0 8%;
  background: url("art/stage-intro-goal.webp") center / 100% 100% no-repeat;
  color: #542808;
  font-size: clamp(12px, 3.3cqw, 17px);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
}
#panel.stage-intro-panel .stage-intro-goal-label {
  position: relative;
  z-index: 0;
  flex: none;
  padding: .1em .4em;
  color: #fffce8;
  font-size: 1em;
  text-shadow: 0 1px #13542e;
}
#panel.stage-intro-panel .stage-intro-goal-label::before {
  position: absolute;
  z-index: -1;
  inset: -2px 0 2px;
  border: 1px solid #f7d57a;
  border-radius: 999px;
  background: linear-gradient(#2a9954, #08703b);
  box-shadow: inset 0 1px #c9f4ae, 0 2px 2px #5f341b80;
  content: "";
}
#panel.stage-intro-panel .stage-intro-goal-text {
  min-width: 0;
  flex: 0 1 auto;
  overflow-wrap: anywhere;
}
#panel.stage-intro-panel .choices, #panel.stage-intro-panel .extra-choices {
  position: absolute;
  left: 12%;
  width: 76%;
  margin: 0;
}
#panel.stage-intro-panel .choices { top: 78.5%; left: 5%; width: 90%; justify-items: center; }
#panel.stage-intro-panel .extra-choices { top: 97%; }
#panel.stage-intro-panel .choices button, #panel.stage-intro-panel .extra-choices button {
  width: max-content;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: 900 / 300;
  padding: 0 1em;
  border: 0;
  border-radius: 0;
  background: url("art/stage-intro-start.webp") center / contain no-repeat;
  box-shadow: none;
  color: #fff8dc;
  font-size: clamp(15px, 5cqw, 22px);
  text-shadow: -2px -2px #66310f, 2px 2px #66310f, 0 3px #66310f;
}
#panel.stage-intro-panel .choices button { width: 15em; padding-inline: .7em; font-size: clamp(17px, 5.8cqw, 24px); }
#panel.stage-intro-panel .choices button span {
  color: #fffdf0;
  font-family: "Rounded Mplus Start", system-ui, sans-serif;
  font-size: 1.35em;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: .09em #4e250e;
  paint-order: stroke fill;
  text-shadow: 0 2px #4e250e;
}
#panel.stage-intro-panel .extra-choices button {
  width: 8em;
  background-image: url("art/stage-intro-back.webp");
  color: #592b10;
  font-size: clamp(17px, 5.5cqw, 22px);
  text-shadow: 0 1px #fff0c5;
}
#panel.stage-intro-panel .extra-choices button span { font-size: .8em; }
#panel.stage-intro-panel button:active { transform: translateY(2px); }
#panel.stage-intro-panel {
  background: url("art/stage-intro-board.webp") center / 100% 100% no-repeat;
}
#panel.stage-intro-panel h2 {
  color: #fff2ca;
  font-size: 5.2cqw;
  text-shadow: -1px -1px #713714, 1px 2px #713714, 0 0 3px #713714;
}
#panel.stage-intro-panel .stage-intro-headline { top: 13%; height: 7%; }
#panel.stage-intro-panel .stage-intro-hero {
  top: 20%;
  left: 11%;
  width: 78%;
  height: 28%;
  background: linear-gradient(#fff7df9e, #fff7dfad), url("art/stage-intro-forest.webp") center / cover no-repeat;
}
#panel.stage-intro-panel .stage-intro-visuals {
  inset: 4% 5%;
  justify-content: space-around;
  gap: 0;
}
.stage-intro-win-stack { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; width: 37%; }
.stage-intro-win-stack img { display: block; width: auto; max-width: 80%; height: 42%; object-fit: contain; filter: drop-shadow(0 2px 2px #65381570); }
.stage-intro-win-down { display: block; height: 15%; color: #e07822; font-size: 5.2cqw; line-height: 1; text-shadow: 0 1px #fff; }
.stage-intro-win-across { color: #a35b22; font-size: 9cqw; font-weight: 900; line-height: 1; }
.stage-intro-win-result { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 39%; height: 80%; color: #744016; text-align: center; }
.stage-intro-win-result > span { color: #e99b20; font-size: 12cqw; line-height: 1; text-shadow: 0 2px #fff1bc; }
.stage-intro-win-result strong { font-size: 4cqw; line-height: 1.25; }
#panel.stage-intro-panel #panelBody {
  top: 48%;
  right: 13%;
  bottom: 32%;
  left: 13%;
  justify-content: center;
  gap: .5cqw;
  overflow: hidden;
  text-align: center;
}
#panel.stage-intro-panel #panelBody p {
  min-height: 0;
  padding: 1.2cqw 2cqw;
  font-size: clamp(12px, 3.3cqw, 16px);
  font-weight: 800;
  line-height: 1.25;
}
#panel.stage-intro-panel #panelBody p + p { color: #765438; font-size: clamp(11px, 2.8cqw, 14px); font-weight: 700; }
#panel.stage-intro-panel:not(.stage-intro-win) #panelBody p { padding-block: .5cqw; }
#panel.stage-intro-panel .stage-intro-goal {
  top: 68%;
  left: 5%;
  width: 90%;
  height: 18%;
  padding: 1% 9% 0;
  background: url("art/stage-intro-goal.webp") center / 100% 100% no-repeat;
  font-size: clamp(15px, 4.2cqw, 20px);
  line-height: 1.05;
}
#panel.stage-intro-panel .stage-intro-goal-label { padding: .25em .6em; font-size: 1em; }
#panel.stage-intro-panel .choices { top: 78.5%; }
#panel.stage-intro-panel .choices button { font-size: clamp(17px, 5.8cqw, 24px); }
#panel.stage-intro-panel .extra-choices { top: 97%; }
#panel.stage-intro-panel .extra-choices button {
  background-image: url("art/stage-intro-back.webp");
}
@media (orientation: portrait) {
  /* ステージ1で調整した配置を、すべてのステージ詳細に使う。 */
  #panel.stage-intro-panel .stage-intro-headline { top: 9.5%; }
  #panel.stage-intro-panel .stage-intro-goal { top: 69.5%; left: -1%; width: 102%; height: 23.2%; }
  #panel.stage-intro-panel .choices { top: 86%; }
  #panel.stage-intro-panel .choices button { width: 71.3cqw; font-size: clamp(13px, 4.5cqw, 19px); }
  #panel.stage-intro-panel .extra-choices { top: 100.5%; }
  #panel.stage-intro-panel .extra-choices button { width: 7em; }
  #panel.stage-intro-panel #panelBody p { font-size: clamp(13px, 3.6cqw, 17px); }
  #panel.stage-intro-panel #panelBody p + p { font-size: clamp(11.5px, 3cqw, 15px); }
}
@media (orientation: landscape) and (max-height: 600px) {
  #panel.stage-intro-panel { width: min(94vw, 70.5svh); }
  #panel.stage-intro-panel .choices { top: 78.5%; }
  #panel.stage-intro-panel .choices button { width: 12.3em; }
  #panel.stage-intro-panel .choices button span { font-size: 1.13em; }
  #panel.stage-intro-panel .extra-choices { top: 92.5%; }
  /* 横画面では板の大きさを保ちながら木札を画面内に収める。 */
  #panel.stage-intro-panel h2 { top: -4.25%; left: 15%; width: 70%; height: 13.5%; }
  #panel.stage-intro-panel .stage-intro-headline { top: 12.5%; height: 5%; }
  #panel.stage-intro-panel .stage-intro-hero { top: 17.5%; height: 4.5%; }
  #panel.stage-intro-panel #panelBody { top: 22%; bottom: 32%; }
  #panel.stage-intro-panel #panelBody p { padding: 2.3cqw 4.4cqw; font-size: clamp(10.2px, 3cqw, 15px); }
  #panel.stage-intro-panel .stage-intro-goal { top: 66.5%; padding: 0 8%; font-size: clamp(11px, 3.3cqw, 16px); }
  #panel.stage-intro-panel .stage-intro-headline { top: 12.5%; height: 6%; }
  #panel.stage-intro-panel .stage-intro-hero { top: 18%; height: 27%; }
  #panel.stage-intro-panel #panelBody { top: 45%; bottom: 32%; }
  #panel.stage-intro-panel .stage-intro-goal { top: 66.5%; font-size: clamp(14px, 4.8cqw, 18px); }
  #panel.stage-intro-panel:not(.stage-intro-win) .stage-intro-goal { font-size: clamp(12px, 4.2cqw, 16px); }
}
@media (orientation: landscape) and (max-height: 390px) {
  #panel.stage-intro-panel .choices { top: 78.2%; }
}
@media (orientation: portrait) and (max-width: 350px) {
  #panel.stage-intro-panel .stage-intro-hero { height: 8%; }
  #panel.stage-intro-panel #panelBody { top: 30%; bottom: 30.5%; }
  #panel.stage-intro-panel .stage-intro-hero { top: 19%; height: 27%; }
  #panel.stage-intro-panel #panelBody { top: 46%; bottom: 36%; }
}

@media (max-width: 680px) {
  .home-screen { justify-content: space-evenly; gap: 8px; }
  .home-logo { width: min(100%, 580px); max-height: 36svh; }
  .home-modes, .home-footer { width: min(96%, 510px); }
  .home-mode { grid-template-columns: 60px 1fr 52px; min-height: clamp(79px, 10svh, 105px); padding: 6px 10px; border-width: 4px; border-radius: 20px; }
  .home-copy strong { font-size: clamp(19px, 5.2vw, 27px); }
  .home-copy small { font-size: clamp(11px, 3vw, 15px); }
  .home-arrow { font-size: 24px; }
  .home-footer { gap: 8px; }
  .home-footer button { min-height: 66px; border-radius: 14px; }
  .wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 570px; gap: 7px; padding: max(7px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .title-row { top: 8px; left: 8px; }
  .menu-btn { width: 46px; height: 49px; font-size: 24px; }
  .hud { width: calc(100% - 54px); height: 100px; margin-left: 54px; padding: 7px; gap: 3px; }
  .hud > span { font-size: clamp(10px, 2.7vw, 14px); }
  .hud b { font-size: clamp(16px, 4vw, 23px); }
  .hud-next { gap: 0; }
  #next { width: min(100%, 68px); }
  .sidebar { display: none; }
  .board-assembly { order: 1; position: relative; width: min(calc((100svh - 265px) * .625), calc(100vw - 78px)); display: block; }
  .board-assembly .accelerator { position: absolute; top: 0; bottom: 0; left: 100%; width: 39px; }
  #game { border-width: 7px; }
  .controls { order: 2; width: min(calc((100svh - 265px) * .625), calc(100vw - 78px)); gap: 4px; padding: 4px; border-width: 3px; }
  .controls button { min-height: 49px; border-width: 2px; border-radius: 10px; font-size: 29px; }
  .controls button small { font-size: 10px; }
  .controls [data-action="drop"] { min-height: 47px; font-size: 24px; }
  .help { order: 3; font-size: 11px; }
}
@media (max-width: 370px) {
  .home-logo { max-height: 31svh; }
  .home-mode { grid-template-columns: 45px 1fr 43px; min-height: 71px; }
  .home-icon { font-size: 32px; }
  .home-copy strong { font-size: 18px; }
  .home-copy small { font-size: 10px; }
  .home-footer button { font-size: 13px; }
  .home-footer button span { font-size: 25px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .wrap {
    display: grid;
    grid-template-columns: calc((100svh - 18px) * .625) minmax(0, 1fr);
    grid-template-rows: 100px minmax(0, 1fr) 112px;
    gap: 4px 10px;
    align-content: stretch;
    width: 100vw;
    max-width: none;
    height: 100svh;
    margin: 0;
    padding: 7px;
  }
  .title-row { top: 16px; left: calc((100svh - 18px) * .625 + 19px); }
  .hud { grid-column: 2; grid-row: 1; width: calc(100% - 54px); height: 100px; margin-left: 54px; padding: 15px 8% 21px; }
  .board-assembly { grid-column: 1; grid-row: 1 / 4; order: 0; align-self: stretch; position: static; display: grid; width: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr) 31px; }
  #game { align-self: stretch; width: 100%; height: 100%; border-width: 7px; }
  .board-assembly .accelerator { position: static; width: auto; }
  .accelerator { gap: 3px; margin: 2px 0 2px -2px; padding: 3px 1px; border-width: 4px; border-left: 0; font-size: 8px; }
  .accelerator-track { width: 12px; }
  .accelerator b { font-size: 7px; }
  .sidebar { grid-column: 2; grid-row: 2; order: 0; display: flex; flex-direction: row; align-items: stretch; justify-content: center; width: 100%; min-height: 0; padding: 0; }
  .special-card { display: block; width: min(100%, 225px); padding: 5px; }
  .special-art { height: 55px; margin: 2px 0; }
  .special-art img { width: 52px; }
  .special-card strong, .special-card span.label { font-size: 13px; }
  .special-card small { margin-top: 2px; font-size: 10px; line-height: 1.2; }
  .controls { grid-column: 2; grid-row: 3; order: 0; width: 100%; height: 112px; gap: 4px; padding: 3px; border-width: 3px; }
  .controls button { min-height: 0; border-width: 2px; border-radius: 10px; font-size: 28px; }
  .controls button small { font-size: 10px; }
  .controls [data-action="drop"] { min-height: 0; font-size: 23px; }
  .help { display: none; }
}
@media (orientation: landscape) and (max-height: 350px) {
  .sidebar { display: none; }
}
@media (orientation: portrait) {
  .stage-map-page { width: 100vw; height: 100svh; --stage-footer-height: calc(100px + env(safe-area-inset-bottom)); }
  .stage-map-scene { top: 50%; left: 50%; right: auto; bottom: auto; width: max(100%, 56.28svh); height: auto; aspect-ratio: 941 / 1672; transform: translate(-50%, -50%); }
  .stage-map-art { object-fit: fill; }
  .stage-map-header { height: 116px; min-height: 0; }
  .stage-map-header h1 { position: absolute; top: 7px; left: 50%; width: min(52vw, 230px); margin: 0; transform: translateX(-50%); font-size: clamp(16px, 4.2vw, 22px); }
  .stage-map-header button { top: 8px; left: 5px; width: clamp(74px, 23vw, 96px); }
  .stage-map-node { width: clamp(43px, 12vw, 58px); font-size: clamp(20px, 6vw, 26px); }
  .stage-map-squirrel { width: clamp(47px, 13vw, 63px); }
  .stage-map-footer { gap: 2px; padding: 3px 3px max(3px, env(safe-area-inset-bottom)); }
  .stage-map-footer button { min-width: 50px; padding: 3px; }
  .stage-map-footer #stageMapPrev, .stage-map-footer #stageMapNext { width: clamp(128px, 42vw, 170px); font-size: clamp(17px, 5vw, 21px); }
  .stage-map-footer span { min-width: 45px; font-size: 13px; }
}
