:root {
  color: #2a2328;
  background: #fff;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button {
  font: inherit; color: inherit; border: 0; border-radius: 8px;
  background: #f3f4f6; min-height: 44px; padding: 10px 12px;
  touch-action: manipulation; overflow-wrap: anywhere;
}
button:disabled { opacity: .45; }
button:focus-visible { outline: 2px solid #a55173; outline-offset: 2px; }
.town-app {
  max-width: 480px; margin: auto;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
}
.town { border-radius: 12px; background: #eaf1e5; padding: 10px; }
.hud {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
  background: #fff; padding: 10px; border-radius: 8px;
}
.goal { font-size: 12px; margin: 8px 0; color: #475346; line-height: 1.5; }
.companion { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 112px; }
.companion > div { min-width: 0; overflow-wrap: anywhere; }
.companion img { object-fit: contain; flex-shrink: 0; }
.companion p { margin: 5px 0; font-weight: 600; }
.companion small { font-size: 11px; line-height: 1.7; color: #52604c; }
.map { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 8px 0; }
.place {
  min-width: 0; min-height: 94px; padding: 7px 3px;
  background: #fff; border: 2px solid transparent; text-align: center;
  display: grid; grid-template-rows: auto auto auto 16px; align-content: center;
}
.place[aria-pressed=true] { border-color: #6e626a; background: #eef0f3; }
.place[data-unavailable=true] { border-style: dashed; }
.place .icon { display: block; margin: 0; font-size: 23px; line-height: 25px; }
.place strong { display: block; font-size: 13px; }
.place small { display: block; font-size: 11px; margin-top: 2px; color: #6e626a; }
.place-status { font-size: 10px; line-height: 16px; color: #6e626a; white-space: nowrap; }
.place-home { grid-column: 1/-1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.place-home .icon { font-size: 21px; }
.place-home small { margin: 0; }
.place-home .place-status { display: none; }
.speech { background: #fff; border-radius: 8px; min-height: 59px; padding: 10px; line-height: 1.5; margin-top: 6px; font-size: 13px; }
#outcome { display: block; font-size: 12px; line-height: 1.5; margin-bottom: 4px; }
#outcome[hidden], #gift[hidden] { display: none; }
.actions { padding-top: 10px; }
#destination { min-height: 42px; line-height: 1.6; font-size: 13px; }
.action-row { display: flex; gap: 8px; margin-top: 8px; }
.action-row button { flex: 1; min-width: 0; }
#go { background: #f0dce4; }
#availability { font-size: 12px; color: #6e626a; min-height: 36px; margin: 6px 0; line-height: 1.5; }
#sleep { width: 100%; }
.footer { display: flex; gap: 8px; margin-top: 10px; }
.footer button { flex: 1; min-width: 0; }
#save-warning, #load-warning { font-size: 12px; color: #984851; }
dialog {
  width: calc(100% - 32px); max-width: 420px;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  border: 0; border-radius: 12px; padding: 16px; color: #2a2328;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #2a232855; }
dialog h2 { font-size: 19px; margin: 0 0 12px; flex-shrink: 0; }
dialog p { line-height: 1.7; }
#modal-body { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
#modal-body > p:last-child { margin-bottom: 0; }
#modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; flex-shrink: 0; }
#modal-actions button { flex: 1; min-width: 100px; }
.memory { padding: 12px 0; border-bottom: 1px solid #eee; }
.memory p { font-size: 13px; margin: 6px 0; }
.memory.locked { color: #6e626a; }
.result-stats { background: #f3f4f6; padding: 12px; border-radius: 8px; }
.game-title-accessible {
  position: absolute !important; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 350px) {
  .town-app { padding-inline: 8px; }
  .companion img { width: 96px; height: 96px; }
  .hud { font-size: 12px; }
}
@media (max-height: 700px) {
  .companion { min-height: 88px; }
  .companion img { width: 88px; height: 88px; }
  .place { min-height: 86px; padding-block: 4px; }
  .place-home { min-height: 44px; }
  .speech { min-height: 50px; padding: 8px; }
}
