/* 영웅의 길 — 한지·먹·인주, 방각본 목판 삽화 */
@font-face { font-family: 'HeroMyeongjo'; src: url('../assets/fonts/myeongjo.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'HeroMyeongjo'; src: url('../assets/fonts/myeongjo-bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'HeroBrush'; src: url('../assets/fonts/brush.woff2') format('woff2'); font-display: swap; }

:root {
  --paper: #efe2c3;
  --paper-2: #e6d5ae;
  --paper-3: #f7efdc;
  --ink: #2a2119;
  --ink-2: #5a4a3a;
  --ink-3: #8b7a64;
  --seal: #b3342a;          /* 붉은 낙관: 실제 작품 */
  --seal-2: #d65a4a;
  --gold: #b8892e;
  --fiction: #1f7474;       /* 청록: 게임 설정(虛) */
  --fiction-bg: #e2f0ee;
  --conv: #8a6a2a;          /* 한지 색: 작품 속 관습 */
  --conv-bg: #f3e6c4;
  --interp: #36548f;        /* 쪽빛: 해석 */
  --interp-bg: #e5eaf5;
  --mu: #b3342a;            /* 武 */
  --byeong: #36548f;        /* 兵 */
  --sul: #1f7474;           /* 術 */
  --ok: #2f6b45;
  --warn: #a4611b;
  --shadow: 0 2px 10px rgba(60, 40, 10, .18);
  --radius: 12px;
  --tray-h: 0px;
  --fs: 1;
  --serif: 'HeroMyeongjo', 'Nanum Myeongjo', 'Noto Serif KR', 'AppleMyungjo', 'Batang', serif;
  --sans: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  --brush: 'HeroBrush', var(--serif);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper) url('../assets/ui/paper.webp') repeat;
  background-size: 512px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: calc(16px * var(--fs));
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
b { font-weight: 700; }
#app { min-height: 100%; display: flex; flex-direction: column; }

/* ───────── 공통 버튼 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 46px; padding: .55em 1.2em; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--paper-3); color: var(--ink);
  font-weight: 700; letter-spacing: -.01em; transition: transform .08s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--paper-3); }
.btn.seal { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn.small { min-height: 38px; padding: .3em .9em; font-size: .9em; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(42,33,25,.35);
  background: rgba(247,239,220,.85); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05em; font-weight: 700; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }

/* ───────── 타이틀 ───────── */
.title-screen { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 24px 16px 32px; text-align: center; overflow: hidden; }
.title-screen .art { position: absolute; inset: 0; background-size: cover; background-position: center 40%; }
.title-screen .art.wide { background-position: center 30%; }
.title-screen .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(239,226,195,.55) 0%, rgba(239,226,195,.0) 26%, rgba(239,226,195,.0) 45%, rgba(239,226,195,.9) 72%, var(--paper) 100%); }
.title-screen .logo { position: relative; margin-bottom: auto; margin-top: 5vh; }
.title-screen .pre { font-family: var(--serif); font-weight: 700; letter-spacing: .3em; color: var(--seal); font-size: clamp(13px, 3.4vw, 17px); }
.title-screen h1 { font-family: var(--brush); font-weight: 400; font-size: clamp(60px, 18vw, 112px); line-height: 1; margin: .08em 0 0; letter-spacing: .04em; text-shadow: 0 2px 0 rgba(255,255,255,.55), 0 0 18px rgba(247,239,220,.9); }
.title-screen .sub { font-family: var(--serif); font-size: clamp(14px, 3.8vw, 19px); margin-top: .5em; font-weight: 700; color: var(--ink-2); text-shadow: 0 0 10px rgba(247,239,220,.95); }
.title-screen .menu { position: relative; display: flex; flex-direction: column; gap: 10px; width: min(360px, 100%); }
.title-screen .credit { position: relative; margin-top: 14px; font-size: .78em; color: var(--ink-2); }
.title-screen .credit.maker, .title-screen .credit.bgm { margin-top: 4px; }
.title-screen .credit.bgm { font-size: .7em; opacity: .85; }
.title-screen .credit.fixed { color: var(--fiction); font-weight: 800; }
.title-screen .music-toggle { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; background: rgba(250,244,230,.85); z-index: 2; }
.title-screen .music-toggle.off { color: var(--ink-2); }
.seal-mark { display: inline-block; border: 2px solid var(--seal); color: var(--seal); font-family: var(--serif); font-weight: 700; padding: 1px 6px; border-radius: 4px; transform: rotate(-4deg); font-size: .8em; letter-spacing: .05em; background: rgba(255,255,255,.35); }
.seal-mark.big { font-size: 1.3em; padding: 3px 10px; border-width: 3px; }
.seal-mark.corner { position: absolute; right: 12px; top: 12px; }

/* ───────── 상단 막대·상태 줄 ───────── */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(239,226,195,.94); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(42,33,25,.15);
}
.topbar .where { flex: 1; min-width: 0; line-height: 1.25; }
.topbar .where small { display: block; color: var(--ink-3); font-size: .78em; }
.topbar .where strong { font-family: var(--serif); font-size: 1.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.progress { height: 3px; background: rgba(42,33,25,.1); }
.progress > i { display: block; height: 100%; background: var(--seal); transition: width .4s; }
.statusbar { position: sticky; top: 61px; z-index: 29; background: rgba(247,239,220,.94); border-bottom: 1px solid rgba(42,33,25,.12); }
.status-btn { width: 100%; max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 5px 14px; text-align: left; font-size: .82em; }
.st-who { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-weight: 700; min-width: 0; white-space: nowrap; }
.st-who img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--ink-2); }
.abs { display: flex; gap: 4px; flex-wrap: wrap; }
.ab { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; background: #fffaf0; border: 1px solid rgba(42,33,25,.25); font-weight: 700; line-height: 1.6; }
.ab b { font-family: var(--serif); }
.ab.mu b { color: var(--mu); } .ab.byeong b { color: var(--byeong); } .ab.sul b { color: var(--sul); }
.ab.relic { border-color: var(--seal); } .ab.relic b { color: var(--seal); }
.ab.doubt { border-color: var(--warn); color: var(--warn); }
.doubt { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.doubt .dl { font-weight: 800; color: var(--warn); }
.dbar, .gbar { width: 70px; height: 8px; border-radius: 99px; background: rgba(42,33,25,.12); overflow: hidden; }
.dbar i, .gbar i { display: block; height: 100%; background: var(--warn); transition: width .5s; }
.dbar.hot i, .gbar.hot i { background: var(--seal); }
.stat-row { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; margin: 8px 0; }
.han-big { font-family: var(--serif); font-weight: 700; font-size: 1.8em; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 2px solid; }
.han-big.mu { color: var(--mu); } .han-big.byeong { color: var(--byeong); } .han-big.sul { color: var(--sul); }

/* ───────── 본문 배치 ───────── */
.stage { flex: 1; display: grid; grid-template-columns: 1fr; width: 100%; max-width: 1180px; margin: 0 auto; }
.main { padding: 14px 16px calc(var(--tray-h) + 28px); min-width: 0; }
.main-inner { max-width: 680px; margin: 0 auto; }
.main-inner * { scroll-margin-top: 110px; scroll-margin-bottom: calc(var(--tray-h) + 16px); }

.ch-head { text-align: center; margin: 6px 0 14px; }
.ch-head h2 { font-family: var(--serif); margin: 2px 0 0; color: var(--seal); font-size: 1em; letter-spacing: .2em; }
.ch-head .ch-title { font-family: var(--brush); font-size: clamp(34px, 10vw, 52px); line-height: 1.1; }
.ch-stage { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-family: var(--serif); font-weight: 700; color: var(--ink-2); }
.ch-stage .num, .num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--ink); color: var(--paper-3); font-weight: 800; font-size: .85em; font-family: var(--sans); }
.stitle { font-family: var(--serif); text-align: center; }

/* ───────── 장면 그림 ───────── */
.scene { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--paper-2); aspect-ratio: 3 / 2; margin-bottom: 14px; }
.scene img { width: 100%; height: 100%; object-fit: cover; }
.scene.short { aspect-ratio: 16 / 7; }

/* ───────── 이야기 줄 ───────── */
.says { margin-top: 4px; }
.para { margin: 0 0 .75em; opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .35s, transform .35s, visibility .35s; }
.para.show { opacity: 1; visibility: visible; transform: none; }
.narr { font-family: var(--serif); font-size: 1.06em; line-height: 1.9; background: var(--paper-3); border-radius: 6px; padding: 10px 14px; box-shadow: inset 0 0 0 1px rgba(90,60,20,.12); }
.say { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; }
.say .who img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--pc, var(--ink-3)); background: var(--paper-2); }
.say .bubble { background: #fffaf0; border: 1px solid rgba(90,60,20,.2); border-radius: 4px 14px 14px 14px; padding: 6px 12px; font-family: var(--serif); }
.say .bubble .nm { display: block; font-family: var(--sans); font-size: .76em; font-weight: 700; color: var(--pc, var(--ink-2)); line-height: 1.5; }
.say.me { grid-template-columns: 1fr 44px; }
.say.me .who { order: 2; }
.say.me .bubble { order: 1; border-radius: 14px 4px 14px 14px; background: #fff6e2; border-color: rgba(179,52,42,.35); }
.say.frame-say .bubble { background: var(--fiction-bg); border: 1.5px solid var(--fiction); font-family: var(--sans); font-size: .95em; }
.say.frame-say .nm { color: var(--fiction); font-weight: 800; }
.tagbadge { display: inline-block; font-family: var(--sans); font-size: .68em; font-weight: 800; letter-spacing: .02em; padding: 0 6px; border-radius: 4px; vertical-align: 2px; margin-left: 4px; color: #fff; }
.tagbadge.fiction { background: var(--fiction); }
.tagbadge.interp { background: var(--interp); }
.tagbadge.conv { background: var(--conv); }
.tagbadge.work { background: var(--seal); }

/* ───────── 고르기 ───────── */
.options { display: grid; gap: 8px; margin: 12px 0; }
.options.two { grid-template-columns: 1fr 1fr; }
.options.three { grid-template-columns: repeat(3, 1fr); }
.opt { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1.5px solid rgba(42,33,25,.4); border-radius: 12px; padding: 11px 14px; background: #fffaf0; min-height: 48px; transition: transform .08s, border-color .2s, background .2s; }
.opt:active { transform: scale(.98); }
.opt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.opt .ot { font-family: var(--serif); font-weight: 700; line-height: 1.5; }
.opt .od { font-size: .84em; color: var(--ink-2); }
.opt .oa { display: flex; gap: 4px; flex-wrap: wrap; font-size: .78em; }
.opt.big { align-items: center; text-align: center; padding: 20px 10px; }
.opt.big .ot { font-family: var(--brush); font-size: 2.2em; font-weight: 400; line-height: 1.1; }
.opt.picked { border-color: var(--gold); background: rgba(184,137,46,.18); box-shadow: 0 0 0 2px rgba(184,137,46,.35); }
.opt.dim { opacity: .45; }
.opt[disabled] { cursor: default; }
.opt.right { border-color: var(--ok); background: #e4f1e6; }
.opt.wrong { border-color: var(--seal); background: repeating-linear-gradient(135deg, rgba(179,52,42,.08) 0 6px, #fffaf0 6px 12px); }
.opt.glow { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,46,.5); animation: pulse 1.2s 3; }
.opt.passage .ot { font-weight: 400; font-size: .98em; }
.opt.stat, .opt.relic { align-items: center; text-align: center; padding: 12px 8px; }
.opt .han { font-family: var(--serif); font-weight: 700; font-size: 2em; line-height: 1.1; width: 1.6em; height: 1.6em; display: flex; align-items: center; justify-content: center; border: 2px solid; border-radius: 10px; margin-bottom: 4px; }
.opt.stat.mu .han { color: var(--mu); } .opt.stat.byeong .han { color: var(--byeong); } .opt.stat.sul .han { color: var(--sul); }
.opt.relic .han { color: var(--seal); border-color: var(--seal); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(184,137,46,.15); } }
.tray-hint { font-size: .86em; color: var(--ink-2); text-align: center; padding: 4px 0; }
.train-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }

/* 이름 짓기 */
.name-box { background: var(--paper-3); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin: 12px 0; }
.name-input { font: inherit; font-size: 1.15em; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--ink-2); background: #fff; width: min(170px, 100%); text-align: center; font-family: var(--serif); font-weight: 700; }
.name-input.sur { width: 84px; }
.name-input.wide { width: min(320px, 100%); font-size: 1em; }
.sur-fixed { font-family: var(--serif); font-weight: 700; font-size: 1.3em; }
.name-preview { font-family: var(--serif); font-weight: 700; letter-spacing: .08em; font-size: 1.8em; text-align: center; margin: 8px 0 2px; color: var(--ink); min-height: 1.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.chip-btn { border: 1.5px solid rgba(42,33,25,.35); background: #fffaf0; border-radius: 999px; padding: 4px 12px; font-family: var(--serif); font-weight: 700; min-height: 38px; }

/* 의심 게이지 카드 */
.gauge-card { display: flex; align-items: center; gap: 10px; background: #fff6e8; border: 1.5px solid var(--warn); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.gauge-card .gl { font-weight: 800; color: var(--warn); white-space: nowrap; }
.gauge-card .gbar { flex: 1; width: auto; height: 12px; }
.gauge-card .gv { font-weight: 700; font-size: .85em; white-space: nowrap; }

/* ───────── 아래 트레이 ───────── */
.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(239,226,195,.97); backdrop-filter: blur(6px);
  border-top: 1px solid rgba(42,33,25,.2); box-shadow: 0 -4px 18px rgba(60,40,10,.12);
  padding: 8px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.tray > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.tray .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }

/* ───────── 카드(표시 체계) ───────── */
.card { position: relative; background: var(--paper-3); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; border-left: 5px solid var(--ink-2); }
.card h3 { margin: 0 0 6px; font-size: 1.05em; font-family: var(--serif); padding-right: 3.2em; }
.card .kind { font-size: .72em; font-weight: 800; letter-spacing: .04em; color: var(--ink-3); display: block; margin-bottom: 2px; }
.card p { margin: .35em 0; }
.card .src { font-size: .74em; color: var(--ink-3); margin-top: 8px; word-break: break-all; }
.card.fiction { border-left-color: var(--fiction); background: var(--fiction-bg); }
.card.fiction .kind { color: var(--fiction); }
.card.conv { border-left-color: var(--conv); background: var(--conv-bg); }
.card.conv .kind { color: var(--conv); }
.card.interp { border-left-color: var(--interp); background: var(--interp-bg); }
.card.interp .kind { color: var(--interp); }
.card.work { border-left-color: var(--seal); background: #fbf1e4; font-family: var(--serif); }
.card.work .kind { color: var(--seal); font-family: var(--sans); }
.card.note { border-left-color: var(--ink); }
.card .real { margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(42,33,25,.3); }
.card.pathseal { text-align: center; border: 2px solid var(--seal); border-left-width: 2px; padding-top: 20px; }
.card.pathseal h3 { padding: 0; font-size: 1.2em; color: var(--seal); margin-top: 8px; }
.card.pathseal .seal-mark { font-size: 1.5em; }

.feedback { border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-weight: 700; }
.feedback.ok { background: #e1efe3; color: var(--ok); }
.feedback.warn { background: #f7e7cf; color: var(--warn); }
.feedback.bad { background: #f6dcd6; color: var(--seal); }

/* ───────── 일대기 띠·단계 고르기 ───────── */
.life-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 14px 0; }
.life-strip .ls { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 8px; background: rgba(255,250,240,.6); border: 1px dashed rgba(42,33,25,.3); font-size: .7em; text-align: center; line-height: 1.25; color: var(--ink-3); }
.life-strip .ls .num { background: var(--ink-3); }
.life-strip .ls.on { background: #fffaf0; border-style: solid; color: var(--ink); }
.life-strip .ls.on .num { background: var(--ink); }
.life-strip .ls.now { border-color: var(--seal); box-shadow: 0 0 0 2px rgba(179,52,42,.25); }
.life-strip .ls.now .num { background: var(--seal); }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stage-btn { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; text-align: left; border: 1.5px solid rgba(42,33,25,.35); border-radius: 10px; padding: 8px 10px; background: #fffaf0; min-height: 48px; }
.stage-btn .nm { font-family: var(--serif); font-weight: 700; }
.stage-btn .ds { grid-column: 1 / -1; font-size: .74em; color: var(--ink-2); line-height: 1.4; }
.stage-btn.right { border-color: var(--ok); background: #e4f1e6; }
.stage-btn.wrong { border-color: var(--seal); opacity: .6; }
.stage-btn.glow { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,46,.5); }
.stage-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ───────── 전투 ───────── */
.battle { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--paper-2); min-height: 56vh; }
.battle > * { position: relative; }
.battle > .bbg { position: absolute; inset: 0; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: .28; }
.fighter { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; background: rgba(255,250,240,.9); border-radius: 12px; padding: 8px 10px; border: 1.5px solid rgba(42,33,25,.25); }
.fighter.foe { border-color: rgba(107,63,140,.45); }
.fighter .face img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 2px solid var(--ink-2); background: var(--paper-2); }
.fighter.down { opacity: .5; filter: grayscale(.8); transition: all .6s; }
.fighter .nm { font-family: var(--serif); font-weight: 700; }
.fighter .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hp { height: 12px; border-radius: 99px; background: rgba(42,33,25,.15); overflow: hidden; margin: 3px 0; }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, #3f7a4f, #5a9a62); transition: width .45s; }
.foe .hp i { background: linear-gradient(90deg, #8a2a22, #c1463a); }
.hp.low i { background: linear-gradient(90deg, #a4611b, #d08a2a); }
.hpnum { font-size: .78em; font-weight: 700; color: var(--ink-2); }
.chip { display: inline-block; font-size: .72em; font-weight: 800; border-radius: 999px; padding: 0 7px; line-height: 1.7; }
.chip.block { background: #dfe6f3; color: var(--byeong); }
.chip.evade { background: var(--fiction-bg); color: var(--fiction); }
.chip.hex { background: #efe1f5; color: #6b3f8c; }
.fighter .abil { display: flex; gap: 4px; flex-wrap: wrap; font-size: .72em; margin-top: 2px; }
.intent { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: .85em; background: #f6dcd6; color: var(--seal); animation: fadein .3s; }
.intent .ic { font-size: 1.05em; }
.intent.charge { background: #fbe7c6; color: var(--warn); animation: pulse 1s infinite; }
.intent.heavy { background: var(--seal); color: #fff; }
.intent.hex { background: #efe1f5; color: #6b3f8c; }
.intent.guard { background: #dfe6f3; color: var(--byeong); }
.intent.stun { background: #e6e2da; color: var(--ink-3); animation: none; }
.blog { flex: 1; min-height: 110px; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 8px 12px; background: rgba(255,250,240,.82); border-radius: 10px; font-family: var(--serif); font-size: .92em; line-height: 1.55; }
.blog p { margin: 0; animation: fadein .3s; }
.blog p.story { color: var(--ink-2); font-style: italic; }
.blog p.act { font-weight: 700; }
.blog p.hit { color: var(--mu); }
.blog p.bad { color: #6b3f8c; }
.blog p.good { color: var(--ok); font-weight: 700; }
.blog p.warn { color: var(--warn); font-weight: 700; }
.btip { background: var(--fiction-bg); border: 1.5px solid var(--fiction); border-radius: 10px; padding: 8px 12px; font-size: .88em; }
.hand { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.bcard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px; border-radius: 12px; border: 2px solid var(--ink-2); background: #fffaf0; min-height: 122px; text-align: center; transition: transform .1s; box-shadow: 0 2px 0 rgba(42,33,25,.25); }
.bcard:active { transform: translateY(2px) scale(.97); }
.bcard:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.bcard .han { font-family: var(--serif); font-weight: 700; font-size: 1.55em; line-height: 1; width: 1.55em; height: 1.55em; display: flex; align-items: center; justify-content: center; border: 2px solid; border-radius: 8px; }
.bcard .cn { font-family: var(--serif); font-weight: 700; font-size: .9em; line-height: 1.3; }
.bcard .ct { font-size: .7em; line-height: 1.35; color: var(--ink-2); }
.bcard .once { font-size: .64em; font-weight: 800; color: var(--seal); }
.bcard.mu { border-color: var(--mu); } .bcard.mu .han { color: var(--mu); }
.bcard.byeong { border-color: var(--byeong); } .bcard.byeong .han { color: var(--byeong); }
.bcard.sul { border-color: var(--sul); } .bcard.sul .han { color: var(--sul); }
.bcard.relic { border-color: var(--seal); background: #fff1e6; box-shadow: 0 0 0 2px rgba(179,52,42,.25), 0 2px 0 rgba(42,33,25,.25); }
.bcard.relic .han { color: var(--seal); background: #fff; }

/* 아래에서 올라오는 판 */
.sheet-back { position: fixed; inset: 0; background: rgba(30,20,10,.35); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fadein .2s; }
.sheet { background: var(--paper-3); width: min(640px, 100%); max-height: 86vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -6px 30px rgba(0,0,0,.25); animation: up .25s ease-out; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h3 { margin: 0 0 6px; font-family: var(--serif); }
.sheet .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
@keyframes fadein { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.pop { position: fixed; z-index: 70; max-width: min(320px, 90vw); background: var(--ink); color: var(--paper-3); border-radius: 10px; padding: 8px 12px; font-size: .86em; line-height: 1.55; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: fadein .15s; }
.pop b { color: #f3d58a; }
.toast { position: fixed; left: 50%; top: 110px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--paper-3); padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: .9em; box-shadow: var(--shadow); animation: fadein .2s; pointer-events: none; white-space: nowrap; }
.stampfx { position: fixed; z-index: 90; pointer-events: none; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-8deg) scale(2.4); opacity: 0;
  border: 4px solid var(--seal); color: var(--seal); font-family: var(--serif); font-weight: 700; font-size: 34px; padding: 4px 14px; border-radius: 8px; background: rgba(255,250,240,.7);
  animation: stampin .55s cubic-bezier(.2,1.6,.4,1) forwards; letter-spacing: .08em; }
@keyframes stampin { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2.4); } 45% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(.95); } 100% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); } }
.stampfx.out { transition: opacity .5s; opacity: 0 !important; }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.ink { position: fixed; z-index: 89; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); pointer-events: none; }

/* ───────── 편람·목차 ───────── */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--paper) url('../assets/ui/paper.webp') repeat; background-size: 512px; display: flex; flex-direction: column; animation: fadein .2s; }
.overlay .tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px 0; border-bottom: 1px solid rgba(42,33,25,.2); }
.overlay .tab { flex: none; border: none; background: transparent; padding: 8px 12px; font-weight: 700; color: var(--ink-3); border-bottom: 3px solid transparent; }
.overlay .tab.on { color: var(--ink); border-bottom-color: var(--seal); }
.overlay .body { flex: 1; overflow: auto; padding: 14px 16px 40px; }
.overlay .body > .inner { max-width: 760px; margin: 0 auto; }
.toc { display: grid; gap: 10px; }
.toc-item { display: grid; grid-template-columns: 50px 1fr auto; gap: 12px; align-items: center; text-align: left; border: 1.5px solid rgba(42,33,25,.3); border-radius: 12px; padding: 10px 12px; background: rgba(255,250,240,.8); }
.toc-item .no { font-family: var(--serif); font-weight: 700; color: var(--seal); font-size: 1.05em; }
.toc-item .tt { font-family: var(--serif); font-weight: 700; }
.toc-item .hm { font-size: .8em; color: var(--ink-3); }
.toc-item .st { font-size: .8em; font-weight: 700; color: var(--ink-3); }
.toc-item.done .st { color: var(--ok); }
.toc-item.locked { opacity: .5; }
.dex { display: grid; gap: 10px; }
.ev { background: rgba(255,250,240,.9); border-radius: 12px; padding: 10px 14px; border: 1.5px solid rgba(42,33,25,.25); position: relative; }
.ev.dim { opacity: .55; }
.ev h4 { margin: 0; font-family: var(--serif); display: flex; align-items: center; gap: 6px; }
.ev .txt { font-family: var(--serif); font-size: .95em; line-height: 1.8; margin-top: 4px; }
.ev .txt.mine { color: var(--seal); }
.work-item { background: rgba(255,250,240,.92); border-radius: 12px; padding: 12px 14px; border: 1.5px solid rgba(179,52,42,.35); }
.work-item.unknown { opacity: .6; border-style: dashed; }
.work-item .wh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--serif); font-size: 1.05em; }
.wrows { display: grid; gap: 4px; margin-top: 6px; }
.wrow { display: grid; grid-template-columns: 1.9em 1fr; gap: 6px; font-family: var(--serif); font-size: .9em; line-height: 1.6; }
.wrow.off { color: var(--ink-3); font-family: var(--sans); font-size: .8em; }
.wrow.off .num { background: var(--ink-3); }

/* ───────── 결과 ───────── */
.cover-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; margin: 14px 0; }
.bookcover { position: relative; aspect-ratio: 2 / 3; background: #c9a25a; border: 2px solid #6b4a2a; border-radius: 2px 6px 6px 2px; box-shadow: var(--shadow), inset 0 0 40px rgba(90,60,20,.25);
  background-image: repeating-linear-gradient(45deg, rgba(90,60,20,.10) 0 2px, transparent 2px 18px), repeating-linear-gradient(-45deg, rgba(90,60,20,.10) 0 2px, transparent 2px 18px); }
.bookcover .holes { position: absolute; right: 10px; top: 5%; bottom: 5%; width: 8px; display: flex; flex-direction: column; justify-content: space-between; border-right: 2px solid var(--seal); }
.bookcover .holes i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-left: 4px; }
.bookcover .slip { position: absolute; left: 12%; top: 7%; width: 24%; height: 62%; background: var(--paper-3); border: 2px solid #6b4a2a; outline: 1px solid #6b4a2a; outline-offset: -5px; writing-mode: vertical-rl; text-orientation: upright; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: clamp(18px, 5.6vw, 32px); letter-spacing: .08em; }
.bookcover .cw { position: absolute; left: 10%; bottom: 5%; right: 18%; font-family: var(--serif); font-size: .8em; font-weight: 700; color: var(--ink); }
.toc-page { background: var(--paper-3); border: 3px solid #6b4a2a; outline: 1px solid #6b4a2a; outline-offset: -8px; padding: 14px 14px 10px; font-family: var(--serif); font-size: .82em; line-height: 1.5; }
.tp-h { text-align: center; font-weight: 700; font-size: 1.3em; letter-spacing: .3em; margin-bottom: 6px; }
.tp-row { display: grid; grid-template-columns: 1.7em 1fr; gap: 2px 6px; margin: 5px 0; }
.tp-row .num { background: var(--seal); font-size: .8em; }
.tp-row b { align-self: center; }
.tp-row span:last-child { grid-column: 2; color: var(--ink-2); font-size: .92em; }
.ledger { background: #fffaf0; border: 1.5px solid rgba(42,33,25,.25); border-radius: 10px; padding: 12px 14px; margin: 16px 0; }
.ledger .lh, .branchmap .lh { font-family: var(--serif); font-weight: 700; font-size: 1.05em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; text-align: left; }
.stat { background: rgba(239,226,195,.6); border-radius: 10px; padding: 8px 12px; }
.stat b { display: block; font-size: 1.3em; font-family: var(--serif); }
.stat span { font-size: .8em; color: var(--ink-2); }
.branchmap { background: #fffaf0; border: 1.5px solid rgba(42,33,25,.25); border-radius: 10px; padding: 12px 14px; margin: 16px 0; }
.bgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.bpath { border-radius: 10px; padding: 8px; background: rgba(239,226,195,.45); display: flex; flex-direction: column; gap: 6px; }
.bpath.mine { background: rgba(184,137,46,.16); }
.bp-h { font-family: var(--serif); font-weight: 700; text-align: center; }
.bnode { position: relative; border: 1.5px solid rgba(42,33,25,.35); border-radius: 8px; padding: 6px 8px; background: #fffaf0; display: flex; flex-direction: column; font-size: .88em; line-height: 1.4; }
.bnode.walked { border-color: var(--seal); box-shadow: 0 0 0 2px rgba(179,52,42,.2); }
.bnode.walked .seal-mark { position: absolute; right: 6px; top: 6px; }
.bnode.locked { border-style: dashed; color: var(--ink-3); background: repeating-linear-gradient(135deg, #f5ecd8 0 6px, #fffaf0 6px 12px); }
.reflect { width: 100%; font: inherit; font-family: var(--serif); padding: 8px 10px; border-radius: 8px; border: 1.5px solid rgba(54,84,143,.45); background: #fff; resize: vertical; }
.slots { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.slot { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; text-align: left; min-height: 46px; border: 1.5px dashed rgba(42,33,25,.35); border-radius: 10px; padding: 6px 10px; background: rgba(255,250,240,.6); color: var(--ink-3); font-size: .9em; }
.slot.full { border-style: solid; background: #fffaf0; color: var(--ink); font-family: var(--serif); }
.slot.bad { border-color: var(--seal); background: repeating-linear-gradient(135deg, rgba(179,52,42,.1) 0 6px, #fffaf0 6px 12px); }
.pool { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.pcard { text-align: left; border: 1.5px solid var(--ink-2); border-radius: 10px; padding: 8px 12px; background: #fff; font-family: var(--serif); min-height: 46px; }

.center { text-align: center; }
.muted { color: var(--ink-3); }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-gap.center { justify-content: center; }
.sp { height: 12px; }
.small { font-size: .85em; }
.hide { display: none !important; }

/* 휴대폰 세로(폭 600px 이하) */
@media (max-width: 600px) {
  body { font-size: calc(15px * var(--fs)); line-height: 1.6; }
  .main { padding: 10px 12px calc(var(--tray-h) + 20px); }
  .topbar { gap: 6px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); }
  .statusbar { top: 53px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .btn { min-height: 42px; padding: .45em 1.05em; }
  .scene.short { aspect-ratio: 16 / 6; }
  .say { grid-template-columns: 38px 1fr; gap: 8px; }
  .say.me { grid-template-columns: 1fr 38px; }
  .say .who img { width: 38px; height: 38px; }
  .card { padding: 12px 14px; margin-bottom: 10px; }
  .options.three { grid-template-columns: 1fr; }
  .opt.stat, .opt.relic { flex-direction: row; text-align: left; flex-wrap: wrap; column-gap: 10px; }
  .opt.stat .han, .opt.relic .han { margin: 0; font-size: 1.6em; }
  .fighter { grid-template-columns: 58px 1fr; }
  .fighter .face img { width: 58px; height: 58px; }
  .battle { min-height: 48vh; }
  .bcard { min-height: 112px; }
  .bcard .ct { font-size: .66em; }
  .life-strip .ls .nm { font-size: .92em; }
  .cover-wrap { grid-template-columns: 1fr; }
  .bookcover { width: 70%; margin: 0 auto; }
  .status-btn { gap: 6px; padding: 4px 10px; }
  .st-who span { max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 380px) {
  .abs .ab.relic { display: none; }
  .life-strip .ls .nm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────── 탑뷰 맵 RPG(js/game/world.js) ───────── */
.world { position: fixed; inset: 0; background: #1b1a17; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 1; }
.wcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.joy-zone { position: absolute; left: 0; bottom: 0; width: 60%; top: 110px; z-index: 2; }
.joy { position: fixed; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 2; }
.joy.on { opacity: 1; }
.joy-base { position: absolute; width: 104px; height: 104px; left: -52px; top: -52px; border-radius: 50%; background: rgba(247,239,220,.16); border: 2px solid rgba(247,239,220,.5); }
.joy-knob { position: absolute; left: 0; top: 0; width: 50px; height: 50px; border-radius: 50%; background: rgba(247,239,220,.82); border: 2px solid #2a2119; transform: translate(-50%, -50%); }
.hud { position: absolute; left: 0; right: 0; top: 0; z-index: 3; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
.hud-top { display: flex; align-items: center; gap: 8px; max-width: 900px; margin: 0 auto; }
.hud-top > * { pointer-events: auto; }
.hud .icon-btn { background: rgba(247,239,220,.94); border: 1.5px solid #2a2119; box-shadow: 0 2px 0 #2a2119; }
.goal { flex: 1; min-width: 0; background: rgba(247,239,220,.95); border: 1.5px solid #2a2119; border-radius: 12px; padding: 5px 12px; line-height: 1.3; box-shadow: 0 2px 0 #2a2119; }
.goal small { display: block; font-size: .72em; color: var(--ink-3); font-weight: 700; }
.goal strong { display: block; font-family: var(--serif); font-size: .95em; }
.goal strong:empty { display: none; }
.hud-status { display: flex; gap: 6px; margin: 6px auto 0; flex-wrap: wrap; align-items: center; max-width: 900px; }
.hud-status > * { pointer-events: auto; }
.hud-status .hp { display: flex; align-items: center; gap: 6px; background: rgba(27,22,18,.82); color: #f7efdc; border-radius: 999px; padding: 2px 10px; font-size: .78em; font-weight: 700; }
.hp .hbar { width: 92px; height: 8px; background: #4a3b30; border-radius: 4px; overflow: hidden; }
.hp .hbar i { display: block; height: 100%; background: linear-gradient(#ea6a5c, #b3342a); transition: width .2s; }
.hp .hbar.low i { animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .45; } }
.hud .status-btn { width: auto; margin: 0; max-width: none; background: rgba(247,239,220,.94); border: 1.5px solid #2a2119; border-radius: 999px; padding: 2px 8px; box-shadow: 0 2px 0 #2a2119; }
.hud .doubt { margin-left: 4px; }
.pad { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 3; display: grid; grid-template-columns: auto auto; gap: 12px; align-items: end; justify-items: end; }
.pbtn { position: relative; display: none; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid #2a2119; background: rgba(247,239,220,.92); box-shadow: 0 3px 0 #2a2119; touch-action: none; padding: 0; }
.pbtn.on { display: flex; }
.pbtn.down { transform: translateY(2px); box-shadow: 0 1px 0 #2a2119; }
.pbtn .ph { line-height: 1; pointer-events: none; }
.pbtn.atk { grid-column: 2; grid-row: 2; width: 78px; height: 78px; background: #b3342a; color: #fff; font-size: 32px; }
.pbtn.skill { grid-column: 1; grid-row: 2; width: 58px; height: 58px; background: #1f7474; color: #fff; font-family: var(--brush); font-size: 27px; }
.pbtn.skill.cool .ph { opacity: .3; }
.pbtn .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; pointer-events: none; }
.pbtn.talk { grid-column: 1 / span 2; grid-row: 1; border-radius: 999px; height: 50px; padding: 0 18px; gap: 6px; background: #f2c94c; font-weight: 800; font-size: 1em; animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.7); } }
.pbtn kbd { position: absolute; top: -9px; right: -6px; font: 700 10px/1 var(--sans); background: #2a2119; color: #f7efdc; border-radius: 4px; padding: 3px 4px; }
.pbtn.talk kbd { position: static; }
.keyhint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3; background: rgba(27,22,18,.78); color: #f7efdc; font-size: .78em; padding: 4px 14px; border-radius: 999px; pointer-events: none; transition: opacity 1.2s; white-space: nowrap; }
.keyhint.fade { opacity: 0; }
@media (pointer: coarse) { .pbtn kbd, .keyhint { display: none; } }
.wfade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 6; }
.wfade.on { opacity: 1; }
.world.talking .pad, .world.talking .joy-zone, .world.talking .keyhint { display: none; }
/* 대화창: 기존 이야기 화면(말풍선·선택지·카드·전투)을 그대로 담는다 */
.dlg { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; max-height: 76%; animation: up .22s ease-out; }
.dlg.small { max-height: 62%; }
.dlg.full { top: 0; max-height: none; }
.dlg-box { width: min(760px, 100%); display: flex; flex-direction: column; background: var(--paper) url('../assets/ui/paper.webp') repeat; background-size: 512px; border: 2px solid #2a2119; border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 26px rgba(0,0,0,.4); overflow: hidden; }
.dlg.full .dlg-box { width: 100%; border: 0; border-radius: 0; }
.dlg-scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 8px; overscroll-behavior: contain; }
.dlg-tray { padding: 8px 16px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(42,33,25,.18); background: rgba(247,239,220,.97); }
.dlg-tray.hide { display: none; }
.dlg-tray > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.dlg-tray .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
.dlg .scene { aspect-ratio: 16 / 7; }
.dlg .scene.short { aspect-ratio: 16 / 6; }
.dlg .main-inner * { scroll-margin-top: 12px; scroll-margin-bottom: 12px; }
.say .who .pxface { width: 44px; height: 44px; border-radius: 50%; image-rendering: pixelated; border: 2px solid var(--pc, var(--ink-3)); background: #d6e4bf; }
@media (max-width: 520px) { .say .who .pxface { width: 38px; height: 38px; } .dlg-scroll { padding: 10px 12px 6px; } .pbtn.atk { width: 72px; height: 72px; } }
/* 카드 전투 손맛 */
.fighter { position: relative; }
.fighter .face { position: relative; }
.fighter.hit .face img { animation: hitflash .09s steps(1) 3; }
@keyframes hitflash { 50% { filter: brightness(4) saturate(0); } }
.slashfx { position: absolute; inset: -6px; pointer-events: none; background: linear-gradient(135deg, transparent 42%, #fff 47%, #ffe08a 50%, transparent 57%); animation: slashfx .28s ease-out forwards; }
@keyframes slashfx { 0% { clip-path: inset(0 100% 100% 0); opacity: 1; } 55% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { opacity: 0; } }
.dmgpop { position: absolute; left: 30px; top: -6px; z-index: 2; font: 900 1.7em/1 var(--serif); color: #b3342a; text-shadow: 0 2px 0 #fff, 0 0 8px #fff; pointer-events: none; animation: dmgpop .85s ease-out forwards; }
.dmgpop.heal { color: var(--ok); }
@keyframes dmgpop { 0% { transform: translateY(8px) scale(.5); opacity: 0; } 18% { transform: translateY(-6px) scale(1.3); opacity: 1; } 100% { transform: translateY(-28px) scale(1); opacity: 0; } }
.battle.flash::after { content: ''; position: absolute; inset: 0; background: #fff; pointer-events: none; animation: bflash .28s ease-out forwards; }
.battle.flash.red::after { background: #b3342a; }
@keyframes bflash { 0% { opacity: .55; } 100% { opacity: 0; } }
/* 가로로 눕힌 휴대폰: 카드 전투를 한 화면에(양쪽 인물을 나란히, 기록·카드를 작게) */
@media (orientation: landscape) and (max-height: 520px) {
  .dlg.full .battle { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; }
  .dlg.full .battle > .fighter.foe { grid-column: 1; grid-row: 1; }
  .dlg.full .battle > .fighter.hero { grid-column: 2; grid-row: 1; }
  .dlg.full .battle > .blog { grid-column: 1 / -1; grid-row: 2; min-height: 58px; font-size: .84em; line-height: 1.45; }
  .dlg.full .battle > .btip { grid-column: 1 / -1; grid-row: 3; font-size: .8em; padding: 5px 10px; }
  .dlg.full .fighter { grid-template-columns: 46px 1fr; gap: 8px; padding: 5px 8px; }
  .dlg.full .fighter .face img { width: 46px; height: 46px; }
  .dlg.full .fighter .abil { display: none; }
  .dlg.full .bcard { min-height: 80px; padding: 5px 3px; }
  .dlg.full .bcard .ct { font-size: .62em; }
  .dlg-scroll { padding: 6px 10px 4px; }
  .dlg-tray { padding: 4px 10px max(6px, env(safe-area-inset-bottom)); }
}
/* ───────── 기술·적장전(js/game/combat.js) ───────── */
.treebtn { display: none; position: relative; font-family: var(--brush); font-size: 1.25em; color: var(--seal); }
.treebtn.on { display: inline-flex; }
.treebtn .th { line-height: 1; }
.treebtn .badge:empty { display: none; }
.treebtn .badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--seal); color: #fff; font: 800 12px/20px var(--sans); text-align: center; padding: 0 5px; border: 2px solid #f7efdc; }
.treebtn.glow { animation: treeglow 1.1s infinite alternate; }
@keyframes treeglow { to { box-shadow: 0 2px 0 #2a2119, 0 0 0 5px rgba(242,201,76,.55); } }
.pad { grid-template-columns: auto auto; grid-template-areas: "talk talk" "s1 s2" "s0 atk"; }
.pad .slots { display: contents; }
.pbtn.talk { grid-area: talk; }
.pbtn.atk { grid-area: atk; }
.pbtn.slot { width: 56px; height: 56px; background: #2a2119; color: #f2c94c; font-family: var(--brush); font-size: 26px; overflow: hidden; }
.pbtn.slot.s0 { grid-area: s0; } .pbtn.slot.s1 { grid-area: s1; } .pbtn.slot.s2 { grid-area: s2; }
.pbtn.slot::after { content: ''; position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.62) var(--cd, 0%), transparent 0); pointer-events: none; border-radius: 50%; }
.pbtn.slot.cool .ph { opacity: .45; }
.pbtn.slot .cd { color: #fff; font-family: var(--sans); font-size: 18px; z-index: 1; }
.bossbar { display: none; margin: 8px auto 0; max-width: 520px; pointer-events: none; background: rgba(27,22,18,.84); border: 1.5px solid #2a2119; border-radius: 12px; padding: 5px 12px 7px; color: #f7efdc; }
.bossbar.on { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center; }
.bossbar .bn { grid-row: span 2; font-family: var(--serif); font-weight: 700; font-size: .92em; }
.bossbar .bb, .bossbar .pz { display: block; background: #4a3b30; border-radius: 4px; overflow: hidden; }
.bossbar .bb { height: 10px; } .bossbar .pz { height: 5px; }
.bossbar .bb i { display: block; height: 100%; background: linear-gradient(#ea6a5c, #b3342a); transition: width .15s; }
.bossbar .pz i { display: block; height: 100%; background: #f2c94c; transition: width .15s; }
.bossbar.stag .pz i { animation: blink .25s infinite alternate; }
.bossbar.p2 { border-color: #b3342a; box-shadow: 0 0 0 2px rgba(179,52,42,.45); }
.tipbar { margin: 8px auto 0; max-width: 560px; width: fit-content; background: rgba(247,239,220,.96); border: 1.5px solid #2a2119; border-radius: 999px; padding: 5px 16px; font-weight: 700; font-size: .88em; box-shadow: 0 2px 0 #2a2119; opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; pointer-events: none; }
.tipbar.on { opacity: 1; transform: none; }
.dlg.tree .dlg-box { background-color: #f3e6c4; }
.tree-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.tree-head h2 { margin: 0; font-family: var(--serif); }
.tree-pts { display: flex; align-items: center; gap: 6px; background: var(--seal); color: #fff; border-radius: 999px; padding: 2px 12px; font-weight: 700; }
.tree-pts b { font-size: 1.2em; }
.tree-abil { display: flex; gap: 4px; margin-left: auto; }
.tree-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.tree-col { display: flex; flex-direction: column; gap: 8px; }
.tree-title { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-weight: 700; }
.tree-title .han-big { font-size: 1.5em; }
.sk { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 2px solid rgba(42,33,25,.35); border-radius: 12px; padding: 8px 10px; background: #fffaf0; position: relative; }
.sk .sk-tier { font-size: .7em; font-weight: 800; color: var(--ink-3); }
.sk .sk-name b { font-family: var(--serif); font-size: 1.05em; }
.sk .sk-name small { color: var(--ink-3); }
.sk .sk-desc { font-size: .8em; line-height: 1.45; color: var(--ink-2); }
.sk .sk-state { font-size: .74em; font-weight: 800; color: var(--ink-3); margin-top: 2px; }
.sk.locked { opacity: .55; border-style: dashed; background: #efe7d4; }
.sk.ready { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,201,76,.45); animation: pulse 1.2s infinite; }
.sk.ready .sk-state { color: #8a6a2a; }
.sk.learned { background: #fff; border-color: var(--ok); }
.sk.learned .sk-state { color: var(--ok); }
.sk.eq::after { content: '단추'; position: absolute; top: 6px; right: 8px; font-size: .66em; font-weight: 800; background: #2a2119; color: #f2c94c; border-radius: 6px; padding: 1px 6px; }
.tree-col.mu .sk.learned { border-color: var(--mu); } .tree-col.byeong .sk.learned { border-color: var(--byeong); } .tree-col.sul .sk.learned { border-color: var(--sul); }
@media (max-width: 640px) {
  .tree-cols { grid-template-columns: 1fr; }
  .tree-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tree-col .tree-title { grid-column: 1 / -1; }
  .sk { padding: 6px 7px; }
  .sk .sk-desc { font-size: .72em; }
  .tree-abil { margin-left: 0; }
  .pbtn.slot { width: 50px; height: 50px; font-size: 23px; }
}
