/* UAENA Planet — paper, ink, washi and painted keepsakes. */
@font-face { font-family: 'Yellowtail'; src: url('../fonts/Yellowtail.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'ZCOOL KuaiLe'; src: url('../fonts/ZCOOLKuaiLe.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Gaegu'; src: url('../fonts/Gaegu-Bold.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #fff2d7;
  --cream: #f9e7c6;
  --ink: #294537;
  --ink-soft: #655747;
  --copper: #85472e;
  --edge: #a8875f;
  --pencil: #7c5e43;
  --gold: #f2d69b;
  --peach: #eebd96;
  --lilac: #e2d2e9;
  --sage: #dbe1ba;
  --dark: #183b33;
  --grain: url('../assets/ui/grain.webp');
  --script: 'Yellowtail', 'Brush Script MT', cursive;
  --body: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --hand: 'ZCOOL KuaiLe', var(--body);
  --kr: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --cute: var(--body);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
html[lang="en"] { --hand: 'Gaegu', var(--body); --cute: var(--hand); }
html[lang="ko"] { --body: var(--kr); --hand: AppleMyungjo, 'Noto Serif CJK KR', var(--kr); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--dark); color: var(--ink); font-family: var(--body); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
:is(#c, #hud, #labels, .overlay, button) { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#in-name { -webkit-touch-callout: default; }
input { font: inherit; }
:focus-visible { outline: 2px solid #67417a; outline-offset: 2px; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.script { font-family: var(--script); font-weight: 400; }
.kr { font-family: var(--kr); font-weight: 700; }
.cute { font-family: var(--cute); font-weight: 700; }
.ico { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.22em; flex: 0 0 auto; }
.ico-slot, .ico-inline { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

/* The painted corners stay at a fixed size as each piece of paper stretches. */
.paper {
  position: relative;
  border: 6px solid transparent;
  border-image: url('../assets/ui/folio.webp') 22 fill / 11px stretch;
}
.tape {
  position: absolute;
  width: 70px;
  height: 16px;
  background: var(--grain) left top / 92px #c9adc9;
  opacity: .86;
  clip-path: polygon(0 4%, 100% 0, 97% 23%, 100% 45%, 97% 66%, 100% 96%, 0 100%, 3% 73%, 0 50%, 3% 29%);
  transform: rotate(-6deg);
  pointer-events: none;
}
.tape.y { background-color: #e1b868; }
.tape.g { background-color: #b4bc96; }
.sticker {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 8px; border: 1px dashed #b4926a;
  border-radius: 4px 6px 4px 7px; background: var(--grain) 0 0 / 96px #f5e3bc;
  font: 700 12px/1.2 var(--body);
}
.btn, .round-btn, .panel .x, .lang-pills button, .pass-stan-btn, .menu-tabs button, .year-arrow {
  min-height: 44px;
  background: var(--grain) 0 0 / 108px var(--tab, var(--cream));
  border: 1px solid var(--edge);
  border-radius: 7px 4px 6px 4px / 5px 6px 4px 7px;
  box-shadow: 0 2px 0 var(--edge);
  font-weight: 700;
  touch-action: manipulation;
}
.btn:active, .round-btn:active, .panel .x:active, .lang-pills button:active,
.pass-stan-btn:active, .menu-tabs button:active, .year-arrow:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--edge);
}
.btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; text-align: center; font-size: 14px; line-height: 1.3; }
.btn.primary { --tab: var(--lilac); --edge: #957e9d; }
.btn.yellow { --tab: var(--gold); }
.lang-pills { display: flex; gap: 4px; }
.lang-pills button { min-width: 44px; padding: 0 9px; font-size: 11px; white-space: nowrap; }
.lang-pills button[aria-pressed="true"] { --tab: var(--lilac); --edge: #957e9d; color: #52394e; }

/* Loading and first departure */
#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  text-align: center; color: var(--paper); background: var(--grain) 0 0 / 180px #153b32;
  transition: opacity .6s;
}
#loading.out { opacity: 0; pointer-events: none; }
.load-planet { font-size: 76px; line-height: 1; margin-bottom: 12px; }
#loading .script { color: var(--gold); font-size: 44px; line-height: 1; }
#load-text { font-size: 13px; margin-top: 12px; }
.load-bar { width: 172px; height: 8px; padding: 1px; margin: 14px auto 0; border: 1px solid #ac9065; border-radius: 5px 3px 3px 4px; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }

#start { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; }
.music-unlock-hint { position: absolute; top: calc(12px + var(--safe-t)); left: calc(14px + var(--safe-l)); padding: 5px 9px; transform: rotate(-3deg); border: 1px dashed #987b5c; border-radius: 5px 8px 4px 7px; background: var(--grain) 0 0 / 100px var(--paper); color: #6b4e62; font: 700 13px/1.2 var(--hand); pointer-events: none; }
.music-unlock-hint > span:first-child { color: var(--copper); font-size: 17px; }
.float-lang { pointer-events: auto; position: absolute; top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); z-index: 1; }
.float-lang button { --edge: #a98d68; }
.title-float {
  position: absolute; inset: calc(63px + var(--safe-t)) 0 auto;
  text-align: center; color: #fff1ce; text-shadow: 0 1px 2px #1b3834;
}
.kicker { font-size: 10px; letter-spacing: .16em; font-weight: 800; }
.title-float .kr { display: block; font-size: 17px; margin: 4px 0 1px; letter-spacing: .08em; }
.title-float .script { display: block; color: var(--gold); font-size: 53px; line-height: .95; }
.start-card {
  pointer-events: auto; margin: 0 max(10px, var(--safe-r)) calc(10px + var(--safe-b)) max(10px, var(--safe-l));
  padding: 16px 13px 13px; max-height: 73dvh; overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
}
html[lang="zh-CN"] .start-card { --hand: 'Songti SC', 'Noto Serif CJK SC', SimSun, serif; }
.start-card::before, .menu-panel::before {
  content: ''; position: absolute; pointer-events: none;
  background: url('../assets/ui/flowers.webp') center / contain no-repeat;
}
.start-card::before { width: 49px; height: 58px; top: 5px; right: 8px; transform: rotate(11deg); }
.start-card .tape { top: -4px; left: 23px; }
.start-card h2 { margin: 0 43px 3px 0; font: 700 23px/1.13 var(--hand); text-wrap: balance; }
.start-card .lead { margin: 0 40px 11px 0; font-size: 12px; line-height: 1.48; color: var(--ink-soft); }
.desk-title { display: none; }
.name-field { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.name-field label, .field-label { font-size: 13px; font-weight: 700; }
.name-field label { flex: 0 1 auto; }
#in-name {
  min-width: 0; flex: 1 1 0;
  border: 0; border-bottom: 1px dashed var(--pencil); padding: 2px 3px 4px;
  background: transparent; color: var(--copper); font-size: 17px; font-weight: 700;
  border-radius: 0; user-select: text; -webkit-user-select: text; touch-action: manipulation;
}
#in-name::placeholder { color: #826951; opacity: 1; }
.field-label { margin: 0 0 5px; }
.year-track { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; }
.year-arrow { z-index: 1; display: grid; place-items: center; color: var(--pencil); font-size: 20px; }
.year-arrow:disabled { opacity: .46; cursor: default; }
#since-row {
  --year-step: 78px;
  display: flex; min-width: 0; padding: 5px calc((100% - var(--year-step)) / 2) 7px;
  overflow: hidden; touch-action: pan-y; cursor: grab; background: var(--grain) 0 0 / 95px #eadcbd;
  border-block: 1px dashed #ae936e;
}
#since-row.dragging, #since-row.dragging button { cursor: grabbing; }
#since-row .chip { flex: 0 0 var(--year-step); padding: 0 3px; min-height: 44px; color: #67523e; touch-action: pan-y; }
#since-row .chip span {
  display: grid; place-items: center; height: 44px; border: 1px solid #b99d79;
  border-radius: 4px 6px 5px 3px; background: var(--grain) 0 0 / 90px #f2dfbb;
  font: 400 25px/.9 var(--script); pointer-events: none;
}
#since-row .chip.current span { background-color: var(--gold); border: 1px solid #957052; color: var(--copper); box-shadow: 0 2px 0 #997352; transform: rotate(-3deg); }
#since-row .chip:focus { outline: none; }
.year-help { margin: 5px 0 8px; text-align: center; color: var(--ink-soft); font-size: 11px; }
.year-postcard {
  display: grid; grid-template-columns: 79px minmax(0, 1fr); gap: 13px; align-items: center;
  min-height: 120px; padding: 7px 8px; border: 1px solid #a789a6; border-radius: 5px 7px 5px 9px;
  background: var(--grain) 0 0 / 118px #ebdcea;
}
.mascot-portrait {
  display: block; width: 79px; height: 79px; border: 1px dashed #9b7b99;
  border-radius: 45% 52% 48% 54%; background-color: #f7e9d9;
  background-image: url('../assets/ui/companions.webp');
  background-size: 308px 154px; background-position: var(--portrait-x, 0) var(--portrait-y, 0);
  transform: rotate(-5deg);
}
.mascot-portrait[data-mascot="osori"], .mascot-portrait[data-mascot="ail"] { --portrait-x: -77px; }
.mascot-portrait[data-mascot="dayuk"], .mascot-portrait[data-mascot="eon"] { --portrait-x: -154px; }
.mascot-portrait[data-mascot="yukbul"], .mascot-portrait[data-mascot="kkumung"] { --portrait-x: -231px; }
.mascot-portrait:is([data-mascot="lucky"], [data-mascot="ail"], [data-mascot="eon"], [data-mascot="kkumung"]) { --portrait-y: -77px; }
.year-story { display: grid; align-content: center; justify-items: start; gap: 2px; }
#since-era { color: #6e4c70; font-size: 10.5px; font-weight: 700; }
#since-song { font-size: 16px; line-height: 1.2; font-family: var(--kr); overflow-wrap: anywhere; }
#since-together, #since-mascot { color: #544656; font-size: 11px; font-weight: 600; }
#since-mascot[hidden] { display: none; }
#mascot-row { display: flex; flex-wrap: wrap; gap: 5px; }
#mascot-row .chip {
  min-height: 44px; padding: 2px 7px; max-width: 100%; font-size: 11px;
  border: 1px solid #aa8ca8; border-radius: 4px 6px 5px 3px; background: #f5eaf2; color: #5c4862;
}
#mascot-row .chip[aria-pressed="true"] { background: #d3b5d7; border-color: #846084; color: #392d3c; }
.stamp-btn {
  width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 11px; padding: 6px 10px; color: #53372f;
  background: var(--grain) 15px 6px / 108px var(--peach);
  border: 1px solid #a76d53; border-radius: 8px 5px 7px 5px / 5px 8px 5px 6px;
  box-shadow: 0 3px 0 #a76d53; font: 700 21px/1.05 var(--hand); touch-action: manipulation;
}
.stamp-btn:active { transform: translateY(3px); box-shadow: none; }
.invite { margin: 3px 0 10px; padding: 7px 9px; border: 1px dashed #a97955; background: var(--cream); font-size: 12px; line-height: 1.5; }
.invite b { color: var(--copper); }

/* World HUD and touch controls */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; touch-action: manipulation; }
#hud > * { pointer-events: auto; }
#hud > .hud-top { pointer-events: none; }
.hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; align-items: flex-start; gap: 4px; }
.hud-top > button { pointer-events: auto; }
.hud-spacer { flex: 1; }
.round-btn, .panel .x {
  width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; font-size: 19px;
}
#btn-map { --tab: var(--sage); --edge: #809374; }
#btn-menu { --tab: var(--lilac); --edge: #987b9d; transform: rotate(3deg); }
#btn-menu:active { transform: rotate(1deg) translateY(2px); }
.round-btn.off { --tab: #ded4bd; color: #67523e; }
.binder-btn, .stan-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px;
  border: 1px solid var(--edge); border-radius: 7px 4px 6px 4px; box-shadow: 0 2px 0 var(--edge);
  background: var(--grain) 0 0 / 105px var(--gold); padding: 0 8px;
  white-space: nowrap; font-size: 12px; font-weight: 700; touch-action: manipulation;
}
.binder-btn { gap: 4px; padding-inline: 6px; }
.binder-btn .ico-slot { font-size: 17px; }
.binder-btn b { font-size: 15px; color: var(--copper); }
.binder-btn:active, .stan-pill:active { transform: translateY(2px); box-shadow: none; }
.stan-pill { background-color: var(--paper); font-size: 11px; gap: 4px; padding-inline: 6px; }
.stan-pill .stan-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #806e57; flex: 0 0 auto; }
.stan-pill { min-width: 0; }
.stan-pill span:last-child { overflow: hidden; text-overflow: ellipsis; }
#hud > :is(#now-playing, #era-banner, #quest, #hint) { pointer-events: none; }
#now-playing {
  position: absolute; bottom: calc(181px + var(--safe-b)); left: calc(10px + var(--safe-l));
  display: flex; align-items: center; gap: 8px; max-width: min(65vw, 260px); min-height: 34px;
  padding: 4px 9px 4px 5px; border: 1px solid #98815e; border-radius: 3px 5px 4px 7px;
  background: var(--grain) 0 0 / 95px #233f34; color: var(--paper); font-size: 12px; font-weight: 700;
}
#np-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#now-playing #np-cover { width: 25px; height: 25px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 1px solid var(--gold); }
#now-playing .reel { width: 19px; height: 19px; border-radius: 50%; border: 3px dotted var(--gold); flex-shrink: 0; }
#era-banner {
  position: absolute; top: calc(65px + var(--safe-t)); left: 50%; transform: translateX(-50%) rotate(-2deg);
  min-width: 130px; padding: 4px 12px; opacity: 0; text-align: center; transition: opacity .35s;
}
#era-banner.on { opacity: 1; }
#era-banner .script { display: block; color: var(--copper); font-size: 26px; line-height: .95; }
#era-banner .cute { font-size: 12px; }
#era-banner .tape { top: -13px; left: calc(50% - 24px); width: 48px; height: 13px; }
#quest {
  position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(82px + var(--safe-b));
  max-width: min(62vw, 275px); padding: 9px 10px; background: var(--grain) 0 0 / 105px var(--paper);
  border: 1px solid var(--edge); border-radius: 7px 4px 8px 3px; font-size: 12px; line-height: 1.48;
}
#quest b { color: var(--copper); }
#act-btn {
  position: absolute; left: 50%; bottom: calc(222px + var(--safe-b)); transform: translateX(-50%) rotate(-2deg);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px;
  width: max-content; max-width: 88vw; padding: 6px 14px; border: 1px solid #9b774a; border-radius: 5px 8px 6px 3px;
  background: var(--grain) 0 0 / 100px var(--gold); box-shadow: 0 3px 0 #906e45; font-size: 14px; font-weight: 700;
}
#act-btn:active { transform: translate(-50%, 3px); box-shadow: none; }
#act-btn kbd { flex-shrink: 0; font: 700 11px var(--body); border: 1px solid #a68a61; padding: 2px 5px; margin-left: 3px; }
#hud > .touch-btns { pointer-events: none; }
.touch-btns { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.t-btn {
  pointer-events: auto; width: 70px; height: 70px; display: grid; place-content: center; justify-items: center; gap: 1px;
  border: 1.5px solid #a8875f; border-radius: 47% 53% 48% 52% / 51% 47% 53% 49%;
  background: var(--grain) 0 0 / 94px var(--gold); box-shadow: 0 3px 0 #a8875f; touch-action: none;
}
.t-btn.ike-btn { width: 58px; height: 58px; background-color: var(--lilac); border-color: #9a7b9e; box-shadow: 0 3px 0 #9a7b9e; font-size: 24px; }
.t-btn.jump-btn { font-size: 23px; }
.t-btn.jump-btn small { font-weight: 800; font-size: 11px; line-height: 1.02; }
.t-btn:active, .t-btn.is-active { transform: translateY(3px) scale(.95); box-shadow: none; }
#joy {
  position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 49%;
  background: #f9e7c63b; border: 2px dashed #f4d59e; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 11;
}
#joy.on { opacity: 1; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 46% 54% 49% 51%; background: var(--grain) 0 0 / 90px var(--gold); border: 1px solid #9b774a; }
#hint {
  position: absolute; left: calc(14px + var(--safe-l)); right: 107px; bottom: calc(20px + var(--safe-b));
  color: var(--paper); font-size: 11px; font-weight: 700; line-height: 1.5;
  text-shadow: 0 1px 3px #152920, 0 1px 3px #152920; transition: opacity 1s;
}
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 9; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: 230px; padding: 8px 11px;
  background: var(--grain) 0 0 / 105px var(--paper); border: 1px solid #9c7d57; border-radius: 8px 13px 12px 7px;
  font-size: 13px; line-height: 1.45; animation: pop .25s;
}
.bubble::after { content: ''; position: absolute; left: calc(50% - 5px); bottom: -5px; width: 9px; height: 9px; background: var(--paper); border-right: 1px solid #9c7d57; border-bottom: 1px solid #9c7d57; transform: rotate(45deg); }
.bubble b { display: block; color: var(--copper); }
@keyframes pop { from { opacity: 0; scale: .8; } }
#toasts {
  position: fixed; top: calc(66px + var(--safe-t)); right: calc(10px + var(--safe-r)); z-index: 40;
  display: flex; flex-direction: column; gap: 7px; pointer-events: none; width: min(56vw, 213px);
}
body.has-modal #toasts, body.has-modal #act-btn { display: none; }
.toast {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 7px;
  background: var(--grain) 0 0 / 112px var(--paper); border: 1px solid #a48564; border-radius: 5px 9px 4px 5px;
  box-shadow: 2px 2px 0 #553d320d; animation: drop .26s ease-out;
}
.toast .medal {
  flex: 0 0 27px; height: 27px; display: grid; place-items: center; font-size: 20px;
  border: 1px dashed #a884a0; border-radius: 48% 52% 46% 54%; background: var(--lilac); transform: rotate(-6deg);
}
.toast b { display: block; font-size: 13px; line-height: 1.25; color: var(--copper); }
.toast small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .35s; }
@keyframes drop { from { transform: translateY(-14px) rotate(-3deg); opacity: 0; } }

body.in-game :is(.stan-pill, #btn-binder, #btn-menu, #btn-map, #quest, #era-banner, .touch-btns, #hint, #now-playing, #act-btn) { display: none !important; }
body.in-game #toasts { top: calc(112px + var(--safe-t)); bottom: auto; }

/* Keepsake sheets */
.sheet {
  position: fixed; inset: 0; z-index: 35; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 max(7px, var(--safe-r)) calc(7px + var(--safe-b)) max(7px, var(--safe-l));
  background: #172b27a3; animation: fade .16s;
}
@keyframes fade { from { opacity: 0; } }
.sheet > .panel {
  width: 100%; max-width: 540px; max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 26px);
  overflow: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin;
  padding: 13px 14px 14px; animation: up .23s ease-out; outline: none;
}
@keyframes up { from { transform: translateY(28px); } }
.panel h3 {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; min-height: 33px;
  margin: 2px 47px 11px 0; color: var(--ink); font: 700 26px/1.12 var(--hand); text-wrap: balance;
}
.panel p { font-size: 13px; line-height: 1.6; }
.panel .x { position: absolute; z-index: 1; top: 8px; right: 9px; --tab: var(--gold); font-size: 16px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }

/* Passport cover, loose ticket and the pages it indexes */
.sheet > .menu-panel { max-width: 475px; }
.menu-panel::before { width: 48px; height: 58px; top: 3px; right: 66px; transform: rotate(11deg); }
.menu-panel h3.menu-title { position: relative; min-height: 38px; margin: 4px 112px 9px 0; font-size: 32px; }
html[lang="en"] .menu-panel h3.menu-title { font: 400 37px/.95 var(--script); }
.uaena-pass {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px;
  padding: 11px 10px 12px; border: 1px solid #594664; border-radius: 3px 9px 6px 5px;
  background: var(--grain) 14px 5px / 143px #625171; color: #fff0d4;
}
.uaena-pass::after {
  content: ''; position: absolute; inset: 3px; pointer-events: none;
  border: 1px dashed #d2b4ac99; border-radius: 2px 6px 4px 5px;
}
.pass-serial { display: block; color: #fae4ac; font: 700 10px/1.15 ui-monospace, monospace; letter-spacing: .1em; }
.pass-name { font: 700 24px/1.12 var(--hand); margin: 3px 0; overflow-wrap: anywhere; }
.pass-since { color: #fff0dc; font-size: 11px; line-height: 1.3; }
.pass-stan-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 136px; padding: 5px 8px; color: #573d33; font-size: 11px; line-height: 1.2; --tab: var(--gold); }
.menu-ticket {
  position: relative; width: 100%; min-height: 78px; margin: 13px 0 10px; padding: 8px 9px 8px 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) 61px; align-items: center; text-align: left;
  color: #5c3a30; background: var(--grain) 0 0 / 137px var(--peach);
  border: 1px solid #a67356; border-radius: 6px 4px 7px 5px; transform: rotate(-1deg);
  box-shadow: 0 2px 0 #a67356; touch-action: manipulation;
}
.menu-ticket:active { transform: translateY(2px); box-shadow: none; }
.menu-ticket b { display: block; font: 700 23px/1.08 var(--hand); }
html[lang="en"] .menu-ticket b { font: 400 29px/1.08 var(--script); }
.menu-ticket small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.2; }
.ticket-stub { align-self: stretch; border-left: 1px dashed #a67356; padding-left: 7px; display: grid; place-items: center; }
.ticket-stub .ico-slot { font-size: 34px; transform: rotate(9deg); }
.menu-pages { display: grid; grid-template-columns: 1fr; }
.menu-pages button {
  min-width: 0; min-height: 51px; display: grid; grid-template-columns: 45px minmax(0, 1fr) 16px;
  align-items: center; gap: 8px; text-align: start; padding: 2px 4px;
  border-bottom: 1px dashed #a7855e; touch-action: manipulation;
}
.menu-pages button:active { background: #e4d1ad; }
.menu-pages b { display: block; font-size: 14px; line-height: 1.2; }
.menu-pages small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 11px; line-height: 1.2; }
.page-arrow { color: #88664c; font-size: 13px; }
.memento {
  width: 42px; height: 42px; display: block; background: url('../assets/ui/mementos.webp') 0 0 / 168px 42px no-repeat;
}
.map-art { transform: rotate(-9deg); }
.binder-art { background-position: -42px 0; transform: rotate(5deg); }
.award-art { background-position: -84px 0; transform: rotate(-7deg); }
.concert-art { background-position: -126px 0; transform: rotate(8deg); }
.menu-tabs { display: flex; gap: 6px; margin-top: 12px; }
.menu-tabs button {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 5px;
  font-size: 11px; line-height: 1.12;
}
.menu-tabs button:nth-child(2) { --tab: var(--sage); }
.menu-tabs button:nth-child(3) { --tab: var(--lilac); --edge: #9c83a1; }
.menu-tabs .ico-slot { font-size: 15px; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 1px; border-bottom: 1px dashed #b49774; font-size: 14px; font-weight: 700;
}
#settings-music { flex: 0 0 auto; --tab: var(--lilac); --edge: #9c83a1; }
#settings-music[aria-pressed="false"] { --tab: #eadfc9; }
.reset-btn { min-height: 44px; margin-top: 12px; color: var(--copper); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* Photocard reveal and album */
.reveal { display: grid; gap: 9px; }
.card3d { perspective: 1100px; width: min(51vw, 235px); aspect-ratio: 2 / 3; margin: 3px auto; }
.card3d .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3, 1.2, .4, 1); }
.card3d.flipped .inner { transform: rotateY(180deg); }
.card3d .face, .card3d .back {
  position: absolute; inset: 0; border-radius: 7px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden; outline: 1px solid #a78656; box-shadow: 1px 3px 0 #87613c50;
}
.card3d .face { transform: rotateY(180deg); }
.card3d img { width: 100%; height: 100%; display: block; }
.reveal .meta { text-align: center; }
.reveal .meta .yr { color: var(--copper); font: 400 31px/1 var(--script); }
.reveal .meta h4 { margin: 2px 0 1px; font-weight: 700; font-size: 17px; }
.reveal .meta .tracks { color: var(--ink-soft); font: 400 13px/1.38 var(--kr); }
.reveal .note {
  position: relative; padding: 10px 11px; border: 1px solid #b8956e; border-radius: 6px 3px 7px 4px;
  background: var(--grain) 0 0 / 105px #fff0cd; font-size: 12.5px; line-height: 1.65;
}
.reveal .note .tape { top: -7px; right: 12px; width: 43px; height: 13px; transform: rotate(7deg); }
.playing {
  display: flex; align-items: center; gap: 7px; padding: 3px 5px 3px 8px;
  background: var(--grain) 0 0 / 110px #e7d9e9; border: 1px solid #ad8eb2; border-radius: 4px 7px 3px 6px;
  color: #543c59; font-size: 12px; font-weight: 700;
}
.playing button { margin-left: auto; min-height: 44px; padding: 0 8px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
.playing button:active { transform: translateY(2px); }
.playing .eq { display: flex; gap: 3px; align-items: flex-end; flex-shrink: 0; height: 12px; }
.playing .eq i { width: 3px; height: 7px; background: #85648d; border-radius: 2px; }
.playing .eq i:nth-child(2) { height: 11px; }
.playing .eq i:nth-child(3) { height: 9px; }
#s-card .row-btns { margin-top: 1px; }
.binder-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.slot {
  aspect-ratio: 2 / 3; position: relative; display: grid; place-items: center; text-align: center;
  border: 1px dashed #a98b67; border-radius: 4px 7px 5px 4px; overflow: hidden; background: var(--grain) 0 0 / 107px #efdcbb;
}
.slot:active { background-color: #dcc49d; }
.slot.got { border: 1px solid #9f7f61; box-shadow: 1px 2px 0 #a48564; transform: rotate(-2deg); }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .q { padding: 4px; color: #72583f; font-size: 11px; font-weight: 600; line-height: 1.28; }
.slot .q b { display: block; font: 400 26px/1 var(--script); color: #8d563c; margin-bottom: 5px; }
.slot .stan-mark {
  position: absolute; top: 3px; left: 3px; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 46% 54%; background: var(--gold); font-size: 12px;
}
.binder-stats { display: flex; gap: 5px; flex-wrap: wrap; margin: 0 0 10px; }

#achievements-progress { margin: -3px 0 12px; color: var(--copper); font-weight: 700; }
.stickers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.stk {
  display: grid; align-content: start; justify-items: start; gap: 5px; padding: 7px 8px;
  border: 1px dashed #b69877; border-radius: 5px 3px 6px 5px; color: #645348; background: #f2dfbd;
}
.stk.got { background: var(--grain) 0 0 / 106px #f8e6bc; border-color: #98734b; }
.stk .ic {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 20px;
  background: url('../assets/ui/stamp.webp') center / contain no-repeat;
}
.stk:not(.got) .ic { opacity: .62; filter: saturate(.35); }
.stk b { display: block; font-size: 13px; line-height: 1.25; }
.stk small { display: block; font-size: 11px; line-height: 1.32; margin-top: 3px; }

/* Map, city tickets, kindness wishes and guide */
#s-map > .panel { display: flex; flex-direction: column; overflow: hidden; }
.map-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 3px 3px; }
.map-list, .kind-list { display: grid; gap: 6px; }
.map-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 0 3px 9px;
  color: var(--ink-soft); font-size: 11px; font-weight: 700;
}
.map-legend > span, .map-stamp { display: inline-flex; align-items: center; gap: 4px; }
.map-legend > span:first-child { color: var(--ink); }
.map-check { font: 700 12px/1 var(--body); color: #715e49; }
.map-legend > span:nth-child(2) .map-check, .map-stamp.done .map-check { color: #345945; }
.map-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 7px; width: 100%; text-align: left;
  border-bottom: 1px dashed #a78665; min-height: 48px;
}
.map-item.with-activities {
  border: 1px solid #b69370; border-radius: 6px 4px 8px 4px;
  background: var(--grain) 0 0 / 110px #f7e7c8;
}
.map-item:active { background-color: #e9d4ad; }
.map-item .dot {
  width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  border: 2px solid #f2dfb9; outline: 1px solid #a28460; border-radius: 5px 6px 4px 3px; color: var(--ink);
}
.map-item .dot .map-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-item b { display: block; font-size: 14px; }
.map-copy { flex: 1; min-width: 0; }
.map-item small, .city small { color: var(--ink-soft); font-size: 11px; }
.map-item .got { color: var(--copper); font-size: 11px; font-weight: 700; white-space: nowrap; }
.map-item.with-activities > .got { align-self: flex-start; padding-top: 2px; }
.map-stamps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.map-stamp {
  min-height: 23px; padding: 2px 5px; color: var(--ink); font-size: 11px; line-height: 1.15;
  border: 1px dashed #ab8a6c; border-radius: 4px 5px 3px 5px;
  background: var(--grain) 0 0 / 85px var(--stamp, #f7edd6);
}
.map-stamp.done { border-style: solid; border-color: #788265; }
.map-stamp .ico { font-size: 13px; }
.map-stamp.mic, .map-stamp.cloud, .map-stamp.telescope { --stamp: #e5d4e8; }
.map-stamp.paw, .map-stamp.lantern { --stamp: #f4d6c3; }
.map-stamp.ike, .map-stamp.ticket { --stamp: #f3dda0; }
.map-heading { margin: 11px 3px 3px; font: 700 14px/1.3 var(--hand); color: var(--copper); }
.map-secrets .map-stamps { margin-left: 3px; }
.stan-tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px; margin-left: 5px; background: var(--gold); color: #76513b; font-size: 10px; }
.kind-list button, .city {
  min-height: 44px; text-align: left; padding: 6px 9px;
  border: 1px dashed #ac8b67; border-radius: 5px 3px 6px 4px; background: var(--grain) 0 0 / 100px #f7e6c7;
  font-size: 13px;
}
.kind-list button[aria-pressed="true"], .city[aria-pressed="true"] { border: 1px solid #987c9e; background-color: var(--lilac); }
.kind-note, #s-help p { padding: 7px 10px; border-left: 2px solid #bb9ac1; background: #f3e4ce; }
#s-help p b { display: block; color: var(--copper); }
.city-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.city b { display: block; font-size: 13px; }

/* Share poster surround. The printed card is generated separately. */
#s-share > .share-panel {
  --share-hand: var(--hand);
  width: min(100%, 442px); padding: 14px 12px 14px; color: var(--paper);
  background: #193d33 url('../assets/share/parchment.webp') center top / 100% auto;
  background-blend-mode: multiply;
  border: 1px solid #a08358; border-radius: 12px 9px 6px 5px; box-shadow: inset 0 0 0 3px #d6ad6247;
}
html[lang="ko"] #s-share > .share-panel { --share-hand: 'Gaegu', var(--hand); }
.share-panel #share-title {
  display: block; margin: 1px 41px 11px; color: var(--paper); text-align: center;
  font: 700 24px/1.12 var(--share-hand);
}
html[lang="en"] .share-panel #share-title { font: 400 30px/1.12 var(--script); }
.share-preview {
  position: relative; width: min(100%, 302px, max(140px, calc((100dvh - 297px - var(--safe-b) - var(--safe-t)) * .5625)));
  aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 4px; outline: 1px solid #c49d65; background: #153b35;
}
.share-img { display: block; width: 100%; height: auto; border-radius: 4px; -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; touch-action: auto; }
.share-status {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center;
  gap: 14px; padding: 12px; text-align: center; color: var(--gold); font: 700 21px/1.2 var(--share-hand);
}
.share-status > .ico-slot { font-size: 34px; }
.share-panel .share-hint { margin: 10px 0 0; text-align: center; color: var(--paper); font-size: 12px; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.share-actions .btn, .share-panel #share-retry { color: var(--ink); word-break: keep-all; }
#ticket-next .btn { min-height: 44px; }
.share-actions .share-send { grid-column: 1 / -1; --tab: var(--peach); }
.share-actions .share-copy { --tab: var(--sage); }

@media (min-width: 820px) {
  .sheet { align-items: center; }
  .sheet > .panel { padding: 16px 19px 18px; max-height: 91dvh; }
  #start { justify-content: center; align-items: flex-start; }
  #start .title-float { display: none; }
  .start-card { margin: 0 0 0 max(5vw, calc((100vw - 1180px) / 2)); width: 414px; max-height: 91dvh; padding: 17px 17px 16px; }
  .desk-title { display: block; margin-bottom: 13px; }
  .desk-title .kr { display: block; color: #5e5366; font-size: 18px; margin: 3px 0; }
  .desk-title .script { display: block; color: var(--copper); font-size: 50px; line-height: .92; }
  .touch-btns { right: 20px; bottom: 20px; gap: 10px; }
  .t-btn { width: 62px; height: 62px; }
  .t-btn.ike-btn { width: 52px; height: 52px; }
  #joy { display: none; }
  #quest { bottom: 24px; left: 16px; }
  #now-playing { bottom: 95px; left: 16px; }
  #hint { left: 50%; right: auto; transform: translateX(-50%); bottom: 17px; text-align: center; width: max-content; max-width: calc(100vw - 320px); }
  #act-btn { bottom: 55px; }
  .binder-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card3d { width: 209px; }
}
@media (max-width: 355px) {
  .hud-top { gap: 4px; }
  .stan-pill { font-size: 10px; padding-inline: 5px; }
  .start-card h2 { font-size: 20px; }
  .start-card .lead { margin-right: 30px; }
  .menu-tabs button { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

#welcome-options { display: grid; gap: 5px; margin-top: 10px; }
#welcome-options .btn, #welcome-options .reset-btn { min-height: 44px; }
#start-title { overflow-wrap: anywhere; }
.map-travel { flex: 0 0 auto; max-width: 25%; color: var(--copper); font-size: 12px; text-align: right; }

.sung-stamp {
  display: inline-block; padding: 3px 5px; transform: rotate(-5deg);
  color: #64410e; background: #ffdf90; border: 1px dashed #936017;
  border-radius: 5px 3px; font: 700 11px/1.12 var(--body); white-space: nowrap;
}
.slot:not(.song-page) .sung-stamp { position: absolute; bottom: 6px; right: 5px; }
#map-songs { min-height: 44px; margin: 2px 0 8px; }

.discovery-spark {
  position: absolute; inset: 0 auto auto 0; width: 44px; height: 44px;
  display: grid; place-items: center; pointer-events: auto; touch-action: manipulation;
}
.discovery-spark::before {
  content: '✦'; color: #fffacf; font: 20px/1 sans-serif;
  text-shadow: 0 0 5px #9e5828, 0 0 11px #ffc54e;
  animation: discovery-glint 2.3s ease-in-out infinite alternate;
}
@keyframes discovery-glint { from { opacity: .53; scale: .72; } to { opacity: 1; scale: 1.18; } }
.bubble.discovery {
  width: max-content; max-width: 210px; display: grid; gap: 2px;
  pointer-events: auto; transform: translate(-50%, -100%); padding: 4px 8px;
}
.bubble.discovery.below { transform: translateX(-50%); }
.discovery.below::after { top: -5px; bottom: auto; transform: rotate(225deg); }
.discovery button {
  min-height: 44px; padding: 2px 8px; color: #4d392b; font-weight: 700;
  line-height: 1.15; border-radius: 5px; touch-action: manipulation;
}
.discovery button + button { border-top: 1px dashed #b39168; }
.discovery button:active { background: var(--gold); }
body.has-modal :is(.discovery, .discovery-spark), body.in-game :is(.discovery, .discovery-spark) { visibility: hidden; }
