/* 본문 글꼴: 갈무리11 (한글 도트 글꼴, SIL OFL 1.1, fonts/Galmuri-LICENSE.txt). 오프라인을 위해 파일을 같이 둔다. */
@font-face { font-family: "Galmuri11"; src: url("../../fonts/Galmuri11.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Galmuri11"; src: url("../../fonts/Galmuri11-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --night: #2a1f14; --wood: #8a5a2b; --wood-dark: #5b3a1c;
  --mat: #cfc48a; --mat-2: #dcd2a0; --heri: #2f4a2c; --heri-2: #3f6238; --shoji: #efe9d6;
  --ink: #2b2415; --ink-2: #5a5032; --accent: #8c2f1b; --teal: #1b5646;
  --cream: #f3ecd2; --gold: #f2c14e; --steam: #7fd1c7; --ember: #ef7a5a;
  /* 옛 이름: 창 바탕과 테두리, 흐린 글자 */
  --win: var(--mat); --win-2: var(--mat-2); --frame: var(--heri); --mist: var(--ink-2);
  /* 다다미 골풀 결: 12x6 타일을 2배로, 흐림 없이 */
  --tatami: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 12 6' shape-rendering='crispEdges'><rect x='0' y='1' width='12' height='1' fill='%23c7bc82'/><rect x='0' y='4' width='12' height='1' fill='%23d6cb92'/><rect x='8' y='5' width='1' height='1' fill='%23c7bc82'/></svg>");
  --f-pixel: "Press Start 2P", ui-monospace, monospace;
  --f-display: "Black Han Sans", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --f-body: "Galmuri11", "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--night);
  color: var(--cream);
  font: 16px/1.6 var(--f-body);
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 88px max(16px, env(safe-area-inset-left, 0px));
}
#app { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
h1 { font-size: 34px; color: var(--cream); }
h2 { font-size: 24px; color: var(--accent); }
h3 { font-size: 18px; color: var(--accent); }
p { margin: 0; }
.muted { color: var(--ink-2); }
.loading { color: var(--cream); }
.loading { position: fixed; inset: 0; display: grid; place-items: center; }
.small { font-size: 14px; }
.pix { font-family: var(--f-pixel); font-size: 10px; line-height: 1.8; }
.win {
  background: var(--mat) var(--tatami); color: var(--ink); border: 3px solid var(--heri); border-radius: 8px;
  box-shadow: 0 0 0 3px var(--wood);
  padding: 14px; display: grid; gap: 10px; min-width: 0;
}
.btn {
  min-height: 44px; padding: 8px 12px; color: var(--ink); background: var(--mat-2);
  border: 2px solid var(--heri); border-radius: 10px; font: inherit; font-family: var(--f-display); font-size: 16px; cursor: pointer;
  text-align: center; display: block; width: 100%; margin-bottom: 4px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 4px 0 var(--wood-dark);
}
.btn.primary { background: var(--heri); border-color: var(--heri); color: var(--cream); box-shadow: inset 0 2px 0 rgba(242, 193, 78, .55), 0 4px 0 var(--wood-dark); }
.btn:active:not(:disabled) { background: var(--heri); color: var(--cream); transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 1px 0 var(--wood-dark); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.alert { border-color: var(--ember); }
.alert strong { color: var(--accent); }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.chips .btn { padding: 6px 2px; font-size: 13px; white-space: nowrap; }
.chips .btn.active { background: var(--heri); border-color: var(--heri); color: var(--cream); }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; }
.log time { color: var(--accent); font-size: 14px; }
.log small { display: block; color: var(--mist); font-size: 14px; }
.quest-item { text-align: left; }
.status { color: var(--teal); font-size: 14px; }
.status.skipped { color: var(--mist); }
.warn { color: var(--accent); }
.stars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stars .btn.active { background: var(--heri); color: var(--cream); border-color: var(--heri); }
textarea {
  width: 100%; min-height: 90px; padding: 10px; color: var(--ink); background: var(--shoji);
  border: 2px solid var(--heri); border-radius: 6px; font: inherit;
}
input[type=file] { display: none; }
.photo { width: 100%; display: block; border-radius: 4px; background: var(--night); }
.entry { display: grid; gap: 6px; padding: 10px; background: var(--win-2); border-radius: 4px; min-width: 0; overflow-wrap: anywhere; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--wood-dark); border-top: 2px solid var(--wood);
}
.nav::-webkit-scrollbar { display: none; }
.nav-back, .nav-item {
  position: relative; flex: 0 0 auto; min-width: 76px; height: 58px; padding: 4px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink); background: var(--mat-2); border: 2px solid var(--heri); border-radius: 12px; cursor: pointer;
  font-family: var(--f-display); font-size: 14px; line-height: 1.2; word-break: keep-all; white-space: nowrap;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 3px 0 var(--wood-dark);
}
.nav-back { background: var(--gold); border-color: var(--wood); }
.nav-item.active { background: var(--heri); color: var(--cream); border-color: var(--gold); }
.nav-back:active, .nav-item:active { transform: translateY(2px); }
.nav-back:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-back .px-icon, .nav-item .px-icon { flex: none; }
.nav-item::before {
  content: ''; display: none; position: absolute; left: -13px; top: 50%; width: 10px; height: 14px; margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23f2c14e' d='M0 0h1v7H0zM1 1h1v5H1zM2 2h1v3H2zM3 3h1v1H3z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: cursor-blink 1s steps(2) infinite;
}
@media (orientation: landscape) { .nav-item.active::before { display: block; } }
@keyframes cursor-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .nav-item::before { animation: none; } }
.sound-note {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 40; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); margin: 0; padding: 10px 14px; font-size: 14px; line-height: 1.5; text-align: center;
  color: var(--ink); background: var(--mat) var(--tatami); border: 2px solid var(--heri);
  box-shadow: 0 0 0 2px var(--wood);
}
.setting-row .btn, .dialog-head .btn, .qlog-head .btn { margin-bottom: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.setting-label { font-weight: 700; }
.setting-switch { width: auto; min-width: 88px; }
.setting-switch.is-on, .setting-option.active { background: var(--heri); border-color: var(--heri); color: var(--cream); }
.setting-options { display: flex; gap: 6px; }
.setting-option { width: auto; min-width: 88px; padding: 8px 10px; }
.win.alert.restart { gap: 12px; }
.restart-panel { display: grid; gap: 12px; padding-top: 12px; border-top: 2px dashed var(--wood); }
.restart-warn { color: var(--accent); }
/* 밀어서 확인: 손잡이를 끝까지 밀어야 한다 */
.slide-track {
  --slide: 0; position: relative; height: 48px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--shoji); border: 0; box-shadow: 0 0 0 2px var(--heri); border-radius: 6px;
}
.slide-fill { position: absolute; inset: 0 auto 0 0; width: calc(48px + (100% - 48px) * var(--slide)); background: var(--gold); }
.slide-text { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 40px; color: var(--ink); font-size: 14px; pointer-events: none; }
.slide-handle {
  position: absolute; top: 0; left: calc((100% - 48px) * var(--slide)); width: 48px; height: 48px;
  display: grid; place-items: center; color: var(--cream); background: var(--heri); border-radius: 4px; cursor: grab; touch-action: none;
}
.slide-track.is-return .slide-handle { transition: left .2s ease-out; }
.slide-track.is-return .slide-fill { transition: width .2s ease-out; }
.slide-handle:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
@media (prefers-reduced-motion: reduce) { .slide-track.is-return .slide-handle, .slide-track.is-return .slide-fill { transition: none; } }
.screen { display: grid; gap: 14px; min-width: 0; }
/* 메뉴 화면에서 창 밖(짙은 나무 바탕)에 바로 놓인 글자는 밝게 */
.screen > h2, .screen > h3, .screen > .row h2 { color: var(--gold); }
.screen > h2, .screen > .row h2 { text-shadow: -1px 0 var(--shadow), 1px 0 var(--shadow), 0 -1px var(--shadow), 0 1px var(--shadow), 0 2px 0 var(--shadow); }
.win h2 { display: inline-block; justify-self: start; padding: 2px 12px; color: var(--cream); background: var(--heri); border-radius: 6px; box-shadow: 0 3px 0 var(--wood-dark); }
.screen > .muted, .screen > .row .pix { color: var(--cream); }
.screen > .warn { color: var(--ember); }
.code { color: var(--accent); font-family: var(--f-pixel); font-size: 13px; overflow-wrap: anywhere; line-height: 1.8; }

/* 시작 화면 */
#stage { position: fixed; inset: 0; z-index: 0; display: block; image-rendering: pixelated; }
body.title-mode { padding: 0; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.title-mode #app { display: block; max-width: none; position: relative; z-index: 1; }

.title-screen {
  --px: 5px;
  --plate: 46px;
  --shadow: #1c140b;
  position: fixed; inset: 0; z-index: 1;
  display: grid;
  grid-template-columns: minmax(180px, 27%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "logo party" "logo start";
  gap: 6px 10px;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  overflow: hidden;
}

.title-logo { grid-area: logo; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.logo-eyebrow { color: var(--cream); font-size: 8px; text-shadow: 1px 1px 0 var(--shadow); white-space: nowrap; }
.logo-title {
  font-size: min(11.5vh, 5.6vw); line-height: 1.12; color: var(--cream);
  text-shadow: 3px 3px 0 var(--shadow), -1px -1px 0 var(--shadow), 1px -1px 0 var(--shadow), -1px 1px 0 var(--shadow);
  display: grid; white-space: nowrap;
}
.logo-line:last-child { color: var(--gold); }
.logo-letter { display: inline-block; animation: letter-wave 6s linear calc(var(--i) * 70ms) infinite; }
.logo-date { color: var(--cream); font-size: 8px; text-shadow: 1px 1px 0 var(--shadow); white-space: nowrap; }
.music-hint {
  margin-top: auto; align-self: flex-start; padding: 4px 8px; font-size: 12px; line-height: 1.35;
  color: var(--ink); background: var(--mat) var(--tatami); box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}

.title-party { grid-area: party; position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; }
.party-label {
  position: absolute; top: 6px; left: 0; right: 0; text-align: center; color: var(--cream); font-size: 10px;
  text-shadow: 2px 2px 0 var(--shadow); animation: blink 1.2s steps(2, jump-none) infinite;
}
.has-pick .party-label { display: none; }
.hero-slot { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; min-height: 0; }
.hero {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; background: none; border: 0;
  font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; outline: none;
}
.hero-stage {
  position: relative; display: block; width: calc(var(--px) * 28); height: calc(var(--px) * 30); transform-origin: 50% 100%;
  transition: transform .24s cubic-bezier(.3, 1.8, .5, 1), filter .2s linear;
}
.hero-sprite {
  position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; transform-origin: 50% 97%;
  animation: hero-idle 1.2s steps(2, jump-none) infinite;
}
.hero-shadow {
  position: absolute; left: 50%; bottom: 0; width: calc(var(--px) * 14); height: calc(var(--px) * 3); transform: translate(-50%, 30%);
  background: rgba(32, 24, 14, .5);
  clip-path: polygon(14% 0, 86% 0, 86% 33%, 100% 33%, 100% 67%, 86% 67%, 86% 100%, 14% 100%, 14% 67%, 0 67%, 0 33%, 14% 33%);
}
.title-screen:not(.has-pick) .hero-stage::before {
  content: "▼"; position: absolute; top: calc(var(--px) * 3); left: 50%; transform: translateX(-50%); color: var(--gold);
  font-size: 14px; line-height: 1; text-shadow: 1px 1px 0 var(--shadow); animation: arrow-bob .8s steps(2, jump-none) infinite;
}
.hero[aria-pressed="true"] .hero-stage { transform: scale(1.3); }
.hero[aria-pressed="true"] .hero-sprite { animation: hero-hop .64s linear infinite; }
.has-pick .hero[aria-pressed="false"] .hero-stage { transform: scale(.8); filter: brightness(.5) saturate(.55); }
.has-pick .hero[aria-pressed="false"] .hero-sprite { animation: none; }

.hero-plate {
  display: flex; align-items: baseline; justify-content: center; gap: 6px; min-height: 34px; padding: 3px 10px; margin: 3px;
  background: var(--mat) var(--tatami); box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri);
  transition: filter .2s linear;
}
.hero-name { font-family: var(--f-display); font-size: 19px; line-height: 1.4; color: var(--ink); white-space: nowrap; }
.hero-role { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.hero[aria-pressed="true"] .hero-plate { box-shadow: 0 -3px 0 var(--gold), 0 3px 0 var(--gold), -3px 0 0 var(--gold), 3px 0 0 var(--gold), 0 0 0 3px var(--gold); }
.hero[aria-pressed="true"] .hero-name { color: var(--accent); }
.hero[aria-pressed="true"] .hero-name::before { content: "▶ "; font-size: .6em; vertical-align: .15em; }
.has-pick .hero[aria-pressed="false"] .hero-plate { filter: brightness(.6); }
.hero:focus-visible .hero-plate { outline: 2px solid var(--gold); outline-offset: 5px; }

.hero-bubble {
  position: absolute; z-index: 3; left: 50%; bottom: calc(var(--plate) + var(--px) * 33); transform: translateX(-50%);
  width: max-content; max-width: min(216px, 110%); padding: 5px 10px; text-align: center; font-size: 14px; font-weight: 700; line-height: 1.3;
  color: var(--ink); background: var(--shoji); pointer-events: none; word-break: keep-all;
  box-shadow: 0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink), 2px 3px 0 2px rgba(32, 24, 14, .45);
}
.hero-bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 6px; height: 4px; margin: 2px 0 0 -3px; background: var(--shoji);
  box-shadow: -2px 0 0 var(--ink), 2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--shoji);
}

.start-btn {
  grid-area: start; justify-self: center; align-self: end; width: min(320px, 100%); min-height: 48px; padding: 6px 16px; margin: 3px;
  font-family: var(--f-display); font-size: 21px; line-height: 1.2; color: var(--ink-2); background: var(--mat) var(--tatami);
  border: 0; cursor: default; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri);
}
.start-btn.is-ready {
  color: var(--cream); background: var(--heri); cursor: pointer;
  box-shadow: 0 -3px 0 var(--gold), 0 3px 0 var(--gold), -3px 0 0 var(--gold), 3px 0 0 var(--gold), 0 6px 0 var(--shadow);
  animation: start-pulse 1s steps(2, jump-none) infinite;
}
.start-btn.is-ready::before { content: "▶ "; font-size: .7em; vertical-align: .1em; }
.start-btn.is-ready:active { transform: translateY(3px); animation: none; }
.start-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }

.title-confirm {
  position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(32, 24, 14, .74);
  padding: max(10px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.title-confirm .win { width: min(420px, 100%); }

@keyframes letter-wave {
  0%, 8%, 100% { transform: translateY(0); }
  3% { transform: translateY(-24%); }
  6% { transform: translateY(-6%); }
}
@keyframes hero-idle { from { transform: translateY(0); } to { transform: translateY(calc(var(--px) * -1 / 2)); } }
@keyframes hero-hop {
  0%, 50%, 100% { transform: translateY(0) rotate(0) scale(1.07, .93); }
  12%, 62% { transform: translateY(-7%) rotate(0) scale(.97, 1.04); }
  25% { transform: translate(-5%, -13%) rotate(-7deg) scale(.98, 1.03); }
  75% { transform: translate(5%, -13%) rotate(7deg) scale(.98, 1.03); }
}
@keyframes blink { from { opacity: 1; } to { opacity: .35; } }
@keyframes arrow-bob { from { margin-top: 0; } to { margin-top: 4px; } }
@keyframes start-pulse { from { filter: brightness(1); } to { filter: brightness(1.14); } }

/* 키가 작은 화면과 큰 화면은 정수 배율로 맞춘다 */
@media (max-height: 359px) { .title-screen { --px: 4px; } }
@media (min-height: 420px) and (orientation: landscape) { .title-screen { --px: 6px; } }

@media (orientation: portrait) {
  .title-screen {
    --px: 4px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "logo" "party" "start";
    align-content: center;
    gap: 10px;
    overflow-y: auto;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
  }
  .logo-title { font-size: min(11vw, 44px); }
  .music-hint { margin-top: 4px; }
  .hero-slot { padding-top: calc(var(--px) * 22); }
  .start-btn { align-self: center; }
}
@media (orientation: portrait) and (min-width: 480px) { .title-screen { --px: 6px; } }

@media (prefers-reduced-motion: reduce) {
  .title-screen *, .title-screen *::before, .title-screen *::after { animation: none !important; transition: none !important; }
}

.music-hint.is-error { color: var(--accent); }

/* 맵 화면: 메뉴와 달리 문서가 스크롤되면 안 된다 */
html.map-mode, body.map-mode { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.map-mode {
  position: fixed; inset: 0; width: 100%; padding: 0; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.map-mode #app { display: block; max-width: none; position: relative; z-index: 1; }

.game-shell {
  --shadow: #1c140b;
  position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none;
}
.map-labels { position: absolute; inset: 0; overflow: hidden; }
.map-label {
  position: absolute; top: 0; left: 0; padding: 1px 6px; font-size: 12px; line-height: 1.35; font-weight: 700; white-space: nowrap;
  color: var(--ink); background: var(--mat) var(--tatami); will-change: transform;
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.map-label.is-sign { color: var(--accent); }
/* 길·강·산·명소 이름: 지형에 굽지 않고 글자로 띄운다. 누를 수 없고 거점 이름표 아래에 깔린다. */
.map-name-spot {
  position: absolute; top: 0; left: 0; font-size: 13px; line-height: 1.2; font-weight: 700; white-space: nowrap;
  pointer-events: none; will-change: transform; --c: #fdf9ec; --o: #33304c;
  color: var(--c);
  text-shadow: -1px 0 var(--o), 1px 0 var(--o), 0 -1px var(--o), 0 1px var(--o), -1px -1px var(--o), 1px -1px var(--o), -1px 1px var(--o), 1px 1px var(--o), 0 2px var(--o);
}
.map-name-spot.is-river { --c: #c9f1ec; --o: #1f5570; }
.map-name-spot.is-mountain { --c: #f3ecd6; --o: #3d4a33; }
.map-name-spot.is-landmark { --c: #ffe597; --o: #33304c; }
.map-name-spot.is-vertical { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 1px; }
/* 캐릭터와 버스가 이름 밑을 지나가면 글자가 옅어져 가리지 않는다. */
.map-name-spot { transition: opacity .15s steps(3); }
.map-name-spot.is-under { opacity: .15; }
@media (prefers-reduced-motion: reduce) { .map-name-spot { transition: none; } }
/* 가 본 거점의 금색 발자국 */
.map-label.is-stamped::after, .world-node-label.is-stamped::after {
  content: ""; display: inline-block; width: 14px; height: 13px; margin-left: 5px; vertical-align: -1px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 10' shape-rendering='crispEdges'><rect x='1' y='6' width='3' height='4' fill='%238c2f1b'/><rect x='1' y='4' width='1' height='1' fill='%238c2f1b'/><rect x='3' y='4' width='1' height='1' fill='%238c2f1b'/><rect x='7' y='2' width='3' height='4' fill='%238c2f1b'/><rect x='7' y='0' width='1' height='1' fill='%238c2f1b'/><rect x='9' y='0' width='1' height='1' fill='%238c2f1b'/></svg>") center / contain no-repeat;
}
.map-label.is-near.is-stamped::after { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 10' shape-rendering='crispEdges'><rect x='1' y='6' width='3' height='4' fill='%232b2415'/><rect x='1' y='4' width='1' height='1' fill='%232b2415'/><rect x='3' y='4' width='1' height='1' fill='%232b2415'/><rect x='7' y='2' width='3' height='4' fill='%232b2415'/><rect x='7' y='0' width='1' height='1' fill='%232b2415'/><rect x='9' y='0' width='1' height='1' fill='%232b2415'/></svg>"); }
.map-label.is-near {
  color: var(--ink); background: var(--gold);
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.map-name {
  position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); left: max(12px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 6px; max-width: 46vw; margin: 0; padding: 4px 12px 4px 8px;
  font-family: var(--f-display); font-size: 17px; line-height: 1.3; color: var(--cream); white-space: nowrap;
  text-shadow: 0 -1px 0 var(--wood-dark), 0 1px 0 var(--wood-dark), -1px 0 0 var(--wood-dark), 1px 0 0 var(--wood-dark), 0 2px 0 var(--wood-dark);
  background:
    linear-gradient(var(--gold), var(--gold)) 3px 3px / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) calc(100% - 3px) 3px / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 3px calc(100% - 3px) / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) calc(100% - 3px) calc(100% - 3px) / 2px 2px no-repeat,
    var(--wood-dark);
  border: 2px solid var(--wood); border-radius: 6px; box-shadow: 0 3px 0 rgba(32, 24, 14, .55);
}
.map-name .px-icon { filter: drop-shadow(0 1px 0 var(--wood-dark)); }
.map-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.map-hud {
  position: absolute; top: max(8px, env(safe-area-inset-top, 0px)); right: max(10px, env(safe-area-inset-right, 0px));
  display: flex; gap: 6px; justify-content: flex-end; pointer-events: none;
}
.map-icon-btn {
  /* 지역 이름표와 같은 짙은 나무 판에 금색 테와 네 모서리 못. 누르면 판이 꾹 들어간다. */
  position: relative; width: 48px; height: 48px; padding: 0; display: grid; place-items: center; flex: none; color: var(--cream);
  background:
    linear-gradient(var(--gold), var(--gold)) 4px 4px / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) calc(100% - 4px) 4px / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 4px calc(100% - 4px) / 2px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) calc(100% - 4px) calc(100% - 4px) / 2px 2px no-repeat,
    linear-gradient(180deg, #7a4d27, var(--wood-dark) 70%);
  border: 2px solid #c08a3e; border-radius: 10px; cursor: pointer; pointer-events: auto;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; margin-bottom: 4px;
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, .35), inset 0 -2px 0 rgba(0, 0, 0, .35), 0 4px 0 #2a1a0d, 0 5px 6px rgba(0, 0, 0, .35);
}
.map-icon-btn .px-icon { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55)); }
.map-icon-btn[hidden] { display: none; }
.map-icon-btn:active {
  transform: translateY(3px); background-color: #4a2f17;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5), 0 1px 0 #2a1a0d;
}
.map-icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
/* 퀘스트 두루마리 버튼만 금빛 판으로 눈에 띄게 */
.map-quest {
  border-color: #fff0b8;
  background:
    linear-gradient(#fff6d0, #fff6d0) 4px 4px / 2px 2px no-repeat,
    linear-gradient(#fff6d0, #fff6d0) calc(100% - 4px) 4px / 2px 2px no-repeat,
    linear-gradient(#fff6d0, #fff6d0) 4px calc(100% - 4px) / 2px 2px no-repeat,
    linear-gradient(#fff6d0, #fff6d0) calc(100% - 4px) calc(100% - 4px) / 2px 2px no-repeat,
    linear-gradient(180deg, #f7cf63, #c9922a 75%);
}
.map-quest-badge {
  position: absolute; top: -9px; right: -9px; min-width: 20px; padding: 3px 4px 2px; font-size: 9px; line-height: 1.2; text-align: center; color: #fff;
  background: var(--accent); border: 2px solid var(--heri); border-radius: 6px;
}
.map-quest-badge[hidden] { display: none; }

/* 서브맵 지도 창 */
.map-window-scrim { align-items: center; }
.map-window { width: auto; max-width: 100%; max-height: 100%; min-width: 0; padding: 0; gap: 0; overflow: hidden; grid-template-columns: minmax(0, 1fr); }
.map-window-head {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 4px 4px 10px;
  background: var(--heri); border-bottom: 3px solid var(--wood); color: var(--gold);
}
.map-window .map-window-title { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; font-size: 18px; line-height: 1.3; color: var(--gold); background: none; box-shadow: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-window-close {
  position: relative; flex: none; width: 40px; height: 40px; padding: 0; cursor: pointer; touch-action: manipulation;
  background: var(--mat-2); border: 2px solid var(--wood); border-radius: 6px; box-shadow: 0 3px 0 var(--wood-dark);
}
.map-window-close:active { background: var(--heri-2); transform: translateY(2px); box-shadow: 0 1px 0 var(--wood-dark); }
.map-window-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.map-window-x {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges' fill='%238c2f1b'><rect x='0' y='0' width='2' height='2'/><rect x='7' y='0' width='2' height='2'/><rect x='1' y='1' width='2' height='2'/><rect x='6' y='1' width='2' height='2'/><rect x='2' y='2' width='2' height='2'/><rect x='5' y='2' width='2' height='2'/><rect x='3' y='3' width='3' height='3'/><rect x='2' y='5' width='2' height='2'/><rect x='5' y='5' width='2' height='2'/><rect x='1' y='6' width='2' height='2'/><rect x='6' y='6' width='2' height='2'/><rect x='0' y='7' width='2' height='2'/><rect x='7' y='7' width='2' height='2'/></svg>") center / contain no-repeat;
}
.map-window-board { position: relative; min-width: 0; overflow: hidden; touch-action: none; background: var(--mat-2); }
.map-window-canvas { position: absolute; left: 0; top: 0; display: block; }
.map-window-board .map-label { font-size: 12px; }
.map-window-board .map-window-name { font-size: 11px; }
.map-window-board .map-label.map-window-me { color: var(--cream); background: var(--accent); }

.area-card {
  position: absolute; top: 18%; left: 0; right: 0; display: grid; justify-items: center; gap: 2px; text-align: center;
  color: var(--cream); text-shadow: 3px 3px 0 var(--shadow), -1px -1px 0 var(--shadow), 1px -1px 0 var(--shadow), -1px 1px 0 var(--shadow);
  animation: area-card 2.6s steps(14) both;
}
.area-card strong { font-family: var(--f-display); font-weight: 400; font-size: 36px; line-height: 1.2; color: var(--gold); }
.area-card span { font-size: 15px; font-weight: 700; }
.map-hint {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(42vw, 320px); padding: 5px 10px; font-size: 13px; line-height: 1.35; text-align: center; word-break: keep-all;
  color: var(--ink); background: var(--shoji);
  box-shadow: 0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink), 2px 3px 0 2px rgba(32, 24, 14, .4);
}

.dpad {
  --k: 54px;
  position: absolute; left: max(14px, env(safe-area-inset-left, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px));
  display: grid; grid-template: repeat(3, var(--k)) / repeat(3, var(--k)); pointer-events: auto; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.dpad-key {
  display: grid; place-items: center; margin: 2px; font-size: 18px; line-height: 1; color: var(--ink);
  background: rgba(207, 196, 138, .8) var(--tatami); pointer-events: none;
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.dpad-up { grid-area: 1 / 2; }
.dpad-left { grid-area: 2 / 1; }
.dpad-right { grid-area: 2 / 3; }
.dpad-down { grid-area: 3 / 2; }
.dpad[data-dir="up"] .dpad-up, .dpad[data-dir="left"] .dpad-left, .dpad[data-dir="right"] .dpad-right, .dpad[data-dir="down"] .dpad-down {
  color: var(--ink); background: var(--gold);
}

.stick {
  position: absolute; left: 0; bottom: 0; width: 230px; height: 230px; pointer-events: auto; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.stick[hidden], .dpad[hidden] { display: none; }
.stick-base {
  position: absolute; width: 108px; height: 108px; display: grid; place-items: center; pointer-events: none;
  left: calc(max(14px, env(safe-area-inset-left, 0px)) + 27px); bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 27px);
  background: rgba(20, 14, 8, .35); border: 2px solid rgba(243, 236, 210, .45); border-radius: 50%; box-sizing: border-box;
  opacity: .55; transition: opacity .12s;
}
.stick.is-held .stick-base { opacity: 1; }
.stick-base::before {
  content: ''; position: absolute; inset: 14px; border-radius: 50%; border: 1px solid rgba(243, 236, 210, .22);
}
.stick-base::after {
  content: ''; position: absolute; inset: -2px; background: rgba(243, 236, 210, .6);
  clip-path: path('M54 8 L59 15 L49 15 Z M54 100 L59 93 L49 93 Z M8 54 L15 49 L15 59 Z M100 54 L93 49 L93 59 Z');
}
.stick-knob {
  width: 48px; height: 48px; border-radius: 50%; will-change: transform; box-sizing: border-box;
  background: radial-gradient(circle at 50% 28%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%), rgba(243, 236, 210, .75);
  border: 2px solid rgba(43, 36, 21, .5);
}
.stick.is-held .stick-knob { box-shadow: 0 0 12px 3px rgba(242, 193, 78, .7); }

.talk-btn {
  position: absolute; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(26px, env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; min-width: 128px; padding: 0 22px 0 18px; border-radius: 28px;
  font-family: var(--f-display); font-size: 19px; line-height: 1; white-space: nowrap; color: var(--ink);
  background: var(--gold); border: 2px solid var(--heri); cursor: pointer; touch-action: none;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 5px 0 var(--wood-dark);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  /* 대상이 없으면 사라지고 누를 수 없다 */
  opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.6); transform-origin: 100% 100%;
  transition: opacity .12s, transform .12s, visibility 0s .12s;
}
.talk-btn.is-ready {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .15s, transform .15s cubic-bezier(.3, 1.5, .6, 1), visibility 0s;
}
.talk-btn .talk-icon { display: inline-flex; }
.talk-btn.is-ready.is-pressed { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 1px 0 var(--wood-dark); transition: none; }
.talk-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) { .talk-btn, .talk-btn.is-ready { transition: none; } }

.dialog-slot { position: absolute; inset: 0; pointer-events: none; }
.dialog-scrim {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center; pointer-events: auto; touch-action: manipulation;
  padding: 8px max(10px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  background: rgba(32, 24, 14, .32);
}
.place-dialog {
  width: min(780px, 100%); max-height: 88%; grid-template-rows: auto minmax(0, 1fr); padding: 10px 12px; gap: 8px;
  -webkit-user-select: text; user-select: text;
}
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -10px -12px 0; padding: 6px 12px;
  background: var(--heri); border-bottom: 3px solid var(--wood); border-radius: 5px 5px 0 0;
}
.dialog-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.dialog-title h2 { font-size: 21px; color: var(--gold); }
.dialog-tag { color: var(--cream); font-family: var(--f-body); font-size: 13px; font-weight: 700; }
.dialog-close { width: auto; min-width: 64px; flex: none; }
.dialog-body {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px 14px; align-content: start; align-items: start;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; min-height: 0;
}
.dialog-note { grid-column: 1 / -1; font-size: 15px; line-height: 1.45; }
.dialog-block { display: grid; gap: 6px; min-width: 0; }
.dialog-block h3 { font-size: 15px; color: var(--teal); }
.dialog-log { gap: 6px; }
.dialog-log li { grid-template-columns: 86px minmax(0, 1fr); font-size: 14px; line-height: 1.4; }
.dialog-log time { font-size: 13px; }
.dialog-log small { font-size: 12.5px; }
.dialog-quests .btn { min-height: 44px; padding: 6px 10px; font-size: 14px; line-height: 1.35; }
.dialog-link { grid-column: 1 / -1; text-decoration: none; color: var(--ink); padding: 9px 12px; font-size: 14px; }

/* 월드맵 */
.game-shell.is-world .map-labels, .game-shell.is-world .dpad, .game-shell.is-world .stick, .game-shell.is-world .talk-btn, .game-shell.is-world .bark, .game-shell.is-world .area-card { display: none; }
/* 이동 장면(.travel)과 대화창(.dialog-slot) 안의 버튼은 이동 중에도 눌려야 한다 */
.game-shell.is-moving > :not(.travel):not(.dialog-slot) button, .game-shell.is-moving .dpad, .game-shell.is-moving .stick { pointer-events: none; }
.world-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.world-node {
  position: absolute; top: 0; left: 0; width: 46px; height: 46px; padding: 0; color: inherit; font: inherit; background: none; border: 0;
  cursor: pointer; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; will-change: transform;
}
.world-node:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.world-node-label {
  position: absolute; padding: 1px 6px; font-size: 13px; line-height: 1.35; font-weight: 700; white-space: nowrap; color: var(--ink); background: var(--mat) var(--tatami);
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.world-node-label.is-top { bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%); }
.world-node-label.is-bottom { top: calc(100% + 4px); left: 50%; transform: translateX(-50%); }
.world-node-label.is-left { right: calc(100% + 2px); top: 50%; transform: translateY(-50%); }
.world-node-label.is-right { left: calc(100% + 2px); top: 50%; transform: translateY(-50%); }
.world-node.is-here .world-node-label {
  color: var(--ink); background: var(--gold);
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.world-node:active .world-node-label { color: var(--cream); background: var(--heri); }
.world-node.is-here:active .world-node-label { color: var(--ink); background: var(--shoji); }
.world-node:active .world-node-label.is-stamped::after { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 10' shape-rendering='crispEdges'><rect x='1' y='6' width='3' height='4' fill='%23f3ecd2'/><rect x='1' y='4' width='1' height='1' fill='%23f3ecd2'/><rect x='3' y='4' width='1' height='1' fill='%23f3ecd2'/><rect x='7' y='2' width='3' height='4' fill='%23f3ecd2'/><rect x='7' y='0' width='1' height='1' fill='%23f3ecd2'/><rect x='9' y='0' width='1' height='1' fill='%23f3ecd2'/></svg>"); }
.world-node.is-here:active .world-node-label.is-stamped::after { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 10' shape-rendering='crispEdges'><rect x='1' y='6' width='3' height='4' fill='%232b2415'/><rect x='1' y='4' width='1' height='1' fill='%232b2415'/><rect x='3' y='4' width='1' height='1' fill='%232b2415'/><rect x='7' y='2' width='3' height='4' fill='%232b2415'/><rect x='7' y='0' width='1' height='1' fill='%232b2415'/><rect x='9' y='0' width='1' height='1' fill='%232b2415'/></svg>"); }
.world-leg {
  position: absolute; top: 0; left: 0; padding: 0 5px; font-size: 12px; line-height: 1.5; font-weight: 700; white-space: nowrap; color: #fff4c0;
  background: rgba(32, 24, 14, .78);
}
.world-leg b { font-size: 9px; font-weight: 400; color: var(--gold); }
.world-leg.is-flight { color: #d8f1f0; }
/* 바다 이름: 늘어난 캔버스에 굽지 않고 글자로 띄운다. 구간·노드 아래층이고 누를 수 없다. */
.world-sea {
  position: absolute; top: 0; left: 0; font-size: 13px; line-height: 1.2; font-weight: 700; white-space: nowrap;
  pointer-events: none; will-change: transform; --o: #1f5570; color: #c9f1ec;
  text-shadow: -1px 0 var(--o), 1px 0 var(--o), 0 -1px var(--o), 0 1px var(--o), -1px -1px var(--o), 1px -1px var(--o), -1px 1px var(--o), 1px 1px var(--o), 0 2px var(--o);
}
/* 좁은 화면에서는 구간에 날짜만 남겨 글자가 겹치지 않게 한다 */
@media (max-width: 600px) { .world-leg-mode { display: none; } }
.world-credit {
  position: absolute; right: max(6px, env(safe-area-inset-right, 0px)); bottom: max(2px, env(safe-area-inset-bottom, 0px));
  font-size: 10px; line-height: 1.4; color: rgba(253, 249, 236, .85); text-shadow: 1px 1px 0 var(--shadow);
}
/* ---- 이동 장면 ---- */
.travel {
  position: absolute; inset: 0; z-index: 30; overflow: hidden; pointer-events: auto; background: #1c140b;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.travel-stage { position: absolute; inset: 0; outline: none; }
.travel-canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.travel-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: max(4px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 4px max(10px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(47, 74, 44, .94), rgba(47, 74, 44, .78));
}
.travel-title { margin: 0; font: 16px/1.2 var(--f-display); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.travel-bar { flex: 1; min-width: 40px; height: 10px; background: var(--mat-2); box-shadow: 0 0 0 2px var(--wood-dark); }
.travel-bar-fill { display: block; height: 100%; width: 0; background: var(--heri-2); }
.travel-count { margin: 0; font: 10px/1 var(--f-pixel); color: var(--cream); white-space: nowrap; }
.travel-skip {
  min-width: 72px; min-height: 44px; padding: 0 14px; font: 700 14px/1 var(--f-body); color: var(--ink);
  background: var(--mat) var(--tatami); border: 0; box-shadow: inset 0 0 0 2px var(--wood); cursor: pointer; touch-action: manipulation;
}
.travel-skip:active { background: var(--heri); color: var(--cream); }
.travel-field { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.travel-item {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  background: transparent; border: 0; cursor: pointer; pointer-events: auto; touch-action: manipulation; will-change: transform;
}
.travel-item .px-icon { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.travel-item.is-taken { pointer-events: none; }
.travel-item.is-taken .px-icon { animation: travel-pop .4s steps(4, end) both; }
@keyframes travel-pop {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-14px) scale(1.4); opacity: 1; }
  100% { transform: translateY(-22px) scale(1.6); opacity: 0; }
}
.travel-bubble {
  position: absolute; z-index: 1; max-width: min(260px, calc(100% - 24px)); padding: 5px 10px 6px; transform: translate(-50%, -100%);
  font-size: 14px; line-height: 1.4; font-weight: 700; color: var(--ink); background: var(--shoji); text-align: center;
  word-break: keep-all; overflow-wrap: anywhere; pointer-events: none;
  box-shadow: 0 -2px 0 var(--night), 0 2px 0 var(--night), -2px 0 0 var(--night), 2px 0 0 var(--night);
}
.travel-bubble::after {
  content: ""; position: absolute; top: 100%; left: clamp(10px, var(--tail, 50%), calc(100% - 18px)); margin-left: -4px;
  width: 8px; height: 6px; background: var(--shoji); clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.travel-bubble.is-pop { animation: bark-pop .22s steps(4, end) both; transform-origin: 50% 100%; }
.travel-stop {
  position: absolute; z-index: 1; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: min(380px, calc(100% - 24px));
  padding: 8px 12px; background: var(--mat) var(--tatami); box-shadow: inset 0 0 0 2px var(--heri), 0 0 0 2px var(--wood-dark);
}
.travel-stop-text { display: grid; gap: 2px; text-align: left; }
.travel-stop strong { font: 15px/1.2 var(--f-display); color: var(--accent); }
.travel-stop span { font-size: 14px; line-height: 1.35; color: var(--ink); }
.travel-stop em { font: normal 700 12px/1.3 var(--f-body); letter-spacing: normal; color: var(--ink-2); }
.travel-stop-go {
  flex: none; width: 56px; height: 56px; padding: 0; display: grid; place-items: center; cursor: pointer; touch-action: manipulation;
  background: var(--mat-2); border: 0; box-shadow: inset 0 0 0 2px var(--heri); animation: travel-nudge .8s steps(2, end) infinite;
}
@keyframes travel-nudge { 50% { transform: translateY(-3px); } }
.travel-result {
  position: absolute; z-index: 1; left: 50%; top: 44%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px;
  padding: 12px 18px; text-align: center; background: var(--mat) var(--tatami); box-shadow: inset 0 0 0 2px var(--heri), 0 0 0 2px var(--wood-dark);
}
.travel-result strong { font: 18px/1.2 var(--f-display); color: var(--ink); }
.travel-result span { font: 11px/1.3 var(--f-pixel); color: var(--teal); }
.travel-result em { font: normal 700 14px/1.3 var(--f-body); color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .travel-item.is-taken .px-icon, .travel-stop-go, .travel-bubble.is-pop { animation: none; }
  .travel-item.is-taken { opacity: 0; }
}

.scene-fade { position: absolute; inset: 0; background: #1c140b; opacity: 0; pointer-events: none; transition: opacity .2s steps(5); }
.scene-fade.is-on { opacity: 1; }
.quest-service { display: block; color: var(--ink-2); font-size: 12.5px; }

.rotate-notice { display: none; }
/* 터치 폰을 세로로 들었을 때만. 노트북의 좁은 창은 막지 않는다(viewport.js ROTATE_QUERY와 같은 조건). */
@media (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .rotate-notice {
    position: fixed; inset: 0; z-index: 200; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 24px;
    text-align: center; color: var(--cream); background: rgba(32, 24, 14, .96); font-family: var(--f-display); font-size: 22px; line-height: 1.3;
  }
  .rotate-notice .rotate-hint { font-family: var(--f-body); font-size: 13px; color: var(--cream); opacity: .8; }
  .rotate-phone {
    width: 42px; height: 72px; background: var(--mat-2);
    box-shadow: 0 -3px 0 var(--cream), 0 3px 0 var(--cream), -3px 0 0 var(--cream), 3px 0 0 var(--cream);
    animation: rotate-phone 2s steps(4) infinite;
  }
}
body.portrait-ok .rotate-notice { display: none !important; }
@keyframes rotate-phone { 0%, 40% { transform: rotate(0); } 80%, 100% { transform: rotate(90deg); } }
@keyframes area-card {
  0% { opacity: 0; transform: translateY(-8px); }
  12%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@media (orientation: portrait) { body.menu-mode { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

/* 가로 화면의 메뉴: 왼쪽 세로 레일 */
@media (orientation: landscape) {
  body.menu-mode {
    padding-left: calc(max(8px, env(safe-area-inset-left, 0px)) + 162px);
  }
  body.menu-mode .nav {
    top: 0; right: auto; bottom: 0; width: calc(max(8px, env(safe-area-inset-left, 0px)) + 150px);
    flex-direction: column; gap: 8px; overflow-x: hidden; overflow-y: auto;
    padding: 8px 8px 8px max(8px, env(safe-area-inset-left, 0px)); border-top: 0; border-right: 2px solid var(--wood);
  }
  body.menu-mode .nav-back, body.menu-mode .nav-item {
    flex: none; width: 100%; min-width: 0; height: 46px; border-radius: 12px; flex-direction: row; justify-content: flex-start; gap: 8px; padding: 0 10px 0 12px;
  }
  body.menu-mode .nav-back, body.menu-mode .nav-item { font-size: 16px; margin-left: 14px; width: calc(100% - 14px); }
}

/* 키 작은 가로 화면의 메뉴: 일정 화면은 2열 */
@media (orientation: landscape) and (max-height: 500px) {
  body.menu-mode {
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) 16px calc(max(8px, env(safe-area-inset-left, 0px)) + 162px);
  }
  body.menu-mode #app { max-width: none; }
  body.menu-mode .today { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  body.menu-mode .today > * { grid-column: 1 / -1; }
  body.menu-mode .today > .alert { order: -1; }
  body.menu-mode .today > .today-schedule, body.menu-mode .today > .today-quests { grid-column: auto; }
  body.menu-mode main.win { max-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-shell *, .rotate-phone { animation: none !important; }
  .scene-fade { transition: none; }
}

/* 진행 막대: 칸이 나뉜 픽셀 막대 */
.q-bar {
  position: relative; display: block; height: 10px; min-width: 40px; background: #a99d64; overflow: hidden;
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri);
}
.q-bar-fill {
  display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--steam) 0 6px, #5fb5ab 6px 8px);
  transition: width .18s steps(4);
}
.q-bar.is-full .q-bar-fill { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, #d0962c 6px 8px); }

/* 퀘스트 창: 지금 화면 위에 뜨는 패널 */
body.qlog-open { overflow: hidden; }
.qlog-host { position: fixed; inset: 0; z-index: 10; }
.qlog-scrim {
  position: absolute; inset: 0; display: flex; align-items: stretch; justify-content: center; background: rgba(32, 24, 14, .55); touch-action: manipulation;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  -webkit-user-select: none; user-select: none;
}
.qlog-panel {
  --shadow: #1c140b;
  width: min(820px, 100%); min-height: 0; margin: 3px; display: grid; grid-template-rows: auto minmax(0, 1fr); color: var(--ink); background: var(--mat) var(--tatami);
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri), 0 7px 0 var(--shadow);
}
.qlog-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 8px 6px 12px; border-bottom: 3px solid var(--wood); background: var(--heri); }
.qlog-head h2 { font-size: 20px; color: var(--gold); }
.qlog-level { color: var(--cream); font-size: 8px; white-space: nowrap; }
.qlog-tabs { display: flex; gap: 4px; margin-left: auto; }
.qlog-tab {
  min-height: 44px; padding: 2px 10px; font: 700 14px/1.2 var(--f-body); color: var(--ink); background: var(--mat-2); border: 0; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 0 0 2px var(--wood); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.qlog-tab[aria-selected="true"] { color: var(--cream); background: var(--heri); box-shadow: inset 0 0 0 2px var(--gold); }
.qlog-tab-count { margin-left: 5px; font-size: 8px; }
.qlog-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.qlog-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qlog-close { width: auto; min-width: 56px; min-height: 44px; padding: 2px 10px; flex: none; }
.qlog-list {
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; min-height: 0; padding: 8px 12px 12px; display: grid; gap: 10px; align-content: start;
}
.qlog-list:focus { outline: none; }
.qlog-group { display: grid; gap: 6px; min-width: 0; }
.qlog-category { font-size: 14px; color: var(--teal); }
.qlog-category::before { content: "▶ "; font-size: .6em; vertical-align: .15em; }
.qlog-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 6px 8px; }
.qlog-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; min-height: 52px; width: 100%; padding: 6px 10px; text-align: left; color: var(--ink);
  font: inherit; background: var(--mat-2); border: 0; box-shadow: inset 0 0 0 2px rgba(47, 74, 44, .55); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
button.qlog-row:active { background: var(--mat); box-shadow: inset 0 0 0 2px var(--accent); }
.px-icon { display: inline-block; flex: none; vertical-align: middle; image-rendering: pixelated; }
.qlog-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qlog-row.is-waiting .px-icon { opacity: .4; }
.quest-item .px-icon { margin-right: 8px; }
.entry-item { grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: start; }
.entry-body { display: grid; gap: 6px; min-width: 0; }
.step-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quest-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quest-title-row h2 { min-width: 0; overflow-wrap: anywhere; }
.qlog-title { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; word-break: keep-all; }
.qlog-exp { color: var(--accent); font-size: 8px; white-space: nowrap; }
.qlog-progress { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 0 2px; }
.qlog-count { color: var(--mist); font-size: 8px; white-space: nowrap; }
.qlog-row.is-skipped .qlog-title { color: var(--mist); }
.qlog-row.is-skipped .qlog-count { font-family: var(--f-body); font-size: 12px; }
.qlog-row.is-waiting { cursor: default; background: transparent; box-shadow: inset 0 0 0 2px rgba(90, 80, 50, .35); }
.qlog-row.is-waiting .qlog-title { color: var(--mist); }
.qlog-hint { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.3; color: var(--teal); }
.qlog-empty { padding: 34px 16px; text-align: center; font-size: 15px; color: var(--mist); word-break: keep-all; }

/* 단계 퀘스트와 확인 퀘스트 */
.quest-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quest-head h2 { flex: 1; min-width: 0; font-size: 21px; color: var(--cream); }
.quest-back { width: auto; flex: none; }
.quest-skip { width: auto; flex: none; min-height: 44px; padding: 2px 10px; }
.quest-exp { flex: none; color: var(--accent); font-size: 9px; white-space: nowrap; }
.quest-prompt { font-size: 15px; line-height: 1.45; word-break: keep-all; }
.steps-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 0 2px; }
.steps-total { color: var(--mist); font-size: 9px; }
.steps-list { display: grid; gap: 6px; }
.step-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 54px; width: 100%; padding: 4px 8px 4px 12px; color: var(--ink); font: inherit; text-align: left;
  background: var(--mat-2); border: 0; box-shadow: inset 0 0 0 2px rgba(47, 74, 44, .55);
}
.step-row.is-filled { box-shadow: inset 0 0 0 2px var(--accent); }
.step-name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.step-count { color: var(--teal); white-space: nowrap; }
.step-unit { margin-left: 3px; font-size: 14px; font-weight: 700; }
.step-row.is-filled .step-count { color: var(--accent); }
.step-btns { display: flex; gap: 6px; }
.step-btn {
  width: 46px; height: 46px; padding: 0; font-family: var(--f-pixel); font-size: 18px; line-height: 1; color: var(--ink); background: var(--mat); border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--heri); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.step-btn.is-plus:not(:disabled) { color: var(--cream); background: var(--heri); }
.step-btn { transition: transform .05s linear; }
.step-btn:active:not(:disabled) { transform: scale(1.14, .8); }
.step-btn:disabled { opacity: .35; cursor: default; }
.step-btn:focus-visible, .step-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.step-check { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.step-box { transition: transform .05s linear; }
.step-check:active .step-box { transform: scale(1.14, .8); }
.step-box { position: relative; width: 36px; height: 36px; margin: 0 5px; background: var(--shoji); box-shadow: inset 0 0 0 3px var(--heri); }
.step-check.is-filled .step-box { background: var(--gold); }
.step-check.is-filled .step-box::after {
  content: ""; position: absolute; left: 9px; top: 19px; width: 4px; height: 4px; background: var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 8px 0 0 var(--ink), 12px -4px 0 var(--ink), 16px -8px 0 var(--ink), 4px 0 0 var(--ink), 8px 4px 0 var(--ink);
}
.steps-done { min-height: 1.45em; font-size: 15px; font-weight: 700; color: var(--accent); text-align: center; }
.steps-done:empty { display: none; }
.check-service { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 8px 12px; background: var(--mat-2); box-shadow: inset 0 0 0 2px rgba(47, 74, 44, .55); }
.check-service div { display: flex; gap: 8px; align-items: baseline; }
.check-service dt { color: var(--teal); font-size: 13px; font-weight: 700; }
.check-service dd { margin: 0; font-size: 15px; }
.check-note {
  width: 100%; min-height: 44px; padding: 8px 10px; color: var(--ink); background: var(--shoji); border: 2px solid var(--heri); border-radius: 6px; font: inherit;
}

/* 전세탕 도장깨기: 메뉴 탭 없이 화면을 꽉 채운다 */
.bath-screen {
  --shadow: #1c140b; --paper: #f6ecd2; --paper-ink: #3d2b1f; --vermilion: #d3312b;
  position: fixed; inset: 0; z-index: 1; display: grid; gap: 6px 10px; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head head" "board detail";
  padding: max(6px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  background: var(--night); overflow: hidden; -webkit-user-select: none; user-select: none;
}
.bath-head { grid-area: head; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bath-back { width: auto; flex: none; min-height: 44px; padding: 2px 10px; }
.bath-skip { width: auto; flex: none; min-height: 44px; padding: 2px 10px; }
.bath-skipped { flex: none; font-size: 12px; color: var(--cream); white-space: nowrap; }
.bath-head h2 { flex: 0 1 auto; min-width: 0; font-size: 19px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bath-count { flex: none; font-family: var(--f-display); font-size: 17px; color: var(--cream); white-space: nowrap; }
.bath-head .q-bar { box-shadow: 0 -2px 0 var(--wood), 0 2px 0 var(--wood), -2px 0 0 var(--wood), 2px 0 0 var(--wood); }
.bath-head .q-bar { flex: 1; margin-right: 4px; height: 12px; }
.bath-board {
  grid-area: board; min-height: 0; width: 416px; margin: 3px; padding: 8px; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 6px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  color: var(--paper-ink); background: var(--paper);
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri), inset 0 0 0 2px #dcc998;
}
.bath-board.is-small { width: 332px; }
.bath-grid { display: grid; grid-template-columns: repeat(4, 96px); justify-content: space-between; align-content: space-evenly; gap: 4px; }
.bath-board.is-small .bath-grid { grid-template-columns: repeat(2, 144px); }
.bath-cell {
  position: relative; display: grid; gap: 2px; justify-items: stretch; align-content: start; width: 100%; padding: 0; color: inherit; font: inherit; background: none; border: 0; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bath-art { display: block; width: 100%; aspect-ratio: 4 / 3; image-rendering: pixelated; background: #cdbd96; }
.bath-cell .bath-art { box-shadow: 0 0 0 2px var(--paper-ink); }
.bath-cell-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bath-cell.is-stamped .bath-cell-name { color: var(--vermilion); }
.bath-cell.is-picked .bath-art { box-shadow: 0 0 0 3px var(--vermilion); }
.bath-cell.is-picked .bath-cell-name::before { content: "▶ "; font-size: .7em; vertical-align: .1em; }
.bath-cell:active .bath-art { transform: translateY(1px); }
.bath-cell:focus-visible { outline: 2px solid #2f6fb0; outline-offset: 3px; }
.bath-reward {
  cursor: default; align-content: center; justify-items: center; gap: 6px; aspect-ratio: 4 / 3; text-align: center; color: #8a7248; background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(138, 114, 72, .14) 4px 8px);
  box-shadow: inset 0 0 0 2px #b9a472;
}
.bath-reward-label { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.bath-reward-exp { font-size: 8px; line-height: 1.2; }
.bath-reward.is-done { color: var(--ink); background: var(--gold); box-shadow: inset 0 0 0 2px var(--paper-ink); }
.bath-prompt { font-size: 13px; line-height: 1.35; word-break: keep-all; color: #6a543a; text-align: center; }
.bath-detail {
  grid-area: detail; container-type: inline-size; min-width: 0; min-height: 0; margin: 3px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  color: var(--ink); background: var(--mat) var(--tatami); box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri);
}
.bath-detail-top { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.bath-big { flex: none; width: 192px; box-shadow: 0 0 0 2px var(--heri); margin: 2px; }
.bath-info { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.bath-name { font-size: 20px; color: var(--accent); word-break: keep-all; }
.bath-kind { padding: 1px 6px; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--steam); word-break: keep-all; }
.bath-mark { font-size: 12.5px; line-height: 1.3; color: var(--ink-2); word-break: keep-all; }
.bath-mark.is-stamped { color: var(--accent); }
.bath-desc { flex: 1; font-size: 14px; line-height: 1.4; word-break: keep-all; }
.bath-stamp {
  flex: none; min-height: 48px; margin: 3px 3px 6px; padding: 4px 12px; font-family: var(--f-display); font-size: 21px; line-height: 1.2; color: #fff; background: var(--vermilion); border: 0; cursor: pointer;
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri), 0 6px 0 var(--shadow); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bath-stamp:active { transform: translateY(3px); }
.bath-stamp:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.bath-stamp.is-undo { font-family: var(--f-body); font-size: 15px; font-weight: 700; color: var(--ink); background: var(--mat-2); box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri); }
@container (min-width: 350px) { .bath-big { width: 240px; } }
@container (max-width: 300px) { .bath-name { font-size: 17px; } }
@media (min-height: 480px) and (orientation: landscape) {
  .bath-big { width: 288px; }
  .bath-desc { font-size: 15px; }
}

/* 보스 퀴즈: 왼쪽은 싸움터, 오른쪽은 문제. 메뉴 탭 없이 화면을 꽉 채운다 */
.boss-screen {
  position: fixed; inset: 0; z-index: 1; display: grid; gap: 6px 8px; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: minmax(0, 1fr);
  padding: max(6px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: var(--night); overflow: hidden; -webkit-user-select: none; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.boss-stage {
  --stage: #2a2a4c; --floor: #3d3d68; --floor-2: #33335a;
  position: relative; min-width: 0; min-height: 0; margin: 3px; padding: 5px 6px 4px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 2px; overflow: hidden; color: var(--cream);
  background: repeating-linear-gradient(90deg, var(--floor) 0 16px, var(--floor-2) 16px 32px) bottom / 100% 32% no-repeat, var(--stage);
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri);
}
.boss-stage[data-art="clock"] { --stage: #46202e; --floor: #6a3644; --floor-2: #5a2c3a; }
.boss-stage[data-art="suitcase"] { --stage: #27424f; --floor: #466a78; --floor-2: #3a5b68; }
.boss-head { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.boss-back { width: auto; flex: none; min-height: 44px; padding: 2px 8px; font-size: 14px; }
.boss-title { flex: 1; min-width: 0; display: grid; gap: 3px; }
.boss-title h2 { padding: 2px 6px; font-size: 15px; line-height: 1.25; color: var(--gold); background: var(--heri); word-break: keep-all; }
.boss-hp { display: flex; align-items: center; gap: 3px; min-height: 12px; }
.boss-hp-label { font-size: 8px; line-height: 1; color: var(--cream); margin-right: 2px; }
.boss-hp-cell { flex: 0 1 26px; height: 10px; min-width: 8px; background: var(--ember); box-shadow: inset 0 2px 0 #ffb29b, 0 0 0 1px #1b1530; }
.boss-hp-cell.is-empty { background: #1b1530; box-shadow: 0 0 0 1px #1b1530; }
.boss-arena { min-height: 0; display: grid; place-items: center; }
.boss-art { display: block; width: 192px; height: 192px; image-rendering: pixelated; }
.boss-art.is-shaking { animation: boss-shake .36s steps(6) both; }
.boss-art.is-down { transform: translateY(4px); }
.boss-party { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-width: 0; }
.boss-party-art { display: block; flex: none; width: 84px; height: 40px; image-rendering: pixelated; }
.boss-party.is-shaking .boss-party-art { animation: boss-shake .3s steps(5) both; }
.boss-hearts { display: flex; gap: 2px; padding-bottom: 4px; }
.boss-hearts .px-icon.is-lost { filter: grayscale(1) brightness(.5); opacity: .55; }
.boss-hearts .px-icon.is-losing { animation: boss-heart .4s steps(4) both; }
.boss-flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: #d3312b; opacity: 0; }
.boss-flash.is-on { animation: boss-flash .3s steps(3) both; }
@keyframes boss-shake { 0%, 100% { translate: 0 0; } 17% { translate: -6px 1px; } 33% { translate: 5px -1px; } 50% { translate: -4px 0; } 67% { translate: 3px 1px; } 83% { translate: -2px 0; } }
@keyframes boss-flash { 0% { opacity: .55; } 50% { opacity: .2; } 75% { opacity: .4; } 100% { opacity: 0; } }
@keyframes boss-heart { 0% { scale: 1.5; } 100% { scale: 1; } }
.boss-panel {
  min-width: 0; min-height: 0; margin: 3px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overscroll-behavior: contain;
  color: var(--ink); background: var(--mat) var(--tatami); box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri);
}
.boss-line { flex: none; min-height: 2.7em; padding: 4px 8px; font-size: 14px; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; color: var(--cream); background: var(--heri); }
.boss-ask { flex: none; font-family: var(--f-display); font-size: 19px; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; color: var(--accent); }
.boss-ask.is-prompt { font-family: var(--f-body); font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--ink); }
.boss-exp { flex: none; font-size: 9px; line-height: 1; color: var(--teal); }
.boss-choices { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(48px, 1fr); gap: 9px; padding: 3px; }
.boss-choice {
  min-width: 0; min-height: 48px; padding: 4px 6px; font-family: var(--f-display); font-size: 22px; line-height: 1.2; word-break: keep-all; overflow-wrap: anywhere; color: var(--ink); background: var(--shoji); border: 0; cursor: pointer;
  box-shadow: 0 -2px 0 var(--heri), 0 2px 0 var(--heri), -2px 0 0 var(--heri), 2px 0 0 var(--heri), 0 4px 0 #1c140b; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.boss-choice.is-ascii { font-family: var(--f-pixel); font-size: 16px; line-height: 1.3; }
.boss-choice:active { transform: translateY(2px); }
.boss-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.boss-choices.is-locked .boss-choice { cursor: default; }
.boss-choices.is-locked .boss-choice:active { transform: none; }
.boss-choices.is-locked .boss-choice:not(.is-right, .is-wrong) { opacity: .5; }
.boss-choice.is-right { color: #fff; background: var(--heri-2); }
.boss-choice.is-wrong { color: #fff; background: var(--accent); }
.boss-choice.is-right::before { content: "○ "; }
.boss-choice.is-wrong::before { content: "✕ "; }
.boss-cta {
  flex: none; margin: 3px 3px 7px; min-height: 52px; padding: 4px 12px; font-family: var(--f-display); font-size: 21px; line-height: 1.2; word-break: keep-all; color: #fff; background: #d3312b; border: 0; cursor: pointer;
  box-shadow: 0 -3px 0 var(--heri), 0 3px 0 var(--heri), -3px 0 0 var(--heri), 3px 0 0 var(--heri), 0 6px 0 #1c140b; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.boss-cta.is-quiet { font-size: 17px; color: var(--cream); background: var(--heri-2); }
.boss-cta:active { transform: translateY(3px); }
.boss-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.boss-panel .boss-spacer { flex: 1 1 auto; min-height: 0; }
@media (max-height: 350px) and (orientation: landscape) {
  .boss-art { width: 128px; height: 128px; }
  .boss-line { min-height: 0; font-size: 13px; }
  .boss-ask { font-size: 17px; }
}
@media (min-height: 480px) and (orientation: landscape) {
  .boss-art { width: 256px; height: 256px; }
  .boss-title h2 { font-size: 19px; }
  .boss-line { font-size: 16px; }
  .boss-ask { font-size: 23px; }
  .boss-choice { font-size: 23px; }
  .boss-choice.is-ascii { font-size: 17px; }
}

@media (orientation: portrait) {
  .bath-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "head" "detail" "board"; align-content: start; overflow-y: auto; }
  .bath-head { flex-wrap: wrap; }
  .bath-board, .bath-board.is-small { width: auto; overflow: visible; }
  .bath-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bath-board.is-small .bath-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bath-detail { overflow: visible; }
  .boss-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .boss-art { width: 128px; height: 128px; }
  .qlog-tabs { margin-left: 0; order: 3; width: 100%; }
  .qlog-tab { flex: 1; }
  .qlog-close { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .qlog-host *, .bath-screen *, .boss-screen *, .steps-view *, .q-bar-fill { animation: none !important; transition: none !important; }
  .boss-art.is-down, .boss-choice:active, .boss-cta:active, .bath-cell:active .bath-art, .bath-stamp:active, .step-btn:active:not(:disabled), .step-check:active .step-box, .map-icon-btn:active { transform: none; }
}

/* 완료 연출. 움직임은 celebrate.js의 프레임 시계가 인라인으로 정하고, 여기서는 모양만 잡는다. */
.fx-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; overflow: hidden; cursor: pointer; outline: none; touch-action: none;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.fx-overlay.is-closing { opacity: 0; transition: opacity .13s steps(3); }
.fx-dim { position: absolute; inset: 0; background: rgba(32, 24, 14, .62); opacity: 0; }
.fx-stage { position: relative; display: grid; justify-items: center; gap: clamp(6px, 2.6vh, 16px); width: min(560px, 100%); min-width: 0; }
.fx-stamp {
  margin-block: 3vh 4vh; padding: .36em .5em .28em; font-family: var(--f-pixel); font-size: clamp(26px, min(8.4vw, 15vh), 60px); line-height: 1; white-space: nowrap; color: var(--gold); background: var(--heri); opacity: 0;
  text-shadow: .07em .07em 0 #8a5a14; will-change: transform;
  box-shadow: 0 -5px 0 var(--gold), 0 5px 0 var(--gold), -5px 0 0 var(--gold), 5px 0 0 var(--gold), inset 0 0 0 3px var(--heri), inset 0 0 0 5px rgba(242, 193, 78, .55), 7px 10px 0 2px #1c140b;
}
.fx-stamp.is-hit { color: var(--ink); background: #fff4cf; text-shadow: none; }
.fx-title {
  max-width: 100%; font-size: clamp(22px, 7.4vh, 36px); line-height: 1.2; text-align: center; word-break: keep-all; color: var(--cream); opacity: 0;
  text-shadow: 3px 3px 0 #1c140b, -1px -1px 0 #1c140b, 1px -1px 0 #1c140b, -1px 1px 0 #1c140b;
}
.fx-exp { display: grid; grid-template-columns: auto minmax(70px, 1fr) auto; gap: 12px; align-items: center; width: min(460px, 100%); opacity: 0; }
.fx-exp-num { min-width: 8.5em; font-size: clamp(11px, 3.6vh, 14px); line-height: 1.2; white-space: nowrap; color: var(--gold); text-shadow: 2px 2px 0 #1c140b; transform-origin: 0 50%; }
.fx-lv { font-size: clamp(10px, 3vh, 12px); line-height: 1.2; white-space: nowrap; color: var(--steam); text-shadow: 2px 2px 0 #1c140b; transform-origin: 100% 50%; }
.fx-bar {
  display: block; height: 12px; background: var(--night);
  box-shadow: 0 -2px 0 var(--cream), 0 2px 0 var(--cream), -2px 0 0 var(--cream), 2px 0 0 var(--cream);
}
.fx-bar-fill { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 6px, #d0962c 6px 8px); }
.fx-levelup { font-family: var(--f-pixel); font-size: clamp(15px, 5.6vh, 24px); line-height: 1.1; white-space: nowrap; color: #fff; opacity: 0; text-shadow: 3px 3px 0 var(--ember), -2px -2px 0 #1c140b; }
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.fx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }

/* 새 퀘스트 배너 */
.fx-banner {
  position: relative; display: grid; justify-items: center; gap: 6px; width: min(520px, 100%); max-height: 100%; padding: 12px 18px 10px; color: var(--ink); background: var(--mat) var(--tatami); opacity: 0;
  box-shadow: 0 -4px 0 var(--heri), 0 4px 0 var(--heri), -4px 0 0 var(--heri), 4px 0 0 var(--heri), 6px 9px 0 2px #1c140b;
}
.fx-banner-head { font-family: var(--f-display); font-size: clamp(26px, 9vh, 38px); line-height: 1.15; color: var(--accent); text-shadow: 2px 2px 0 var(--mat-2); }
.fx-banner-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 16px; font-weight: 700; line-height: 1.35; text-align: center; word-break: keep-all; }
.fx-banner-list li::before { content: "▶ "; font-size: .6em; vertical-align: .15em; color: var(--teal); }
.fx-hint { font-size: 13px; color: var(--ink-2); animation: blink 1s steps(2, jump-none) infinite; }

/* 단계와 도장 효과 */
.fx-pop { animation: fx-pop .26s linear; }
.fx-float {
  position: fixed; z-index: 25; font-size: 14px; line-height: 1; color: var(--gold); pointer-events: none; transform: translate(-50%, -50%);
  text-shadow: 2px 2px 0 #1c140b, -1px -1px 0 #1c140b; animation: fx-float .66s steps(14) both;
}
.fx-gold { animation: fx-gold .5s steps(8); }
.fx-squash { animation: fx-squash .3s linear; }
.fx-hanko { position: fixed; z-index: 25; image-rendering: pixelated; pointer-events: none; will-change: transform; opacity: 0; }
@keyframes fx-pop {
  0% { transform: scale(1.16, .8); }
  35% { transform: scale(.86, 1.22); }
  65% { transform: scale(1.06, .95); }
  100% { transform: none; }
}
@keyframes fx-float {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.5); }
  22% { opacity: 1; transform: translate(-50%, -110%) scale(1.4); }
  40% { opacity: 1; transform: translate(-50%, -140%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -320%) scale(1); }
}
@keyframes fx-gold {
  0%, 35% { color: var(--ink); background: var(--gold); box-shadow: inset 0 0 0 2px #fff4cf; }
  100% { box-shadow: inset 0 0 0 2px var(--gold); }
}
@keyframes fx-squash {
  0% { transform: scale(1.12, .8); }
  35% { transform: scale(.94, 1.08); }
  70% { transform: scale(1.03, .98); }
  100% { transform: none; }
}
@keyframes fx-fade-float {
  0% { opacity: 0; transform: translate(-50%, -110%); }
  25%, 70% { opacity: 1; transform: translate(-50%, -110%); }
  100% { opacity: 0; transform: translate(-50%, -110%); }
}
@media (prefers-reduced-motion: reduce) {
  .fx-pop, .fx-squash, .fx-gold, .fx-hint { animation: none; }
  .fx-float { animation-name: fx-fade-float; animation-timing-function: linear; }
  .step-btn, .step-box { transition: none; }
}

/* 걷는 중 말풍선 */
.bark {
  position: absolute; top: 0; left: 0; max-width: min(240px, calc(100vw - 16px)); will-change: transform; pointer-events: none;
}
.bark-text {
  position: relative; display: block; padding: 5px 10px 6px; font-size: 14px; line-height: 1.4; font-weight: 700;
  color: var(--ink); background: var(--shoji); word-break: keep-all; overflow-wrap: anywhere; text-align: center;
  box-shadow: 0 -2px 0 var(--night), 0 2px 0 var(--night), -2px 0 0 var(--night), 2px 0 0 var(--night);
}
.bark-text::after {
  content: ""; position: absolute; top: 100%; left: clamp(10px, var(--tail, 50%), calc(100% - 18px)); margin-left: -4px;
  width: 8px; height: 6px; background: var(--shoji);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.bark.is-below .bark-text::after { top: auto; bottom: 100%; clip-path: polygon(50% 0, 0 100%, 100% 100%); }
.bark.is-pop .bark-text { animation: bark-pop .22s steps(4, end) both; transform-origin: 50% 100%; }
@keyframes bark-pop {
  from { transform: scale(.4) translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bark.is-pop .bark-text { animation: none; }
}

/* 사파리 먹이 주기: 버스 창 세 개와 먹이 통. 캔버스는 낮은 해상도를 정수 배율로 키운다. */
.feed { position: absolute; inset: 0; z-index: 20; background: #26382c; outline: none; touch-action: manipulation; overflow: hidden; -webkit-user-select: none; user-select: none; }
.feed-canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.feed-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 2px max(8px, env(safe-area-inset-right, 0px)) 2px max(8px, env(safe-area-inset-left, 0px)); min-height: 44px;
  background: rgba(47, 74, 44, .88); border-bottom: 3px solid var(--wood-dark);
}
.feed-hud[hidden], .feed-panel[hidden], .feed-line[hidden], .feed-streak[hidden] { display: none; }
.feed-score { font: 17px/1 var(--f-display); color: var(--gold); white-space: nowrap; }
.feed-streak { font: 700 13px/1 var(--f-body); color: var(--steam); white-space: nowrap; }
.feed-bar { flex: 1; min-width: 40px; height: 10px; background: #1c140b; box-shadow: 0 0 0 2px var(--wood); }
.feed-bar-fill { display: block; height: 100%; width: 0; background: var(--steam); }
.feed-close {
  min-width: 64px; min-height: 44px; padding: 0 12px; font: 700 14px/1 var(--f-body); color: var(--ink);
  background: var(--mat-2); border: 2px solid var(--heri); border-radius: 6px; cursor: pointer;
}
.feed-slot { position: absolute; z-index: 1; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.feed-slot:disabled { pointer-events: none; }
.feed-slot:focus-visible { outline: 2px solid var(--steam); outline-offset: -2px; }
.feed-line {
  position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 2;
  max-width: min(300px, 34%); margin: 0; padding: 6px 12px; text-align: center;
  font: 700 15px/1.3 var(--f-body); color: var(--ink); background: var(--mat) var(--tatami); border: 2px solid var(--heri); border-radius: 6px;
  pointer-events: none;
}
.feed-panel {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); width: min(460px, calc(100% - 24px)); max-height: calc(100% - 16px);
  overflow-y: auto; text-align: center; gap: 8px; padding: 12px 14px;
}
.feed-panel h2 { margin: 0; justify-self: center; font: 22px/1.2 var(--f-display); color: var(--cream); }
.feed-intro { margin: 0; font-size: 15px; line-height: 1.5; }
.feed-best { margin: 0; font-size: 11px; color: var(--teal); }
.feed-best em { font-style: normal; color: var(--accent); }
.feed-actions { display: flex; gap: 10px; }
.feed-actions .btn { flex: 1; }
.dialog-activity { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dialog-activity strong { font: 700 15px/1.2 var(--f-body); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dialog-activity-block { grid-column: 1 / -1; }
.dialog-vehicle { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; }
.dialog-vehicle strong { font: 700 17px/1.2 var(--f-body); }

/* 엔딩: 귀국 비행기와 사진 크레딧. 대화창 위에서도, 앨범에서 body에 붙어도 화면 전체를 덮는다. */
body.ending-open { overflow: hidden; }
body.ending-open .rotate-notice { display: none !important; }
.album-replay { display: flex; align-items: center; justify-content: center; gap: 8px; }
.album-replay strong { font: 700 15px/1.2 var(--f-body); }
.ending {
  position: fixed; inset: 0; z-index: 25; overflow: hidden; pointer-events: auto; outline: none; color: var(--cream); background: #0d1230;
  touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.ending-canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.ending-view { position: absolute; inset: 0; overflow: hidden; outline: none; }
.ending-roll {
  position: absolute; left: 0; right: 0; top: 0; display: grid; justify-items: center; gap: 40px; text-align: center; will-change: transform;
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
}
.ending-title { font: 36px/1.2 var(--f-display); color: var(--gold); }
.ending-block { display: grid; justify-items: center; gap: 14px; width: min(560px, 100%); }
.ending-block h3 { font: 22px/1.25 var(--f-display); color: var(--gold); }
.ending-cast, .ending-route, .ending-stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ending-cast li { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.ending-cast strong { font: 22px/1.3 var(--f-display); font-weight: 400; }
.ending-cast span { font-size: 14px; color: var(--steam); }
.ending-route li { display: flex; align-items: baseline; justify-content: center; gap: 12px; font-size: 16px; line-height: 1.4; }
.ending-route time { color: var(--steam); }
.ending-stats li { font-size: 16px; line-height: 1.4; }
.ending-photos { gap: 36px; }
.ending-photo { margin: 0; display: grid; justify-items: center; gap: 8px; width: 100%; }
.ending-shot { display: grid; place-items: center; max-width: 100%; padding: 6px; background: var(--cream); box-shadow: 0 0 0 3px var(--wood); }
.ending-shot img { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; max-height: 62dvh; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
/* 불러오는 동안 자리를 잡아 두어 다 뜬 뒤에도 크게 밀리지 않는다 */
.ending-shot.is-loading { width: min(84vw, 62vh); height: 62vh; height: 62dvh; opacity: .35; }
.ending-shot.is-loading img { visibility: hidden; }
.ending-photo figcaption { display: grid; justify-items: center; gap: 2px; max-width: 480px; }
.ending-photo strong { font: 17px/1.3 var(--f-display); font-weight: 400; color: var(--gold); }
.ending-photo p { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.ending-photo span { font-size: 13px; color: var(--steam); }
.ending-finale { display: grid; justify-items: center; gap: 10px; width: min(480px, 100%); margin-top: 45vh; } /* 맺음말은 혼자 화면에 남는다 */
.ending-pair { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.ending-pair .px-icon { align-self: center; }
.ending-sprite { display: block; width: 64px; height: 80px; image-rendering: pixelated; }
.ending-closing { font: 21px/1.35 var(--f-display); color: var(--gold); }
.ending-note { font-size: 13px; line-height: 1.45; color: var(--cream); opacity: .8; }
.ending-skip, .ending-close {
  position: absolute; z-index: 1; min-width: 64px; min-height: 44px; padding: 6px 14px; font: 700 15px/1.2 var(--f-body); border-radius: 6px; cursor: pointer;
  pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ending-skip {
  top: max(8px, env(safe-area-inset-top, 0px)); right: max(10px, env(safe-area-inset-right, 0px));
  color: var(--cream); background: rgba(13, 18, 48, .72); border: 2px solid var(--cream);
}
.ending-close {
  left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); min-width: 140px;
  color: var(--night); background: var(--gold); border: 2px solid var(--cream);
}
.ending-skip:focus-visible, .ending-close:focus-visible { outline: 2px solid var(--steam); outline-offset: 2px; }
/* 움직임 줄이기: 스크롤되는 목록. 닫기는 글을 가리지 않게 오른쪽 위에 둔다. */
.ending.is-still { touch-action: pan-y; }
.ending.is-still .ending-view { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.ending.is-still .ending-roll { position: static; padding-top: 60px; padding-bottom: 40px; will-change: auto; }
.ending.is-still .ending-finale { margin-top: 0; }
.ending.is-still .ending-close {
  left: auto; bottom: auto; transform: none; min-width: 64px;
  top: max(8px, env(safe-area-inset-top, 0px)); right: max(10px, env(safe-area-inset-right, 0px));
}

/* 걷는 동안 보이는 반투명 작은 지도 */
.minimap {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top, 0px)) + 42px); left: max(12px, env(safe-area-inset-left, 0px));
  display: block; box-sizing: content-box; pointer-events: none; opacity: 0; transition: opacity 400ms ease-out;
  background: var(--mat-2); border: 2px solid var(--heri); border-radius: 4px;
}
.minimap.is-on { opacity: .62; transition-duration: 150ms; }
.game-shell.is-world .minimap { display: none; }
@media (prefers-reduced-motion: reduce) { .minimap { transition: none; } }
.setting-note { display: block; font-weight: 400; margin-top: 2px; }
.setting-row > .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }
.setting-row > .setting-label { flex: 1 1 0; min-width: 0; }

/* 온천에서 쉬기: 옆에서 본 노천탕. 캔버스는 낮은 해상도를 정수 배율로 키운다. */
.onsen { position: absolute; inset: 0; z-index: 20; background: #a9d8e6; outline: none; touch-action: none; overflow: hidden; -webkit-user-select: none; user-select: none; }
.onsen-canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.onsen-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) 6px max(8px, env(safe-area-inset-left, 0px)); min-height: 50px;
  background: rgba(47, 74, 44, .9); border-bottom: 3px solid var(--wood-dark);
}
.onsen-hp { flex: 1 1 110px; display: grid; gap: 6px; min-width: 90px; }
.onsen-hp-name { font: 700 12px/1 var(--f-body); color: var(--cream); white-space: nowrap; }
.onsen-hp .q-bar { height: 8px; }
.onsen-heat { flex: 1.3 1 140px; display: grid; gap: 6px; min-width: 110px; }
.onsen-thermo { position: relative; height: 8px; background: #1c140b; box-shadow: 0 0 0 2px var(--wood); }
.onsen-comfy { position: absolute; top: 0; bottom: 0; background: var(--gold); }
.onsen-needle { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; background: var(--cream); box-shadow: 0 0 0 1px var(--ink); }
.onsen-heat-name { font: 14px/1 var(--f-display); color: var(--cream); }
.onsen-heat[data-zone="comfy"] .onsen-heat-name { color: var(--gold); }
.onsen-heat[data-zone="hot"] .onsen-heat-name { color: var(--ember); }
.onsen-close {
  min-width: 64px; min-height: 44px; padding: 0 12px; font: 700 14px/1 var(--f-body); color: var(--ink);
  background: var(--mat-2); border: 2px solid var(--heri); border-radius: 6px; cursor: pointer;
}
.onsen-bubble {
  position: absolute; z-index: 2; transform: translate(-50%, -100%); margin: 0; padding: 4px 10px; max-width: 220px; text-align: center;
  font: 700 14px/1.3 var(--f-body); color: var(--ink); background: var(--shoji); border: 2px solid var(--heri); border-radius: 8px; pointer-events: none;
}
/* 가운데 맞춤은 transform 없이 한다: 누를 때 .btn:active의 translateY가 그대로 먹도록 */
.onsen-hold {
  position: absolute; z-index: 2; left: 0; right: 0; margin-inline: auto; bottom: max(8px, env(safe-area-inset-bottom, 0px));
  width: min(280px, 60%); min-height: 60px; font-size: 20px; touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.onsen-panel {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); width: min(460px, calc(100% - 24px)); max-height: calc(100% - 16px);
  overflow-y: auto; text-align: center; gap: 8px; padding: 12px 14px;
}
.onsen-panel.is-result { top: auto; bottom: max(8px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); }
.onsen-panel h2 { margin: 0; justify-self: center; font: 22px/1.2 var(--f-display); color: var(--cream); }
.onsen-intro { margin: 0; font-size: 15px; line-height: 1.5; }
.onsen-actions { display: flex; gap: 10px; }
.onsen-actions .btn { flex: 1; }

/* 지옥 순례 수집: 바위 들판 위에 김 덮인 분화구 일곱 곳 */
.jigoku { position: absolute; inset: 0; z-index: 20; background: #8c7c5a; outline: none; touch-action: manipulation; overflow: hidden; -webkit-user-select: none; user-select: none; }
.jg-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; min-height: 50px;
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) 6px max(8px, env(safe-area-inset-left, 0px));
  background: rgba(47, 74, 44, .9); border-bottom: 3px solid var(--wood-dark);
}
.jg-title { flex: 1; font: 16px/1.2 var(--f-display); color: var(--cream); }
.jg-progress { font: 12px/1 var(--f-pixel); color: var(--gold); }
.jg-field {
  position: absolute; inset: 50px 0 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.jg-row { display: flex; justify-content: center; gap: 8px; }
.jg-vent {
  position: relative; display: block; width: var(--vw, 96px); height: var(--vh, 72px); min-width: 64px; min-height: 64px; padding: 0; overflow: hidden;
  background: #dfe9e6; border: 3px solid var(--wood-dark); border-radius: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.jg-vent:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.jg-vent.is-open { border-color: var(--gold); }
.jg-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.jg-timebar { position: absolute; left: 4px; right: 4px; top: 4px; height: 6px; background: rgba(28, 20, 11, .6); opacity: 0; pointer-events: none; }
.jg-vent.is-open .jg-timebar { opacity: 1; }
.jg-time { display: block; height: 100%; width: 0; background: var(--gold); }
.jg-vent.is-puff { animation: jg-puff .35s ease-out; }
@keyframes jg-puff { 0% { transform: scale(1); } 30% { transform: scale(1.1); } 100% { transform: scale(1); } }
.jg-toast {
  position: absolute; z-index: 2; left: 50%; top: 58px; transform: translateX(-50%); margin: 0; padding: 4px 12px; white-space: nowrap;
  font: 700 15px/1.3 var(--f-body); color: var(--ink); background: var(--shoji); border: 2px solid var(--heri); border-radius: 8px; pointer-events: none;
}
.jg-card {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 8px; border: 0; background: rgba(28, 20, 11, .55);
  font: inherit; color: var(--ink); cursor: pointer; perspective: 800px;
}
.jg-card-face {
  display: grid; justify-items: center; gap: 4px; width: min(300px, 100%); padding: 10px 14px; text-align: center;
  background: var(--shoji); border: 4px solid var(--heri); border-radius: 8px; box-shadow: 0 0 0 3px var(--gold);
}
.jg-card.is-flip .jg-card-face { animation: jg-flip .45s ease-out; }
@keyframes jg-flip { from { transform: rotateY(90deg) scale(.6); } to { transform: rotateY(0) scale(1); } }
.jg-card-got { font: normal 700 13px/1.2 var(--f-body); color: var(--accent); }
.jg-card-art { width: 144px; height: 108px; image-rendering: pixelated; border: 2px solid var(--wood-dark); }
.jg-card-name { font: 18px/1.2 var(--f-display); }
.jg-card-desc { font-size: 13px; line-height: 1.4; }
.jg-panel { position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); width: min(460px, calc(100% - 24px)); max-height: calc(100% - 16px); overflow-y: auto; text-align: center; gap: 8px; padding: 12px 14px; }
.jg-panel.is-result { top: auto; bottom: max(8px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); }
.jg-panel.is-book { width: min(760px, calc(100% - 24px)); }
.jg-panel h2 { margin: 0; justify-self: center; font: 22px/1.2 var(--f-display); color: var(--cream); }
.jg-count { margin: 0; font: 700 14px/1.2 var(--f-body); }
.jg-panel .onsen-actions { flex-wrap: wrap; }
.jg-panel .onsen-actions .btn { min-width: 90px; }
.jg-book { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.jg-book-card { display: grid; justify-items: center; align-content: start; gap: 3px; padding: 6px; text-align: center; background: var(--shoji); border: 2px solid var(--heri); border-radius: 6px; color: var(--ink); }
.jg-book-card strong { font: 14px/1.2 var(--f-display); }
.jg-book-card span { font-size: 12px; line-height: 1.35; }
.jg-book-art { width: 96px; height: 72px; image-rendering: pixelated; border: 2px solid var(--wood-dark); }
@media (prefers-reduced-motion: reduce) {
  .jg-vent.is-puff, .jg-card.is-flip .jg-card-face { animation: none; }
}

/* 아이폰 홈 화면 앱(가로): innerHeight와 inset: 0이 세로 상태 막대만큼 짧아 아래에 빈 띠가 남는다.
   html.is-installed와 --app-h는 src/ui/viewport.js가 홈 화면 앱일 때만 붙인다. 보통 브라우저에서는 아무 일도 없다.
   화면을 꽉 채우는 position: fixed 층만 고치면 그 안의 absolute 층(이동, 연습 게임, 대화창)은 따라온다. */
html.is-installed body { min-height: var(--app-h); }
html.is-installed .loading,
html.is-installed #stage,
html.is-installed .title-screen,
html.is-installed .title-confirm,
html.is-installed.map-mode,
html.is-installed body.map-mode,
html.is-installed .game-shell,
html.is-installed .rotate-notice,
html.is-installed .qlog-host,
html.is-installed .bath-screen,
html.is-installed .boss-screen,
html.is-installed .fx-overlay,
html.is-installed .ending { bottom: auto; height: var(--app-h); }
html.is-installed .nav { bottom: calc(0px - var(--app-gap, 0px)); }

/* 맵 화면 위 가운데 레벨·경험치: 지역 이름표와 같은 나무 판. 아래쪽 안내 말풍선과 겹치지 않는다. */
.exp-hud {
  position: absolute; left: 50%; top: max(12px, env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px;
  background: var(--wood-dark); border: 2px solid var(--wood); box-shadow: 0 3px 0 rgba(32, 24, 14, .55);
  pointer-events: none; white-space: nowrap;
}
.exp-hud[hidden] { display: none; }
.exp-hud .q-bar { width: 120px; min-width: 0; height: 8px; flex: none; }
.exp-hud-lv { font-size: 10px; color: var(--gold); }
.exp-hud-num { font-size: 8px; color: var(--shoji); }
.exp-hud.is-up .q-bar { animation: exp-up .8s steps(2) 3; }
@keyframes exp-up { 50% { filter: brightness(1.8); } }
/* 가운데 판과 부딪히지 않게 지역 이름표 폭을 줄인다 */
.map-name { max-width: calc(50vw - 150px); }
/* 좁은 화면(세로 허용)에서는 오른쪽 버튼 줄 아래로 */
@media (max-width: 700px) {
  .exp-hud { left: auto; right: max(10px, env(safe-area-inset-right, 0px)); transform: none; top: calc(max(8px, env(safe-area-inset-top, 0px)) + 60px); }
  .map-name { max-width: 46vw; }
}
@media (prefers-reduced-motion: reduce) { .exp-hud.is-up .q-bar { animation: none; } }

/* 인벤토리: 가죽 가방(손잡이·버클·바느질)과 안감 주머니, 가죽 이름표 탭, 그림만 있는 칸, 같은 높이의 상세 카드.
   가방 안은 다다미가 아니라 어두운 천 안감이다. 분류마다 칸 안쪽에 은은한 빛깔(--hue)이 돈다. */
.bag {
  --leather: #6b3f1f; --leather-2: #8a5530; --leather-dark: #3e2210; --stitch: #d9a85c;
  --lining: #2e1c12; --lining-2: #3a2417; --slot: #1d120b; --tag: #4a2b15; --tag-ink: #ecd6a4; --paper: #f1e2bd;
  gap: 14px; align-items: stretch; padding-top: 22px;
}
.bag [data-cat="flight"] { --hue: #5fb2e8; }
.bag [data-cat="stay"] { --hue: #ee8fa0; }
.bag [data-cat="tour"] { --hue: #f2c14e; }
.bag [data-cat="shopping"] { --hue: #8fd06f; }
.bag-case {
  position: relative; display: grid; grid-template-rows: auto auto 1fr; gap: 0; min-width: 0; padding: 12px 12px 14px;
  color: var(--tag-ink); background: linear-gradient(180deg, var(--leather-2), var(--leather) 40%, #5a341a);
  border: 4px solid var(--leather-dark); border-radius: 16px;
  box-shadow: 0 5px 0 var(--leather-dark), inset 0 2px 0 rgba(255, 220, 160, .25), inset 0 -3px 0 rgba(0, 0, 0, .25);
}
/* 테두리 안쪽 바느질 */
.bag-case::before { content: ""; position: absolute; inset: 4px; border: 2px dashed var(--stitch); border-radius: 11px; opacity: .55; pointer-events: none; }
.bag-handle {
  position: absolute; left: 50%; top: -24px; width: 92px; height: 26px; transform: translateX(-50%);
  border: 6px solid var(--leather-dark); border-bottom: 0; border-radius: 46px 46px 0 0; box-shadow: inset 0 2px 0 var(--leather-2);
}
.bag-buckle {
  position: absolute; left: 50%; top: -6px; z-index: 2; width: 22px; height: 14px; transform: translateX(-50%);
  background: var(--gold); border: 3px solid #8a6416; border-radius: 3px; box-shadow: 0 2px 0 var(--leather-dark);
}
.bag-head { position: relative; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 6px 8px; }
.bag-head h2 { color: var(--gold); font-size: 22px; text-shadow: 0 2px 0 var(--leather-dark), 2px 0 0 var(--leather-dark), -2px 0 0 var(--leather-dark), 0 -2px 0 var(--leather-dark); }
.bag-count { color: var(--tag-ink); font: 400 13px/1 var(--f-display); opacity: .9; }

/* 분류 탭: 주머니 위에 꽂힌 가죽 이름표. 고른 탭은 금색 테가 둘리고 주머니와 이어진다. */
.bag-tabs {
  position: relative; z-index: 2; display: flex; gap: 4px; padding: 0 6px; margin-bottom: -2px;
  overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x; scrollbar-width: none;
}
.bag-tabs::-webkit-scrollbar { display: none; }
.bag-tab {
  position: relative; display: inline-grid; justify-items: center; align-content: center; gap: 3px; flex: 1 0 54px; min-width: 54px; min-height: 48px; margin-top: 6px; padding: 5px 4px 6px;
  font: 400 12px/1 var(--f-display); color: var(--tag-ink); background: linear-gradient(180deg, #5a3519, var(--tag));
  border: 2px solid var(--leather-dark); border-bottom: 0; border-radius: 10px 10px 0 0; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, .18); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bag-tab .px-icon { filter: saturate(.7) brightness(.85); }
.bag-tab[aria-selected="true"] {
  margin-top: 0; padding-bottom: 10px; color: var(--gold); background: var(--lining-2);
  border-color: var(--gold); box-shadow: inset 0 3px 0 rgba(242, 193, 78, .35), 0 -2px 0 var(--leather-dark);
}
.bag-tab[aria-selected="true"] .px-icon { filter: none; }
.bag-tab:active:not([aria-selected="true"]) { transform: translateY(2px); }

/* 안감 주머니: 어두운 천결과 안쪽 바느질 */
.bag-pocket {
  position: relative; min-width: 0; padding: 12px 10px; border: 2px solid var(--leather-dark); border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .12) 0 2px, transparent 2px 6px),
    radial-gradient(120% 90% at 50% 0%, var(--lining-2), var(--lining));
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, .45);
}
.bag-pocket::before { content: ""; position: absolute; inset: 4px; border: 1px dashed rgba(217, 168, 92, .35); border-radius: 7px; pointer-events: none; }
.bag-grid { position: relative; display: grid; grid-template-columns: repeat(4, 64px); gap: 10px; justify-content: center; align-content: start; }

/* 칸: 움푹 들어간 상자 안에 분류 빛깔이 돌고, 그림만 크게 */
.bag-slot {
  position: relative; display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border-radius: 12px; cursor: pointer;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--hue, #000) 34%, transparent), transparent 68%), var(--slot);
  border: 2px solid #120a05;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .55), inset 0 -2px 0 rgba(255, 220, 160, .10), 0 1px 0 rgba(255, 220, 160, .15);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .08s;
}
.bag-slot .px-icon { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .6)); }
.bag-slot:not(.is-empty):active { transform: scale(.94); }
.bag-slot.is-empty { cursor: default; background: var(--slot); opacity: .55; }
.bag-slot.is-empty::after { content: ""; width: 14px; height: 14px; border: 2px solid rgba(217, 168, 92, .18); border-radius: 4px; }
/* 고른 칸: 금색 테와 네 모서리 꺾쇠 */
.bag-slot.is-picked { border-color: var(--gold); box-shadow: 0 0 0 2px #120a05, 0 0 12px color-mix(in srgb, var(--gold) 55%, transparent), inset 0 3px 0 rgba(0, 0, 0, .45); }
.bag-slot.is-picked::before {
  content: ""; position: absolute; inset: -7px; pointer-events: none;
  background:
    linear-gradient(var(--gold), var(--gold)) 0 0 / 10px 3px, linear-gradient(var(--gold), var(--gold)) 0 0 / 3px 10px,
    linear-gradient(var(--gold), var(--gold)) 100% 0 / 10px 3px, linear-gradient(var(--gold), var(--gold)) 100% 0 / 3px 10px,
    linear-gradient(var(--gold), var(--gold)) 0 100% / 10px 3px, linear-gradient(var(--gold), var(--gold)) 0 100% / 3px 10px,
    linear-gradient(var(--gold), var(--gold)) 100% 100% / 10px 3px, linear-gradient(var(--gold), var(--gold)) 100% 100% / 3px 10px;
  background-repeat: no-repeat; animation: bag-pick 1.2s steps(2) infinite;
}
@keyframes bag-pick { 50% { inset: -4px; } }
.bag-badge {
  position: absolute; right: -4px; bottom: -5px; padding: 2px 4px; font: 7px/1 var(--f-pixel); color: var(--cream);
  background: #120a05; border: 1px solid var(--hue, var(--stitch)); border-radius: 4px;
}
.bag-badge.is-uses { font-size: 9px; padding: 1px 4px; }
.bag-tab:focus-visible, .bag-slot:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* 상세 카드: 가방과 같은 가죽 틀, 안은 오래된 종이. 가방과 위아래 선이 맞는다. */
.bag-detail {
  display: grid; min-width: 0; min-height: 0; padding: 8px; color: var(--ink);
  background: linear-gradient(180deg, var(--leather-2), var(--leather)); border: 4px solid var(--leather-dark); border-radius: 16px;
  box-shadow: 0 5px 0 var(--leather-dark), inset 0 2px 0 rgba(255, 220, 160, .25);
}
.bag-card {
  position: relative; display: grid; gap: 8px; align-content: start; min-height: 0; padding: 12px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 9px; box-shadow: inset 0 0 0 2px #d9c493, inset 0 4px 8px rgba(91, 58, 28, .18);
}
.bag-detail-head { display: flex; align-items: center; gap: 10px; min-width: 0; padding-bottom: 8px; border-bottom: 2px dashed #cdb47e; }
.bag-detail-icon {
  flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 12px; border: 2px solid #120a05;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--hue, #000) 40%, transparent), transparent 70%), var(--slot);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .5), 0 2px 0 #b89a5e;
}
.bag-detail-title { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.bag-detail-title h3 { color: var(--accent); font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.bag-chip {
  padding: 2px 8px; font: 400 12px/1.3 var(--f-display); color: var(--ink); border-radius: 999px;
  background: color-mix(in srgb, var(--hue, var(--gold)) 45%, var(--paper)); box-shadow: inset 0 0 0 1px rgba(43, 36, 21, .35);
}
.bag-desc { font-size: 14px; }
.bag-row { display: grid; gap: 1px; padding: 6px 2px; border-top: 1px dotted #c3a873; min-width: 0; font-size: 14px; }
.bag-row-label { font: 400 12px/1.3 var(--f-display); color: var(--teal); }
.bag-ref { user-select: text; -webkit-user-select: text; }
.bag-pick { color: var(--ink-2); text-align: center; padding: 16px 0; }
@media (orientation: landscape) and (max-height: 500px) {
  body.menu-mode .bag { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  body.menu-mode .bag-detail { max-height: calc(var(--app-h, 100vh) - 60px); }
}
@media (prefers-reduced-motion: reduce) { .bag-slot.is-picked::before { animation: none; } }

/* 숙박권 사용 블록과 잠긴 활동, 일정 화면의 기한 창 */
.stay-row { display: flex; align-items: center; gap: 12px; }
.stay-cell { flex: 0 0 96px; }
.stay-side { display: grid; gap: 4px; flex: 1; min-width: 0; }
.stay-side p { margin: 0; }
.stay-use:disabled, .dialog-activity:disabled { opacity: .55; }
.dialog-locked { margin: 0; text-align: center; }
.deadline-list li.is-past { opacity: .45; }
.deadline-list strong { font-weight: 700; }
.deadline-list li { grid-template-columns: 96px minmax(0, 1fr); }
.deadline-list time { white-space: nowrap; }

/* ---- 아이폰 버튼 진동: 버튼을 덮는 투명 라벨과 숨긴 스위치 (src/ui/haptics.js) ----
   손가락이 라벨을 누르면 아이폰이 스위치에 믿을 수 있는 클릭을 넘겨 햅틱이 난다. 라벨은 눈에 보이지 않고 글자도 없다. */
.hx { position: absolute; inset: 0; z-index: 1; margin: 0; padding: 0; border-radius: inherit; background: none; -webkit-tap-highlight-color: transparent; cursor: inherit; }
.hx > input { position: absolute; width: 1px; height: 1px; margin: 0; visibility: hidden; pointer-events: none; }
:disabled > .hx, [aria-disabled="true"] > .hx, html.haptics-off :not([data-haptic-own]) > .hx { display: none; }

/* 추억 앨범: 크래프트지 위에 마스킹 테이프로 붙인 종이 카드와 폴라로이드 사진. 핀터레스트처럼 빈틈없이 쌓는다(album.js masonry). */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: 4px; column-gap: 14px; align-items: start; }
.album-slot { min-width: 0; }
.album-card {
  position: relative; display: grid; gap: 10px; min-width: 0; padding: 18px 12px 12px; color: var(--ink);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .35), transparent 40%),
    repeating-linear-gradient(0deg, rgba(120, 84, 40, .05) 0 1px, transparent 1px 4px),
    #ead9b5;
  border-radius: 4px; box-shadow: 0 2px 0 #b99a63, 0 6px 12px rgba(0, 0, 0, .35);
}
.album-slot:nth-child(3n + 1) .album-card { transform: rotate(-.6deg); }
.album-slot:nth-child(3n + 2) .album-card { transform: rotate(.5deg); }
.album-tape {
  position: absolute; top: -8px; left: 50%; width: 64px; height: 18px; transform: translateX(-50%) rotate(-3deg);
  background: repeating-linear-gradient(45deg, rgba(242, 193, 78, .75) 0 6px, rgba(255, 226, 150, .75) 6px 12px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.album-slot:nth-child(even) .album-tape { background: repeating-linear-gradient(45deg, rgba(239, 122, 90, .7) 0 6px, rgba(255, 176, 150, .7) 6px 12px); transform: translateX(-50%) rotate(2deg); }
.album-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-bottom: 6px; border-bottom: 2px dashed #c7ab76; }
.album-card-head h3 { color: var(--accent); font-size: 17px; }
.album-card .entry { display: grid; gap: 6px; min-width: 0; padding: 0; background: none; border-radius: 0; }
.album-card .entry + .entry { padding-top: 10px; border-top: 1px dotted #c3a873; }
.entry-name {
  justify-self: start; padding: 1px 8px; font: 700 12px/1.5 var(--f-body); color: var(--cream);
  background: var(--heri); border-radius: 999px;
}
.polaroid { margin: 0; padding: 6px 6px 18px; background: #fffdf6; border-radius: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.polaroid .photo { border-radius: 1px; background: #ddd; max-height: 260px; object-fit: cover; }
.album-card .entry p { font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .album-slot .album-card { transform: none; } }

/* 금고 비밀번호 화면(공개 판 첫 실행) */
.unlock-screen { min-height: calc(var(--app-h, 100vh) - 40px); display: grid; place-items: center; }
.unlock { width: min(420px, 100%); text-align: center; }
.unlock-title { font-size: 26px; color: var(--accent); }
.unlock-input {
  width: 100%; min-height: 48px; padding: 8px 12px; font: 16px/1.4 var(--f-body); color: var(--ink);
  background: var(--shoji); border: 3px solid var(--wood); border-radius: 8px; box-shadow: inset 0 3px 0 rgba(91, 58, 28, .25);
}
.unlock-input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.unlock-wrong { color: var(--accent); }
