#logo { top: max(42px, calc(env(safe-area-inset-top) + 36px)); }
#hud { top: calc(max(env(safe-area-inset-top), var(--kids-inset-top, 0px)) + 19px); }
.title-actions {
  position: absolute; z-index: 2;
  inset-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  bottom: max(clamp(12px, 3vw, 28px), calc(env(safe-area-inset-bottom) + 12px));
  width: min(920px, calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - clamp(32px, 8vw, 88px)));
  margin-inline: auto;
  display: grid; justify-items: center; gap: 10px;
}
#play {
  width: 100%; min-height: clamp(71px, 9vw, 82px); padding: 8px 16px;
  border: 0; border-radius: 30px; background: var(--sun);
  border-image: url(art/button-wide.webp) 0 155 fill / 0 52px / 0 stretch;
  filter: drop-shadow(0 4px 0 #dcb057) drop-shadow(0 4px 8px #3a2a5c26);
  font-size: clamp(27px, 7vw, 34px); line-height: 1.1; font-weight: 650;
}
.title-secondary {
  display: flex; justify-content: center; gap: 10px; width: min(100%, 340px);
}
.title-secondary button {
  flex: 0 1 165px; min-height: 64px; min-width: 0; padding: 8px 12px;
  color: var(--ink); background: #fff5db; border: 2px solid #d1a771; border-radius: 21px;
  box-shadow: 0 3px 0 #906a44, 0 5px 10px #311b2430;
  font-weight: 550; font-size: 18px;
}
#menu-button {
  position: absolute; z-index: 14;
  top: calc(max(env(safe-area-inset-top), var(--kids-inset-top, 0px)) + 8px);
  left: calc(max(env(safe-area-inset-left), var(--kids-inset-left, 0px)) + 8px);
  display: grid; place-items: center; width: 64px; height: 64px; padding: 0;
  background: #fff5dc; border: 2px solid #bc8254; border-radius: 22px;
  box-shadow: inset 0 2px 0 #fffaf2, 0 3px 0 #926240, 0 4px 12px #3a2a5c26;
}
#menu-button svg { width: 28px; fill: none; stroke: var(--ink); stroke-linecap: round; stroke-width: 2.5; }
body[data-screen="result"] #menu-button { z-index: 35; }
.pk-host:is([data-surface="places"], [data-surface="book"]) .pk-panel {
  background: #fff6e1; border: 2px solid #ce9b66; border-image: none; border-radius: 26px;
  box-shadow: 0 5px 0 #a86a50, 0 22px 60px #2a173e46;
  padding: 12px 15px 14px;
}
.pk-host:is([data-surface="places"], [data-surface="book"]) .pk-ribbon { min-height: 40px; margin: 0 0 8px; padding: 0; }
.pk-host:is([data-surface="places"], [data-surface="book"]) .pk-primary { font-size: 20px; }
.pk-host[data-surface="places"] .pk-panel { overflow: auto; }
.book-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 6px 4px 0; font-size: 15px; }
.book-caption .book-total { margin: 0; white-space: nowrap; }
#game-menu {
  width: min(calc(100% - 28px), 430px); max-height: calc(100dvh - 24px);
  margin: auto; padding: 0; color: var(--ink);
  background: #fff6e1; border: 2px solid #ce9b66; border-radius: 28px;
  box-shadow: 0 5px 0 #a86a50, 0 22px 60px #2a173e46;
  overflow: auto;
}
#game-menu[open] { animation: menu-in 220ms cubic-bezier(.22,.8,.27,1) both; }
#game-menu::backdrop { background: #2c1d3d82; }
@keyframes menu-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.menu-panel { padding: 17px clamp(14px, 4vw, 24px) 15px; }
.menu-panel h2 { margin: 0 0 11px; text-align: center; font-size: 28px; font-weight: 650; }
.menu-settings {
  display: grid; padding: 0 10px; background: #f9ebce;
  border: 1px solid #dec6a0; border-radius: 17px; box-shadow: inset 0 2px 5px #78532d15;
}
.menu-settings button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 64px; padding: 5px 3px; background: none; border: 0;
  text-align: left; font-weight: 550; font-size: 17px;
}
.menu-settings button + button { border-top: 1px solid #ddc39e; }
.menu-switch { display: flex; align-items: center; flex: 0 0 54px; height: 32px; padding: 3px; border: 1px solid #a98cbd; border-radius: 20px; background: #d8c9e1; }
.menu-switch::after {
  content: ""; width: 24px; height: 24px; border-radius: 50%; background: #fffbf0;
  box-shadow: 0 1px 3px #4e37568c; transition: transform 160ms ease-out;
}
[aria-checked="true"] .menu-switch { background: #8bdbc0; border-color: #619b85; }
[aria-checked="true"] .menu-switch::after { transform: translateX(21px); }
.menu-actions { display: grid; gap: 4px; margin-top: 10px; }
#menu-resume {
  min-height: 66px; width: 100%; padding: 0 13px; border: 0; border-radius: 23px;
  background: var(--sun) url(art/button-wide.webp) center / 100% 100% no-repeat;
  font-size: 23px; font-weight: 650;
}
.menu-links { display: flex; justify-content: center; gap: 8px; }
.menu-quiet {
  min-height: 64px; min-width: 100px; padding: 0 9px;
  border: 0; border-radius: 14px; background: transparent; font-size: 16px; font-weight: 550;
}
.menu-quiet:hover { background: #f2dfbd; }
#menu-gate { position: relative; display: block; margin: 0 auto; color: #604878; }
#menu-exit { color: #693b52; }
.place-label { display: flex; flex-direction: column; align-items: flex-start; }
.place-label small { color: #574475; font-size: 14px; }
.place-progress { display: flex; gap: 4px; }
.place-progress i { display: block; width: 10px; height: 10px; border: 1px solid #a99277; border-radius: 50%; background: #f0dfbd; }
.place-progress i.done { background: #67b69d; border-color: #478773; }
.place-progress i.current { background: #ffca65; border-color: #c08146; }
.area-pips { justify-content: center; }
@media (max-height: 600px) and (orientation: portrait) {
  .title-scene { height: 110%; inset-block: auto 0; object-position: center bottom; }
}
@media (max-height: 470px) and (min-aspect-ratio: 16/9) {
  .title-scene { width: 145%; inset-inline: -22.5% auto; object-position: center bottom; }
}
@media (max-height: 470px) and (orientation: landscape) {
  .menu-panel { padding-top: 10px; }
  .menu-settings { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .menu-settings button + button { border-top: 0; }
  .menu-settings button:nth-child(n + 3) { border-top: 1px solid #ddc39e; }
  .menu-settings button { font-size: 15px; }
  .title-actions { bottom: calc(env(safe-area-inset-bottom) + 10px); gap: 7px; }
  #play { min-height: 64px; }
}
