/* 냥도사 운빨 디펜스
   밤 마당 디펜스. 냥냥대군과 같은 남보라 밤 톤에, 포인트는 등급 색(흔함 회색, 드묾 파랑, 귀함 보라, 전설 금색, 신화 빨강). */
:root {
  --bg: #15122f;
  --surface: #241e48;
  --surface-2: #2f2860;
  --ink: #f3f0ff;
  --sub: #aaa3d6;
  --line: #3a3270;
  --accent: #ffd23f;
  --accent-ink: #2a1d00;
  --red: #ff5a4e;
  --jade: #6fe3c8;
  --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 > * { 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; }
.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 #b8860b, var(--shadow); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8860b, var(--shadow); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--sub); font-weight: 400; min-height: 44px; }
.actions { display: grid; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 0; color: var(--ink); font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.chip .ico { width: 18px; height: 18px; }
.chip.new { background: var(--accent); color: var(--accent-ink); animation: pop .5s ease-out both .9s; }
.ico { width: 28px; height: 28px; object-fit: contain; flex: none; }
.seg { display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--surface); border-radius: 99px; padding: 4px; box-shadow: var(--shadow); align-self: center; }
.seg-lbl { font-size: 12px; color: var(--sub); padding: 0 6px 0 8px; }
.seg button { border: 0; background: transparent; border-radius: 99px; min-width: 38px; min-height: 34px; font-weight: 700; font-size: 14px; color: var(--sub); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.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; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

/* ---- 살아 있는 마당(시작·결과) */
.result .bubble { animation: pop .4s ease-out .3s both; }
.stamp { position: absolute; right: 5%; top: 8%; border: 4px solid var(--red); color: var(--red); font-family: "Gowun Batang", serif; font-weight: 700; font-size: 20px; padding: 2px 10px; border-radius: 6px; transform: rotate(-10deg); background: rgba(255, 255, 255, .85); animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) .5s both; z-index: 3; }
@keyframes stamp { from { transform: rotate(-10deg) scale(2.4); opacity: 0; } }
.hero-pose { width: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); animation: idle 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes idle { 50% { transform: scaleY(.97) scaleX(1.02); } }
.bubble { position: absolute; left: 4%; top: 5%; max-width: 44%; background: #fff; color: #1d1838; border-radius: 16px 16px 16px 4px; 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.sul { background: #efe6ff; }
.bubble.pop { animation: pop .3s ease-out; }
.hero-title { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.hero-title h1 { font-size: 44px; line-height: 1.05; letter-spacing: -0.01em; 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; }

.res-title { text-align: center; }
.res-title h2 { font-size: 30px; color: var(--accent); animation: pop .5s ease-out .6s both; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { background: var(--surface); border-radius: 14px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; }
.stats b { font-family: var(--game); font-weight: 400; font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; color: var(--sub); }
.earn { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; flex-wrap: wrap; }
.earn b { font-family: var(--game); font-weight: 400; font-size: 22px; color: var(--accent); }
.unlocks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ---- 상점 */
.shop-head { display: flex; align-items: flex-end; gap: 8px; }
.shop-sul { width: 84px; height: 84px; object-fit: contain; flex: none; }
.say { flex: 1; background: var(--surface); border-radius: 18px 18px 18px 6px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; word-break: keep-all; }
.say .who { display: block; font-size: 11px; color: var(--sub); }
.purse { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; }
.purse b { font-family: var(--game); font-weight: 400; font-size: 26px; color: var(--accent); }
.shop-list, .dex-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 16px; padding: 8px 10px; }
.shop-row > .ico { width: 44px; height: 44px; }
.shop-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.pips i.on { background: var(--accent); }
.btn.buy { min-height: 42px; min-width: 76px; padding: 4px 10px; font-family: var(--game); font-weight: 400; font-size: 17px; display: flex; gap: 2px; background: var(--surface-2); }
.btn.buy .ico { width: 20px; height: 20px; }

/* ---- 도감 */
.screen-title { font-size: 26px; text-align: center; }
.dex-grid { grid-template-columns: 1fr 1fr; }
.dex-grid li { display: contents; }
.dex-card { width: 100%; border: 2px solid transparent; color: var(--ink); font: inherit; background: var(--surface); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.dex-card img { width: 72px; height: 72px; object-fit: contain; }
.dex-card.unseen img { filter: brightness(0) opacity(.5); }
.dex-card.on { border-color: var(--accent); }
.dex-grid { grid-template-columns: 1fr 1fr 1fr; }
.dex-card b { font: 15px var(--game); }
.dex-card .cnt { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ---- 판 */
.stage.playing .topbar { display: flex; flex-shrink: 0; }
.stage.playing .screen { padding: 0; }
.play { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #221c40; 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) + 6px) 10px 0; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
.hud-row { display: grid; grid-template-columns: 44px 1fr 92px; align-items: center; }
.hud .pause { pointer-events: auto; width: 40px; height: 40px; background: rgba(0, 0, 0, .45); box-shadow: none; }
.hud .pause svg { width: 18px; height: 18px; }
.where { text-align: center; font: 18px/1.1 var(--game); color: #fff; text-shadow: 0 2px 0 #000a; }
.peak { text-align: right; font: 14px/1.2 var(--game); color: #ffe14a; text-shadow: 0 1px 2px #000; }
.prog { height: 8px; margin: 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .45); overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7cc8ff, #ffe14a); }
.banner { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); white-space: normal; word-break: keep-all; width: calc(100% - 32px); max-width: calc(100% - 32px); text-align: center; font: 24px/1.2 var(--game); color: #fff; text-shadow: 0 3px 0 #000, 0 0 12px #000; pointer-events: none; opacity: 0; }
.banner.high { top: 15%; }
.banner.on { animation: banner 1s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 1; } }
.overlay { position: absolute; inset: 0; background: rgba(10, 8, 30, .72); display: grid; place-items: center; padding: 16px; z-index: 5; backdrop-filter: blur(2px); }
.panel { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; box-shadow: var(--shadow); animation: pop .3s ease-out; }
.panel h2 { font-size: 24px; }
.kicker { font: 16px var(--game); color: var(--accent); }

.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.3333; --crop-top: .3; --crop-cap: min(var(--cap-a, 100000px), var(--cap-b, 100000px), var(--cap-c, 100000px)); }
.screen:has(.game-logo) .hall.orak-crop { --crop-ratio: 1.5; }
.hall.orak-crop .bubble { top: calc(max(0px, 100% - var(--crop-cap)) * var(--crop-top) + 6%); }
.stage.fit1 .hall { --cap-b: 220px; }
.hall .bubble { text-wrap: balance; }
.stage.fit1 .hero-title h1 { font-size: 36px; }
.stage.fit1 .btn { min-height: 46px; }
.stage.fit1 .shop-sul { width: 60px; height: 60px; }
.stage.fit2 .hall { --cap-b: 160px; }
.stage.fit2 .hero-title .lede, .stage.fit2 .screen > .fine { display: none; }
.stage.fit2 .bubble { font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .hall .bg, .motes i, .pull, .hero-pose, .top-unit, .cbtn.ready, .myth-row.can { animation: none !important; }
}

.village-won { text-align: center; background: linear-gradient(90deg, #4a2a10, #7a4a14); border: 2px solid var(--accent); border-radius: 16px; padding: 10px 14px; margin: 0; word-break: keep-all; animation: pop .5s ease-out both .6s; }
.village-won b { color: var(--accent); }
/* 행운 부적 안내 */
.lucky-tip { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; margin: 0; padding: 9px 12px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px dashed rgba(255,255,255,.35); color: inherit; text-decoration: none; font-size: 14px; line-height: 1.4; text-align: center; word-break: keep-all; }
.lucky-tip i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.lucky-tip span { flex-basis: 100%; }
.lucky-tip b { color: var(--accent); }
.lucky-tip u { color: #ffe14a; text-underline-offset: 3px; }
.lucky-tip.known { border-style: solid; }
.lucky-tip.known i { margin-right: 4px; }

/* ---- 마당 그림(시작·결과) */
.hall { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 24px; overflow: hidden; background: #1b1440; box-shadow: var(--shadow); isolation: isolate; flex: none; }
.hall .bg { position: absolute; inset: 0; background: url("sprites/bg-start.webp") center 62% / cover no-repeat, linear-gradient(#1b1440, #563067); }
.hall.result .bg { background-image: url("sprites/bg-yard.webp"); background-position: center 18%; animation: none; }
.hall.lose .bg { filter: saturate(.6) brightness(.7); }
.hall .bg { animation: kenburns 18s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.06) translateY(-1.5%); } }
.motes i { position: absolute; left: calc(6% + var(--i) * 9.5%); bottom: 8%; width: 6px; height: 6px; border-radius: 50%; background: #ffe9a0; box-shadow: 0 0 10px 3px rgba(255, 220, 120, .7); opacity: 0; animation: mote 5.5s ease-in infinite; animation-delay: calc(var(--i) * -.57s); }
.motes i:nth-child(3n) { background: #b9e8ff; box-shadow: 0 0 10px 3px rgba(140, 200, 255, .7); }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(14px, -260%) translateY(-180px); } }
.pull { position: absolute; bottom: 40%; width: 22%; translate: -50% 0; opacity: 0; z-index: 2; pointer-events: none; }
.pull img { position: relative; width: 100%; display: block; filter: drop-shadow(0 0 10px var(--c)) drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.pull .orb { position: absolute; left: 50%; top: 55%; width: 120%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 80%, white) 0%, transparent 65%); }
.pull b { position: absolute; left: 50%; top: -14%; translate: -50% 0; font: 15px/1 var(--game); font-weight: 400; color: #fff; background: var(--c); padding: 3px 8px; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.pull.go { animation: pullin 2s ease-out both; }
.pull.go .orb { animation: orb 2s ease-out both; }
@keyframes pullin { 0% { opacity: 0; transform: translateY(30%) scale(.3); } 15% { opacity: 1; transform: translateY(-12%) scale(1.15); } 25% { transform: translateY(0) scale(1); } 80% { opacity: 1; transform: translateY(-4%); } 100% { opacity: 0; transform: translateY(-14%); } }
@keyframes orb { 0% { transform: scale(0); opacity: 1; } 30% { transform: scale(1.3); opacity: .9; } 100% { transform: scale(.8); opacity: 0; } }
.hero-title h1 { font-size: 38px; }
.hall .bubble { left: auto; right: 4%; top: 6%; max-width: 52%; border-radius: 16px 16px 4px 16px; }
.top-unit { position: absolute; left: 50%; bottom: 2%; width: 44%; translate: -50% 0; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); animation: cheer2 1.1s ease-in-out infinite; transform-origin: 50% 100%; }
.hall.lose .top-unit { animation: none; filter: grayscale(.4) drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.hall.result .bubble { left: 4%; right: auto; border-radius: 16px 16px 16px 4px; }
@keyframes cheer2 { 50% { transform: translateY(-5%) scale(1.03); } }
.btn.primary small { display: block; font-family: var(--body); font-size: 12px; font-weight: 700; opacity: .75; }
.btn.primary { line-height: 1.15; }

/* ---- 오행 점 */
.eld { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #1b1440; font: 700 12px/1 "Gowun Batang", serif; font-style: normal; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.lucky-tip .eld { width: 22px; height: 22px; }
.ico.big { width: 52px; height: 52px; }

/* ---- 도감 */
.dex-h { display: flex; align-items: center; gap: 6px; font-size: 18px; margin-top: 4px; }
.dex-grid.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dex-grid.four .dex-card { padding: 6px 2px; }
.dex-grid.four .dex-card img { width: 56px; height: 56px; }
.dex-grid.four .dex-card b { font-size: 12px; line-height: 1.2; word-break: keep-all; }
.dex-card { border-color: color-mix(in srgb, var(--c, transparent) 60%, transparent); }
.dex-card.unseen { border-color: transparent; }
.dex-card .cnt { color: var(--c, var(--accent)); }

/* ---- 판 */
.stage.playing .screen { gap: 0; padding-bottom: 0; }
.play { background: #1a1830; }
.play.danger::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 60px 10px rgba(255, 50, 50, .55); animation: danger 1s ease-in-out infinite alternate; }
@keyframes danger { from { opacity: .4; } }
.hud-row { grid-template-columns: 44px 1fr 56px; }
.where { font-size: 17px; }
.where span { font-size: 14px; color: #d8d2ff; }
.spd { pointer-events: auto; justify-self: end; width: 52px; height: 40px; border-radius: 12px; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font: 17px/1 var(--game); }
.mobbar, .bossbar { display: flex; align-items: center; gap: 8px; font: 13px/1 var(--game); color: #fff; text-shadow: 0 1px 2px #000; }
.mobbar div, .bossbar div { flex: 1; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .5); overflow: hidden; border: 1.5px solid rgba(255, 255, 255, .7); }
.mobbar i, .bossbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b8f36a, #ffd23f); transition: width .2s; }
.mobbar i.low { background: linear-gradient(90deg, #ff9f6a, #ff3a3a); }
.mobbar b, .bossbar b { min-width: 52px; text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; }
.bossbar[hidden] { display: none; }
.bossbar i { background: linear-gradient(90deg, #ff3a5a, #ff8a4a); width: 100%; }
.bossbar span { color: #ffb0b8; }

/* 고른 병사 */
.sel { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 8px; background: rgba(20, 16, 50, .92); border: 2px solid rgba(255, 255, 255, .25); border-radius: 18px; padding: 8px 10px; z-index: 4; animation: pop .2s ease-out; }
.sel[hidden] { display: none; }
.sel img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.sel-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sel-txt b { font: 17px var(--game); font-weight: 400; }
.sel-txt em { font-style: normal; color: #ffe14a; }
.tier { font-size: 12px; font-weight: 700; color: var(--c); }
.sel-btns { display: flex; flex-direction: column; gap: 6px; }
.btn.mini { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.btn.mini.ghosty { background: var(--surface-2); color: var(--ink); }

/* 아래 조작 버튼 */
.ctrl { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; padding: 8px 10px 4px; background: #15122f; }
.cbtn { position: relative; overflow: hidden; min-height: 64px; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: var(--shadow); touch-action: manipulation; transition: transform .08s; }
.cbtn:active { transform: scale(.95); }
.cbtn b { position: relative; z-index: 1; font: 20px/1 var(--game); font-weight: 400; }
.cbtn small { position: relative; z-index: 1; display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; color: var(--sub); }
.cbtn.summon { background: var(--accent); color: var(--accent-ink); box-shadow: 0 5px 0 #b8860b, var(--shadow); }
.cbtn.summon small { color: #5a4300; font-size: 15px; }
.cbtn.summon b { font-size: 26px; }
.cbtn.summon.off { filter: saturate(.3) brightness(.75); }
.cbtn.fortune i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#b46cff, #6a3ad0); transition: height .2s; }
.cbtn.ready { animation: skillglow .8s ease-in-out infinite alternate; }
.cbtn.myth { background: #3a1e3e; }
.cbtn.myth.ready { background: #a8243a; }
.ctrl .cbtn.myth, .ctrl .cbtn.myth.ready, .ctrl .cbtn.fortune, .ctrl .cbtn.summon { background: none; box-shadow: none; }
@keyframes skillglow { from { box-shadow: 0 0 0 0 rgba(255, 225, 74, .9), var(--shadow); } to { box-shadow: 0 0 0 8px rgba(255, 225, 74, 0), var(--shadow); } }
.coins-line { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px 0 calc(env(safe-area-inset-bottom, 0px) + 8px); background: #15122f; font-size: 14px; }
.coins-line b { font: 22px/1 var(--game); font-weight: 400; color: var(--accent); font-variant-numeric: tabular-nums; }
.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; }
.coin.bok { width: 20px; height: 20px; background: radial-gradient(circle, transparent 3.5px, #ff7a8a 4px, #e0304a 9px); box-shadow: inset 0 0 0 1px #7a0018; }

/* 신화 조합 */
.myth-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.myth-row { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: var(--surface-2); border: 2px solid transparent; border-radius: 14px; padding: 6px 10px; color: var(--ink); font: inherit; }
.myth-row img { width: 48px; height: 48px; object-fit: contain; flex: none; }
.myth-row img.unseen { filter: brightness(0) opacity(.5); }
.myth-row span { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.myth-row b { font: 16px var(--game); font-weight: 400; }
.myth-row small { font-size: 12px; color: var(--sub); }
.myth-row em { font-style: normal; font: 15px var(--game); color: #fff; background: #e8413a; padding: 4px 10px; border-radius: 99px; }
.myth-row:disabled { opacity: .7; }
.myth-row.can { border-color: #ff4a5a; animation: skillglow .8s ease-in-out infinite alternate; }

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

@media (prefers-reduced-motion: reduce) { .pull.go { animation: none !important; opacity: 1; transform: none; } .pull.go .orb { display: none; } }

/* 시작 로고는 원화 비율을 유지한다. */
.game-logo{display:block;width:min(90vw,400px);max-width:100%;height:auto;margin:0 auto;filter:drop-shadow(0 4px 7px #0008)}
/* 긴 번역도 좁은 카드와 소환 말풍선 안에서 줄바꿈한다. */
html:not([lang=ko]) .pull b{max-width:140px;white-space:normal;text-align:center;font-size:12px}
html:not([lang=ko]) :is(.btn,.dex-card b,.myth-row b,.sel-txt){min-width:0;overflow-wrap:anywhere}
html:not([lang=ko]) .purse{flex-wrap:wrap}
html:not([lang=ko]) .res-title h2{font-size:clamp(24px,7vw,30px);overflow-wrap:anywhere}
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}
.screen:has(.game-logo){gap:8px}.screen:has(.game-logo) .hall{aspect-ratio:3/2}.screen:has(.game-logo) .lucky-tip{font-size:12px;padding:6px 10px}

/* 무한 밤 / 기록장 */
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.row3 .btn { padding: 8px 5px; font-size: 13px; overflow-wrap: anywhere; }
.row3 [aria-disabled="true"] { opacity: .55; }
.endless-lock { margin-top: -6px; }
.endless-badge { display: inline-block; border-radius: 8px; background: #554377; padding: 3px 6px; font-size: 10px; margin-right: 5px; }
.dex-header { display: flex; align-items: center; justify-content: space-between; }
.screen:has(> .osc-book) { padding: 0; overflow: hidden; }
.osc-book { flex: 1; min-height: 0; width: 100%; }

.screen:has(.row3) .hall { --cap-a: 20dvh; }
.screen:has(.row3) .game-logo { max-height: 20dvh; width: auto; }

/* Depth rules: tags stay within the original selector row. */
.seg:has(.depth-tag) { width: 100%; border-radius: 16px; gap: 1px; }
.seg:has(.depth-tag) .seg-lbl { display: none; }
.seg:has(.depth-tag) button { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; padding: 3px 1px; }
.depth-tag { display: block; font-size: 10px; line-height: 1.3; font-weight: 400; white-space: nowrap; }
.rule-badge { align-self: center; background: #354961df; color: #edf6ff; border: 1px solid #a8cfdb66; border-radius: 9px; padding: 1px 8px; font-size: 11px; line-height: 1.4; }
.hud:has(.rule-badge) { gap: 4px; }
.fit1 .result-rule, .fit2 .result-rule { display: none; }

.hud:has(.rule-badge) .pause, .hud:has(.rule-badge) .spd { min-width: 44px; min-height: 44px; }
/* 밤의 깊이 줄이 생기면 작은 화면에서 로고를 낮춰 한 화면에 */
.stage.fit2 .screen:has(.seg [data-depth]) .game-logo { max-height: 92px; width: auto; max-width: 100%; }
.stage.fit2 .screen:has(.seg [data-depth]) .lucky-tip { padding: 6px 10px; font-size: 12px; }

/* ===== 3.0 판 화면: 마당이 화면 끝까지, 그 위에 나무 현판과 단추를 얹는다(시안 01·03) ===== */
.stage.playing { position: relative; height: 100dvh; }
.stage.playing .topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 6; background: none; pointer-events: none; }
.stage.playing .topbar > * { pointer-events: auto; }
.stage.playing .screen { flex: 1; height: 100%; }
.stage.playing .play { flex: 1; height: 100%; background: #141a3a; }
/* 위 막대 단추도 시안처럼: 홈은 짙은 나무 판 + 금테, 소리·진동은 둥근 금 단추(크기·글자는 공통 단추 그대로) */
.stage.playing a.orak-home-button:not(.btn):not(.pbtn) { background: linear-gradient(#5c3b22, #3a2313) !important; color: #fff3dc !important; border-color: #d2a352 !important; box-shadow: 0 2px 0 #1d1008, 0 3px 8px #0009 !important; }
.stage.playing button.orak-tool { border-radius: 50% !important; border-color: #9a6512 !important; background: radial-gradient(circle at 40% 32%, #ffe58a, #f6bd2a 60%, #d4920e) !important; box-shadow: 0 2px 0 #7a4c08, 0 3px 8px #0009 !important; }
.stage.playing button.orak-tool.is-off { background: radial-gradient(circle at 40% 32%, #8a8794, #5a5764) !important; border-color: #3a3842 !important; }

.hud { padding: calc(env(safe-area-inset-top, 0px) + 50px) 8px 0; gap: 0; align-items: center; }
.plaque { position: relative; width: min(100%, 352px); aspect-ratio: 900 / 190; background: url(sprites/ui/ui-hud.webp) center / 100% 100% no-repeat; display: grid; grid-template-columns: 17% 1fr 17%; align-items: center; padding: 0 2.5% 1.5%; filter: drop-shadow(0 3px 4px #0009); }
.rbtn { pointer-events: auto; justify-self: center; width: 40px; height: 40px; border: 0; padding: 0; border-radius: 50%; background: url(sprites/ui/btn-round.webp) center / 100% 100% no-repeat; color: #fff3dc; display: grid; place-items: center; font: 17px/1 var(--game); text-shadow: 0 1px 0 #2a1608; }
.rbtn svg { width: 16px; height: 16px; filter: drop-shadow(0 1px 0 #2a1608); }
.rbtn:active { transform: scale(.94); }
.plaque .where { display: flex; align-items: baseline; justify-content: center; gap: 0; min-width: 0; white-space: nowrap; font: 23px/1 var(--game); color: #fff3dc; text-shadow: 0 2px 0 #2a1608, 0 0 6px #0008; }
.plaque .where b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.plaque .where span { font-size: 18px; color: #fff3dc; }
.plaque .where span:not(:empty)::before { content: ""; display: inline-block; width: 2px; height: 18px; margin: 0 10px; background: #c89a4a99; vertical-align: -2px; }
.plaque .endless-badge { font-size: 10px; align-self: center; }
.pills { display: flex; justify-content: center; gap: 10px; margin-top: -6px; width: min(100%, 352px); padding-left: 24px; }
.pills[hidden], .bossplate[hidden] { display: none; }
.pill { position: relative; height: 30px; display: flex; align-items: center; gap: 4px; padding: 0 12px 0 8px; background: url(sprites/ui/pill.webp) center / 100% 100% no-repeat; color: #fff3dc; font: 15px/1 var(--game); text-shadow: 0 1px 0 #2a1608; white-space: nowrap; filter: drop-shadow(0 2px 3px #0009); }
.pill .txt b { font-weight: 400; font-variant-numeric: tabular-nums; }
.pill.mob { padding-left: 30px; min-width: 124px; }
.pill.mob .gourd { position: absolute; left: -16px; top: 50%; width: 40px; height: 52px; transform: translateY(-58%); }
.pill.mob .gourd img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 요괴 수만큼 아래부터 보라 물약이 찬다(병 속 32%~96%) */
.pill.mob .gourd .fill { --p: 0; clip-path: inset(calc(96% - var(--p) * 64%) 0 0 0); transition: clip-path .25s; }
.pill.mob.low .txt b { color: #ff9a8a; }
.pill.wx img { width: 28px; height: 28px; object-fit: contain; margin-left: -4px; }

.bossplate { position: relative; width: min(100% - 40px, 316px); aspect-ratio: 900 / 222; margin-top: -8px; background: url(sprites/ui/boss-plate.webp) center / 100% 100% no-repeat; display: flex; align-items: center; filter: drop-shadow(0 3px 4px #0009); }
.bossplate .face { position: absolute; left: 1.6%; top: 50%; width: 25%; transform: translateY(-50%); }
.bp-main { margin-left: 27%; margin-right: 4%; flex: 1; display: flex; flex-direction: column; gap: 5px; padding-bottom: 2px; }
.bp-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font: 16px/1 var(--game); color: #fff3dc; text-shadow: 0 1px 0 #2a1608; white-space: nowrap; }
.bp-top #bossname { overflow: hidden; text-overflow: ellipsis; }
.bp-t { display: flex; align-items: center; gap: 2px; font-size: 17px; }
.bp-t img { width: 16px; height: 20px; object-fit: contain; }
.bp-t b { font-weight: 400; font-variant-numeric: tabular-nums; }
.bp-bar { height: 12px; border-radius: 99px; background: #2a160c; box-shadow: inset 0 1px 2px #000; overflow: hidden; }
.bp-bar i { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(#ff6a5a, #d0202a); box-shadow: inset 0 2px 0 #ffffff40; transition: width .2s; }

/* 아래 단추: 나무 받침 위 점괘 통 · 금빛 엽전 · 봉인 두루마리 */
.stage.playing .ctrl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: calc(env(safe-area-inset-bottom, 0px) + 176px); display: block; padding: 0; background: none; pointer-events: none; }
.ctrl .stand { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) - 12px); width: min(108%, 470px); transform: translateX(-50%); pointer-events: none; filter: drop-shadow(0 -2px 6px #0007); }
.ctrl .cbtn { position: absolute; pointer-events: auto; background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; border-radius: 0; overflow: visible; color: #fff3dc; touch-action: manipulation; animation: none; }
.ctrl .cbtn:active { transform: scale(.95); }
.ctrl .cbtn img { display: block; pointer-events: none; }
.ctrl .fortune, .ctrl .myth { bottom: calc(env(safe-area-inset-bottom, 0px) + 36px); width: 26%; max-width: 112px; height: 130px; }
.ctrl .fortune { left: max(2%, 50% - 190px); }
.ctrl .myth { right: max(2%, 50% - 190px); }
.ctrl .art { position: absolute; left: 50%; bottom: 34px; width: 74px; height: 90px; transform: translateX(-50%); }
.ctrl .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.ctrl .fortune .fill { --p: 0; clip-path: inset(calc(100% - var(--p) * 100%) 0 0 0); transition: clip-path .25s; }
.ctrl .myth .art { width: 84px; }
.ctrl .myth .glow { opacity: 0; transition: opacity .2s; }
.ctrl .myth.ready .glow { opacity: 1; animation: mythglow .9s ease-in-out infinite alternate; }
@keyframes mythglow { from { filter: brightness(1); } to { filter: brightness(1.2) drop-shadow(0 0 8px #ffd23f); } }
.ctrl .fortune.ready .art { animation: mythglow .9s ease-in-out infinite alternate; }
.ctrl .lbl { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: url(sprites/ui/label-purple.webp) center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; filter: drop-shadow(0 2px 3px #0009); }
.ctrl .lbl b { white-space: nowrap; display: inline-block; font: 20px/1 var(--game); font-weight: 400; color: #fff3dc; text-shadow: 0 2px 0 #2a1030; }
.ctrl .lbl small { white-space: nowrap; display: inline-block; font: 13px/1 var(--game); color: #ffd23f; text-shadow: 0 1px 0 #2a1030; }
.ctrl .lbl small:empty { display: none; }
.ctrl .summon { left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); width: 124px; height: 124px; margin-left: -62px; display: block; }
.ctrl .summon > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px #0009); }
.ctrl .summon .off, .ctrl .summon.off .on { display: none; }
.ctrl .summon.off .off { display: block; }
.ctrl .summon b { position: absolute; left: 0; right: 0; top: 17%; text-align: center; font: 29px/1 var(--game); font-weight: 400; color: #5a2c06; text-shadow: 0 1px 0 #fff3b0; }
.ctrl .summon .cost { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); height: 26px; min-width: 64px; padding: 0 10px 0 6px; border-radius: 99px; background: linear-gradient(#fff6da, #f1dcaa); box-shadow: inset 0 0 0 2px #c9952c, 0 1px 2px #0006; display: flex; align-items: center; justify-content: center; gap: 4px; font: 18px/1 var(--game); color: #4a2a08; }
.ctrl .summon .cost img { width: 17px; height: 17px; }
.ctrl .summon.off b, .ctrl .summon.off .cost { color: #4a4a4a; text-shadow: none; }
.stage.playing .coins-line { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); transform: translateX(-50%); z-index: 1; height: 34px; min-width: 132px; padding: 0 16px 0 10px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 5px; background: url(sprites/ui/pill.webp) center / 100% 100% no-repeat; font: 15px/1 var(--game); color: #fff3dc; text-shadow: 0 1px 0 #2a1608; filter: drop-shadow(0 2px 3px #0009); white-space: nowrap; }
.stage.playing .coins-line img { width: 22px; height: 22px; }
.stage.playing .coins-line b { font: 22px/1 var(--game); color: #ffd23f; }
.stage.playing .sel { bottom: calc(env(safe-area-inset-bottom, 0px) + 182px); }
@media (max-height: 700px) {
  .stage.playing .ctrl { height: calc(env(safe-area-inset-bottom, 0px) + 150px); }
  .ctrl .fortune, .ctrl .myth { height: 112px; bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); }
  .ctrl .art { width: 62px; height: 74px; bottom: 30px; }
  .ctrl .myth .art { width: 70px; }
  .ctrl .lbl { height: 38px; } .ctrl .lbl b { font-size: 18px; }
  .ctrl .summon { width: 108px; height: 108px; margin-left: -54px; bottom: calc(env(safe-area-inset-bottom, 0px) + 34px); }
  .ctrl .summon b { font-size: 25px; }
  .stage.playing .coins-line { height: 30px; bottom: calc(env(safe-area-inset-bottom, 0px) + 3px); }
  .stage.playing .sel { bottom: calc(env(safe-area-inset-bottom, 0px) + 156px); }
}

/* 두목 등장: 붉은 비단 띠(왼쪽 메달에 두목 얼굴) + 오른쪽 위 냥도사 외침 */
.boss-intro { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.boss-intro.out { animation: biout .35s ease-in forwards; }
@keyframes biout { to { opacity: 0; } }
.bi-ribbon { position: absolute; left: 50%; top: 50%; width: min(120%, 540px); aspect-ratio: 900 / 165; transform: translate(-50%, -50%); animation: biin .45s cubic-bezier(.2, 1.4, .4, 1) both; filter: drop-shadow(0 6px 10px #000a); }
@keyframes biin { from { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.bi-ribbon .rib { position: absolute; inset: 0; width: 100%; height: 100%; }
.bi-ribbon .face { position: absolute; left: 13%; top: 50%; width: 30%; transform: translate(-50%, -52%); filter: drop-shadow(0 3px 5px #0009); }
.bi-txt { position: absolute; left: 27%; right: 9%; top: 15%; bottom: 20%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.bi-txt b { font: 28px/1.05 var(--game); font-weight: 400; color: #fff; -webkit-text-stroke: 1.5px #4a0a0a; paint-order: stroke fill; text-shadow: 0 3px 0 #4a0a0a; max-width: 100%; overflow-wrap: anywhere; }
.bi-txt small { font: 15px/1.1 var(--game); color: #fff3dc; background: #4a1a10cc; border-radius: 99px; padding: 3px 12px; }
.bi-dosa { position: absolute; right: 0; top: 27%; width: 124px; animation: dosain .4s .15s ease-out both; }
@keyframes dosain { from { transform: translateX(60px); opacity: 0; } }
.bi-dosa img { display: block; width: 100%; filter: drop-shadow(0 4px 6px #0009); }
.bi-dosa .bi-bubble { position: absolute; right: 74%; top: -26%; width: 118px; margin: 0; padding: 8px 10px; border-radius: 18px; background: #fffaf0; color: #2a1608; font: 14px/1.25 var(--game); text-align: center; word-break: keep-all; box-shadow: 0 0 0 2px #2a1608, 0 4px 8px #0008; }
.bi-dosa .bi-bubble::after { content: ""; position: absolute; right: 8px; bottom: -9px; border: 8px solid transparent; border-top-color: #fffaf0; border-bottom: 0; filter: drop-shadow(0 2px 0 #2a1608); }

/* 냥도사의 점괘(시안 04): 한지 두루마리 위 대나무 패 세 장, 고른 패는 금빛 */
.overlay.fortune-ov { background: rgba(10, 8, 30, .45); backdrop-filter: none; padding: 8px; align-content: end; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px); }
.fortune-pick { position: relative; width: min(100%, 372px); animation: pop .3s ease-out; }
.fp-dosa { position: relative; height: 128px; }
.fp-dosa img { position: absolute; left: 6%; bottom: -26px; width: 150px; filter: drop-shadow(0 4px 6px #0009); z-index: 1; }
.fp-dosa .bi-bubble { position: absolute; right: 2%; top: 8px; width: auto; max-width: 52%; margin: 0; padding: 10px 14px; border-radius: 22px; background: #fffaf0; color: #2a1608; font: 16px/1.3 var(--game); text-align: center; word-break: keep-all; box-shadow: 0 0 0 2px #2a1608, 0 4px 8px #0008; }
.fp-dosa .bi-bubble::after { content: ""; position: absolute; left: 14px; bottom: -9px; border: 8px solid transparent; border-top-color: #fffaf0; border-bottom: 0; }
.fp-scroll { position: relative; aspect-ratio: 620 / 555; background: url(sprites/ui/scroll-fortune.webp) center / 100% 100% no-repeat; padding: 8% 7% 7%; display: flex; flex-direction: column; align-items: center; gap: 6px; filter: drop-shadow(0 8px 14px #000a); }
.fp-scroll h2 { margin: 0; font: 24px/1.1 var(--game); font-weight: 400; color: #3a1d0c; }
.fp-cards { flex: 1; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-height: 0; }
.fp-card { position: relative; border: 0; padding: 22% 6px 18%; background: var(--card) center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; color: #3a1d0c; text-align: center; transition: transform .15s, filter .15s; touch-action: manipulation; }
.fp-card img { width: 46%; aspect-ratio: 1; object-fit: contain; }
.fp-card b { font: 16px/1.15 var(--game); font-weight: 400; word-break: keep-all; overflow-wrap: anywhere; }
.fp-card small { font: 12px/1.3 var(--body, sans-serif); font-weight: 700; color: #5a3a1c; word-break: keep-all; overflow-wrap: anywhere; border-top: 1.5px solid #c89a4a88; padding-top: 4px; }
.fp-card.on { transform: scale(1.06); filter: drop-shadow(0 0 8px #ffd23f) drop-shadow(0 0 3px #ffb000) brightness(1.06); }
.fp-go { width: 76%; aspect-ratio: 720 / 170; border: 0; background: url(sprites/ui/btn-gold.webp) center / 100% 100% no-repeat; font: 24px/1 var(--game); color: #4a2606; text-shadow: 0 1px 0 #fff3b0; touch-action: manipulation; }
.fp-go:disabled { filter: grayscale(.7) brightness(.85); }
.fp-go:not(:disabled):active { transform: scale(.96); }
@media (max-height: 700px) { .fp-dosa { height: 92px; } .fp-dosa img { width: 112px; } .overlay.fortune-ov { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); } .fp-card small { font-size: 11px; } }

/* 3.0 글자-판 맞춤(그림에서 잰 판 안쪽 기준) */
/* 위 현판: 나무 판 안쪽 y 28~122 / 190 → 가운데 39.5% */
.plaque { padding: 0 2.5% 4.4%; }
.plaque .where b { overflow: visible; line-height: 1.25; }
/* 두목 판: 고리 가운데 (13.3%, 49.5%) 지름 19%, 이름 칸 y 13~53%, 막대 홈 x 23.7~94.4% y 55~79% */
.bossplate .face { left: 13.3%; top: 49.5%; width: 19%; transform: translate(-50%, -50%); }
.bossplate .bp-main { position: absolute; inset: 0; margin: 0; padding: 0; display: block; }
.bossplate .bp-top { position: absolute; left: 26%; right: 7.5%; top: 13%; height: 40%; }
.bossplate .bp-bar { position: absolute; left: 24.4%; right: 6.3%; top: 56.5%; height: 20%; padding: 2px 3px; background: #1a0c06; box-shadow: none; }
.bossplate .bp-bar i { border-radius: 99px; }
/* 등장 띠: 고리 가운데 (20.2%, 47.6%) 지름 16%, 붉은 띠 글자 칸 x 30~89% y 24~79% */
.bi-ribbon { width: min(118%, 540px); }
.bi-ribbon .face { left: 20.2%; top: 47.6%; width: 16.4%; transform: translate(-50%, -50%); }
.bi-txt { left: 30%; right: 11%; top: 24%; bottom: 21%; gap: 1px; }
.bi-txt b { font-size: 25px; line-height: 1.15; white-space: nowrap; display: inline-block; }
.bi-txt small { font-size: 13px; line-height: 1.15; background: none; padding: 0; color: #ffe9a8; text-shadow: 0 1px 0 #4a0a0a; white-space: nowrap; display: inline-block; }
.bossplate .bp-top #bossname { display: block; flex: 1 1 auto; min-width: 0; overflow: visible; text-overflow: clip; }
.bossplate .bp-t { flex: 0 0 auto; }
.fp-card { overflow: hidden; }
.fp-card img { flex: 0 0 auto; height: auto; }
.fp-card small { overflow-wrap: normal; word-break: keep-all; hyphens: auto; }
/* 작은 글은 오른쪽 아래 구름 장식(x 74% 부터) 왼쪽에서 가운데 */
.bi-txt small { align-self: stretch; margin-right: 22%; text-align: center; }
.bi-dosa .bi-bubble { width: 132px; }
/* 그림이 늦게 와도 크기가 정해져 있게(말풍선 자리 계산용) */
.bi-dosa img { aspect-ratio: 451 / 420; height: auto; }
.fp-dosa img { aspect-ratio: 449 / 420; }
/* 시안 03: 굵은 테두리 큰 제목, '등장!'은 노란색 */
.bi-txt b { font-size: 29px; -webkit-text-stroke: 5px #4a0a0a; text-shadow: 0 3px 0 #4a0a0a; letter-spacing: -0.01em; }
.bi-txt b em { font-style: normal; color: #ffe14a; }
.bi-txt small { font-size: 14px; -webkit-text-stroke: 3px #4a0a0a; paint-order: stroke fill; color: #fff3dc; }
/* 일본어·중국어는 띄어쓰기가 없어 keep-all이면 줄이 안 바뀐다 */
html:not([lang="ko"]) .fp-card small, html:not([lang="ko"]) .fp-card b { word-break: normal; overflow-wrap: anywhere; line-break: strict; }
html:lang(ko) .fp-card small { word-break: keep-all; }
.fp-scroll h2 { white-space: nowrap; display: inline-block; }
.pill { padding-right: 15px; }
.pill.mob { padding-left: 33px; }
html:not([lang="ko"]) .bi-bubble { word-break: normal; overflow-wrap: anywhere; line-break: strict; }
/* 패 제목은 낱말 가운데서 자르지 않는다(넘치면 글자를 줄임) */
html:not([lang="ko"]) .fp-card b { overflow-wrap: normal; hyphens: manual; }
/* 시안 03처럼 띠를 두껍게: 띠 그림만 세로로 1.3배, 메달은 둥근 채로 크게(늘어난 고리를 덮음) */
.bi-ribbon { aspect-ratio: 900 / 215; }
.bi-ribbon .face { width: 21.5%; }
.bi-txt b { font-size: 32px; }
.bi-txt small { font-size: 16px; }

/* ===== 3.0 알림·안내·창 (Q1~Q6) ===== */
/* 알림: 한지 띠(900x210). 종이 안쪽 가로 9~91%, 세로 14~76% → 글자 가운데 y 45% */
.stage.playing .banner { top: 150px; width: min(94%, 372px); max-width: none; aspect-ratio: 900 / 210; transform: translate(-50%, 0); background: url(sprites/ui/strip-hanji.webp) center / 100% 100% no-repeat; display: flex; align-items: center; justify-content: center; padding: 0 9% 2.3%; color: #3a1d0c; text-shadow: none; font: 19px/1.2 var(--game); filter: drop-shadow(0 4px 6px #0008); z-index: 3; }
.stage.playing .banner span { display: block; max-width: 100%; text-align: center; word-break: keep-all; overflow-wrap: normal; }
html:not([lang="ko"]) .stage.playing .banner span { word-break: normal; overflow-wrap: anywhere; line-break: strict; }
.stage.playing .banner.high { top: 150px; }
.stage.playing .banner.on { animation: banner3 .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes banner3 { from { opacity: 0; transform: translate(-50%, -8px) scale(.85); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.stage.playing .banner:not(.on) { opacity: 0; transition: opacity .25s; }

/* 안내 쪽지: 한지 쪽지(600x202). 안쪽 가로 12~88%, 세로 18~82% */
.gtoast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); z-index: 20; width: min(86vw, 320px); aspect-ratio: 600 / 202; transform: translateX(-50%); background: url(sprites/ui/note-hanji.webp) center / 100% 100% no-repeat; display: flex; align-items: center; justify-content: center; padding: 0 12%; color: #3a1d0c; font: 16px/1.25 var(--game); text-align: center; pointer-events: none; filter: drop-shadow(0 4px 8px #0009); animation: gtin .25s ease-out both; }
.gtoast span { display: block; max-width: 100%; word-break: keep-all; }
html:not([lang="ko"]) .gtoast span { word-break: normal; overflow-wrap: anywhere; line-break: strict; }
.gtoast.in-play { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 184px); width: min(84%, 300px); }
.gtoast.out { opacity: 0; transition: opacity .35s; }
@keyframes gtin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 두루마리 창: scroll-fortune(620x555)을 위 170·좌우 70·아래 110px만 그대로 두고 가운데 종이를 늘린다 */
.pscroll { --w: min(100vw - 24px, 372px); position: relative; width: var(--w); box-sizing: border-box; border-style: solid; border-color: transparent; border-width: calc(var(--w) * 150 / 620) calc(var(--w) * 64 / 620) calc(var(--w) * 104 / 620); border-image: url(sprites/ui/scroll-fortune.webp) 150 64 104 64 fill stretch; filter: drop-shadow(0 8px 14px #000a); animation: pop .3s ease-out; color: #3a1d0c; text-align: center; }
/* 제목: 위 띠 가운데(y 92/555), 두 구름(x 15~28%, 72~85%) 사이 */
.pscroll .ps-title { position: absolute; left: calc(var(--w) * (176 - 64) / 620); right: calc(var(--w) * (176 - 64) / 620); top: calc(var(--w) * (92 - 150) / 620); transform: translateY(-50%); margin: 0; display: flex; justify-content: center; font: 22px/1.15 var(--game); font-weight: 400; color: #3a1d0c; }
.pscroll .ps-title span { white-space: nowrap; display: inline-block; }
.pscroll .ps-body { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 4px 2px; }
.pscroll .ps-big { margin: 0; font: 28px/1.1 var(--game); }
.pscroll .ps-sub { margin: 0; font: 14px/1.35 var(--body, sans-serif); font-weight: 700; color: #6a4520; word-break: keep-all; }
.pscroll a.pbtn, .pscroll button.pbtn, .pscroll a.pbtn.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; width: 80%; aspect-ratio: 560 / 128; margin: 0; padding: 0 19%; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: url(sprites/ui/btn-wood.webp) center / 100% 100% no-repeat !important; color: #fff3dc !important; font: 19px/1 var(--game); text-shadow: 0 2px 0 #2a1608; text-decoration: none; white-space: nowrap; touch-action: manipulation; min-height: 0; }
.pscroll .pbtn.gold { aspect-ratio: 720 / 170; width: 86%; padding: 0 15%; background-image: url(sprites/ui/btn-gold.webp) !important; color: #4a2606 !important; text-shadow: 0 1px 0 #fff3b0; font-size: 23px; }
.pscroll .pbtn svg { width: 18px; height: 18px; flex: none; }
.pscroll .pbtn:active { transform: scale(.96); }
/* 신화 줄: row-card(700x170) 왼쪽 고리(가운데 x 13.5%, 지름 18%)에 그림, 글은 x 26~95% */
.pscroll .myth-list { width: 100%; max-height: min(48vh, 340px); gap: 6px; padding: 2px; }
.pscroll .myth-row { position: relative; aspect-ratio: 700 / 170; padding: 0 5% 0 26%; border: 0; border-radius: 0; background: url(sprites/ui/row-card.webp) center / 100% 100% no-repeat; color: #3a1d0c; gap: 6px; }
.pscroll .myth-row img { position: absolute; left: 13.5%; top: 50%; width: 15%; height: auto; aspect-ratio: 1; transform: translate(-50%, -50%); }
.pscroll .myth-row img.unseen { filter: brightness(0) opacity(.35); }
.pscroll .myth-row b { font-size: 16px; color: #3a1d0c; }
.pscroll .myth-row small { color: #6a4520; font-weight: 700; font-size: 12px; }
.pscroll .myth-row:disabled { opacity: 1; }
.pscroll .myth-row:disabled span { opacity: .8; }
.pscroll .myth-row.can { border: 0; filter: drop-shadow(0 0 6px #ffd23f); animation: none; }
.pscroll .myth-row em { font-size: 14px; background: #c8202a; color: #fff3dc; padding: 4px 9px; }
.ctrl .summon > b { left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; }
.stage.playing .banner { line-height: 1.12; }
/* 사이트 공통 확인 창(Orak.ask)도 이 게임에선 한지 + 현판 단추로 */
body > [role=dialog][aria-modal] > div { background: #fbefd5 !important; border: 4px solid #7a3f9a !important; border-radius: 18px !important; box-shadow: 0 0 0 2px #e8b34a, 0 10px 40px #000a !important; color: #3a1d0c !important; font-family: var(--game) !important; text-align: center; }
body > [role=dialog][aria-modal] > div > p { font: 17px/1.4 var(--game) !important; }
body > [role=dialog][aria-modal] > div > div { flex-direction: column !important; align-items: center; gap: 6px !important; }
body > [role=dialog][aria-modal] > div > div > button { flex: none !important; width: 84% !important; aspect-ratio: 560 / 128; min-height: 0 !important; border-radius: 0 !important; background: url(sprites/ui/btn-wood.webp) center / 100% 100% no-repeat !important; color: #fff3dc !important; font: 18px/1 var(--game) !important; text-shadow: 0 2px 0 #2a1608; }
body > [role=dialog][aria-modal] > div > div > button:first-child { width: 90% !important; aspect-ratio: 720 / 170; background-image: url(sprites/ui/btn-gold.webp) !important; color: #4a2606 !important; text-shadow: 0 1px 0 #fff3b0; font-size: 20px !important; }
/* 사이트 알림(새 오락기·도전 과제)이 홈·소리 단추나 아래 단추를 덮지 않게: 위 단추 줄 아래로 */
.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) !important; }
/* 두 줄일 때 한 낱말만 아래로 떨어지지 않게 줄 길이를 고르게 */
.stage.playing .banner span, .gtoast span, .bi-bubble, .fp-card small, .ps-sub, .bi-txt small { text-wrap: balance; }

/* ================================================================ 3.0 그림 화면(시작·수련·도감·결과) */
.stage.v3 { position: relative; }
.stage.v3 .topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 6; background: none; pointer-events: none; }
.stage.v3 .topbar > * { pointer-events: auto; }
.stage.v3 a.orak-home-button:not(.btn):not(.pbtn) { background: linear-gradient(#5c3b22, #3a2313) !important; color: #fff3dc !important; border-color: #d2a352 !important; box-shadow: 0 2px 0 #1d1008, 0 3px 8px #0006 !important; }
.stage.v3 button.orak-tool { border-radius: 50% !important; border-color: #9a6512 !important; background: radial-gradient(circle at 40% 32%, #ffe58a, #f6bd2a 60%, #d4920e) !important; box-shadow: 0 2px 0 #7a4c08, 0 3px 8px #0006 !important; color: #3b2208 !important; }
.stage.v3 button.orak-tool.is-off { background: radial-gradient(circle at 40% 32%, #8a8794, #5a5764) !important; border-color: #3a3842 !important; }
.stage.v3 .screen { padding: 0; gap: 0; }
.v3s { position: relative; display: flex; flex-direction: column; min-height: 100%; }
/* 그림 판: 배경은 판 그림 통째로, 글자는 잰 안쪽 칸(.in) 가운데 */
.plate { position: relative; display: block; border: 0; padding: 0; margin: 0 auto; background: center / 100% 100% no-repeat; color: #fff3dc; font-family: var(--game); text-decoration: none; -webkit-tap-highlight-color: transparent; }
button.plate:active, a.plate:active { transform: translateY(2px) scale(.985); }
.plate .in { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.12; overflow: visible; }
.plate .in b { font-weight: 400; white-space: normal; text-wrap: balance; word-break: keep-all; overflow-wrap: normal; line-height: 1.05; }
html:not([lang="ko"]) .plate .in b { word-break: normal; }
.plate .in small { font-family: var(--body); font-weight: 700; font-size: .5em; white-space: normal; text-wrap: balance; word-break: keep-all; overflow-wrap: normal; }
html:not([lang="ko"]) .plate .in small, html:not([lang="ko"]) .plate .in > span { word-break: normal; overflow-wrap: normal; }
.plate[aria-disabled="true"] { filter: grayscale(.55) brightness(.8); }

/* 시작 */
.st { background: #24150c url(sprites/bg-wood.webp) center top / 100% auto no-repeat; }
.st-scene { position: relative; height: clamp(250px, 37dvh, 330px); overflow: hidden; flex: none; isolation: isolate; }
.st-bg { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; transform: translateY(21%); z-index: -1; }
.st-scene::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: linear-gradient(transparent, #24150c); }
.st .st-logo { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 8px); width: min(58%, 250px); transform: translateX(-50%); margin: 0; line-height: 0; z-index: 2; }
.st .st-logo .game-logo { width: 100%; height: auto; filter: drop-shadow(0 4px 6px #0008); }
.st-panel { position: relative; display: flex; flex-direction: column; gap: 7px; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 14px); margin-top: -10px; z-index: 1; }
.p-start { width: min(82%, 320px); aspect-ratio: 760 / 240; background-image: url(sprites/ui/btn-start.webp); color: #4a2306; font-size: 34px; filter: drop-shadow(0 4px 6px #000a); }
.p-start .in { left: 16%; right: 16%; top: 17%; bottom: 20%; }
.p-start .in b { text-shadow: 0 1px 0 #fff6c8; }
.p-start .in small { color: #6b3a10; font-size: .44em; }
.st-depth { position: relative; height: 138px; flex: none; }
.st-rope { position: absolute; left: 1%; width: 98%; top: 6px; height: auto; pointer-events: none; }
.p-sign { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 112px; aspect-ratio: 360 / 145; background-image: url(sprites/ui/sign-small.webp); font-size: 14px; z-index: 2; }
.p-sign .in { left: 22%; right: 22%; top: 18%; bottom: 20%; }
.lanterns { position: absolute; left: 11%; right: 11%; top: 24px; bottom: 0; isolation: isolate; display: grid; grid-template-columns: repeat(5, 1fr); align-items: start; }
.lan { position: relative; border: 0; background: none; padding: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; -webkit-tap-highlight-color: transparent; }
.lan-img { width: 46px; height: auto; aspect-ratio: 160 / 276; filter: drop-shadow(0 3px 4px #0009); transition: transform .15s; }
.lan b { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); font: 22px/1 var(--game); color: #6a2c00; text-shadow: 0 1px 0 #fff4b0; }
.lan-wx { width: 26px; height: 26px; margin-top: 2px; filter: drop-shadow(0 1px 2px #000a); }
.lan.on::before { content: ""; position: absolute; left: 50%; top: 40px; width: 136px; height: 136px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #fff6b0 0, #ffe066 24%, #ffc22acc 38%, #ffae0066 52%, transparent 70%); z-index: -1; animation: langlow 2.2s ease-in-out infinite alternate; }
.lan.on .lan-img { transform: scale(1.12); }
.lan[aria-disabled="true"] .lan-wx { opacity: .55; }
.lan[aria-disabled="true"] b { color: #d9d6e2; text-shadow: 0 1px 0 #2a2733; font-size: 19px; top: 27px; }
@keyframes langlow { from { opacity: .75; } to { opacity: 1; } }
.p-red { width: min(80%, 312px); aspect-ratio: 760 / 228; background-image: url(sprites/ui/btn-red.webp); font-size: 25px; filter: drop-shadow(0 4px 6px #000a); }
.p-red .in { left: 20.5%; right: 20.5%; top: 17%; bottom: 20%; } /* 양쪽 부적 그림(그림 폭의 4.6~19%, 81~96%)과 글이 겹치던 것 → 부적 안쪽부터 */
.p-red .in b { text-shadow: 0 2px 0 #5c0a06; }
.p-red .in small { color: #ffe3b8; font-size: .48em; }
.p-red.hot:not([aria-disabled="true"]) { animation: redpulse 1.8s ease-in-out infinite; }
@keyframes redpulse { 50% { filter: drop-shadow(0 0 10px #ffcf5a) drop-shadow(0 4px 6px #000a); } }
.st-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.p-plank { width: 100%; aspect-ratio: 420 / 221; background-image: url(sprites/ui/btn-plank.webp); font-size: 15px; filter: drop-shadow(0 3px 4px #0009); }
.p-plank .in { left: 10%; right: 10%; top: 18%; bottom: 20%; flex-direction: row; gap: .2em; }
.p-plank .in img { width: 1.35em; height: auto; flex: none; }
.p-plank .in b { text-shadow: 0 1px 0 #2a1608; }
.p-plank.locked { filter: grayscale(.6) brightness(.75) drop-shadow(0 3px 4px #0009); }
.st-fine { margin: -2px 0 0; text-align: center; font-size: 12px; color: #e9cf9f; }
.p-lucky { width: 100%; aspect-ratio: 900 / 210; background-image: url(sprites/ui/strip-hanji.webp); color: #3e2a12; font-family: var(--body); font-weight: 700; font-size: 13px; }
.p-lucky .in { left: 11%; right: 10%; top: 16%; bottom: 26%; flex-direction: row; gap: .45em; justify-content: flex-start; text-align: left; line-height: 1.25; }
.p-lucky .in img { width: 2.1em; height: auto; flex: none; }
.p-lucky .in > span { text-wrap: balance; word-break: keep-all; }
.p-note { width: 100%; aspect-ratio: 900 / 210; background-image: url(sprites/ui/strip-hanji.webp); color: #3e2a12; font-family: var(--body); font-weight: 700; font-size: 14px; }
.p-note .in { left: 11%; right: 11%; top: 16%; bottom: 26%; }
.stage.fit1 .st-scene { height: clamp(220px, 32dvh, 300px); }
.stage.fit2 .st-scene { height: 200px; }
.stage.fit2 .st .st-logo { width: min(50%, 200px); }
@media (prefers-reduced-motion: reduce) { .lan.on::before, .p-red.hot { animation: none !important; } }

/* 오행 수련 */
.stage[data-v3="train"] { background: #6b4a2a url(sprites/bg-train.webp) center top / cover no-repeat; }
.tr { padding: calc(env(safe-area-inset-top, 0px) + 62px) 14px calc(env(safe-area-inset-bottom, 0px) + 12px); gap: 6px; }
.p-title { width: min(60%, 250px); aspect-ratio: 760 / 253; background-image: url(sprites/ui/plaque-title.webp); font-size: 26px; color: #ffe7b0; filter: drop-shadow(0 4px 6px #0009); flex: none; }
.p-title .in { left: 22%; right: 22%; top: 20%; bottom: 25%; }
.p-title .in { text-shadow: 0 2px 0 #2a1406; line-height: 1.05; text-wrap: balance; }
.tr-info { display: flex; align-items: center; gap: 4px; margin-bottom: clamp(40px, 8dvh, 66px); }
.p-light { flex: 1; min-width: 0; aspect-ratio: 600 / 192; max-height: 58px; background-image: url(sprites/ui/btn-light.webp); color: #4a3012; font-family: var(--body); font-weight: 700; font-size: 13px; margin: 0; }
.p-light .in { left: 12%; right: 12%; top: 18%; bottom: 20%; }
.tr-purse { position: relative; flex: none; width: 112px; height: 52px; margin: 0; }
.tr-purse > img { position: absolute; left: -4px; top: -2px; width: 50px; height: auto; z-index: 2; filter: drop-shadow(0 2px 3px #0008); }
.p-sign2 { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 92px; aspect-ratio: 420 / 221; background-image: url(sprites/ui/btn-plank.webp); font-size: 17px; }
.p-sign2 .in { left: 24%; right: 9%; top: 18%; bottom: 20%; line-height: 1.05; }
.p-sign2 .in small { font-family: var(--game); font-weight: 400; font-size: .62em; color: #f3d9a4; }
.p-sign2 .in b { color: #ffe066; text-shadow: 0 1px 0 #2a1406; }
.tr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.p-train { width: 100%; aspect-ratio: 900 / 226; background-image: url(sprites/ui/train-card.webp); filter: drop-shadow(0 3px 5px #0008); }
.tr-flag { position: absolute; left: -.5%; top: -4%; height: 106%; width: auto; aspect-ratio: 160 / 292; }
.tr-unit { position: absolute; left: 3%; bottom: 4%; height: 88%; width: auto; filter: drop-shadow(0 2px 2px #0007); }
.tr-txt { left: 22%; right: 29%; top: 12%; bottom: 14%; color: #4a3218; font-size: 17px; gap: .12em; }
.tr-txt b { color: var(--ink); font-family: var(--game); line-height: 1.05; }
.plate .tr-txt small { font-size: .64em; color: #5c4428; }
.tr .pips { display: flex; gap: 2px; justify-content: center; margin: 0; }
.tr .pips i { display: block; width: .78em; height: .78em; border: 0; border-radius: 50%; transform: none; background: url(sprites/ui/pip-off.webp) center / 100% 100%; box-shadow: none; flex: none; }
.tr .pips i.on { background-image: url(sprites/ui/pip-on.webp); }
.p-purse { position: absolute; right: 3%; top: 0; bottom: 0; margin: auto 0; width: 25%; height: auto; aspect-ratio: 360 / 159; background-image: url(sprites/ui/btn-purse.webp); font-size: 18px; color: #fff3dc; }
.p-purse .in { left: 38%; right: 8%; top: 26%; bottom: 20%; }
.p-purse .in { text-shadow: 0 1px 0 #2c0b38; white-space: nowrap; font-size: 1.1em; }
.p-back { width: min(52%, 210px); aspect-ratio: 560 / 128; background-image: url(sprites/ui/btn-wood.webp); margin-top: 6px; font-size: 18px; flex: none; }
.p-back .in { left: 18%; right: 18%; top: 16%; bottom: 18%; }
.p-back .in { flex-direction: row; gap: .3em; }
.p-back .arr { width: .9em; height: .9em; flex: none; background: #fff3dc; clip-path: polygon(0 50%, 55% 0, 55% 32%, 100% 32%, 100% 68%, 55% 68%, 55% 100%); }

/* 도감 */
.stage[data-v3="dex"] { background: #3a2312 url(sprites/bg-dex.webp) center top / cover no-repeat; }
.dx { padding-left: 6px !important; padding-right: 6px !important; padding: calc(env(safe-area-inset-top, 0px) + 62px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px); gap: 4px; }
.dx-head { display: flex; justify-content: center; align-items: center; gap: 6px; margin-bottom: -4px; z-index: 1; }
.p-book { width: 92px; aspect-ratio: 420 / 221; margin: 0; font-size: 14px; flex: none; }
.p-count { width: min(52%, 200px); aspect-ratio: 600 / 192; background-image: url(sprites/ui/btn-light.webp); color: #4a3012; font-size: 15px; flex: none; margin: 0; }
.p-count .in { left: 12%; right: 12%; top: 18%; bottom: 20%; white-space: nowrap; }
.dx-scroll { position: relative; border-style: solid; border-width: 30px 12px 30px; border-image: url(sprites/ui/scroll-tall.webp) 110 66 110 66 fill / 30px 12px 30px 12px stretch; padding: 4px 2px 8px; display: flex; flex-direction: column; gap: 6px; filter: drop-shadow(0 6px 10px #0009); }
.p-brush { width: 94%; margin: 4px 0 0; aspect-ratio: 700 / 157; max-height: 44px; background-image: var(--br); align-self: flex-start; font-size: 18px; color: #fff8e6; }
.p-brush .br-han { position: absolute; left: 1.5%; top: 9%; width: 17%; height: 82%; display: grid; place-items: center; font: 400 20px/1 var(--game); color: var(--ink); }
.p-brush .in { left: 22%; right: 30%; top: 14%; bottom: 16%; align-items: flex-start; text-shadow: 0 1px 2px #0009; white-space: nowrap; }
.dx-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.dx-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dex-f { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.df { position: relative; width: 100%; aspect-ratio: 240 / 351; background: var(--fr) center / 100% 100% no-repeat; font-family: var(--game); }
.dx-grid.three .df { aspect-ratio: 240 / 307; }
.df-img { position: absolute; left: 7%; top: 6%; width: 86%; height: 67%; object-fit: contain; object-position: center bottom; }
.df .in { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.unseen .df-img { filter: brightness(0) opacity(.45); }
.df .in.df-tier { left: 18%; right: 18%; top: 72.5%; bottom: 13.5%; color: #4a3218; font-size: 12px; white-space: nowrap; line-height: 1; }
.dx-grid.three .df .in.df-tier { bottom: 12%; }
.df-name { margin: 0; font: 400 12px/1.1 var(--game); color: #3e2a12; text-align: center; text-wrap: balance; word-break: keep-all; overflow-wrap: normal; min-height: 2.2em; }
html:not([lang="ko"]) .df-name { word-break: normal; overflow-wrap: anywhere; }
.unseen .df-name { color: #8a7458; }
.dx-grid.three .df-name { min-height: 0; }
.df-foot { margin: 0; font: 700 11px/1.2 var(--body); color: #5c4428; text-align: center; text-wrap: balance; word-break: keep-all; }
html:not([lang="ko"]) .df-foot { word-break: normal; }
.p-mythh { width: 82%; aspect-ratio: 700 / 144; max-height: 46px; background-image: url(sprites/ui/plaque-cloud.webp); margin: 8px auto 2px; font-size: 19px; color: #ffe9b0; }
.p-mythh .seal { position: absolute; left: 13%; top: 50%; transform: translateY(-50%); height: 118%; aspect-ratio: 1; background: url(sprites/ui/seal-myth.webp) center / 100% 100%; z-index: 1; display: grid; place-items: center; font: 400 22px/1 var(--game); color: #ffe7a0; text-shadow: 0 1px 0 #4a0604; filter: drop-shadow(0 2px 2px #0008); }
.p-mythh .in { left: 30%; right: 26%; top: 16%; bottom: 16%; text-shadow: 0 1px 0 #3c0806; white-space: nowrap; }
.dx .p-back { margin-top: 6px; }

/* 결과(이김·짐) */
.stage[data-v3="result"] { background: #2a1d3a url(sprites/yard-dawn.webp) center top / cover no-repeat; }
.stage[data-v3="result"]:has(.rs.lose) { background-color: #171433; background-image: linear-gradient(#1d1846cc, #120f2ae6), url(sprites/yard-dawn.webp); }
.rs-scene { position: relative; width: 100%; aspect-ratio: 3 / 2; max-height: 34dvh; overflow: hidden; flex: none; }
.rs-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.rs.win .rs-bg { object-position: center 85%; }
.rs-scene::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: linear-gradient(transparent, #0004); }
.rs-unit { position: absolute; left: 50%; bottom: 24%; height: 64%; width: auto; transform: translateX(-46%); filter: drop-shadow(0 0 4px #fff3b0) drop-shadow(0 3px 3px #0006); animation: rsbob 2.4s ease-in-out infinite; }
@keyframes rsbob { 50% { transform: translateX(-46%) translateY(-4px); } }
.rs-bub { position: absolute; left: 4%; top: calc(env(safe-area-inset-top, 0px) + 58px); max-width: min(64%, calc(100% - 120px)); margin: 0; padding: 6px 10px; border-radius: 14px; background: #fffdf6; border: 2px solid #3a2414; color: #2a1a0c; font: 700 12px/1.3 var(--body); text-wrap: balance; word-break: keep-all; box-shadow: 0 3px 6px #0005; }
html:not([lang="ko"]) .rs-bub { word-break: normal; }
.rs-bub::after { content: ""; position: absolute; left: 22px; bottom: -8px; width: 12px; height: 12px; background: #fffdf6; border-right: 2px solid #3a2414; border-bottom: 2px solid #3a2414; transform: rotate(45deg); }
.rs.lose .rs-bub { left: 20%; max-width: calc(80% - 112px); }
.p-stamp { position: absolute; right: 3%; top: calc(env(safe-area-inset-top, 0px) + 62px); width: 88px; aspect-ratio: 260 / 262; background: none; color: #c4161c; font-size: 17px; }
.p-stamp::before { content: ""; position: absolute; inset: 0; background: url(sprites/ui/stamp.webp) center / 100% 100% no-repeat; transform: rotate(8deg); filter: drop-shadow(0 2px 3px #0006); }
.p-stamp .in { left: 21%; right: 21%; top: 20%; bottom: 20%; line-height: 1.05; text-wrap: balance; word-break: keep-all; hyphens: manual; overflow-wrap: normal; }
html:not([lang="ko"]) .p-stamp .in { word-break: normal; }
.rs-panel { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 14px); margin-top: -18px; z-index: 1; }
.p-laurel { width: 100%; aspect-ratio: 900 / 258; max-width: 380px; background-image: url(sprites/ui/plaque-laurel.webp); color: #5a2a04; font-size: 29px; filter: drop-shadow(0 4px 6px #0008); }
.p-laurel .in { left: 21%; right: 21%; top: 28%; bottom: 18%; gap: .08em; }
.p-laurel .in small { font-size: .54em; color: #7a4a18; }
.rs-tags { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.p-tag { width: 100%; aspect-ratio: 360 / 285; background-image: url(sprites/ui/tag-hang.webp); color: #4a2506; font-size: 32px; filter: drop-shadow(0 3px 4px #0008); }
.p-tag .in { left: 11%; right: 11%; top: 36%; bottom: 19%; gap: .04em; }
.p-tag .in b { display: inline-flex; align-items: center; gap: .15em; }
.p-tag .in b img { width: .8em; height: .8em; }
.p-tag .in b.word { font-size: max(11px, .66em); }
.p-tag .in small { font-size: max(10px, .52em); color: #6b4418; line-height: 1; text-wrap: balance; }
.p-strip { width: 100%; height: 50px; background: none; border-style: solid; border-width: 0 26px; border-image: url(sprites/ui/btn-light.webp) 0 104 fill / 0 26px stretch; color: #3e2a12; font-family: var(--body); font-weight: 700; font-size: 15px; margin: 0; flex: none; }
.p-strip .in { left: 0; right: 0; top: 17%; bottom: 19%; line-height: 1.2; }
.p-strip .in > span { text-wrap: balance; }
.p-strip .in b { font-family: var(--game); font-weight: 400; color: #c4161c; font-size: 1.3em; }
.p-strip .in small { font-size: .78em; color: #6b5030; }
.p-strip .in .hot { color: #c4161c; }
.rs-earn .in, .rs-open .in, .rs-tip .in { left: 21%; } /* 왼쪽 주머니·냥도사 그림(판 밖으로 튀어나옴) 오른쪽에서 글자 시작 */
.rs-purse, .rs-dosa { position: absolute; left: -16px; top: 50%; height: 124%; width: auto; transform: translateY(-50%); z-index: 1; filter: drop-shadow(0 2px 3px #0007); }
.rs-wx { position: absolute; left: 2%; top: 50%; height: 62%; width: auto; transform: translateY(-50%); }
.rs-open { height: 64px; }
.rs-tip { height: 56px; }
.rs-open .in { font-size: 13px; }
.rs-open .in b { font-size: 1.15em; color: #1d5aa8; }
.rs-tip .in { font-size: 13px; }
.rs-new { width: min(84%, 320px); height: 40px; align-self: center; font-size: 14px; }
.rs-new .in > span { display: inline-flex; align-items: center; gap: .3em; }
.rs-new .in img { width: 1.3em; height: auto; }
.rs .p-go { width: min(84%, 330px); font-size: 28px; margin-top: 2px; }
.rs-row { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
/* 긴 언어에서 좁은 화면이면 두 줄로(작은 단추에 글자를 억지로 줄이지 않게) */
html:not([lang="ko"]):not([lang="ja"]):not([lang="zh-TW"]) .rs-row .plate { min-width: 124px; }
.rs-row .plate { flex: 1 1 0; min-width: 0; height: 50px; font-size: 16px; margin: 0; background: none; border-style: solid; }
.p-lightbtn { color: #4a2506; border-width: 0 18px; border-image: url(sprites/ui/btn-light.webp) 0 70 fill / 0 18px stretch; }
.p-lacq { color: #fff3dc; border-width: 0 24px; border-image: url(sprites/ui/btn-lacquer.webp) 0 104 fill / 0 24px stretch; }
.rs-row .plate .in { left: 9px; right: 9px; top: 16%; bottom: 18%; }
.rs-row .p-lacq .in { left: 3px; right: 3px; }
.p-lacq .in b { text-shadow: 0 1px 0 #2c0b38; }
.rs-homelink { align-self: center; border: 0; background: none; color: #ffe9b8; font: 400 15px var(--game); text-decoration: underline; text-underline-offset: 3px; padding: 4px 10px; text-shadow: 0 1px 2px #000a; }
.rs #next { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .rs-unit { animation: none !important; } }


/* 결과 카드 화면 */
.stage[data-v3="card"] { background: #2a1a0e url(sprites/bg-wood.webp) center top / cover no-repeat; }
.cd { align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 60px) 14px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.cd .cardimg { display: block; width: auto; max-width: 100%; max-height: calc(100dvh - 250px); aspect-ratio: 1080 / 1350; margin: 0 auto; border-radius: 12px; border: 3px solid #d2a352; box-shadow: 0 6px 18px #000a; background: #3a2414; }
.cd-fine { margin: 0; font: 700 12px var(--body); color: #f3d9a4; text-align: center; text-shadow: 0 1px 2px #000; }
.cd .p-go { width: min(84%, 330px); font-size: 28px; }
.cd .rs-row { width: 100%; max-width: 400px; }

/* 기록장(공용 화면)을 이 게임 그림에 맞춘다 */
.osc-book { background: #2a1a0e url(sprites/bg-dex.webp) center top / cover no-repeat; color: #3e2a12; font-family: var(--body); }
.osc-book .osc-header { border-bottom: 0; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 6px; justify-content: center; position: relative; }
.osc-book .osc-back { position: absolute; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 10px); min-width: 64px; height: 44px; border: 0; border-radius: 0; color: #fff3dc; font: 30px/1 var(--game); background: url(sprites/ui/btn-wood.webp) center / 100% 100% no-repeat; text-shadow: 0 1px 0 #2a1406; }
.osc-book .osc-title { min-width: 200px; padding: 12px 44px 16px; font: 400 24px/1.1 var(--game); color: #ffe7b0; text-align: center; text-shadow: 0 2px 0 #2a1406; background: url(sprites/ui/plaque-title.webp) center / 100% 100% no-repeat; }
.osc-book .osc-book-scroll { margin: 8px auto 0; width: calc(100% - 16px); padding: 18px 18px 28px; border-style: solid; border-width: 30px 12px; border-image: url(sprites/ui/scroll-tall.webp) 110 66 110 66 fill / 30px 12px stretch; }
.osc-book .osc-heading { margin: 4px 0 10px; font: 400 20px var(--game); color: #5a2a04; text-align: center; }
.osc-book .osc-record, .osc-book .osc-challenge { background: #fff6e1cc; border: 2px solid #c79a55; color: #3e2a12; box-shadow: 0 2px 0 #a7763a55; }
.osc-book .osc-record-value { color: #b5420f; font-family: var(--game); font-weight: 400; }
.osc-book .osc-sub, .osc-book .osc-date { color: #7a5a30; }
.osc-book .osc-tier { color: #8a4a10; font-family: var(--game); font-weight: 400; font-size: 16px; }
.osc-book .osc-done { border-color: #c4161c; background: #fff0e0; }
.osc-book .osc-done-stamp { color: #c4161c; font-family: var(--game); font-size: 15px; border: 2px solid #c4161c; border-radius: 6px; padding: 2px 6px; transform: rotate(-6deg); }

/* 판 그림을 받는 동안(느린 망) */
.v3-wait { display: flex; gap: 10px; justify-content: center; align-items: center; min-height: 60dvh; }
.v3-wait i { width: 12px; height: 12px; border-radius: 50%; background: #ffd66b; box-shadow: 0 0 8px #ffb84a; animation: v3w 1s ease-in-out infinite; }
.v3-wait i:nth-child(2) { animation-delay: .15s; } .v3-wait i:nth-child(3) { animation-delay: .3s; }
@keyframes v3w { 50% { transform: translateY(-8px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .v3-wait i { animation: none; } }

/* 무한 밤 결과: 점수 내역을 한지 판 위에 */
.rs.endless .rs-board .osc-breakdown { margin: 0; padding: 4px 16px; border-radius: 0; background: none; border-style: solid; border-width: 26px 12px; border-image: url(sprites/ui/scroll-tall.webp) 110 66 110 66 fill / 26px 12px stretch; color: #3e2a12; font-family: var(--body); box-shadow: 0 4px 8px #0006; }
.rs.endless .rs-board .osc-label { color: #5c4428; }
.rs.endless .rs-board .osc-value, .rs.endless .rs-board .osc-number { color: #b5420f; font-family: var(--game); font-weight: 400; }
.rs.endless .rs-board .osc-total { border-top: 1px dashed #a7763a; }
.rs.endless .rs-board .osc-best, .rs.endless .rs-board .osc-delta { color: #7a5a30; }
.rs.endless .rs-board .osc-seal { color: #c4161c; border-color: #c4161c; }
/* 3.0 글자·판 재검수 */
html:not([lang="ko"]) .p-plank { font-size: 13px; }
html[lang="th"] .pscroll .pbtn.gold { padding-bottom: .45em !important; }
html[lang="th"] .fp-go { padding-top: .4em; }
/* 3.0 전체 조합 검수: 두 줄 보라 판(점괘 0% 등)은 윗줄이 금테에 닿지 않게 한 단계 작게 */
.ctrl .lbl:has(small:not(:empty)) b { font-size: 16px; }
.ctrl .lbl:has(small:not(:empty)) small { font-size: 11px; }
.v3s small, .ps-sub { text-wrap-style: balance; } /* 끝 줄에 낱말 하나만 남지 않게 */
.in small .dp { display: inline-block; max-width: 100%; }
html:not([lang="ko"]):not([lang="ja"]):not([lang="zh-TW"]):not([lang="th"]) .fp-card small { hyphens: manual; overflow-wrap: normal; text-wrap-style: balance; } /* 점괘 패 설명이 낱말 가운데서 하이픈으로 끊기던 것 → 글자를 줄여 맞춘다 */
html[lang=ja] .stage :is(p, span, b, small, h2, h3, li) { word-break: auto-phrase !important; } /* 일본어: 낱말 가운데서 줄이 바뀌지 않게(コイ/ン 등) */
.v3s .plate .in { text-wrap-style: balance; }
html[lang=zh-TW] .p-light .in { word-break: keep-all; }
html[lang=ja] .stage :is(.banner, .gtoast, .bubble) { word-break: auto-phrase !important; text-wrap-style: balance; }
.rs-bub { text-wrap-style: balance !important; } /* 끝 줄에 "판 더?"만 남던 것 */
html[lang=zh-TW] .stage :is(.bubble, .fp-card small, .bi-bubble, .banner) { text-wrap-style: balance; }
/* 결과 화면 도전 알림: 말풍선·'두목 놓침' 도장 위를 덮던 것 → 작게 줄여 칭호 판 바로 위(그림 아래쪽 냥이들 몸 위)로 */
body:has(.rs-scene) .osc-toast { top: auto !important; bottom: auto !important; top: calc(env(safe-area-inset-top, 0px) + 156px) !important; padding: 5px 12px !important; font-size: 12px !important; line-height: 1.25 !important; max-width: min(330px, calc(100% - 24px)) !important; }
body:has(.rs-scene) .osc-toast .osc-toast-text { text-wrap: balance; }
/* 점괘·신화 창이 뜬 뒤에도 그 전에 뜬 알림 띠(보물 깨비 등) 글자 조각이 냥도사 뒤로 비치던 것 → 창이 떠 있는 동안 띠를 숨긴다 */
body:has(#overlay:not([hidden])) #banner { visibility: hidden !important; }
/* 2026-12-02 금빛 큰 판: 긴 글(Jugar de nuevo)이 양쪽 구름 장식 위까지 퍼지던 것 → 구름 안쪽부터. 붉은 판: 제목이 두 줄로 접혀 판 위아래로 넘치던 것(Tantangan harian) → 제목은 한 줄로 두고 글자를 줄인다 */
.p-start .in { left: 23%; right: 23%; }
.p-start .in b, .p-red .in b { white-space: nowrap; }
