/* 핀 뽑아라 냥
   해 질 녘 동굴 톤. 바탕은 짙은 밤색, 포인트는 엽전 금색과 부적 빨강. */
:root {
  --bg: #1d1520;
  --surface: #2e2230;
  --surface-2: #3d2d3c;
  --ink: #fff4ea;
  --sub: #d1b9b0;
  --line: #4a3846;
  --accent: #ffc93c;
  --accent-ink: #2e1a00;
  --red: #e8413a;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --game: "Jua", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --body: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { font-family: var(--game); font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.stage { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 6px; }
.logo { font-family: var(--game); font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: 0.04em; }
.logo b { color: #ff4867; font-weight: 400; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.screen.measuring > *, .screen.scrollable > * { flex-shrink: 0; }
.sub { color: var(--sub); }
.small { font-size: 13px; }
.center { text-align: center; }
.fine { font-size: 12px; color: var(--sub); text-align: center; }

.btn { min-height: 52px; border-radius: 16px; border: 0; padding: 10px 16px; font-size: 16px; font-weight: 700; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); transition: transform .08s ease; text-decoration: none; display: grid; place-items: center; text-align: center; line-height: 1.25; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-family: var(--game); font-weight: 400; font-size: 22px; box-shadow: 0 6px 0 #b47a08, var(--shadow); line-height: 1.15; }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b47a08, var(--shadow); }
.btn.primary small { display: block; font-family: var(--body); font-size: 12px; font-weight: 700; opacity: .75; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--sub); font-weight: 400; min-height: 44px; }
.btn.daily { display: flex; flex-direction: column; gap: 0; font-family: var(--game); font-weight: 400; font-size: 19px; background: var(--surface-2); border: 2px solid rgba(255, 201, 60, .35); }
.btn.daily .sub { font-family: var(--body); font-weight: 700; }
.btn.daily.hot { border-color: var(--accent); animation: glow 1.4s ease-in-out infinite alternate; }
.btn small.sub { font-size: 12px; }
@keyframes glow { from { box-shadow: 0 0 0 0 rgba(255, 201, 60, .7), var(--shadow); } to { box-shadow: 0 0 0 7px rgba(255, 201, 60, 0), var(--shadow); } }
.actions { display: grid; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.chip.new { background: var(--accent); color: var(--accent-ink); animation: pop .5s ease-out both .6s; align-self: center; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 14px; z-index: 20; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, transparent 3px, #ffd23f 3.5px, #e0a020 7px); box-shadow: inset 0 0 0 1px #8a5a00; flex: none; vertical-align: -2px; }
.purse { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--sub); }
.purse b { font-family: var(--game); font-weight: 400; font-size: 20px; color: var(--accent); }
.invite { text-align: center; background: rgba(255, 201, 60, .14); border: 1px dashed var(--accent); border-radius: 14px; padding: 8px 12px; font-size: 14px; word-break: keep-all; }
.invite b { color: var(--accent); }

/* ---- 시작 화면: 동굴 앞 */
.hall { position: relative; width: 100%; aspect-ratio: 4 / 3.4; border-radius: 24px; overflow: hidden; background: #2a1e33; box-shadow: var(--shadow); isolation: isolate; flex: none; }
.hall .bg { position: absolute; inset: 0; background: url("sprites/bg-start.webp") center 58% / cover no-repeat, linear-gradient(#8a6ad0, #e88a5a); animation: kenburns 18s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.06) translateY(-1.5%); } }
.motes i { position: absolute; left: calc(8% + var(--i) * 10%); bottom: 10%; width: 6px; height: 6px; border-radius: 50%; background: #ffe9a0; box-shadow: 0 0 10px 3px rgba(255, 210, 110, .75); opacity: 0; animation: mote 5.5s ease-in infinite; animation-delay: calc(var(--i) * -.61s); }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(14px, -200px); } }
.hall-hero { position: absolute; left: 6%; bottom: -2%; width: 46%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); z-index: 2; }
.bubble { position: absolute; right: 4%; top: 7%; max-width: 52%; background: #fff; color: #2a1d38; border-radius: 16px 16px 4px 16px; padding: 7px 12px; font-family: var(--game); font-size: 15px; line-height: 1.35; box-shadow: var(--shadow); word-break: keep-all; z-index: 4; }
.bubble.pop { animation: pop .3s ease-out; }
.hero-title { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.hero-title h1 { font-size: 46px; line-height: 1.05; text-shadow: 0 3px 0 #000a; }
.hero-title h1 em { font-style: normal; color: var(--accent); }
.hero-title .lede { color: var(--sub); font-size: 15px; word-break: keep-all; }

/* ---- 마을 지도 */
.screen-title { font-size: 28px; text-align: center; }
.village { position: relative; border-radius: 20px; padding: 12px; overflow: hidden; background: var(--surface); isolation: isolate; box-shadow: var(--shadow); }
.village::before { content: ""; position: absolute; inset: 0; background: var(--vbg) center 40% / cover no-repeat; opacity: .55; z-index: -1; }
.village::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(20, 12, 24, .2), rgba(20, 12, 24, .75)); z-index: -1; }
.village h3 { font-size: 20px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; text-shadow: 0 2px 0 #0008; }
.village h3 span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 15px; }
.village h3 small { font-family: var(--body); font-size: 12px; color: #f0dccf; flex-basis: 100%; }
.village.locked { filter: grayscale(.8) brightness(.7); }
.lv-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lv { width: 100%; aspect-ratio: 1 / 1.1; border: 0; border-radius: 12px; background: rgba(30, 20, 34, .82); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.lv b { font: 15px/1 var(--game); }
.lv span { font-size: 10px; letter-spacing: -1px; color: var(--accent); }
.lv:disabled span { color: var(--sub); letter-spacing: 0; }
.lv.done { background: rgba(80, 52, 20, .9); }
.lv.next { background: var(--accent); color: var(--accent-ink); animation: glow 1.2s ease-in-out infinite alternate; }
.lv.next span { color: #7a4d00; }

/* ---- 도감 */
.dex-h { display: flex; align-items: baseline; gap: 8px; font-size: 20px; margin-top: 6px; }
.dex-h small { font-family: var(--body); font-size: 13px; color: var(--accent); }
.dex-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dex-grid.five { grid-template-columns: repeat(5, 1fr); }
.dex-grid.four { grid-template-columns: repeat(4, 1fr); }
.dex-grid li { display: contents; }
.dex-card { background: var(--surface); border-radius: 14px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.dex-card img { width: 100%; max-width: 64px; aspect-ratio: 1; object-fit: contain; }
.dex-card.unseen img { filter: brightness(0) opacity(.45); }
.dex-card b { font: 12px/1.2 var(--game); word-break: keep-all; }
.dex-card .cnt { font-size: 11px; color: var(--accent); font-weight: 700; }

/* ---- 판 */
.stage.playing .topbar { display: flex; flex-shrink: 0; }
.stage.playing .screen { padding: 0; gap: 0; }
.play { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #17141f; touch-action: none; }
.play > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 0; pointer-events: none; }
.hud-row { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; }
.hud .hb { pointer-events: auto; background: rgba(0, 0, 0, .5); box-shadow: none; }
.where { text-align: center; display: flex; flex-direction: column; line-height: 1.15; color: #fff; text-shadow: 0 2px 0 #000a; }
.where b { font: 18px var(--game); font-weight: 400; }
.where span { font-size: 13px; color: var(--accent); }
.foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 10px calc(env(safe-area-inset-bottom, 0px) + 10px); pointer-events: none; }
.hint-btn { pointer-events: auto; flex: none; min-width: 74px; min-height: 52px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4px 0 #b47a08, var(--shadow); touch-action: manipulation; }
.hint-btn b { font: 19px/1 var(--game); font-weight: 400; }
.hint-btn small { font-size: 11px; font-weight: 700; }
.hint-btn:active { transform: translateY(2px); }
.hint-btn.off { filter: saturate(.2) brightness(.7); }
.hint-btn.busy { animation: glow .5s ease-in-out infinite alternate; }
.tipline { flex: 0 0 100%; margin: 0; min-width: 0; font: 12px/1.3 var(--game); color: #fff; text-shadow: 0 2px 2px #000; white-space: nowrap; word-break: keep-all; transition: opacity .6s; }
.tipline.dim { opacity: .45; }
.banner { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 80px); transform: translate(-50%, -50%); width: calc(100% - 24px); max-width: 92%; text-align: center; font: 16px/1.25 var(--game); color: #fff; background: #17141f; border-radius: 8px; padding: 4px; text-shadow: 0 2px 0 #000; pointer-events: none; opacity: 0; word-break: keep-all; z-index: 3; }
.banner.on { animation: banner 1s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 1; } }
.overlay { position: absolute; inset: 0; background: rgba(20, 10, 24, .7); display: grid; place-items: center; padding: 16px; z-index: 5; backdrop-filter: blur(2px); overflow-y: auto; }
.overlay[hidden] { display: none; }
.panel { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 18px 14px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; box-shadow: var(--shadow); animation: pop .3s ease-out; }
.panel h2 { font-size: 30px; color: var(--accent); }
.panel.fail h2 { color: #ffb3c0; }
.kicker { font: 15px var(--game); color: var(--sub); }
.big-stars { font-size: 48px; line-height: 1; display: flex; justify-content: center; gap: 6px; }
.big-stars i { font-style: normal; color: rgba(255, 255, 255, .18); }
.big-stars i.on { color: #ffd23f; text-shadow: 0 0 14px rgba(255, 210, 60, .8); animation: starpop .45s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: var(--d); }
@keyframes starpop { from { transform: scale(2.4) rotate(-30deg); opacity: 0; } }
.got { display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(255, 201, 60, .12); border-radius: 16px; padding: 6px 10px; animation: pop .5s ease-out both 1s; }
.got img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(255, 220, 120, .8)); }
.got b, .earn b, .rate b, .village-won b { color: var(--accent); }
.earn { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.earn b { font: 22px var(--game); font-weight: 400; }
.rate { font-size: 15px; }
.village-won { background: linear-gradient(90deg, #4a2a10, #7a4a14); border: 2px solid var(--accent); border-radius: 14px; padding: 8px 12px; word-break: keep-all; font-size: 14px; animation: pop .5s ease-out both .8s; }
.fail-art { width: 62%; align-self: center; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .5)); animation: wobble 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) scaleY(.97); } }
.say-line { font: 17px/1.4 var(--game); word-break: keep-all; }

.cardimg { width: 100%; border-radius: 18px; box-shadow: var(--shadow); -webkit-touch-callout: default; user-select: auto; }

/* ---- 아래 설명 글 */
.guide { max-width: 480px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 28px; }
.guide section { display: flex; flex-direction: column; gap: 10px; }
.guide h2 { font-size: 24px; }
.guide p, .guide li { font-size: 15px; max-width: 65ch; }
.guide a { color: var(--accent); }
.guide ul, .guide ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.arcana { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; list-style: none; padding: 0 !important; }
.arcana li { background: var(--surface); border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.arcana b { display: block; font-family: var(--game); font-weight: 400; font-size: 16px; }
.log { font-size: 14px; }
.site-foot { border-top: 1px solid var(--line); padding-top: 16px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.site-foot a { color: var(--sub); }

/* ---- 작은 화면 */
.hall.orak-crop { --crop-ratio: 1.1765; --crop-top: .9; --crop-cap: min(var(--cap-a, 100000px), var(--cap-b, 100000px), var(--cap-c, 100000px)); }
.stage.fit1 .hall { --cap-b: 240px; }
.hall.orak-crop .bubble { top: calc(max(0px, 100% - var(--crop-cap)) * var(--crop-top) + 7%); text-wrap: balance; }
.stage.fit1 .hero-title h1 { font-size: 38px; }
.stage.fit1 .btn { min-height: 46px; }
.stage.fit2 .hall { --cap-b: 170px; }
.stage.fit2 .hero-title .lede { display: none; }
.stage.fit2 .bubble { font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .hall .bg, .motes i, .btn.daily.hot, .lv.next, .fail-art, .hint-btn.busy { animation: none !important; }
}

/* 공통 추천 카드: 게임의 밝기·테마를 따른다. */
:root { --orak-next-bg: var(--surface, #24263d); --orak-next-ink: var(--ink); --orak-next-sub: var(--sub); }

/* 결과 위에서도 다음 놀이를 바로 고를 수 있는 작은 추천 카드 */
.overlay .orak-next-mini .orak-next-sub{display:none}.overlay .orak-next-title{font-size:12px;margin:4px 0}.overlay .orak-next-card{padding:6px;min-height:42px}.overlay .orak-next-icon,.overlay .orak-next-icon img{width:32px;height:32px}.overlay .panel.win,.overlay .panel.fail{gap:7px;padding:14px 12px}.overlay .panel .fail-art{max-height:110px;object-fit:contain}
.overlay .orak-next-mini{margin-top:2px;gap:3px}.overlay .orak-next-icon{flex-basis:32px}
@media(prefers-reduced-motion:reduce){.overlay .panel,.overlay .big-stars i.on,.overlay .got,.overlay .village-won{animation:none!important;opacity:1}}

/* 시작 로고는 원화 비율을 유지한다. */
.game-logo{display:block;width:min(90vw,400px);max-width:100%;height:auto;margin:0 auto;filter:drop-shadow(0 4px 7px #0008)}
h1:has(>.game-logo){width:100%;margin:0;line-height:0}.hero-title:has(.game-logo){width:100%}.hero-title:has(.game-logo) .lede{font-size:13px}
/* Rescue accounting stays compact so both rows of result buttons remain visible. */
.hall-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hall-links .btn { padding-inline: 6px; font-size: 15px; }
.lv-grid > li { min-width: 0; }
.lv-score { font: 10px/1.1 var(--body); color: var(--sub); white-space: nowrap; }
.lv-score.perfect, .perfect-chip, .challenge-count { color: var(--accent); }
.lv { min-height: 51px; }
.overlay .panel.win { gap: 6px; padding: 12px; }
.panel.win .big-stars { font-size: 38px; }
.panel.win .rescue-score .osc-breakdown { padding: 8px 10px; background: var(--surface-2); border-color: var(--line); border-radius: 14px; }
.panel.win .osc-row { padding: 2px 0; gap: 8px; font-size: 12px; }
.panel.win .osc-value { font-size: 15px; }
.panel.win .osc-total { margin-top: 5px; padding: 5px 0 0; flex-direction: row; justify-content: center; gap: 10px; }
.panel.win .osc-number { font-size: 30px; line-height: 1.2; }
.panel.win .osc-total > .osc-label { font-size: 12px; }
.panel.win .osc-seal { position: static; flex-shrink: 0; min-width: 0; padding: 3px 7px; font-size: 11px; border-width: 2px; }
.panel.win .osc-delta { font-size: 10px; }
.panel.win .got { padding: 3px 6px; gap: 4px; font-size: 12px; min-height: 36px; }
.panel.win .got img { width: 36px; height: 36px; }
.panel.win .perfect-chip { align-self: center; margin: 0; padding: 2px 12px; border: 1px solid var(--accent); border-radius: 20px; background: #ffc93c18; font-size: 12px; }
.panel.win .earn b { font-size: 18px; }
.panel.win .village-won { font-size: 12px; padding: 4px 8px; }
.panel.win .rate, .panel.win .rescue-rank, .panel.win .challenge-count { font-size: 11px; }
.panel.win .btn { min-height: 44px; padding: 8px; }
.panel.win .actions { gap: 7px; }
@media (max-height: 760px) {
  .overlay:has(.panel.win) { padding: 10px; }
  .overlay .panel.win { gap: 5px; }
  .panel.win h2 { font-size: 26px; }
  .panel.win .big-stars { font-size: 32px; }
  .panel.win .osc-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .panel.win .osc-total { grid-column: 1 / -1; }
  .panel.win .osc-row { font-size: 11px; }
  .panel.win .osc-value { font-size: 13px; }
}

/* Gold goals occupy reserved HUD space above the board. */
.gold-chip { display: block; margin: 3px auto 0; padding: 3px 7px; border: 1px solid #b88a34; border-radius: 12px; background: #2e2517; color: #ffe39a; font: 11px/1.3 var(--body); max-width: 100%; word-break: keep-all; }
.play:has(.gold-chip) .banner { top: calc(env(safe-area-inset-top, 0px) + 108px); font-size: 12px; animation: none; transform: translate(-50%, -50%); }
.play:has(.gold-chip) .banner.on { opacity: 1; }
.gold-result { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; min-height: 26px; color: var(--sub); }
.gold-result i { font-style: normal; color: #756341; font-size: 25px; }
.gold-result.met { color: #ffe39a; }
.gold-result.met i { color: #ffd23f; animation: starpop .45s cubic-bezier(.2,1.6,.4,1) both 1s; }
.gold-result b { white-space: nowrap; font-size: 11px; }
.map-gold { color: #ffd23f; font: 12px var(--body); margin-left: 2px; }
.village-gold { font: 12px var(--body); color: #ffe39a; font-style: normal; }
.gold-flag { font: 10px var(--body); color: #35210d; background: #ffd23f; padding: 3px 8px; clip-path: polygon(0 0,100% 0,88% 50%,100% 100%,0 100%); }
.map-screen { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.stage.map-mode { touch-action: pan-y; overscroll-behavior: none; }
.map-screen .screen-title { flex-shrink: 0; }
.map-pages { display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; touch-action: pan-y; overscroll-behavior: none; }
.map-pages .village { width: 100%; min-width: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px; }
.map-pages .village[hidden] { display: none; }
.map-pages .village h3 { padding-right: 32px; font-size: 23px; }
.map-pages .lv-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.map-pages .lv { aspect-ratio: auto; min-height: 68px; background: #251b29df; }
.map-pages .lv.next { background: var(--accent); }
.map-material { font-size: 13px; color: #ffe39a; }
.map-info { position: absolute; top: 8px; right: 5px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #251b29; color: var(--accent); font-size: 25px; }
.map-nav { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.map-nav > .btn { min-width: 44px; min-height: 44px; padding: 0; font-size: 30px; }
.map-dots { display: flex; flex: 1; justify-content: center; min-width: 0; }
.map-dots button { flex: 1; max-width: 27px; height: 44px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; }
.map-dots span { width: 7px; height: 7px; border-radius: 50%; background: #7e687c; }
.map-dots [aria-current] span { background: var(--accent); box-shadow: 0 0 0 3px #ffc93c33; }
.map-position { margin-top: -8px; }
.village-intro { position: absolute; z-index: 12; touch-action: none; }
.village-intro .panel { gap: 16px; max-width: 340px; }
.intro-art { display: flex; align-items: center; justify-content: center; gap: 12px; }
.intro-art img { width: 90px; height: 90px; object-fit: contain; }
@media(max-height:760px) { .map-screen { gap: 7px; } .map-pages .village { padding: 12px; } .map-pages .lv-grid { gap: 8px; margin-top: 10px; } .map-pages .lv { min-height: 58px; } }
@media(prefers-reduced-motion:reduce) { .gold-result.met i { animation: none; } }

/* Weekly selection shares the map's compact header and normal gravity canvas. */
.map-header { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-shrink:0; }
.map-header .screen-title { font-size:24px; }
.map-header .btn { min-height:44px; padding:8px 12px; }
.weekly-screen { width:100%; max-width:500px; margin:auto; display:flex; flex-direction:column; gap:12px; word-break:normal; overflow-wrap:normal; hyphens:auto; }
.weekly-levels { display:grid; gap:12px; }
.weekly-level { display:flex; flex-direction:column; gap:8px; min-height:100px; white-space:normal; word-break:normal; overflow-wrap:normal; hyphens:auto; }
#weekly-hud { display:block; font-size:13px; color:var(--accent); }

/* Outfit anchors share the exact same compositor on all screens. */
.map-header { flex-wrap:wrap; }
.map-header > .screen-title { flex-basis:100%; }
.map-secondary { display:flex; gap:8px; width:100%; }
.map-secondary .btn { flex:1; min-width:0; white-space:normal; word-break:normal; overflow-wrap:normal; }
.outfit-shop { width:100%; max-width:440px; margin:auto; display:flex; flex-direction:column; gap:8px; word-break:normal; overflow-wrap:normal; }
.outfit-shop .map-header { flex-wrap:nowrap; }
.outfit-shop .screen-title { flex-basis:auto; }
.outfit-preview { width:156px; height:156px; align-self:center; }
.outfit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.outfit-item { min-width:0; min-height:104px; padding:6px; gap:2px; font-size:14px; word-break:normal; overflow-wrap:normal; white-space:normal; }
.outfit-item img { width:46px; height:46px; object-fit:contain; }
.outfit-item.selected { outline:2px solid var(--accent); background:var(--surface-2); }
.outfit-item small { color:var(--accent); }
.outfit-selected { min-height:20px; }
.panel.win { position:relative; }
.result-hero { position:absolute; top:4px; right:4px; width:68px; height:68px; pointer-events:none; }
.panel.win > .kicker,.panel.win > h2 { padding:0 58px; }
.icon-btn { min-width:44px; min-height:44px; }
@media(max-height:760px) { .outfit-preview { width:128px; height:128px; } .outfit-shop { gap:6px; } .outfit-item { min-height:96px; } }

/* 44px touch area, independent of the drawing. */
.map-dots{flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;scrollbar-width:none;touch-action:pan-x}.map-dots::-webkit-scrollbar{display:none}.map-dots button{flex:0 0 44px;max-width:none;min-width:44px;min-height:44px}

.stage.playing:has(.panel.win,.panel.fail) .topbar{display:none}

/* 마을 점이 화살표 밑으로 잘려 보이지 않게 양 끝을 흐리게 지운다. */
.map-dots{margin:0 4px;-webkit-mask-image:linear-gradient(90deg,transparent,#000 18px,#000 calc(100% - 18px),transparent);mask-image:linear-gradient(90deg,transparent,#000 18px,#000 calc(100% - 18px),transparent)}
/* 결과 판: 넘쳐도 위가 잘리지 않게(가운데 정렬은 남는 공간이 있을 때만) */
.overlay { align-items: start; }
.overlay > .panel { margin-block: auto; }
.overlay.pf1 .panel.win { gap: 4px; padding-top: 8px; padding-bottom: 8px; }
.overlay.pf1 .panel.win .kicker { display: none; }
.overlay.pf1 .panel.win .osc-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.overlay.pf1 .panel.win .osc-total { grid-column: 1 / -1; }
.overlay.pf2 .panel.win h2 { font-size: 24px; line-height: 1.1; }
.overlay.pf2 .panel.win .big-stars { font-size: 28px; line-height: 1; }
.overlay.pf2 .panel.win .got { min-height: 30px; }
.overlay.pf2 .panel.win .got img { width: 28px; height: 28px; }
.overlay.pf3 .panel.win .orak-next-mini { display: none; }
/* 8판 마을(6~9)은 작은 화면에서 넷째 줄이 잘리지 않게 칸을 낮춘다 */
@media(max-height:760px) { .map-pages .lv-grid:has(> li:nth-child(7)) { gap: 6px; margin-top: 8px; } .map-pages .lv-grid:has(> li:nth-child(7)) .lv { min-height: 46px; gap: 0; } }
@media(max-height:700px) { .map-pages .village:has(.lv-grid > li:nth-child(7)) { padding: 10px 12px; } .map-pages .village:has(.lv-grid > li:nth-child(7)) .map-material { margin: 2px 0 0; } }
.topbar > #mute { margin-left: auto; margin-right: 8px; }

/* ---- 3.0 판 화면: 나무 현판, 나무 동그라미 단추, 종이 띠, 붉은 부적 힌트, 종이 두루마리 팁 ---- */
.hud { padding: 2px 8px 0; }
.hud-row { grid-template-columns: 52px 1fr 52px; align-items: start; gap: 4px; }
.hud .wood-btn { pointer-events: auto; width: 52px; height: 52px; margin-top: 30px; border: 0; padding: 0; border-radius: 50%; background: center/contain no-repeat; box-shadow: none; touch-action: manipulation; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.hud .wood-btn.back { background-image: url(sprites/ui-back.webp); }
.hud .wood-btn.retry { background-image: url(sprites/ui-retry.webp); }
.hud .wood-btn:active { transform: translateY(2px) scale(.96); }
/* 현판 그림 520x287: 판자는 위 26%~아래 72%, 좌우 6%~93%. 글자는 판자 가운데에 */
.where { justify-self: center; width: min(232px, 100%); aspect-ratio: 520 / 287; background: url(sprites/ui-plaque.webp) center/100% 100% no-repeat; position: relative; text-shadow: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.4)); }
.plaque-in { position: absolute; left: 11%; right: 11%; top: 30%; bottom: 31%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden; }
.where b { font: 19px/1.1 var(--game); color: #fff6df; text-shadow: 0 2px 0 #3a1d08, 0 0 3px #3a1d08; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.where .stars { font-size: 19px; line-height: 1; letter-spacing: 3px; display: flex; }
.where .stars i { font-style: normal; color: #3b200b; -webkit-text-stroke: 1px #8a5a2a; }
.where .stars i.on { color: #ffd23a; -webkit-text-stroke: 1px #6b3a06; text-shadow: 0 0 6px rgba(255,210,58,.6); }
.where .sub { font: 12px/1.15 var(--game); color: #ffe7a8; }
.gold-chip { display: table; position: relative; z-index: 1; margin: -30px auto 0; padding: 4px 18px 5px; border: 0; border-radius: 0; background: url(sprites/ui-strip.webp) center/100% 100% no-repeat; color: #5a3410; font: 12px/1.25 var(--game); max-width: 86%; word-break: keep-all; text-align: center; filter: drop-shadow(0 2px 1px rgba(0,0,0,.4)); }
.foot { flex-wrap: nowrap; align-items: center; gap: 6px; padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 8px); }
/* 부적 그림 377x302: 붉은 판은 위 33%~아래 97% */
.hint-btn { min-width: 0; width: 84px; height: 67px; border-radius: 0; background: url(sprites/ui-hint.webp) center/100% 100% no-repeat; box-shadow: none; padding: 21px 8px 0; color: #fff3d0; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.hint-btn b { font: 18px/1 var(--game); text-shadow: 0 2px 0 #5a0c0c; }
.hint-btn small { font: 10px/1.2 var(--game); font-weight: 400; color: #ffe39a; }
/* 두루마리 그림 520x85: 종이 가운데에 */
.tipline { flex: 1 1 auto; min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 4px 22px; background: url(sprites/ui-scroll.webp) center/100% 100% no-repeat; color: #4a2c10; text-shadow: none; font: 12px/1.25 var(--game); white-space: normal; text-align: center; filter: drop-shadow(0 2px 1px rgba(0,0,0,.35)); }
.play:has(.gold-chip) .banner { top: calc(env(safe-area-inset-top, 0px) + 150px); }
.banner { top: calc(env(safe-area-inset-top, 0px) + 140px); }
/* 짧은 화면(360x640 등): 현판·단추를 줄여 판을 크게 */
@media (max-height: 700px) {
  .hud-row { grid-template-columns: 44px 1fr 44px; }
  .hud .wood-btn { width: 42px; height: 42px; margin-top: 22px; }
  .where { width: min(176px, 100%); }
  .where b { font-size: 15px; }
  .where .stars { font-size: 14px; }
  .gold-chip { margin-top: -24px; font-size: 11px; padding: 3px 14px 4px; }
  .hint-btn { width: 66px; height: 53px; padding-top: 16px; }
  .hint-btn b { font-size: 15px; }
  .tipline { min-height: 36px; font-size: 11px; padding: 3px 18px; }
}
/* 알림 띠: 검은 막대 대신 종이 띠 */
.banner { width: auto; max-width: 86%; padding: 6px 22px 7px; border-radius: 0; background: url(sprites/ui-strip.webp) center/100% 100% no-repeat; color: #4a2c10; text-shadow: none; font: 14px/1.25 var(--game); filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }

/* ---------------------------------------------------------------- 3.0 시작 화면 (시안 03-start) */
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stage[data-scene="start"] { background: #2a1d22 url("sprites/bg-start.webp") center top / cover no-repeat; }
.stage[data-scene="start"] .screen { padding-top: 0; }
.s3-start { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.s3-start .motes { position: absolute; inset: 0; pointer-events: none; }
.s3-top { --hw: min(52vw, 250px); position: relative; width: 100%; flex: 0 0 auto; height: clamp(130px, 24vh, 230px); }
/* 시안: 냥도사 키 = 시안 높이의 21%(390폭에서 약 147px), 고양이 몸은 그림판의 75% 높이라 판 너비 52%로 맞춘다 */
.s3-hero { position: absolute; left: calc(10% - var(--hw) * .24); bottom: calc(var(--hw) * -.06 - 2px); width: var(--hw); aspect-ratio: 1; height: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); z-index: 2; }
.s3-bubble.bubble { left: 14%; right: auto; top: 0; max-width: 48%; border-radius: 18px 18px 18px 4px; border: 3px solid #3a2414; text-align: center; font-size: 15px; text-wrap: balance; }
.s3-logo { position: relative; width: 76%; max-width: 330px; margin: -4px 0 0; line-height: 0; z-index: 3; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.s3-logo img { width: 100%; height: auto; }
.s3-ribbon { position: relative; z-index: 3; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: -2px; padding: 4px 22px; min-height: 30px; background: linear-gradient(#4a2a1a, #2c170e); border: 2px solid #c8902e; border-radius: 8px; color: #fff1d6; font-weight: 700; font-size: 13px; line-height: 1.3; box-shadow: 0 3px 0 #1a0c06, 0 4px 10px rgba(0,0,0,.4); }
.s3-ribbon::before, .s3-ribbon::after { content: ""; position: absolute; top: 50%; width: 10px; height: 26px; margin-top: -9px; background: linear-gradient(#ff5a46, #b21d1d); border-radius: 3px 3px 6px 6px; box-shadow: inset 0 -6px 0 #8c1414; }
.s3-ribbon::before { left: -6px; } .s3-ribbon::after { right: -6px; }
.s3-ribbon span + span::before { content: "·"; margin-right: 10px; opacity: .7; }
.s3-actions { position: relative; z-index: 3; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: auto 0; padding-top: 8px; }
.s3-big, .s3-red { border: 0; background: center / 100% 100% no-repeat; color: #fff6df; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--game); text-align: center; transition: transform .08s ease; }
.s3-big:active, .s3-red:active, .s3-sq:active { transform: translateY(2px) scale(.98); }
.s3-big { width: 74%; max-width: 330px; aspect-ratio: 1134 / 326; background-image: url("sprites/ui-btn-big.webp"); padding: 0 12% 3%; }
.s3-big b { font-weight: 400; font-size: clamp(26px, 8.6vw, 36px); line-height: 1.05; text-shadow: 0 3px 0 #3a1c08, 0 0 2px #3a1c08; }
.s3-big small, .s3-red small { display: inline-block; margin-top: 3px; padding: 1px 12px; border-radius: 999px; background: #fff2d6; color: #3a2414; font-family: var(--body); font-weight: 700; font-size: 12px; line-height: 1.5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s3-red { width: 82%; max-width: 360px; aspect-ratio: 1142 / 277; background-image: url("sprites/ui-btn-red.webp"); padding: 0 4% 1% 18%; }
.s3-red small { font-size: 11.5px; padding-inline: 9px; }
.s3-red b { font-weight: 400; font-size: clamp(22px, 7vw, 29px); line-height: 1.05; text-shadow: 0 3px 0 #5a0d0a, 0 0 2px #5a0d0a; }
.s3-red.hot { animation: s3glow 1.4s ease-in-out infinite alternate; }
@keyframes s3glow { from { filter: drop-shadow(0 0 0 rgba(255,200,60,0)); } to { filter: drop-shadow(0 0 10px rgba(255,200,60,.85)); } }
.s3-squares { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4%; width: 92%; max-width: 400px; margin-top: 2px; }
.s3-sq { position: relative; border: 0; aspect-ratio: 272 / 287; background: url("sprites/ui-sq.webp") center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 14% 8% 10%; color: #fff6df; font-family: var(--game); font-size: 15px; line-height: 1.1; text-shadow: 0 2px 0 #3a1c08; transition: transform .08s ease; }
.s3-sq img { width: 58%; height: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.s3-sq span { margin-top: 2px; word-break: keep-all; text-align: center; text-wrap: balance; }
.s3-sq.long span { font-size: 12.5px; line-height: 1.05; }
.s3-purse { position: relative; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 6px; width: 92%; max-width: 400px; margin-top: 8px; padding: 9px 9% 9px 8%; min-height: 44px; white-space: nowrap; background: url("sprites/ui-cream.webp") center / 100% 100% no-repeat; color: #3a2414; font-weight: 700; font-size: clamp(11px, 3.3vw, 14px); line-height: 1.25; text-align: center; }
.s3-purse span { overflow: hidden; text-overflow: ellipsis; }
.s3-purse img { width: 26px; height: 26px; flex: none; }
.s3-purse b { font-family: var(--game); font-weight: 400; font-size: 18px; color: #7a3d00; }
@media (max-height: 700px) {
  .s3-top { --hw: min(38vw, 200px); height: clamp(116px, 21vh, 200px); }
  .s3-purse { min-height: 38px; padding-block: 6px; margin-top: 4px; }
  .s3-actions { gap: 4px; padding-top: 4px; }
  .s3-logo { width: 62%; }
  .s3-big { width: 64%; } .s3-red { width: 70%; }
  .s3-squares { width: 74%; }
  .s3-sq { font-size: 13px; }
  .s3-bubble.bubble { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .s3-red.hot { animation: none !important; } }

/* ---------------------------------------------------------------- 3.0 마을 지도 (시안 04-map) */
.stage[data-scene="map"] { background: #1d2a18; }
.stage[data-scene="map"] .topbar { position: relative; z-index: 6; }
.stage[data-scene="map"] .screen { position: absolute; inset: 0; padding: 0; gap: 0; }
.m3 { position: relative; flex: 1; min-height: 0; height: 100%; }
.m3-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 96px; }
.m3-scroll::-webkit-scrollbar { display: none; }
.m3-seg { position: relative; width: 100%; aspect-ratio: 2 / 3; background: #2a3a20 center / 100% 100% no-repeat; }
.m3-seg.locked::after { content: ""; position: absolute; inset: 0; background: rgba(20, 14, 30, .45); pointer-events: none; z-index: 3; }
.m3-fog { position: absolute; left: 50%; bottom: -5%; width: 44%; transform: translateX(-50%); opacity: .6; pointer-events: none; z-index: 4; filter: blur(.5px); }
.m3-seg:first-child .m3-fog { display: none; }
.m3-tag { position: absolute; top: var(--tag-y, 14%); z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 40%; max-width: 64%; aspect-ratio: auto; padding: 10px 14px 10px 26%; background: url("sprites/ui-btn-red.webp") center / 100% 100% no-repeat; color: #fff6df; text-align: center; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.m3-tag.left { left: 2%; } .m3-tag.right { right: 2%; }
.m3-tag b { font-family: var(--game); font-weight: 400; font-size: 19px; line-height: 1.1; text-shadow: 0 2px 0 #5a0d0a; word-break: keep-all; white-space: nowrap; }
.m3-tag small { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; padding: 0 9px; border-radius: 999px; background: #fff2d6; color: #3a2414; font-weight: 700; font-size: 11.5px; line-height: 1.6; white-space: nowrap; }
.m3-tag small img { width: 13px; height: 13px; }
.m3-info { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #3a2414; background: #ffe9a8; color: #3a2414; font: 700 15px/1 Georgia, serif; font-style: italic; display: grid; place-items: center; }
.m3-info::after { content: ""; position: absolute; inset: -8px; }
.m3-node { position: absolute; z-index: 2; width: 20%; aspect-ratio: 301 / 233; transform: translate(-50%, -58%); border: 0; padding: 0 0 12%; background: url("sprites/mp-stone.webp") center / 100% 100% no-repeat; display: block; color: #fff; font-family: var(--game); transition: transform .08s ease; }
.m3-node:active:not(:disabled) { transform: translate(-50%, -58%) scale(.95); }
.m3-node b { position: absolute; left: 0; right: 0; top: 17%; text-align: center; font-weight: 400; font-size: clamp(15px, 4.8vw, 21px); line-height: 1; color: #fff; text-shadow: 0 2px 0 #2a2a2a, 0 0 3px #2a2a2a, 0 0 3px #2a2a2a; }
.m3-node .map-gold { position: absolute; top: -12px; right: 2px; font-style: normal; font-size: 14px; color: #ffd23c; text-shadow: 0 1px 0 #6a3a00, 0 0 2px #6a3a00; }
.m3-node.cur { background-image: url("sprites/mp-stone-cur.webp"); aspect-ratio: 318 / 290; width: 22%; padding-bottom: 8%; }
.m3-node.cur b { top: 46%; color: #5a2a00; text-shadow: 0 1px 0 #fff3c0, 0 0 3px #fff3c0; z-index: 4; }
.m3-node.cur .m3-stars { top: 70%; }
.m3-node.lock { background-image: url("sprites/mp-stone-lock.webp"); aspect-ratio: 292 / 228; }
.m3-node.lock b { color: #cfcfcf; }
.m3-node:disabled { opacity: 1; }
.m3-stars { position: absolute; left: 50%; top: 48%; transform: translateX(-50%); display: flex; gap: 0; padding: 0 5px; border-radius: 999px; background: rgba(40, 24, 10, .78); font-size: 12px; line-height: 1.35; white-space: nowrap; }
.m3-stars i { font-style: normal; color: #6d5b46; }
.m3-stars i.on { color: #ffd23c; text-shadow: 0 0 3px rgba(255, 200, 60, .7); }
/* 시안: 지도 위 냥도사 키 ≈ 시안 높이 11%(390폭 약 75px). 고양이 몸은 그림판 높이 75% → 그림판 26% */
.m3-me { position: absolute; z-index: 3; width: 26%; aspect-ratio: 1; transform: translate(-50%, -104%); pointer-events: none; }
.m3-hero { width: 100%; height: 100%; filter: drop-shadow(0 4px 4px rgba(0,0,0,.45)); }
.m3-flag { position: absolute; right: -6%; top: 10%; width: 32%; transform: rotate(8deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.m3-lock { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; pointer-events: none; }
.m3-lock img { width: 22%; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.m3-lock p { padding: 4px 12px; border-radius: 999px; background: rgba(30, 18, 10, .82); color: #fff1d6; font-weight: 700; font-size: 13px; }
.m3-head { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 6; display: flex; justify-content: space-between; align-items: flex-start; padding: 0 10px; pointer-events: none; }
.m3-head > * { pointer-events: auto; }
.m3-sign { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 48%; max-width: 220px; aspect-ratio: 698 / 269; padding: 6% 6% 4%; background: url("sprites/ui-sign.webp") center / 100% 100% no-repeat; color: #fff6df; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.m3-sign h2 { font-size: clamp(20px, 6.4vw, 27px); line-height: 1.05; text-shadow: 0 2px 0 #3a1c08; }
.m3-sign p { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 0 10px; border-radius: 999px; background: #fff2d6; color: #3a2414; font-weight: 700; font-size: 12px; line-height: 1.6; white-space: nowrap; }
.m3-sign p img { width: 14px; height: 14px; }
.m3-side { display: flex; gap: 6px; }
.m3-sq { width: 68px; aspect-ratio: 272 / 287; border: 0; background: url("sprites/ui-sq.webp") center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14% 6% 8%; color: #fff6df; font-family: var(--game); font-size: 12px; line-height: 1.05; text-shadow: 0 1px 0 #3a1c08; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.m3-sq img { width: 56%; }
.m3-sq span { word-break: keep-all; text-align: center; }
.m3-sq:active { transform: translateY(2px); }
.m3-foot { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.m3-back { pointer-events: auto; width: 56%; max-width: 250px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.m3-back b { font-size: clamp(22px, 7vw, 28px); }
/* 마을 사이 이음새: 아래 조각의 윗부분을 위 조각에 겹치고 부드럽게 지운다 */
.m3-seg + .m3-seg { margin-top: -12%; -webkit-mask-image: linear-gradient(transparent 0, #000 8%); mask-image: linear-gradient(transparent 0, #000 8%); }
.m3-stars { font-size: 13px; }

/* ---------------------------------------------------------------- 3.0 구출 성공·수난 (시안 05-win, 06-fail) */
.stage.playing:has(.panel.r3) .topbar { display: flex; position: relative; z-index: 7; }
.stage.playing:has(.panel.r3) .hud { visibility: hidden; }
.overlay:has(.panel.r3) { position: fixed; inset: 0; z-index: 6; padding: calc(env(safe-area-inset-top, 0px) + 58px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px); background: linear-gradient(rgba(16, 10, 20, .55), rgba(16, 10, 20, .72)), var(--rbg, none) center / cover no-repeat, #1d1520; backdrop-filter: none; place-items: start center; }
.overlay .panel.r3 { max-width: 420px; background: none; box-shadow: none; padding: 0; gap: 6px; align-items: center; animation: none; }
.r3-sign { position: relative; display: grid; place-items: center; width: 54%; max-width: 240px; aspect-ratio: 3.7; margin: 0 auto; padding: 0 9% 1%; background: url("sprites/ui-pill.webp") center / 100% 100% no-repeat; color: #fff6df; font-family: var(--game); font-size: 16px; line-height: 1.15; text-shadow: 0 2px 0 #3a1c08; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.r3-sign span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.panel.r3 .r3-stars { display: flex; justify-content: center; align-items: flex-end; gap: 2px; margin: -6px 0 -14px; font-size: 0; position: relative; z-index: 2; }
.r3-stars i { display: block; width: 58px; filter: grayscale(1) brightness(.45); opacity: .8; }
.r3-stars i:nth-child(2) { width: 70px; margin-bottom: 8px; }
.r3-stars i img { width: 100%; display: block; }
.r3-stars i.on { filter: drop-shadow(0 0 8px rgba(255, 210, 60, .8)); opacity: 1; animation: r3star .45s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: var(--d, 0s); }
@keyframes r3star { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.panel.r3 h2.r3-ribbon { position: relative; display: grid; place-items: center; width: 92%; max-width: 400px; aspect-ratio: 1142 / 306; margin: 0 auto; padding: 0 17% 5%; background: url("sprites/rb-red.webp") center / 100% 100% no-repeat; color: #fff6df; font-size: clamp(30px, 10vw, 42px); line-height: 1; text-shadow: 0 3px 0 #6a0e0a, 0 0 3px #6a0e0a; filter: drop-shadow(0 5px 6px rgba(0,0,0,.4)); }
.panel.r3 h2.r3-ribbon.blue { background-image: url("sprites/rb-blue.webp"); text-shadow: 0 3px 0 #0e1e5a, 0 0 3px #0e1e5a; font-size: clamp(24px, 8.4vw, 36px); }
.r3-ribbon span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.r3-mid { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.r3-hero { position: relative; width: 66%; max-width: 290px; aspect-ratio: 1.3; }
.r3-pile { position: absolute; left: -4%; right: -4%; bottom: 0; width: 108%; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
/* 시안: 냥도사 키 ≈ 시안 높이 25%. 고양이 몸 = 그림판 높이 76%라 그림판 = 화면 폭 60% 전후 */
.panel.r3 .result-hero.r3-cat { position: absolute; left: -2%; bottom: 2%; width: 100%; height: auto; aspect-ratio: 1; margin: 0; transform: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.r3-bubble.bubble { position: absolute; right: 8%; left: auto; top: -8%; max-width: 44%; z-index: 4; border: 3px solid #3a2414; border-radius: 16px 16px 4px 16px; text-align: center; font-size: 14px; text-wrap: balance; }
.r3-treasure.got { position: relative; z-index: 3; flex: none; width: 33%; max-width: 140px; aspect-ratio: 268 / 396; margin-left: -6%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 40% 9% 12%; background: url("sprites/ui-tag.webp") center / 100% 100% no-repeat; color: #3a2414; font-size: 12px; font-weight: 700; line-height: 1.15; min-height: 0; border: 0; border-radius: 0; animation: pop .4s ease-out both; animation-delay: .9s; }
.r3-treasure b { font-family: var(--game); font-weight: 400; font-size: 12px; color: #7a1d12; white-space: nowrap; }
.r3-treasure .r3-tr { width: 86%; height: auto; }
.r3-treasure span { text-align: center; word-break: keep-all; }
.r3-new { display: none; }
.r3-new-t { position: absolute; z-index: 5; left: -14%; top: 16%; transform: rotate(-12deg); padding: 1px 7px; border-radius: 6px; background: #e8413a; border: 2px solid #ffd76a; color: #fff; font-style: normal; font-family: var(--game); font-size: 12px; line-height: 1.2; box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.r3-scroll { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 28px 15% 20px; background: url("sprites/ui-panel.webp") center / 100% 100% no-repeat; color: #3a2414; min-height: 92px; }
.r3-scroll .rescue-score { width: 100%; }
.panel.r3 .osc-breakdown { background: none !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; color: #3a2414; }
.panel.r3 .osc-row { color: #5a3a24; font-size: 12px; }
.panel.r3 .osc-total { justify-content: center; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
.panel.r3 .osc-total > .osc-label { font-family: var(--game); font-size: 19px; color: #3a2414; }
.panel.r3 .osc-number { font-family: var(--game); font-size: 34px; color: #b0200e; line-height: 1.1; }
.panel.r3 .osc-seal { position: static; transform: rotate(-6deg); border: 2px solid #c2241a; color: #c2241a; background: #fff3e0; padding: 1px 6px; font-size: 13px; font-family: var(--game); border-radius: 4px; }
.panel.r3 .osc-delta { color: #7a5a40; }
.panel.r3 .osc-best { color: #7a5a40; font-size: 11px; margin: 0; }
.rescue-score.r3-collapsed .osc-row, .rescue-score.r3-collapsed .osc-best { display: none; }
.r3-scroll .earn { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 14px; font-weight: 700; }
.r3-scroll .earn img { width: 22px; height: 22px; }
.r3-scroll .earn b { font-family: var(--game); font-weight: 400; font-size: 19px; color: #7a3d00; }
.r3-scroll .earn .small { color: #6a4a30; }
.r3-scroll .gold-result, .r3-scroll .rate, .r3-scroll .rescue-rank, .r3-scroll .challenge-count, .r3-scroll .village-won { color: #5a3a24; font-size: 12px; background: none; margin: 0; padding: 0; }
.r3-scroll .gold-result i { color: #e0a800; }
.r3-scroll .perfect-chip { color: #8a4a00; border-color: #c88a1a; background: #ffe9a8; }
.r3-more { border: 0; background: none; color: #6a4a30; font-size: 12px; font-weight: 700; padding: 2px 10px; min-height: 26px; }
.r3-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.r3-big { width: 70%; max-width: 310px; padding-bottom: 2%; }
.r3-big b { font-size: clamp(26px, 8.4vw, 34px); }
.r3-next { margin-top: -6px; padding: 1px 14px; border-radius: 999px; background: #fff2d6; color: #3a2414; font-size: 12px; font-weight: 700; border: 2px solid #c8902e; }
.r3-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.r3-pill { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; padding: 6px 14px 8px; border: 0; background: url("sprites/ui-pill.webp") center / 100% 100% no-repeat; color: #fff6df; font-family: var(--game); font-size: clamp(13px, 4.1vw, 17px); line-height: 1.1; text-shadow: 0 2px 0 #3a1c08; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
.r3-pill img { width: 30px; height: 30px; flex: none; }
.r3-pill span { word-break: keep-all; text-align: center; }
.r3-pill:active { transform: translateY(2px); }
.r3-pill:disabled { filter: grayscale(.8) brightness(.8); }
.r3-map { width: 52%; }
/* 수난 */
.r3-mid.fail { flex-direction: column; min-height: 220px; }
.panel.r3 .r3-fail-art { width: 96%; max-width: 380px; max-height: none; height: auto; aspect-ratio: 1; object-fit: contain; margin: -4px 0 -10px; animation: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.r3-mid.fail .r3-bubble { left: 0; right: auto; top: 6%; max-width: 40%; border-radius: 16px 16px 16px 4px; }
.r3-stamp.chip { position: absolute; right: 0; bottom: 8%; width: 40%; font-size: 13px; aspect-ratio: 313 / 314; display: grid; place-items: center; transform: rotate(-10deg); padding: 13% 9%; border: 0; border-radius: 0; background: url("sprites/ui-stamp.webp") center / 100% 100% no-repeat; color: #c2241a; font-family: var(--game); font-size: 14px; line-height: 1.15; text-align: center; word-break: keep-all; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); }
.panel.r3 .challenge-count { display: none; } /* 도전 과제는 알림으로 이미 뜬다 */
@media (max-height: 700px) {
  .r3-sign { width: 46%; font-size: 14px; }
  .r3-stars i { width: 40px; } .r3-stars i:nth-child(2) { width: 48px; }
  .panel.r3 h2.r3-ribbon { width: 76%; }
  .r3-hero { width: 46%; }
  .r3-scroll { padding-block: 22px 14px; min-height: 0; }
  .r3-big { width: 58%; }
  .r3-actions { gap: 4px; }
  .panel.r3 .r3-fail-art { width: 56%; }
  .r3-mid.fail { min-height: 160px; }
  .panel.r3 .osc-number { font-size: 28px; }
  .r3-pill { min-height: 44px; font-size: 15px; }
}
/* 토스트(허브 알림·도전 과제)는 위쪽 나무 단추와 겹치지 않게 아래로 (봉인 항아리와 같은 값) */
.orak-hub-toast { top: calc(env(safe-area-inset-top, 0px) + 62px) !important; }
.osc-toast { bottom: auto !important; top: calc(env(safe-area-inset-top, 0px) + 112px); }
/* 결과 화면 위쪽은 판 이름·별·띠라서, 결과가 떠 있을 때는 가운데(냥도사 그림 높이)로 */
body:has(.panel.r3) .orak-hub-toast { top: 40% !important; }
body:has(.panel.r3) .osc-toast { top: calc(40% + 52px); }
.r3-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; font-size: 12px; color: #5a3a24; }
.r3-line .gold-result { display: inline-flex; align-items: center; gap: 3px; }
.r3-line .gold-result i { font-style: normal; color: #e0a800; }
.r3-line .perfect-chip { margin: 0; padding: 0 10px; border: 1px solid #c88a1a; border-radius: 999px; background: #ffe9a8; color: #8a4a00; font-size: 11.5px; }
/* 예전 결과 판 규칙(.panel.win > .kicker 등)이 3.0 결과 화면에 끼어들지 않게 */
.overlay .panel.r3 > .r3-sign { padding: 0 9% 1%; }
.overlay .panel.r3 > h2.r3-ribbon { padding: 0 13% 5%; }
.overlay.pf1 .panel.r3 .kicker { display: grid; }
.overlay.pf1 .panel.r3 { gap: 4px; padding: 0; }
.overlay.pf1 .panel.r3 .orak-next-mini { display: none; }
.overlay.pf2 .panel.r3 .r3-hero { width: 42%; }
.overlay.pf2 .panel.r3 .r3-fail-art { width: 50%; }
.overlay.pf2 .panel.r3 h2.r3-ribbon { font-size: 24px; width: 88%; }
.overlay.pf3 .panel.r3 .r3-bubble { display: none; }
@media (max-height: 700px) {
  .overlay .panel.r3 .r3-bubble { display: none; }
  .overlay .panel.r3 { gap: 3px; }
  .r3-stars { margin: -4px 0 -10px !important; }
  .r3-scroll .earn { font-size: 12.5px; }
  .r3-big b { font-size: 24px; }
  .r3-next { font-size: 11px; }
  .r3-mid.fail .r3-stamp { width: 36%; }
}
@media (max-height: 700px) {
  .overlay .panel.r3.win > .r3-sign { display: none; }
  .overlay .panel.r3 > h2.r3-ribbon { font-size: 22px; width: 80%; }
  .r3-hero { width: 40%; }
  .r3-treasure.got { width: 26%; }
  .r3-scroll { padding-block: 18px 10px; }
  .panel.r3 .osc-number { font-size: 24px; }
  .r3-more { min-height: 22px; padding: 0 8px; }
}

/* ---------------------------------------------------------------- 3.0 도감 (시안 07-dex) */
.stage[data-scene="dex"], .stage[data-scene="shop"] { background: linear-gradient(rgba(20, 12, 16, .35), rgba(20, 12, 16, .55)), #2a1d22 url("sprites/bg-v1.webp") center / cover no-repeat; }
.stage[data-scene="dex"] .screen { padding-top: 0; }
.d3 { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.d3-sign { display: grid; place-items: center; width: 52%; max-width: 230px; aspect-ratio: 698 / 269; margin-top: -8px; padding: 8% 8% 2%; background: url("sprites/ui-sign.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.d3-sign h2.screen-title { color: #fff6df; font-size: 30px; line-height: 1; text-shadow: 0 3px 0 #3a1c08; }
.d3-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.d3-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 6px 10px 8px; border: 0; background: url("sprites/ui-pill.webp") center / 100% 100% no-repeat; color: #fff6df; font-family: var(--game); line-height: 1.1; text-shadow: 0 2px 0 #3a1c08; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)) brightness(.85); }
.d3-tab b { font-weight: 400; font-size: 16px; }
.d3-tab small { font-family: var(--body); font-weight: 700; font-size: 12px; }
.d3-tab.on { background-image: url("sprites/ui-cream.webp"); color: #3a2414; text-shadow: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }
.d3-body { position: relative; flex: 1; min-height: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; }
.d3-body::-webkit-scrollbar { display: none; }
.d3-cab { position: relative; width: 100%; padding: calc(100% * 58 / 640) 0 calc(100% * 18 / 640); background: url("sprites/ui-cab-top.webp") top center / 100% auto no-repeat, url("sprites/ui-cab-bot.webp") bottom center / 100% auto no-repeat; }
.d3-row { position: relative; width: 100%; aspect-ratio: 640 / 174; background: url("sprites/ui-cab-row.webp") center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; padding: 2% 7% 6.5%; }
.d3-row.eight { aspect-ratio: 640 / 240; }
.d3-label { margin-top: -2px; padding: 0 12px; border-radius: 6px; background: linear-gradient(#f6e2b4, #e2c48a); border: 2px solid #8a5a24; color: #3a2414; font-family: var(--game); font-size: 13px; line-height: 1.45; white-space: nowrap; box-shadow: 0 2px 3px rgba(0,0,0,.35); }
.d3-label span { margin-left: 4px; color: #7a3d00; }
.d3-row ul { list-style: none; margin: 0; padding: 0; flex: 1; width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 2px; }
.d3-row.eight ul { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; padding: 0 6%; }
.d3-item { position: relative; display: grid; place-items: end center; width: 100%; aspect-ratio: 1; border: 0; padding: 0; background: none; }
.d3-item img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.22); transform-origin: 50% 85%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.5)); }
.d3-item.unseen img { filter: brightness(0) opacity(.55); }
.d3-item.unseen i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-family: var(--game); font-size: 20px; color: #e8d6b0; text-shadow: 0 2px 0 #000; }
.d3-item:active { transform: scale(.94); }
.d3-album { list-style: none; margin: 0; padding: 6px 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.d3-photo { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.d3-pic { position: relative; width: 100%; aspect-ratio: 305 / 323; background: url("sprites/ui-photo.webp") center / 100% 100% no-repeat; display: grid; place-items: center; padding: 16% 12% 22%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.d3-photo:nth-child(odd) .d3-pic { transform: rotate(-3deg); } .d3-photo:nth-child(even) .d3-pic { transform: rotate(2deg); }
.d3-pic img { width: 100%; height: 100%; object-fit: contain; }
.d3-pic i { font-style: normal; font-family: var(--game); font-size: 28px; color: #9a8a7a; }
.d3-photo b { font-family: var(--game); font-weight: 400; font-size: 13px; line-height: 1.15; color: #fff1d6; text-shadow: 0 2px 0 #000; word-break: keep-all; }
.d3-photo .cnt { font-size: 11px; color: #e8d6b0; }
.d3-note { width: 100%; padding: 7px 10%; background: url("sprites/ui-cream.webp") center / 100% 100% no-repeat; color: #3a2414; font-weight: 700; font-size: 12.5px; line-height: 1.3; text-align: center; }
.d3-back { width: 58%; max-width: 260px; }
.d3-back b { font-size: clamp(22px, 7vw, 28px); }

/* ---------------------------------------------------------------- 3.0 꾸미기 (시안 08-shop) */
.stage[data-scene="shop"] { background: #241820 url("sprites/bg-shop.webp") center top / cover no-repeat; }
.stage[data-scene="shop"] .screen { padding-top: 0; }
.outfit-shop.h3 { flex: 1; min-height: 0; max-width: 440px; gap: 6px; align-items: center; }
.h3-head { position: relative; width: 100%; display: flex; justify-content: center; align-items: flex-start; }
.h3-head .d3-sign { width: 46%; }
.h3-coins { position: absolute; right: 0; top: 18px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px 3px 6px; border-radius: 999px; background: rgba(40, 22, 12, .82); border: 2px solid #c8902e; color: #fff1d6; font-size: 12px; font-weight: 700; }
.h3-coins img { width: 22px; height: 22px; }
.h3-coins b { font-family: var(--game); font-weight: 400; font-size: 17px; color: #ffd23c; }
/* 옷방 그림의 붉은 무대(그림 높이 33.5%) 위에 냥도사 발이 오게. 시안: 냥도사 키 = 화면 높이 25% */
.h3-room { position: relative; width: 100%; flex: 1 1 auto; min-height: 110px; }
.h3 .h3-hero { position: absolute; left: 50%; top: auto; bottom: 0; width: min(60vw, 30vh, 260px); max-height: 128%; height: auto; aspect-ratio: 1; transform: translate(-50%, 3%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.h3-note { padding: 5px 18px; border-radius: 999px; background: rgba(255, 242, 214, .94); border: 2px solid #c8902e; color: #3a2414; font-weight: 700; font-size: 12.5px; }
.h3-shelf.outfit-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 14px 12px; background: linear-gradient(#5a3418, #3e220f); border: 4px solid #2a1408; border-radius: 10px; box-shadow: inset 0 0 0 3px #c8902e, inset 0 0 18px rgba(0,0,0,.6), 0 6px 12px rgba(0,0,0,.45); }
.h3-item.outfit-item { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 4px 8px; border: 0; border-radius: 8px; background: none; box-shadow: none; color: #fff1d6; outline: none; }
.h3-item.outfit-item:nth-child(-n+3) { border-bottom: 5px solid #8a5a24; border-radius: 0; margin-bottom: 8px; }
.h3-item + .h3-item:not(:nth-child(4)) { box-shadow: -2px 0 0 #2a1408; }
.h3-cush { position: relative; display: block; flex: none; width: 82%; aspect-ratio: 324 / 275; background: url("sprites/ui-cushion.webp") center / 100% 100% no-repeat; }
.h3-cush img { position: absolute; left: 15%; top: 2%; width: 70%; height: 70%; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.h3-item b { font-family: var(--game); font-weight: 400; font-size: 13.5px; line-height: 1.15; text-align: center; word-break: keep-all; margin-top: 2px; }
.h3-item small { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; padding: 0 8px; border-radius: 999px; font-weight: 700; font-size: 12px; line-height: 1.5; }
.h3-item small img { width: 15px; height: 15px; }
.h3-item small.price { background: #fff2d6; color: #3a2414; }
.h3-item small.own { background: #e9d9b8; color: #5a3a24; }
.h3-item small.on { background: #3d9b46; color: #fff; }
.h3-item.selected { background: radial-gradient(closest-side, rgba(255, 214, 90, .35), transparent); }
.h3-item.selected .h3-cush { filter: drop-shadow(0 0 6px #ffd23c) drop-shadow(0 0 2px #ffd23c); }
.h3-item.worn::after { content: "✓"; position: absolute; top: 2px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: #3d9b46; border: 2px solid #fff; color: #fff; font-size: 13px; line-height: 18px; font-weight: 700; text-align: center; }
.h3-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; margin-top: 2px; }
.h3-actions .h3-act { width: 100%; padding: 0 6% 1% 30%; }
.h3-actions .h3-back { width: 100%; }
.h3-actions b { font-size: clamp(20px, 6.4vw, 27px); }
@media (max-height: 700px) {
  .h3-head .d3-sign { width: 34%; padding-top: 6%; }
  .h3-head .d3-sign h2.screen-title { font-size: 22px; }
  .h3 .h3-hero { width: min(50vw, 27vh); }
  .h3-shelf.outfit-grid { padding: 8px 10px; }
  .h3-cush { width: 64%; }
  .h3-item b { font-size: 12px; }
}
.d3-sign.long h2.screen-title, .h3-head.long .d3-sign h2.screen-title { font-size: clamp(17px, 5.4vw, 23px); white-space: nowrap; }
.h3-head.long .h3-coins { top: 66px; }

/* ---------------------------------------------------------------- 3.0 주간 도전·기록장 (도감과 같은 동굴 방, 나무 현판·종이) */
.stage[data-scene="book"] { background: linear-gradient(rgba(20, 12, 16, .45), rgba(20, 12, 16, .65)), #2a1d22 url("sprites/bg-v1.webp") center / cover no-repeat; }
.w3 { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.w3-date { padding: 3px 14px; border-radius: 999px; background: rgba(255, 242, 214, .94); border: 2px solid #c8902e; color: #3a2414; font-weight: 700; font-size: 13px; }
.w3-levels { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.w3-card { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 86px; padding: 12px 22px 14px 16px; border: 0; background: url("sprites/ui-btn-big.webp") center / 100% 100% no-repeat; color: #fff6df; text-align: left; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); transition: transform .08s ease; }
.w3-card:active { transform: translateY(2px) scale(.98); }
.w3-no { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(#ffe07a, #e0a020); border: 3px solid #7a4a10; color: #5a2a00; font-family: var(--game); font-size: 22px; }
.w3-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.w3-txt b { font-family: var(--game); font-weight: 400; font-size: 19px; line-height: 1.1; text-shadow: 0 2px 0 #3a1c08; }
.w3-txt .chip { padding: 0 9px; border-radius: 999px; background: #fff2d6; color: #3a2414; font-size: 12px; font-weight: 700; line-height: 1.55; }
.w3-card small { text-align: center; font-size: 11px; line-height: 1.2; color: #f3dcb4; }
.w3-card small b { font-family: var(--game); font-weight: 400; font-size: 19px; color: #ffd23c; }
.w3-total { display: inline-flex; align-items: center; gap: 6px; padding: 6px 28px; background: url("sprites/ui-cream.webp") center / 100% 100% no-repeat; color: #3a2414; font-weight: 700; }
.w3-total img { width: 22px; }
.w3-total b { font-family: var(--game); font-weight: 400; font-size: 22px; color: #b0200e; }
.w3 .weekly-rank { color: #fff1d6; font-size: 13px; }
.w3 .weekly-rank:empty { display: none; }
.w3 .d3-back { margin-top: auto; }
/* 기록장(공용 Score.book): 종이 카드 */
.stage[data-scene="book"] .osc-book { color: #fff6df; }
.stage[data-scene="book"] .osc-header { border-bottom-color: rgba(255, 220, 160, .25); }
.stage[data-scene="book"] .osc-title { font-family: var(--game); font-weight: 400; color: #fff6df; text-shadow: 0 2px 0 #3a1c08; }
.stage[data-scene="book"] .osc-record { background: linear-gradient(#fff4da, #f1dcae); border: 2px solid #b8843a; color: #3a2414; box-shadow: 0 3px 0 #6a4418, 0 4px 8px rgba(0,0,0,.35); }
.stage[data-scene="book"] .osc-record .osc-label { color: #6a4a30; }
.stage[data-scene="book"] .osc-record-value { color: #9a2a12; font-family: var(--game); font-weight: 400; }
.stage[data-scene="book"] .osc-heading { color: #ffe9b8; font-family: var(--game); font-weight: 400; }
.stage[data-scene="book"] .osc-challenge { background: rgba(255, 244, 218, .95); border-color: #b8843a; color: #3a2414; }
.stage[data-scene="book"] .osc-back { background: url("sprites/ui-back.webp") center / contain no-repeat; border: 0; color: transparent; width: 46px; height: 46px; box-shadow: none; }
.stage[data-scene="book"] .osc-back svg { display: none; }
.stage[data-scene="book"] .osc-book { background: linear-gradient(rgba(20, 12, 16, .5), rgba(20, 12, 16, .7)), #2a1d22 url("sprites/bg-v1.webp") center / cover no-repeat; }
.stage[data-scene="book"] .osc-book-scroll, .stage[data-scene="book"] .osc-header { background: transparent; }
.w3-card { padding-right: 36px; }
/* 마을 소개 창: 종이 두루마리 + 나무 단추 */
.village-intro .panel { background: linear-gradient(#fff4da, #f0d9a8); border: 4px solid #8a5a24; box-shadow: inset 0 0 0 3px #e0b860, 0 10px 24px rgba(0,0,0,.5); color: #3a2414; }
.village-intro .panel h2 { color: #9a2a12; text-shadow: none; }
.village-intro .panel h3 { color: #5a3a24; }
.village-intro .panel p { color: #3a2414; }
.village-intro .btn.primary { background: url("sprites/ui-btn-big.webp") center / 100% 100% no-repeat; color: #fff6df; box-shadow: none; min-height: 64px; text-shadow: 0 2px 0 #3a1c08; font-size: 24px; }
/* 결과 화면 손질(360x640·영어): 큰 단추·알약 글자는 한 줄로(넘치면 fitTexts가 줄임), 보물 꼬리표 글자는 술과 NEW를 피해서,
   목소리 대사가 나오는 말풍선은 작은 화면에서도 보인다 */
.r3-big b, .r3-pill span { white-space: nowrap; }
.r3-treasure.got { padding: 46% 17% 12% 10%; }
.r3-treasure b { font-size: 11px; }
.r3-treasure span { font-size: 11.5px; overflow-wrap: anywhere; }
.r3-new-t { left: -10%; top: auto; bottom: 12%; }
@media (max-height: 700px) {
  .overlay .panel.r3 .r3-bubble { display: block; font-size: 11.5px; padding: 4px 8px; line-height: 1.25; }
  .r3-mid:not(.fail) .r3-bubble.bubble { right: auto; left: -14%; top: -14%; max-width: 52%; border-radius: 14px 14px 14px 4px; }
  .r3-mid.fail .r3-bubble { top: 0; max-width: 46%; }
  .r3-hero { width: 46%; }
  .r3-treasure.got { width: 28%; }
}
/* ui-tag 그림의 몸통은 왼쪽 71%, 오른쪽 29%는 술 → 글자는 몸통 안에만 */
.panel.r3 .r3-treasure.got { padding: 15% 11.5% 4% 3%; } /* %는 부모 폭 기준: 꼬리표 폭 33% × (몸통 위 44%, 술 34%, 아래 12%, 왼쪽 9%) */
.panel.r3 .r3-treasure.got > * { max-width: 100%; }
.r3-treasure b { white-space: normal; text-align: center; font-size: 10.5px; line-height: 1.1; }
.r3-treasure .r3-tr { width: 100%; }
/* 총점 줄: 긴 언어(독일어 Gesamt 등)에서 낱말·숫자가 쪼개지지 않게, 넘치면 신기록 도장만 아래로 */
.panel.r3 .osc-total { flex-wrap: wrap; row-gap: 0; }
.panel.r3 .osc-total > .osc-label, .panel.r3 .osc-number { white-space: nowrap; }
@media (max-height: 700px) { .panel.r3 .r3-treasure.got { width: 28%; padding: 12.5% 9.8% 3.4% 2.5%; } }
/* NEW 띠는 꼬리표 왼쪽 위(이름·보물 글자를 가리지 않게), 긴 한 낱말 이름은 줄여서 */
.panel.r3 .r3-new-t { top: 4%; bottom: auto; left: -16%; }
.panel.r3 .r3-treasure span { overflow-wrap: normal; hyphens: auto; }
@media (max-height: 700px) {
  .panel.r3 .osc-total > .osc-label { font-size: 15px; }
  .panel.r3 .osc-seal { font-size: 11px; padding: 2px 7px; }
}
.panel.r3 .rescue-score, .panel.r3 .osc-breakdown { max-width: 100%; min-width: 0; box-sizing: border-box; }
.panel.r3 .osc-breakdown { padding-inline: 0; }
@media (max-height: 700px) { .panel.r3 .osc-delta { flex-basis: 100%; text-align: center; margin-top: -2px; } }
@media (max-height: 700px) { .panel.r3 .r3-scroll { padding-block: 30px 20px; } }
/* 가장 빠듯한 단계(pf3)에서도 냥도사 말풍선(목소리 대사)은 남기고, 대신 별·띠·두루마리를 줄인다 */
.overlay.pf3 .panel.r3 .r3-bubble { display: block; }
.overlay.pf3 .panel.r3 .r3-stars i { width: 34px; } .overlay.pf3 .panel.r3 .r3-stars i:nth-child(2) { width: 42px; }
.overlay.pf3 .panel.r3 > h2.r3-ribbon { width: 76%; font-size: 20px; }
.overlay.pf3 .panel.r3 .r3-scroll { padding-block: 32px 14px; }
.overlay.pf3 .panel.r3 .r3-big { width: 52%; }
.overlay.pf3 .panel.r3 .r3-pill { min-height: 40px; }
/* 게임 알림(보물 이름·힌트 안내 등)은 아래 단추(돌아가기·힌트)를 가리지 않게 위쪽에, 손가락은 통과 */
.toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 118px); pointer-events: none; white-space: normal; text-align: center; }
/* ---------------------------------------------------------------- 3.0 결과 카드 화면: 마을 그림 위에 카드, 나무 단추 */
.stage[data-scene="card"] { background: linear-gradient(rgba(20, 12, 16, .45), rgba(20, 12, 16, .7)), #2a1d22 var(--kbg, url("sprites/bg-v1.webp")) center / cover no-repeat; }
.k3 { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 16px; }
.k3-card.cardimg { width: 92%; max-width: 420px; border-radius: 14px; border: 4px solid #c8862a; box-shadow: 0 0 0 3px #4a2a10, 0 10px 22px rgba(0,0,0,.5); }
.k3-fine.fine { color: #f3e2c2; text-shadow: 0 1px 2px #000; margin: 0; }
.k3-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.k3-big { width: 70%; max-width: 310px; }
.k3-big b { font-size: clamp(24px, 7.6vw, 32px); white-space: nowrap; }
.stage[data-scene="card"] .orak-next, .stage[data-scene="card"] #next { width: 100%; }
/* 예전 .panel.win .got img(36px)가 보물 그림을 덮어쓰던 것: 시안처럼 꼬리표 몸통을 채우는 크기로 */
.overlay .panel.r3 .r3-treasure .r3-tr { width: 100%; height: auto; max-height: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.overlay .panel.r3 .r3-treasure .r3-new { display: none; }
/* 시안처럼 말풍선은 냥도사 머리 오른쪽·꼬리표 왼쪽(NEW 띠를 가리지 않게) */
@media (min-height: 701px) { .r3-mid:not(.fail) .r3-bubble.bubble { right: auto; left: 34%; top: -10%; max-width: 38%; } }
/* 말풍선 위치는 .r3-hero 기준(%)이라 판이 줄면 같이 좁아진다 → 폭은 글자 기준으로 */
.r3-mid:not(.fail) .r3-bubble.bubble { width: max-content; max-width: 150px; min-width: 84px; overflow-wrap: break-word; }
/* NEW 띠는 꼬리표 오른쪽 위(술 자리): 말풍선과 겹치지 않게 */
.panel.r3 .r3-new-t { left: auto; right: -12%; top: 0; transform: rotate(10deg); }
/* 두루마리 윗단(테두리)에 총점이 걸치지 않게, 엽전 줄은 한 줄로 */
.panel.r3 .r3-scroll { padding-top: 36px; }
.panel.r3 .earn { white-space: nowrap; }
@media (max-height: 700px) { .panel.r3 .r3-scroll { padding-top: 32px; } }
.overlay.pf2 .r3-mid:not(.fail) .r3-bubble.bubble { left: -30%; top: -16%; }
/* 알약 두 개 줄: 긴 언어(독일어 Missgeschick-Karte)가 판 폭을 밀어내지 않게 칸을 고정하고 글자를 줄인다 */
.r3-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.r3-pill { min-width: 0; padding-inline: 10px; }
.r3-pill span { min-width: 0; overflow: hidden; }
.overlay.pf3 .panel.r3 { gap: 2px; }
.overlay.pf3 .panel.r3 .r3-hero { width: 38%; }
.overlay.pf3 .panel.r3 .r3-scroll { gap: 0; padding-bottom: 10px; }
.overlay.pf3 .panel.r3 .r3-scroll .earn, .overlay.pf3 .panel.r3 .r3-line { font-size: 11.5px; }
.overlay.pf3 .panel.r3 .r3-big b { font-size: 22px; }
.overlay.pf3 .panel.r3 .r3-more { min-height: 18px; }
.overlay.pf3 .panel.r3 .r3-treasure.got { width: 24%; padding: 10.5% 8.3% 2.9% 2.2%; }
@media (max-height: 700px) { .overlay .panel.r3 > .r3-sign { width: 62%; } }
html:not([lang="ko"]) .panel.r3 .r3-treasure span { font-size: 10.5px; letter-spacing: -.2px; }
.panel.r3 .r3-treasure.got { padding-right: 13%; }
@media (max-height: 700px) { .panel.r3 .r3-treasure.got { padding-right: 11%; } }
.overlay.pf3 .panel.r3 .r3-treasure.got { padding-right: 9.4%; }
/* 기록장: 다른 3.0 화면처럼 매달린 현판 제목 + 크림 판(구름 모서리) 카드. 판 그림은 9조각(border-image)으로 늘려 모서리가 일그러지지 않게 */
.stage[data-scene="book"] .osc-header { position: relative; justify-content: center; min-height: 92px; border-bottom: 0; }
.stage[data-scene="book"] .osc-back { position: absolute; left: 12px; top: 50%; transform: translateY(-40%); }
.stage[data-scene="book"] .osc-title { display: grid; place-items: center; width: min(62%, 260px); aspect-ratio: 640 / 237; margin: 0 auto; padding: 8% 9% 3%; background: url("sprites/ui-sign.webp") center / 100% 100% no-repeat; font-size: clamp(20px, 6.4vw, 28px); line-height: 1; filter: drop-shadow(0 4px 5px rgba(0,0,0,.45)); }
.stage[data-scene="book"] .osc-record, .stage[data-scene="book"] .osc-challenge { background: radial-gradient(120% 90% at 50% 40%, #fff6de 0%, #f6e2b4 70%, #e9cc8e 100%); border: 3px solid #e0a83a; border-radius: 12px; box-shadow: 0 0 0 2px #5a2e0e, inset 0 0 0 2px rgba(255, 255, 255, .55), 0 4px 6px rgba(0,0,0,.4); padding: 10px 12px; }
.stage[data-scene="book"] .osc-heading { text-shadow: 0 2px 0 #3a1c08; }
.stage[data-scene="book"] .osc-label { word-break: keep-all; }
/* 지도 머리: 현판 글자·별 칩이 판자 안쪽(세로 30~86%)에, 네모 단추 글자는 구름 위가 아니라 나무 안쪽(17~80%)에.
   (padding %는 부모 폭 기준이라 판 크기 비율로 환산) */
.m3-sign { width: 56%; max-width: 250px; aspect-ratio: 640 / 237; padding: 6.2% 5.6% 2.9%; gap: 1px; }
.m3-sign h2 { font-size: clamp(18px, 5.6vw, 23px); }
.m3-sign p { font-size: 11.5px; line-height: 1.45; margin-top: 1px; }
.m3-sq { width: 74px; padding: 11px 6px 16px; gap: 0; justify-content: center; }
.m3-sq img { width: 46%; }
.m3-sq span { font-size: 11.5px; line-height: 1.1; }

/* 지도: 시안처럼 나무 판 이름표 + 왼쪽 부적, 술 달린 지도 현판, 돌 위 진한 글씨 */
.m3::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(env(safe-area-inset-top, 0px) + 150px); z-index: 5; pointer-events: none; background: linear-gradient(rgba(18, 10, 24, .62), rgba(18, 10, 24, .32) 55%, rgba(18, 10, 24, 0)); }
.m3-tag { width: 50%; min-width: 0; max-width: 236px; padding: 9px 7% 12px 17%; background-image: url("sprites/mp-board.webp"); color: #ffe9b0; }
.m3-tag::before { content: ""; position: absolute; left: -1%; top: -16%; width: 15%; aspect-ratio: 265 / 392; background: url("sprites/ui-tag.webp") center / 100% 100% no-repeat; transform: rotate(-7deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.m3-tag.left { left: 3%; } .m3-tag.right { right: 3%; }
.m3-tag b { max-width: 100%; overflow: hidden; color: #ffe9b0; text-shadow: 0 2px 0 #3a1c08, 1px 0 0 #3a1c08, -1px 0 0 #3a1c08, 0 -1px 0 #3a1c08; }
.m3-tag small { background: #fff2d6; box-shadow: inset 0 0 0 1px #c89a52; }
.m3-sign { aspect-ratio: 520 / 239; padding: 3.4% 7% 15.5%; background-image: url("sprites/mp-sign.webp"); color: #ffe9b0; }
.m3-sign h2 { max-width: 100%; white-space: nowrap; overflow: hidden; font-size: clamp(19px, 6vw, 25px); text-shadow: 0 2px 0 #3a1c08, 1px 0 0 #3a1c08, -1px 0 0 #3a1c08, 0 -1px 0 #3a1c08; }
.m3-sign p { box-shadow: inset 0 0 0 1px #c89a52; }
.m3-node b { top: 34%; transform: translateY(-50%); color: #33291f; text-shadow: 0 1px 0 #fff6e0, 1px 0 0 #fff6e0, -1px 0 0 #fff6e0, 0 -1px 0 #fff6e0, 0 0 4px rgba(255, 246, 224, .8); }
.m3-node:has(.m3-stars) b { top: 24%; }
.m3-node .m3-stars { top: 40%; }
.m3-node.lock b { color: #e9e4dc; text-shadow: 0 1px 0 #2a2622, 1px 0 0 #2a2622, -1px 0 0 #2a2622, 0 -1px 0 #2a2622; }
.m3-node.cur b { top: 47%; }
.m3-node.cur:has(.m3-stars) b { top: 40%; }
.m3-node.cur .m3-stars { top: 56%; }
.m3-node .map-gold { top: 2%; right: 8%; font-size: 15px; }
.m3-back b { white-space: nowrap; }
.m3-tag { width: 52%; max-width: 244px; padding: 10px 7% 13px 18%; }
.m3-tag::before { top: 10%; left: -2%; width: 17%; }
.m3-tag b { font-size: clamp(19px, 6vw, 24px); }
.m3-sign { width: 60%; max-width: 262px; }
.m3-sign h2 { font-size: clamp(22px, 7.4vw, 30px); }
.m3-node.lock b { top: 26%; color: #2a2622; text-shadow: 0 1px 0 #f2ede4, 1px 0 0 #f2ede4, -1px 0 0 #f2ede4, 0 -1px 0 #f2ede4, 0 0 4px rgba(242, 237, 228, .8); }
.m3-node.lock::after { content: ""; position: absolute; left: 50%; top: 40%; width: 19%; aspect-ratio: 1; transform: translateX(-50%); background: url("sprites/ic-lock.webp") center / contain no-repeat; filter: drop-shadow(0 1px 0 #f2ede4); }
.m3-me { transform: translate(-50%, -116%); }
.m3-scroll { padding-bottom: 0; }
.m3-tag::before { background: url("sprites/ui-stamp.webp") 50% 62% / 58% auto no-repeat, url("sprites/ui-tag.webp") center / 100% 100% no-repeat; }
.m3-sq span { display: block; max-width: 100%; overflow: hidden; }
.m3-sq span { -webkit-hyphens: auto; hyphens: auto; }
@media (max-width: 380px) { .m3-tag { width: 58%; } }
/* 도감 탭: 알약 판 아래 테두리(28%)를 비우고 글자를 판 안쪽 가운데로 */
.d3-tab { padding: 4px 10px 15px; }
.d3-tab.on { padding: 6px 10px 9px; }
.osc-label { word-break: keep-all; overflow-wrap: break-word; }
/* 힌트 단추: 시안처럼 크게, '오늘 N번'은 붉은 판 안쪽 크림 알약에 */
.hint-btn { width: 100px; height: 80px; padding: 17px 12px 0; justify-content: flex-start; gap: 3px; }
.hint-btn b { font-size: 21px; }
.hint-btn small { padding: 1px 8px; border-radius: 999px; background: #fff2d6; color: #6a1410; font: 12px/1.25 var(--game); box-shadow: inset 0 0 0 1px #d9a24a; white-space: nowrap; }
.tipline { min-height: 50px; padding: 3px 22px 9px; font-size: 14px; }
@media (max-height: 700px) { .hint-btn { width: 88px; height: 70px; padding-top: 14px; } .hint-btn b { font-size: 18px; } .hint-btn small { font-size: 11px; } .tipline { font-size: 13px; min-height: 44px; } }
.hint-btn { padding-top: 25px; gap: 2px; }
@media (max-height: 700px) { .hint-btn { padding-top: 22px; gap: 1px; } }
/* 기록장: 홈 단추가 보이도록 위 단추 줄 아래에서 시작 */
.stage[data-scene="book"] .osc-book { padding-top: calc(env(safe-area-inset-top, 0px) + 60px); }
.stage[data-scene="book"] > header { position: relative; z-index: 101; }
/* 시작 화면 360: 띠와 지갑 글은 한 줄로, 넘치면 글자를 줄인다(fitTexts) */
.stage .s3-purse, .stage .s3-purse span { white-space: nowrap; }
.stage .s3-ribbon { flex-wrap: nowrap; white-space: nowrap; max-width: 92%; overflow: hidden; }
.stage .s3-ribbon span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* 꾸미기: 시안처럼 이름·값을 크림 이름판에, 엽전은 크림 판으로 현판 오른쪽에 따로 */
.h3-head:not(.long) .d3-sign { margin-right: auto; margin-left: 4%; width: 50%; }
.h3-coins { top: 24px; right: 2px; padding: 4px 12px 4px 6px; border-radius: 12px; background: linear-gradient(#fff6e2, #f1dcae); border: 2px solid #c8902e; color: #3a2414; box-shadow: 0 3px 6px rgba(0,0,0,.35); }
.h3-coins b { color: #7a3d00; }
.h3-lab { display: flex; flex-direction: column; align-items: center; width: 92%; margin-top: 2px; padding: 3px 4px 2px; border-radius: 9px; background: linear-gradient(#fff6e2, #f1dcae); border: 2px solid #c8902e; box-shadow: 0 2px 3px rgba(0,0,0,.35); color: #3a2414; text-shadow: none; }
.h3-item .h3-lab b { margin-top: 0; color: #3a2414; text-shadow: none; font-size: 13.5px; }
.h3-item .h3-lab small { margin-top: 0; padding: 0 4px; background: transparent; font-family: var(--game); font-weight: 400; font-size: 14px; color: #3a2414; }
.h3-item .h3-lab small.on { background: transparent; color: #2f8a3a; }
.h3-item .h3-lab small.own { background: transparent; color: #7a5a3a; }
@media (max-height: 700px) { .h3-item .h3-lab b { font-size: 12px; } .h3-item .h3-lab small { font-size: 12.5px; line-height: 1.3; } .h3-lab { padding: 2px 3px 1px; } }
.h3-item .h3-lab b { font-size: 14.5px; max-width: 100%; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
.h3-head.long .h3-coins { top: 60px; padding: 2px 9px 2px 4px; font-size: 11px; }
.h3-head.long .h3-coins b { font-size: 15px; }
.h3-head.long .h3-coins img { width: 18px; height: 18px; }
@media (max-height: 700px) { .h3-item .h3-lab b { font-size: 12px; } }
/* 도감: 시안처럼 큰 현판 글씨와 큰 탭, 수난 앨범 사진 이름은 크림 이름표에 */
.d3-tab { min-height: 60px; }
.d3-tab b { font-size: 17px; }
.d3-tab small { font-family: var(--game); font-weight: 400; font-size: 17px; line-height: 1.05; }
.d3-photo b, .d3-photo .cnt { color: #3a2414; text-shadow: none; }
.d3-cap { display: flex; flex-direction: column; align-items: center; max-width: 100%; margin-top: 2px; padding: 2px 8px 1px; border-radius: 8px; background: linear-gradient(#fff6e2, #f1dcae); border: 2px solid #c8902e; box-shadow: 0 2px 3px rgba(0,0,0,.35); }
.d3-photo.unseen .d3-cap { opacity: .75; }
@media (max-height: 700px) { .d3-tab { min-height: 50px; padding-bottom: 12px; } .d3-tab b { font-size: 15px; } .d3-tab small { font-size: 14px; } }
.d3-sign h2.screen-title { font-size: clamp(26px, 8.4vw, 36px); }
.d3-sign { width: 58%; max-width: 262px; }
.d3-label { font-size: clamp(13px, 4vw, 16px); padding: 0 14px; }
@media (max-height: 700px) { .d3-sign { width: 50%; } .d3-label { font-size: 13px; } }
/* 결과: 다른 놀이 추천은 화면 아래(스크롤)로 — 맞춤 계산에서 빼서 그림이 시안 크기를 지키게 */
.overlay.measuring .orak-next-mini { display: none; }
/* 수난 결과: 그림 둘레 빈 곳 때문에 인물이 시안보다 작다 → 그림을 키워 인물 폭을 시안(화면 85%)에 맞춤, 도장은 작게 기울여 오른쪽 아래 */
.panel.r3 .r3-mid.fail .r3-fail-art { width: 88%; transform: scale(1.3); transform-origin: 50% 96%; margin: 13% 0 -1%; }
.overlay.pf2 .panel.r3 .r3-mid.fail .r3-fail-art { width: 62%; margin-top: 9%; }
.overlay.pf3 .panel.r3 .r3-mid.fail .r3-fail-art { width: 52%; margin-top: 8%; }
.panel.r3 .r3-mid.fail .r3-stamp.chip { right: -1%; bottom: 2%; width: 32%; padding: 11% 8%; transform: rotate(-12deg); color: #c4231b; font-family: var(--game); font-weight: 400; font-size: clamp(13px, 4.2vw, 17px); line-height: 1.1; text-align: center; word-break: keep-all; z-index: 3; }
@keyframes r3stamp { 0% { transform: rotate(-12deg) scale(1.7); opacity: 0; } 60% { transform: rotate(-12deg) scale(.94); opacity: 1; } 100% { transform: rotate(-12deg); opacity: 1; } }
.panel.r3 .r3-mid.fail .r3-stamp.chip { width: 42%; aspect-ratio: 313 / 314; padding: 5.5% 5% 5%; background-size: 100% 100%; animation: r3stamp .45s ease-out both .7s; }
@media (prefers-reduced-motion: reduce) { .panel.r3 .r3-mid.fail .r3-stamp.chip { animation: none; transform: rotate(-12deg); } }
/* 결과 배경: 시안처럼 마을 그림이 보이게 덜 어둡게 (글자는 모두 판 위라 대비 유지) */
.overlay:has(.panel.r3) { background: linear-gradient(rgba(16, 10, 20, .28), rgba(16, 10, 20, .5)), var(--rbg, none) center / cover no-repeat, #1d1420; }
@media (min-height: 701px) { .overlay .panel.r3 .r3-bubble.bubble { font-family: var(--game); font-weight: 400; font-size: 15px; line-height: 1.2; padding: 6px 10px; } }
/* 점수 두루마리: '자세히'가 아래 테두리에 걸리지 않게 아래 여백 유지, 최고 기록 차이는 초록 ▲ 로 */
.panel.r3 .osc-delta { color: #2f7a36; font-weight: 700; font-size: 11px; }
.panel.r3 .osc-delta::before { content: "▲ "; font-size: 9px; }
/* '자세히'는 두루마리 아래 끝에 걸친 작은 크림 탭으로(테두리에 겹쳐도 단추로 읽히게) */
.panel.r3 .r3-more, .overlay.pf3 .panel.r3 .r3-more { position: absolute; left: 50%; bottom: 2px; transform: translate(-50%, 45%); min-height: 0; padding: 2px 12px 3px; line-height: 1.2; border-radius: 999px; background: linear-gradient(#fff6e2, #f1dcae); border: 2px solid #c8902e; box-shadow: 0 2px 3px rgba(0,0,0,.35); color: #5a3a24; font-size: 12px; z-index: 2; }
.panel.r3 .r3-scroll { margin-bottom: 12px; }
.panel.r3 .r3-treasure b { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-align: center; }
.panel.r3 .r3-scroll, .overlay.pf1 .panel.r3 .r3-scroll, .overlay.pf2 .panel.r3 .r3-scroll, .overlay.pf3 .panel.r3 .r3-scroll { padding-bottom: 24px; }
.panel.r3 .r3-scroll { margin-bottom: 6px; }
@media (min-height: 701px) {
  .overlay:not(.pf2):not(.pf3) .panel.r3 .osc-total > .osc-label { font-size: 21px; }
  .overlay:not(.pf2):not(.pf3) .r3-scroll .earn { font-size: 15px; }
  .overlay:not(.pf2):not(.pf3) .r3-scroll .earn b { font-size: 22px; }
}
/* 긴 이름 현판은 판을 넓혀 글이 판 안쪽에 맞게 (줄인 글자는 15px 아래로 안 내려가게) */
.d3-sign.long { width: 70%; max-width: 300px; }
.h3-head .d3-sign { width: 44%; }
.h3-head.long .d3-sign { width: 62%; margin-left: auto; margin-right: auto; }
@media (max-height: 700px) { .h3-head .d3-sign { width: 42%; padding-top: 6%; } .h3-head.long .d3-sign { width: 60%; } }
.overlay.pf3 .panel.r3 .r3-scroll { padding-bottom: 36px; }
/* 점수 두루마리: 판 그림을 통째로 늘리면 글이 많을 때 아래 테두리가 글 위로 올라온다 → 위아래 두루마리 끝은 고정 두께로 (border-image) */
.r3-scroll { background: none; border: 0; border-image: url("sprites/ui-panel.webp") 40 52 40 52 fill / 22px 28px / 0 stretch; }
.panel.r3 .r3-scroll, .overlay.pf1 .panel.r3 .r3-scroll, .overlay.pf2 .panel.r3 .r3-scroll, .overlay.pf3 .panel.r3 .r3-scroll { padding-bottom: 22px; }
/* 판 위 금별 띠: 시안처럼 굵게 읽히는 크기로 */
.gold-chip { font-size: 14px; padding: 5px 20px 6px; max-width: 92%; }
@media (max-height: 700px) { .gold-chip { font-size: 12.5px; padding: 4px 16px 5px; } }
.plaque-in b { max-width: 100%; white-space: nowrap; overflow: hidden; }

/* 판 현판 글자 상자 = 그림에서 잰 나무판(가로 8~92%, 세로 30~70%) */
.plaque-in { left: 8%; right: 8%; top: 30%; bottom: 30%; }
.r3-stamp.chip > span { display: block; }
.w3-total { min-height: 46px; line-height: 1.1; }
.gold-chip { display: flex; align-items: center; justify-content: center; width: fit-content; }
/* 판 위 글자는 fitPlates가 판 안쪽에 맞추므로 글 상자에서 자르지 않는다 */
.m3-sign h2, .panel.r3 .r3-ribbon span, .plaque-in b, .m3-tag b, .r3-treasure b, .r3-treasure span, .s3-sq span, .m3-sq span, .s3-purse span, .s3-big b, .s3-big small, .s3-red b, .s3-red small, .r3-pill span, .d3-tab b, .d3-sign h2 { overflow: visible; text-overflow: clip; }
.h3-coins { z-index: 4; }
.m3-node.cur b { top: 53%; }
.m3-node.cur:has(.m3-stars) b { top: 46%; }
.m3-node.cur .m3-stars { top: 62%; }
/* 판 현판 글: 길면 두 줄까지(주간·오늘의 판 이름), 줄 사이는 촘촘히 */
.plaque-in b { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.08; text-align: center; }
.plaque-in { box-sizing: border-box; }
/* 네모 단추·말풍선: 한·중·일 긴 낱말도 필요할 때만 줄을 나눔 */
.s3-sq span, .m3-sq span, .bubble { word-break: keep-all; overflow-wrap: anywhere; }
.r3-sign span { overflow: visible; text-overflow: clip; }
/* 지도 돌: 별이 있으면 이름은 돌 윗면 위쪽, 별은 그 아래 */
.m3-node:has(.m3-stars) b { top: 27%; }
.m3-node:not(.cur) .m3-stars { top: 44%; }
.overlay > .panel.r3 { min-width: 0; } /* 줄바꿈 안 하는 글(띠 제목 등)이 판 폭을 밀어내지 않게: 판 글 맞춤 때 폭이 흔들리면 안 된다 */

/* ── 시안 글씨 (2026-11-28): 나무·붉은 판 위 글은 굵은 갈색 테두리, 주요 단추는 금색, 양피지 띠는 진갈색 ── */
.s3-big b, .s3-red b, .village-intro .btn.primary { color: #ffd65a; -webkit-text-stroke: 5px #3a1c08; paint-order: stroke fill; text-shadow: 0 3px 0 #2a1204, 0 5px 6px rgba(0,0,0,.4); letter-spacing: .01em; }
.s3-red b { -webkit-text-stroke-color: #4a0c08; text-shadow: 0 3px 0 #3a0806, 0 5px 6px rgba(0,0,0,.4); }
.d3-back b, .m3-back b, .h3-back b, .d3-sign h2.screen-title, .m3-sign h2, .s3-sq span, .m3-sq span, .r3-pill span, .d3-tab:not(.on) b, .d3-tab:not(.on) small, .r3-sign span, .hint-btn b {
  color: #fff1cf; -webkit-text-stroke: 4px #3a1c08; paint-order: stroke fill; text-shadow: 0 2px 0 #2a1204; }
.hint-btn b { -webkit-text-stroke-color: #4a0c08; text-shadow: 0 2px 0 #3a0806; }
.s3-sq span, .m3-sq span, .r3-pill span, .d3-tab:not(.on) small { -webkit-text-stroke-width: 3.5px; }
.s3-big b { font-size: clamp(30px, 10vw, 42px); }
.s3-red b { font-size: clamp(26px, 8.4vw, 34px); }
.r3-big b { font-size: clamp(30px, 9.6vw, 40px); }
.d3-back b, .m3-back b { font-size: clamp(26px, 8vw, 32px); }
.d3-sign h2.screen-title { font-size: 34px; }
.s3-sq span { font-size: 17px; }
.r3-pill { font-size: 18px; }
/* 양피지 띠: 흰 알약 대신 시안의 종이 띠 */
.s3-big small, .s3-red small, .r3-next, .h3-note { border: 0; border-radius: 0; background: url("sprites/ui-strip.webp") center / 100% 100% no-repeat; color: #4a2a10; font-family: var(--game); font-weight: 400; font-size: 15px; line-height: 1.25; padding: 3px 16px 4px; -webkit-text-stroke: 0; text-shadow: none; box-shadow: none; }
.s3-red small { font-size: 14px; }
.s3-purse span { font-family: var(--game); font-weight: 400; font-size: 17px; color: #4a2a10; }
.s3-purse b { font-size: 21px; }
.d3-tab.on b { color: #4a2a10; font-size: 18px; } .d3-tab.on small { color: #4a2a10; font-family: var(--game); font-weight: 400; font-size: 15px; }
.d3-tab:not(.on) b { font-size: 18px; } .d3-tab:not(.on) small { font-family: var(--game); font-weight: 400; font-size: 15px; }
.s3-big b, .s3-red b { line-height: .98; }
.s3-big small, .s3-red small { margin-top: 2px; }
.s3-sq.long span, .m3-sq.long span { font-size: 15.5px; line-height: 1.05; }
.s3-sq img { width: 66%; }
.s3-big small, .s3-red small { margin-top: 1px; padding: 2px 16px 3px; }
.s3-big small { min-width: 46%; } .s3-red small { min-width: 82%; }
.where b { font-size: 22px; color: #fff1cf; -webkit-text-stroke: 4px #3a1c08; paint-order: stroke fill; text-shadow: 0 2px 0 #2a1204; }
.where .sub { font-size: 13.5px; }
.overlay .panel.r3 > .r3-sign { width: 60%; max-width: 260px; font-size: 19px; }
.panel.r3 .r3-pill { min-height: 58px; font-size: 19px; }
.panel.r3 .r3-pill img { width: 34px; height: 34px; }
.panel.r3 .r3-mid.fail .r3-stamp.chip { font-size: clamp(18px, 6vw, 24px); line-height: 1.05; }
.panel.r3 .r3-next { font-size: 16px; }
.where .stars { font-size: 23px; }
.tipline { font-size: 16px; color: #3e220c; }
@media (max-height: 700px) { .tipline { font-size: 14px; } }
.d3-label { font-size: clamp(14px, 4.4vw, 17px); line-height: 1.4; }
.d3-tab { min-height: 62px; }
.d3-sign { width: 58%; max-width: 250px; }
.d3-sign h2.screen-title { font-size: 38px; }
.d3-note { font-family: var(--game); font-weight: 400; font-size: 15px; color: #4a2a10; }
.h3-item b { font-size: 15.5px; }
.h3-item small { font-family: var(--game); font-weight: 400; font-size: 14.5px; }
.h3-item small img { width: 17px; height: 17px; }
.h3-coins { padding: 6px 16px 7px 12px; border: 0; border-radius: 0; background: url("sprites/ui-cream.webp") center / 100% 100% no-repeat; color: #4a2a10; }
.h3-coins b { color: #7a3d00; font-size: 19px; }
.h3-actions .h3-act { aspect-ratio: 1142 / 350; }
.h3-actions .h3-back { aspect-ratio: 1134 / 380; }
@media (max-height: 700px) { .d3-tab { min-height: 54px; } .d3-label { font-size: 14px; } }
.d3 > .d3-sign:not(.long) { width: 64%; max-width: 280px; }
@media (max-height: 700px) { .d3 > .d3-sign:not(.long) { width: 54%; } }
.m3-sign h2 { font-size: clamp(26px, 8.6vw, 34px); color: #ffe9b0; }
.m3-sign p, .m3-tag small { font-family: var(--game); font-weight: 400; font-size: 14.5px; color: #4a2a10; line-height: 1.4; }
.m3-sign p img, .m3-tag small img { width: 16px; height: 16px; }
.m3-tag b { -webkit-text-stroke: 4px #3a1c08; paint-order: stroke fill; text-shadow: 0 2px 0 #2a1204; }
@media (max-width: 380px) { .m3-tag { width: 50%; } } /* 좁은 화면에서 이름표가 첫 돌 모서리를 가리지 않게 */

/* ── 시안 맞춤 2차 (2026-11-28) ── */
/* 11·16. 결과 띠: 크림 종이 띠 + 진홍 글씨(시안) */
.panel.r3 h2.r3-ribbon, .overlay .panel.r3 > h2.r3-ribbon { aspect-ratio: 1142 / 453; background-image: url("sprites/rb-cream-red.webp"); color: #a3180f; -webkit-text-stroke: 0; text-shadow: 0 2px 0 #fff4d8, 0 0 1px #5a0a06; font-size: clamp(28px, 9.6vw, 40px); }
.panel.r3 h2.r3-ribbon.blue, .overlay .panel.r3 > h2.r3-ribbon.blue { aspect-ratio: 1142 / 431; background-image: url("sprites/rb-cream-blue.webp"); color: #8e1610; text-shadow: 0 2px 0 #fff4d8, 0 0 1px #5a0a06; }
/* 10·F1. 결과 배경: 시안처럼 마을 배경이 밝게 보이게(아래 단추 쪽만 살짝 어둡게) */
.overlay:has(.panel.r3) { background: linear-gradient(rgba(16, 10, 20, .04), rgba(16, 10, 20, .1) 55%, rgba(16, 10, 20, .38)), var(--rbg, none) center / cover no-repeat, #1d1420; }
.panel.r3.win .r3-mid::before { content: ""; position: absolute; inset: -6% -4%; background: radial-gradient(closest-side, rgba(255, 214, 90, .55), rgba(255, 190, 60, .18) 60%, transparent); pointer-events: none; z-index: 0; }
/* 12·20. 말풍선: 시안의 만화 말풍선(크림 바탕, 굵은 갈색 테두리, 꼬리) */
.overlay .panel.r3 .r3-bubble.bubble { background: #fffaf0; color: #3a2414; border: 3px solid #3a2414; border-radius: 22px; padding: 7px 12px; font-family: var(--game); font-weight: 400; box-shadow: 0 3px 0 rgba(0,0,0,.25); overflow: visible; }
.overlay .panel.r3 .r3-bubble.bubble::after { content: ""; position: absolute; bottom: -13px; left: 22%; width: 16px; height: 16px; background: #fffaf0; border: 3px solid #3a2414; border-top: 0; border-left: 0; transform: skewX(28deg) rotate(45deg); border-radius: 0 0 4px 0; }
.overlay .panel.r3 .r3-mid.fail .r3-bubble.bubble::after { left: auto; right: 18%; transform: skewX(-28deg) rotate(45deg); }
/* 12. 구출 성공 냥도사: 시안 크기(화면 폭의 약 55%) */
@media (min-height: 701px) { .overlay .panel.r3 .r3-hero { width: 60%; max-width: 300px; } }
/* 13. '자세히'는 두루마리 안 아래쪽 글자 단추 */
.panel.r3 .r3-more, .overlay.pf3 .panel.r3 .r3-more { position: static; transform: none; margin: 0 auto; padding: 0 8px; border: 0; border-radius: 0; background: none; box-shadow: none; color: #4a2a10; font-family: var(--game); font-weight: 400; font-size: 14px; }
.panel.r3 .r3-scroll, .overlay.pf1 .panel.r3 .r3-scroll, .overlay.pf2 .panel.r3 .r3-scroll, .overlay.pf3 .panel.r3 .r3-scroll { padding-bottom: 14px; }
/* 14. 총점·엽전 크게 */
.panel.r3 .osc-number { font-size: 42px; }
.panel.r3 .osc-total > .osc-label { font-size: 22px; }
.panel.r3 .earn { font-family: var(--game); font-weight: 400; font-size: 17px; color: #3a2414; }
.panel.r3 .earn b { font-size: 22px; color: #b0200e; }
.panel.r3 .earn img { width: 24px; height: 24px; }
/* 15·20. 큰 단추 아래 붉은 술 */
.panel.r3 .r3-actions { position: relative; }
.panel.r3 .r3-big { position: relative; overflow: visible; }
.panel.r3 .r3-big::before, .panel.r3 .r3-big::after { content: ""; position: absolute; top: 80%; width: 6.5%; aspect-ratio: 87 / 128; background: url("sprites/ui-tassel.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); pointer-events: none; z-index: 1; }
.panel.r3 .r3-big::before { left: 17%; } .panel.r3 .r3-big::after { right: 17%; }
/* 17. 수난 그림 크게 */
.panel.r3 .r3-mid.fail .r3-fail-art { width: 96%; }
/* 18. 도장: 시안처럼 작은 직사각 붉은 도장 + 굵은 진홍 글씨 */
.panel.r3 .r3-mid.fail .r3-stamp.chip { width: auto; max-width: 46%; aspect-ratio: auto; padding: 6px 12px 7px; background: #fff6e4; border: 4px double #c4231b; border-radius: 6px; box-shadow: 0 0 0 2px #fff6e4, 0 4px 6px rgba(0,0,0,.35); color: #b51c12; font-size: clamp(17px, 5.4vw, 22px); line-height: 1.12; right: 0; bottom: 10%; }
/* 19. 수난 '마을 지도'는 크림 판 */
.panel.r3 .r3-pill.r3-map { background-image: url("sprites/ui-cream.webp"); }
.panel.r3 .r3-pill.r3-map span { color: #4a2a10; -webkit-text-stroke: 0; text-shadow: none; }
/* 11. 띠는 조금 좁게, 별은 띠 위 구름에 걸치게(시안), 띠 글씨는 크게 */
.overlay.overlay .panel.r3 > h2.r3-ribbon, .overlay.pf1.pf1 .panel.r3 > h2.r3-ribbon, .overlay.pf2.pf2 .panel.r3 > h2.r3-ribbon, .overlay.pf3.pf3 .panel.r3 > h2.r3-ribbon { width: 84%; max-width: 360px; font-size: clamp(28px, 9.4vw, 38px); }
.overlay .panel.r3 .r3-stars { margin-bottom: -30px; position: relative; z-index: 3; }
.overlay .panel.r3.win > h2.r3-ribbon { margin-top: 0; }
.panel.r3 .osc-number { font-size: 38px; }
.panel.r3 .osc-total { flex-wrap: nowrap; }
/* 결과 화면 크기 단계는 '다른 놀이' 목록을 빼고 잰다(시안처럼 첫 화면에 냥도사를 크게, 다른 놀이는 아래로 내려 보기) */
.overlay.measuring .panel.r3 > .orak-next { display: none; }
.panel.r3 .r3-scroll { padding-top: 26px; }
.panel.r3 .r3-line { margin-top: 0; }
/* 구출 성공 보물 카드: 시안의 종이 카드(NEW 딱지 · '보물 도감' · 큰 보물 · 이름 띠) */
.overlay .panel.r3 .r3-treasure.got, .overlay.pf1 .panel.r3 .r3-treasure.got, .overlay.pf2 .panel.r3 .r3-treasure.got, .overlay.pf3 .panel.r3 .r3-treasure.got {
  width: 36%; max-width: 150px; aspect-ratio: auto; margin-left: -4%; padding: 10px 8px 8px; gap: 3px; justify-content: flex-start;
  background: linear-gradient(#fbf1d6, #efd8a4); border: 3px solid #5e3612; border-radius: 10px; box-shadow: inset 0 0 0 3px #e2b85a, 0 5px 10px rgba(0,0,0,.45); transform: rotate(3deg); }
.overlay .panel.r3 .r3-treasure.got b { font-size: 16px; color: #4a2a10; white-space: nowrap; overflow: visible; line-height: 1.15; }
.overlay .panel.r3 .r3-treasure .r3-tr { width: 82%; }
.overlay .panel.r3 .r3-treasure.got span { display: block; width: 100%; padding: 2px 4px 3px; background: url("sprites/ui-strip.webp") center / 100% 100% no-repeat; font-family: var(--game); font-size: 14px; color: #4a2a10; letter-spacing: 0; text-align: center; white-space: nowrap; }
.overlay .panel.r3 .r3-new-t { left: -12%; right: auto; top: -9%; bottom: auto; transform: rotate(-10deg); font-size: 13px; }
.overlay .panel.r3 .r3-mid:not(.fail) .r3-bubble.bubble, .overlay.pf2 .panel.r3 .r3-mid:not(.fail) .r3-bubble.bubble { left: 30%; right: auto; top: -12%; max-width: 160px; }
.overlay .panel.r3 .r3-mid:not(.fail) .r3-bubble.bubble::after { left: 18%; }
/* 시작 2. 단추 묶음은 별 띠 바로 아래, 남는 높이는 위 장면(냥도사·동굴)에 */
.s3-start .s3-top { flex: 1 1 auto; height: auto; min-height: clamp(130px, 24vh, 230px); }
.s3-start .s3-actions { margin: 4px 0 0; padding-top: 6px; }
.s3-start .s3-purse { margin-top: 10px; margin-bottom: 6px; }
@media (min-height: 760px) { .s3-top { --hw: min(56vw, 270px); } }
/* 시작 1 · 판 말풍선: 시안의 만화 말풍선 */
.s3-bubble.bubble, .play .bubble, .stage .bubble { background: #fffaf0; color: #3a2414; border: 3px solid #3a2414; font-family: var(--game); font-weight: 400; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.s3-bubble.bubble { border-radius: 24px; padding: 8px 14px; font-size: 16px; line-height: 1.3; }
.s3-bubble.bubble::after { content: ""; position: absolute; bottom: -14px; left: 26%; width: 16px; height: 16px; background: #fffaf0; border: 3px solid #3a2414; border-top: 0; border-left: 0; transform: skewX(28deg) rotate(45deg); border-radius: 0 0 4px 0; }
/* 시작 3. '오늘의 판' 양옆 금빛 반짝 선 */
.s3-red b { position: relative; }
.s3-red b::before, .s3-red b::after { content: ""; position: absolute; top: 18%; width: 14px; height: 60%; background: linear-gradient(#ffe066, #ffe066) 0 0 / 3px 45% no-repeat, linear-gradient(#ffe066, #ffe066) 6px 30% / 3px 55% no-repeat, linear-gradient(#ffe066, #ffe066) 12px 60% / 3px 40% no-repeat; filter: drop-shadow(0 1px 0 #5a0d0a); pointer-events: none; }
.s3-red b::before { left: -24px; transform: skewX(-18deg); } .s3-red b::after { right: -24px; transform: scaleX(-1) skewX(-18deg); }
/* 시작 4. 지갑 엽전·글씨 크게 */
.s3-purse img { width: 32px; height: 32px; }
.s3-purse span { font-size: 18px; }
.s3-purse b { font-size: 22px; }
/* 지도 5·6·7: 시안 비율(이름표 폭 ≈ 33%, 돌판 ≈ 13%, 냥도사 몸 ≈ 17%) */
.m3-tag, .m3-tag.left, .m3-tag.right { width: 40%; max-width: 190px; padding: 6px 4% 8px 10%; }
.m3-tag::before { width: 13%; left: -4%; top: 6%; }
.m3-tag b { font-size: clamp(18px, 5.6vw, 23px); }
.m3-node { width: 15%; }
.m3-node.cur { width: 18%; }
.m3-node b { font-size: clamp(14px, 4.2vw, 18px); }
.m3-me { width: 34%; }
@media (max-width: 380px) { .m3-tag, .m3-tag.left, .m3-tag.right { width: 42%; } }
/* 지도 8. '처음으로'는 시안처럼 붉은 나무 판 */
.m3-back { background-image: url("sprites/ui-btn-redwood.webp"); }
.m3-back b { -webkit-text-stroke-color: #4a0c08; text-shadow: 0 2px 0 #3a0806; color: #fff1cf; }
/* 지도 머리 현판은 시안 크기(화면 폭 약 50%)로 */
.m3-sign { max-width: 210px; }
/* 도감 21. 진열장 넓게, 칸 낮게: 다섯 칸이 한 화면에(시안) */
.d3 { position: relative; }
.d3 > .d3-body { width: 106%; margin-inline: -3%; }
.d3-row { aspect-ratio: 640 / 142; padding-top: 1%; }
.d3-row ul { gap: 0; }
.d3-item img { max-height: 54px; }
.d3 > .d3-sign:not(.long) { width: 52%; max-width: 230px; margin-top: -14px; }
.d3 .d3-tab { min-height: 56px; }
/* 22. 아래 오른쪽 수난 사진(폴라로이드) */
.d3-snap { position: absolute; right: 1%; bottom: 4px; z-index: 6; width: 25%; max-width: 110px; aspect-ratio: .82; padding: 6% 6% 22%; border: 0; background: #fbf7ee; box-shadow: 0 4px 8px rgba(0,0,0,.45), inset 0 0 0 1px #d8cdb4; transform: rotate(7deg); }
.d3-snap img { width: 100%; height: 100%; object-fit: cover; background: #4d5560; }
.d3-snap::before { content: ""; position: absolute; left: 32%; top: -7px; width: 36%; height: 16px; background: rgba(226, 206, 160, .85); transform: rotate(-6deg); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.d3 > .d3-note { width: 72%; align-self: flex-start; margin-left: 1%; }
.d3 > .d3-back { align-self: center; margin-right: 18%; }
@media (max-height: 700px) { .d3-snap { width: 20%; } .d3-row { aspect-ratio: 640 / 130; } }
/* 23. 진열장 칸 이름표: 종이 띠 */
.d3-label { border: 0; border-radius: 0; background: url("sprites/ui-strip.webp") center / 100% 100% no-repeat; box-shadow: none; padding: 1px 22px 2px; color: #4a2a10; }
.d3-label span { margin-left: 10px; }
.d3-tab.on { filter: drop-shadow(0 0 4px #ffd23c) drop-shadow(0 0 2px #ffb000); }
/* 꾸미기 26. 진열장: 시안처럼 금 구름 모서리 나무 장(두 칸) */
.h3-shelf.outfit-grid { aspect-ratio: 640 / 467; padding: 6% 7.5% 12.5%; row-gap: 4.6%; grid-template-rows: 1fr 1fr; border: 0; border-radius: 0; box-shadow: none; background: url("sprites/ui-cab2.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.h3-item.outfit-item, .h3-item.outfit-item:nth-child(-n+3) { border: 0; margin: 0; padding: 0 2px; justify-content: flex-end; }
.h3-item + .h3-item:not(:nth-child(4)) { box-shadow: none; }
.h3-cush { width: 92%; }
.h3-lab { width: 96%; }
/* 25. 냥도사는 무대 원판 위에, 현판은 크게 */
.h3 .h3-hero { width: min(62vw, 32vh, 270px); transform: translate(-50%, -14%); }
.h3-head:not(.long) .d3-sign, .h3-head .d3-sign { width: 56%; max-width: 250px; }
/* 28. 착용·구매 붉은 단추를 시안처럼 두툼하게 */
.h3-actions .h3-act { aspect-ratio: 1142 / 380; }
.h3-actions .h3-act b { font-size: clamp(26px, 8vw, 32px); }
@media (max-height: 700px) { .h3-shelf.outfit-grid { aspect-ratio: 640 / 420; } .h3 .h3-hero { width: min(52vw, 27vh); } }
.d3-snap { padding: 7px 7px 26px; aspect-ratio: auto; }
.d3-snap img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.d3-row { aspect-ratio: 640 / 126; }
.d3-item img { max-height: 46px; }
.d3 > .d3-note { font-size: 13.5px; }
.h3-note { margin-top: -18px; position: relative; z-index: 2; }
.d3-row .d3-item { aspect-ratio: auto; height: 50px; }
.d3-row .d3-item img { transform: scale(1.1); }
.d3-row { padding-bottom: 2.4%; }
.h3-note { margin-top: -44px; }
.h3 .h3-hero { width: min(70vw, 34vh, 290px); }
/* 캐릭터 크기 맞춤(시안 대비): 지도 냥도사는 돌판 위에, 꾸미기 냥도사는 무대 위에 */
.m3-me { width: 28%; transform: translate(-50%, -92%); }
.h3 .h3-hero { width: min(60vw, 30vh, 250px); transform: translate(-50%, -20%); }
@media (min-height: 701px) { .h3 .h3-hero { transform: translate(-50%, -34%); } }
@media (min-height: 701px) { .overlay .panel.r3 .r3-hero { width: 68%; max-width: 330px; } }
@media (min-height: 760px) { .s3-top { --hw: min(48vw, 236px); } }
.m3-node b { font-size: clamp(13px, 3.9vw, 17px); line-height: 1; }
html:is([lang="ja"], [lang="zh-TW"], [lang="th"]) .m3-node b { font-size: clamp(12px, 3.5vw, 15px); }
.panel.r3 .osc-total { flex-wrap: wrap; }
html:not([lang="ko"]) .m3-tag, html:not([lang="ko"]) .m3-tag.left, html:not([lang="ko"]) .m3-tag.right { width: 46%; max-width: 220px; }
/* 시안 맞춤 3차: 구출 성공 냥도사를 시안 크기(화면 폭의 약 64%)로 지키려고, 줄이는 대신 겹친다
   (시안처럼 동전 더미가 두루마리 윗단에 올라앉고, 판 이름 나무판은 조금 작게) */
@media (min-height: 701px) {
  .overlay .panel.r3.win .r3-mid { margin-top: -14px; z-index: 2; }
  .overlay .panel.r3.win .r3-cat { translate: 0 -16px; }
  .overlay .panel.r3.win > .r3-sign { width: 50%; margin-bottom: -10px; }
  .overlay.pf2 .panel.r3 .r3-hero { width: 60%; }
  .overlay.pf3 .panel.r3 .r3-hero { width: 54%; }
  /* 수난 그림(깨비+냥도사)도 시안처럼 화면 폭 가득: 위 여백을 줄여 자리를 만든다 */
  .overlay .panel.r3.fail > .r3-sign { width: 50%; margin-bottom: -10px; }
  .overlay .panel.r3.fail > h2.r3-ribbon { position: relative; z-index: 4; } /* 커진 그림의 빈 윗부분이 띠 글자를 덮지 않게 */
  .overlay .panel.r3 .r3-mid.fail .r3-fail-art, .overlay.pf1 .panel.r3 .r3-mid.fail .r3-fail-art, .overlay.pf2 .panel.r3 .r3-mid.fail .r3-fail-art { width: 100%; margin-top: 6%; }
}
/* 예전 pf2 규칙(.panel.win .got img 28px)이 보물 그림을 우표만 하게 줄이던 것 */
.overlay .panel.r3 .r3-treasure img.r3-tr { width: 82%; height: auto; }
/* 작은 화면(높이 700 이하): 무대가 낮아 냥도사가 간판을 덮고 안내 띠가 무대를 가리던 것 */
@media (max-height: 700px) {
  .h3 .h3-hero { width: min(40vw, 20vh); transform: translate(-50%, -16%); }
  .h3-note { margin-top: -40px; }
}
/* 3.0 글자·판 재검수: 긴 독일어 낱말('Rekordbuch')을 중간에서 끊지 않고 글자 맞춤이 줄이도록 */
.s3-sq span, .m3-sq span { overflow-wrap: normal; word-break: keep-all; hyphens: manual; -webkit-hyphens: manual; }
/* 3.0 글자·판 재검수: 일본어 '週間チャレンジ'는 네모 판 안에서 두 줄로 */
:lang(ja) .m3-sq span { word-break: normal; line-break: strict; }
/* 2026-12-01 시작 화면 네모 단추: 세 칸이 늘 같은 크기(긴 낱말이 칸을 넓히거나 두 줄이 판을 키우지 않게, 글·그림은 판 면 안으로 줄인다) */
.s3-squares { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s3-sq { min-width: 0; min-height: 0; }
@media (max-height: 700px) { .s3-squares { width: 80%; } }
/* 2026-12-02 잠긴 마을 자물쇠·안내: 마을 칸 가운데에 두면 지금 마을을 볼 때 윗 제목판 뒤에 반쯤 가려 보이던 것 → 지금 마을 바로 위(잠긴 칸 아래쪽)에 둔다 */
.m3-lock { justify-content: flex-end; padding-bottom: 9%; }
/* 2026-12-02 주간 도전 카드: 긴 말(스페인어)이 제목·설명을 세 줄로 접고 낱말 가운데를 하이픈으로 끊어 카드가 커지고 뒤로 단추가 화면 밖으로 밀리던 것(main 부터)
   → 최고 기록 칸은 좁게(두 줄), 제목·설명은 낱말 단위로만 접는다 */
.w3-card small { max-width: 64px; overflow-wrap: normal; word-break: keep-all; hyphens: manual; -webkit-hyphens: manual; }
.w3-txt b, .w3-txt .chip { hyphens: manual; -webkit-hyphens: manual; overflow-wrap: normal; word-break: normal; }
.w3-txt .chip { line-height: 1.3; padding-top: 2px; padding-bottom: 2px; }
@media (max-height: 700px) { .w3-levels { gap: 6px; } .w3-card { min-height: 78px; } }
/* 2026-12-02 꾸미기: 큰 화면(390x844)에서 냥도사가 위로 올라가 제목판 글자(Trang trí)를 덮던 것(main 부터) → 덜 올리고, 제목판은 늘 냥도사 위에 */
.h3-head .d3-sign { position: relative; z-index: 3; }
/* 2026-12-02 꾸미기: 긴 말에서 선반·단추가 커져 방 칸이 낮아지면 냥도사가 위로 올라가 제목판 글자(Trang trí)를 덮던 것(main 부터) → 냥도사 크기를 방 칸 높이에 맞춰 묶는다 */
.h3 .h3-room { container-type: size; }
@media (min-height: 701px) { .h3 .h3-hero.h3-hero { width: min(60vw, 30vh, 250px, 90cqh); } }
.d3-note { text-wrap: balance; }
.tipline { text-wrap: balance; }
html[lang="ja"] .tipline { word-break: auto-phrase; }
/* 2026-12-02 판 위 단계 이름: 긴 이름(Enter the Boss)이 현판 양 끝 장식에 닿던 것 */
.plaque-in { left: 13%; right: 13%; }
/* 2026-12-02 결과 화면: 새 보물 카드가 있을 때 냥도사 말풍선이 카드 이름(보물 도감)을 덮던 것(main 부터) → 말풍선을 카드 왼쪽에 두고, 긴 카드 이름은 두 줄 */
.overlay .panel.r3 .r3-mid:not(.fail):has(.r3-treasure.got) .r3-bubble.bubble { left: -44px !important; right: auto !important; width: max-content !important; max-width: 150px !important; text-wrap: balance; }
.overlay .panel.r3 .r3-mid:not(.fail):has(.r3-treasure.got) .r3-bubble.bubble::after { left: 58%; }
.overlay .panel.r3 .r3-treasure.got b { white-space: normal !important; text-align: center; text-wrap: balance; font-size: 14px; max-width: 100%; }
@media (min-height: 701px) { .overlay .panel.r3 .r3-mid:not(.fail):has(.r3-treasure.got) .r3-bubble.bubble { left: -26px !important; } }

/* 도감 목록이 아래 안내판 뒤로 잘려 글자가 반쯤 보이지 않게, 끝을 부드럽게 흐린다 */
.d3-body { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); }
