@font-face {
  font-family: "Map WenKai";
  src: url('/fonts/map-wenkai.woff2?v=404-typeset') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Yuji Syuku";
  src: url("fonts/yuji-syuku.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Nanum Brush Script";
  src: url("fonts/nanum-brush.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond.woff2") format("woff2");
  font-style: italic;
  font-weight: 600;
  font-display: swap;
}
:root {
  color-scheme: light;
  font: 15px/1.5 system-ui,-apple-system,'PingFang SC','Microsoft Yahei',sans-serif;
  background: #f3f0e7;
  color: #333a33;
  --muted: #626b5e;
  --line: #b1b2a35c;
  --accent: #57684c;
  --seal-ink: #ae442e;
}
:root:lang(ja) {
  --inscription-font: "Yuji Syuku", "Hiragino Mincho ProN", serif;
}
:root:lang(ko) {
  --inscription-font: "Nanum Brush Script", "AppleMyungjo", serif;
}
:root:lang(en) {
  --inscription-font: "Cormorant Garamond", Georgia, serif;
  --inscription-style: italic;
  --inscription-weight: 600;
}
* { box-sizing: border-box; }
body { margin: 0; }
.game-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.game-shell :focus { outline: none; }
.game-shell img { -webkit-user-drag: none; }
.game-header {
  position: absolute;
  z-index: 2;
  top: max(15px,env(safe-area-inset-top));
  inset-inline: max(17px,env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}
.title-column {
  --inscription-unit: clamp(.32px, .052dvh, .46px);
  padding-top: 5px;
}
.title-inscription { display: flex; align-items: flex-end; gap: 5px; }
.title-inscription .wordmark {
  margin: 0;
  color: #453629;
  font: 400 calc(105 * var(--inscription-unit))/1 "Map WenKai", "Kaiti SC", KaiTi, serif;
  writing-mode: vertical-rl;
  letter-spacing: .07em;
}
.title-inscription:not(:lang(zh)) .wordmark {
  font-size: clamp(22px, 6.6vw, 42px);
  writing-mode: horizontal-tb;
  letter-spacing: 0;
}
.author-seal {
  width: calc(52 * var(--inscription-unit));
  height: auto;
  flex: none;
}
.corner-tools {
  position: fixed;
  top: max(20px,env(safe-area-inset-top));
  right: max(24px,env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.corner-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3e5142;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.corner-button:disabled { opacity: .48; cursor: default; }
.music-note { display: grid; place-items: center; flex: 0 0 15px; height: 15px; font-size: 17px; line-height: 15px; }
.language-control { position: relative; }
.mobile-language { display: none; }
.language-control summary { border-radius: 8px; list-style: none; }
.language-control summary::-webkit-details-marker { display: none; }
.language-control[open] summary { background: #f6f3e9; }
.globe-symbol {
  position: relative;
  width: 15px;
  height: 15px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.globe-symbol::before, .globe-symbol::after { content: ""; position: absolute; }
.globe-symbol::before {
  inset: -1px 3px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.globe-symbol::after { inset: 50% 0 auto; border-top: 1px solid currentColor; }
.language-chevron {
  width: 6px;
  height: 6px;
  margin: -3px 2px 0;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}
.language-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 152px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6f3e9;
  box-shadow: 0 10px 28px #3e514226;
}
.language-options button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 36px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.language-options button:hover { background: #57684c12; }
.language-options button[aria-pressed="true"] {
  color: #36563c;
  font-weight: 600;
}
.language-options button[aria-pressed="true"]::after {
  content: "";
  width: 5px;
  height: 9px;
  margin: -3px 2px 0;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}
.walk-mode {
  position: absolute;
  z-index: 2;
  bottom: max(22px,env(safe-area-inset-bottom));
  left: max(21px,env(safe-area-inset-left));
  display: flex;
  gap: 5px;
  max-width: calc(100% - 18px);
}
.walk-mode button {
  --seal-face-width: clamp(36px, 3.36vw, 52px);
  position: relative;
  width: clamp(40px, 3.7vw, 58px);
  aspect-ratio: 28/29;
  padding: 6px;
  color: var(--seal-ink);
  background: transparent;
  border: 0;
  border-radius: 15%;
  font: 600 clamp(10px, 1vw, 13px)/1.2 system-ui,sans-serif;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.walk-mode:lang(zh) button::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: var(--seal-face-width);
  height: calc(var(--seal-face-width) * 29 / 28);
  background: var(--seal-image) center bottom / 100% 200% no-repeat;
  pointer-events: none;
}
.walk-mode:lang(zh) button[aria-pressed="true"]::before { background-position: center top; }
.walk-mode:lang(zh) [data-copy] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.walk-mode [data-leader="human"] {
  --seal-image: url('lettering/human-hans.png?v=carved-seal-edges');
}
.walk-mode [data-leader="dogs"] {
  --seal-image: url('lettering/dogs-hans.png?v=dogs-lead');
}
.walk-mode:lang(zh-Hant) [data-leader="human"] { --seal-image: url('lettering/human-hant.png?v=carved-seal-edges'); }
.walk-mode:lang(zh-Hant) [data-leader="dogs"] { --seal-image: url('lettering/dogs-hant.png?v=dogs-lead'); }
.walk-mode:not(:lang(zh)) button {
  border: 1px solid var(--seal-ink);
  border-radius: 15% 11% 14% 10% / 17% 14% 19% 13%;
  color: var(--seal-ink);
  font-family: var(--inscription-font);
  font-style: var(--inscription-style,normal);
  font-weight: var(--inscription-weight,400);
  line-height: 1;
}
.walk-mode:not(:lang(zh)) button[aria-pressed="true"] {
  background: linear-gradient(157deg,#ba5039,#a6402e);
  color: #fff2dc;
}
.walk-mode:not(:lang(zh)) button {
  width: auto;
  min-height: 36px;
  padding: 4px 9px;
  aspect-ratio: auto;
  font-size: 17px;
  white-space: nowrap;
}
.walk-mode:lang(ja) button { font-size: 14px; }
.walk-mode:lang(ko) button { font-size: 20px; }
.map-picker {
  position: absolute;
  z-index: 2;
  right: max(21px,env(safe-area-inset-right));
  bottom: max(22px,env(safe-area-inset-bottom));
  color: #3e5142;
  font-size: 13px;
}
.map-trigger {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  background: #f3f0e7e8;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.map-trigger::-webkit-details-marker { display: none; }
.map-choices {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 3px;
  width: min(290px,calc(100vw - 24px));
  max-height: min(345px,50dvh);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border-radius: 8px;
  background: #f3f0e7;
}
.map-choices a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
}
.map-choices a[aria-current="page"] { color: #36563c; font-weight: 600; }
@media (max-width: 720px) {
  .map-picker {
    right: max(9px,env(safe-area-inset-right));
    bottom: calc(max(12px,env(safe-area-inset-bottom)) + 10px);
  }
}
:where(.gallery-back,.logo-option):focus-visible,
.game-shell :is(.corner-button, .language-options button, .map-trigger, .map-choices a):focus-visible {
  outline: none;
  text-decoration: underline;
  text-underline-offset: .26em;
}
.play {
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #c8dfe0;
  isolation: isolate;
}
#map {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: crosshair;
}
.play::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--paper-texture);
  pointer-events: none;
}
.play[data-season="winter"]::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: -330px -90px 0;
  background-image: var(--snow-texture);
  pointer-events: none;
  animation: falling-snow 6.8s linear infinite;
}
@keyframes falling-snow {
  to { transform: translateY(320px); }
}
@media (prefers-reduced-motion: reduce) {
  .play[data-season="winter"]::before { animation: none; }
}
@media (max-width: 720px) {
  .game-header { top: max(10px,env(safe-area-inset-top)); inset-inline: 9px; gap: 7px; }
  .title-column { --inscription-unit: clamp(.25px, .047dvh, .33px); }
  .walk-mode { left: max(9px,env(safe-area-inset-left)); bottom: calc(max(12px,env(safe-area-inset-bottom)) + 10px); }
}
.logo-page { min-height: 100dvh; background: #f3f0e7; }
.logo-gallery { width: min(940px,calc(100% - 36px)); margin: 0 auto; padding: clamp(22px,5vw,58px) 0; }
.gallery-back { color: #4d674d; text-underline-offset: .2em; }
.logo-gallery h1 { margin: 21px 0 4px; font-size: clamp(25px,4vw,34px); }
.logo-gallery p { margin: 0 0 21px; color: var(--muted); }
.logo-options { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,128px),1fr)); gap: clamp(8px,2vw,20px); }
.logo-option {
  display: block; min-width: 0; text-decoration: none; color: inherit; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px; background: #f9f6ec;
}
.logo-option > img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.logo-option div { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding: 10px 13px; }
.logo-option:hover { border-color: #6d8068; }
.logo-option strong { font-size: clamp(12px,2vw,15px); }
.icon-sample { width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 3px; }
@media (max-width: 440px) {
  .logo-option div { padding: 7px 5px; }
  .icon-sample { width: 16px; height: 16px; }
}

@media (max-width: 720px), (pointer: coarse) and (max-height: 600px) {
  .corner-tools {
    top: calc(8px + env(safe-area-inset-top,0px));
    right: max(9px,env(safe-area-inset-right));
    gap: 4px;
  }
  .corner-button { min-height: 44px; min-width: 44px; padding-inline: 8px; }
  .language-control { display: none; }
  .mobile-language { display: block; position: relative; }
  .mobile-language select {
    position: absolute;
    top: -6px;
    left: -3px;
    width: calc(100% + 11px);
    height: calc(100% + 12px);
    font-size: 16px;
    opacity: 0;
    z-index: 1;
    touch-action: manipulation;
  }
  .mobile-language .corner-button { pointer-events: none; }
}

.map-choices .map-home {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin-bottom: 3px;
  font-weight: 600;
}
