/* Responsive geometry, loaded after appearance tokens. */
html {
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: clip;
}
button,
input,
select,
textarea {
  max-width: 100%;
}
:where(dialog) {
  overscroll-behavior: contain;
  scroll-padding-block: 20px;
}
:where(dialog) :is(img, video, iframe) {
  max-width: 100%;
}
:where(dialog) :is(h2, h3, p, strong, span) {
  overflow-wrap: anywhere;
}
.walk-buttons {
  gap: 8px;
}
.walk-buttons button {
  flex: 1 1 auto;
}
@media (min-width: 901px) and (max-width: 1200px) {
  .walking-hud {
    width: 280px;
    right: 18px;
  }
  .festival-dock,
  .hide-mission .festival-dock {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    max-width: calc(100% - 200px);
  }
}
@media (max-width: 900px) {
  :root {
    --scene-height: clamp(480px, 68svh, 600px);
  }
  main {
    width: 100%;
  }
  .world,
  .hide-mission .world {
    height: var(--scene-height);
  }
  header {
    padding-inline: max(16px, env(safe-area-inset-left));
    gap: 10px;
    width: 100%;
  }
  .walking-hud {
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
    background: #fff;
  }
  .walking-hud .walk-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }
  .walk-buttons button,
  .walk-buttons button + button {
    min-height: 44px;
    font-size: 12px;
    padding: 10px;
  }
  .walking-hint {
    line-height: 1.6;
  }
  .emote-buttons {
    gap: 8px;
    margin-top: 12px;
  }
  .emote-buttons button {
    min-height: 44px;
    min-width: 52px;
    font-size: 12px;
  }
  .village-directory {
    padding: 16px;
    border-radius: 0;
    box-shadow: none;
    background: #f5f5f7;
  }
  .village-directory button {
    min-height: 44px;
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
  }
  .festival-dock,
  .hide-mission .festival-dock {
    border-radius: 0;
    box-shadow: none;
    padding-bottom: 12px;
  }
  .festival-dock button {
    min-height: 76px;
  }
  .festival-dock span {
    font-size: 11px;
  }
  .page-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-footer button {
    min-height: 44px;
    min-width: 72px;
    font-size: 12px;
  }
  .page-footer > span {
    width: 100%;
  }
  .scene-tools button {
    min-height: 44px;
    font-size: 11px;
  }
  .touch-pad {
    top: calc(var(--scene-height) - 108px);
    left: 16px;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
    gap: 5px;
  }
  .touch-pad button {
    width: 44px;
    height: 44px;
  }
  .scene-tools,
  .watching-show .scene-tools {
    left: auto;
    right: 16px;
    bottom: 14px;
    max-width: calc(100% - 178px);
    padding: 3px;
  }
  .inventory {
    top: calc(var(--scene-height) - 238px);
    left: 16px;
  }
  .collection-book {
    top: calc(var(--scene-height) - 180px);
    left: 16px;
  }
  .guide-gift-button {
    top: calc(var(--scene-height) - 180px);
    left: 148px;
  }
  .collection-book,
  .guide-gift-button {
    min-height: 48px;
    max-width: 128px;
    padding: 7px 10px;
  }
  .solo-journey-dialog {
    padding: 22px;
  }
}
@media (max-width: 600px) {
  header {
    height: 72px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    gap: 6px;
  }
  header .brand {
    font-size: 18px;
    flex: 1;
    letter-spacing: -0.6px;
    white-space: nowrap;
  }
  header .brand span {
    font-size: 8px;
    letter-spacing: 1px;
  }
  header #help {
    min-height: 44px;
    font-size: 11px;
    padding: 9px 12px;
  }
  header .profile-button {
    min-height: 44px;
    padding: 9px 10px;
    max-width: 88px;
    font-size: 11px;
  }
  .sky-caption {
    display: none;
  }
  .river-switcher,
  .hide-mission .river-switcher,
  .watching-show .river-switcher {
    top: 80px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    min-height: 48px;
  }
  .river-switcher button {
    min-width: 44px;
    min-height: 48px;
  }
  .river-switcher #river-select strong {
    font-size: 12px !important;
  }
  .online-status {
    top: 140px;
    right: 12px;
    max-width: calc(100% - 24px);
    padding: 6px 10px;
  }
  .online-status button {
    min-height: 32px;
    font-size: 11px;
  }
  .festival-status {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    margin: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
    padding: 10px 16px;
    order: 0;
    min-height: 48px;
    font-size: 10px;
    box-shadow: none;
  }
  .festival-status #star-total {
    font-size: 12px;
  }
  .festival-status #panel-toggle {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 11px;
    margin-left: auto;
  }
  .scene-tools button {
    padding: 6px 7px;
    font-size: 10px;
  }
  .village-directory > div {
    min-width: 0;
  }
  .village-directory h3 {
    font-size: 17px;
  }
  .village-directory button {
    font-size: 11px;
  }
  .village-directory .vn-festival-launcher {
    min-height: 44px;
  }
  .festival-dock,
  .hide-mission .festival-dock {
    padding-inline: 8px;
    gap: 4px;
  }
  .festival-dock span {
    font-size: 10px;
    white-space: normal;
  }
  :is(
    .arrival-dialog,
    .guide-dialog,
    .festival-dialog,
    .river-map-dialog,
    .theater-video-dialog,
    .vn-festival-dialog,
    .solo-journey-dialog,
    #dialog
  ) {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    max-height: calc(
      100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    border-radius: 22px;
    padding: 20px;
    margin: auto;
  }
  .arrival-dialog {
    padding: 0;
  }
  .arrival-identity form,
  .arrival-destinations {
    padding: 24px 20px;
  }
  .arrival-dialog h2,
  .guide-dialog h2,
  .festival-dialog h2,
  .solo-journey-dialog h2 {
    font-size: 23px;
  }
  .arrival-identity input {
    font-size: 16px;
  }
  .arrival-bottom {
    gap: 10px;
  }
  .arrival-bottom .primary,
  .arrival-bottom .choice {
    min-height: 48px;
    font-size: 12px;
  }
  .destination-grid button > span,
  .destination-grid h3,
  .destination-grid strong,
  .destination-grid button > small {
    margin-inline: 12px;
  }
  .guide-dialog .primary,
  .guide-dialog .choice {
    min-height: 48px;
  }
  .guide-game-header {
    min-width: 0;
  }
  .guide-match-columns {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .guide-match-columns button {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    min-height: 90px;
    font-size: 12px;
  }
  .guide-proximity-bubble {
    max-width: min(210px, calc(100vw - 32px));
  }
  .guide-proximity-bubble button {
    min-height: 36px;
  }
  .solo-score > strong {
    font-size: 38px;
  }
  .solo-tasks article {
    padding: 13px;
  }
  .solo-journey-dialog summary {
    min-height: 44px;
    display: list-item;
    line-height: 1.7;
  }
  .shore-trash-label {
    min-height: 44px;
  }
}
@media (max-width: 360px) {
  header .brand {
    font-size: 16px;
  }
  header #help,
  header .profile-button {
    padding-inline: 8px;
    max-width: 76px;
  }
  .scene-tools,
  .watching-show .scene-tools {
    right: 10px;
    max-width: calc(100% - 170px);
  }
  .scene-tools button {
    padding-inline: 5px;
    font-size: 9px;
  }
  .guide-dialog,
  .solo-journey-dialog {
    padding: 16px;
  }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  :root {
    --scene-height: max(320px, 100svh);
  }
  .inventory {
    top: 146px;
  }
  .inventory button {
    width: 38px;
    height: 38px;
  }
  .inventory .item-art {
    width: 36px;
    height: 36px;
  }
  .collection-book,
  .guide-gift-button {
    top: 194px;
    min-height: 44px;
  }
  .touch-pad {
    top: calc(var(--scene-height) - 106px);
  }
  .scene-tools {
    bottom: 12px;
  }
}

.map-art > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-art:has(> img) {
  height: 150px;
}
