@font-face { font-family: SbBody; src: url(../assets/fonts/sb-body.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: SbBody; src: url(../assets/fonts/sb-body-bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: SbBrush; src: url(../assets/fonts/sb-brush.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: SbBrushAll; src: url(../assets/fonts/sb-brush-all.woff2) format('woff2'); font-display: swap; }      /* 직접 쓴 글에 대본에 없는 글자가 있을 때만 받습니다 */
@font-face { font-family: SbHan; src: url(../assets/fonts/sb-han.woff2) format('woff2'); font-display: swap; }

:root {
  --paper: #f1e8d2; --paper2: #e7dcc0; --out: #2a251d; --ink: #1d1a16; --dim: #6a5f4f;
  --indigo: #24365c; --ochre: #c08a2e; --gold: #e7c27a; --red: #9b2d24; --night: #15182a;
  --font: SbBody, SbHan, 'Batang', 'Noto Serif KR', serif;
  --brush: SbBrush, SbHan, serif;
  --brushall: SbBrush, SbBrushAll, SbBody, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--out); color: var(--ink); font-family: var(--font); line-height: 1.7; word-break: keep-all; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.9); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.04); } 20%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes bump { 30% { transform: scale(1.25); color: var(--red); } }
@keyframes blink { 50% { opacity: .25; } }

/* ── 바탕 ─────────────────────────────── */
#app { position: relative; height: 100%; height: 100dvh; margin: 0 auto; overflow: hidden; background: var(--paper); }
#img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s; }
#img.out { opacity: 0; }

/* 위쪽 진행 표시: 장 도장, 장 이름, 다섯 장 가운데 어디인지, 살림 */
#hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 13.5px; line-height: 1.3; z-index: 3; }
#h-ch { display: flex; align-items: center; gap: 7px; min-width: 0; }
#h-seal { flex: none; width: 26px; height: 26px; display: grid; place-items: center; background: var(--red); color: #f8ecd6; font-family: var(--brush); font-weight: 400; font-size: 18px; border-radius: 3px; }
#h-title { font-weight: 700; white-space: nowrap; }
#h-pips { display: flex; gap: 4px; }
#h-pips i { width: 9px; height: 9px; border: 1.5px solid currentColor; transform: rotate(45deg); opacity: .5; }
#h-pips i.done { background: currentColor; opacity: .8; }
#h-pips i.now { background: var(--ochre); border-color: var(--ochre); opacity: 1; }
#h-stats { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
#h-stats span:empty { display: none; }
#h-stats span { display: inline-flex; align-items: center; gap: 4px; }
#b-when { font-weight: 700; }
#h-stats b { font-family: var(--brush); font-weight: 400; font-size: 16px; }
.bump { animation: bump .6s; }
.ic { width: 14px; height: 14px; display: inline-block; background: currentColor; opacity: .85; }
.ic.rice { border-radius: 50% 50% 46% 46%; clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); }        /* 쌀자루 */
.ic.cloth { border-radius: 2px; background: repeating-linear-gradient(0deg, currentColor 0 2px, transparent 2px 4px); outline: 1.5px solid currentColor; outline-offset: -1px; }   /* 베 */
.ic.brush { width: 5px; border-radius: 3px 3px 50% 50%; transform: rotate(35deg); margin: 0 4px; }           /* 붓 */

#cap:empty { display: none; }
@media (max-width: 420px) { #h-pips { display: none; } }
@media (max-width: 520px) { #h-title { display: none; } #hud { font-size: 13px; } #h-stats { gap: 8px; } }
#cap { position: absolute; z-index: 3; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); padding: 0 10px; font-size: 13px; font-weight: 700; }

#toast { position: absolute; left: 50%; top: 34%; z-index: 7; background: var(--ink); color: var(--gold); border: 2px solid var(--gold); padding: 8px 20px; font-weight: 700; font-size: 17px; white-space: nowrap; animation: pop 2.2s both; pointer-events: none; }

#text .who { font-weight: 700; }
#text p.glyph { text-align: center; font-family: var(--brush); font-size: 84px; line-height: 1.15; }
#text blockquote small { display: block; margin-top: 6px; font-size: 12.5px; opacity: .7; }
#opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; padding: 11px 14px; font-size: 16.5px; line-height: 1.5; }
.opt small { display: block; font-size: 13px; opacity: .72; }

/* 종이 */
.paper { background: #f8f1dc; border: 1.5px solid #8d7f63; box-shadow: 4px 5px 0 rgba(0, 0, 0, .35); padding: 22px 18px; display: flex; flex-direction: row-reverse; justify-content: center; gap: 14px; }
.paper .col { writing-mode: vertical-rl; font-family: var(--brush); font-size: var(--hs, 34px); line-height: 1.15; letter-spacing: .06em; color: #25211b; white-space: nowrap; }
.paper .col i { font-style: normal; opacity: .82; }
.paper .col i.k { opacity: 1; color: #000; background: rgba(192, 138, 46, .4); }
.paper .col i.s { background: rgba(36, 54, 92, .16); }
#over { position: absolute; inset: 0; z-index: 6; background: rgba(20, 17, 13, .95); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; animation: in .3s both; }
#over-sheet .paper { --hs: clamp(30px, min(9.5vw, 6.4vh), 50px); padding: 30px 26px; transform: rotate(-.6deg); }
#over-cap { color: var(--paper); font-size: 16.5px; text-align: center; max-width: 22em; }
#over-close { padding: 10px 26px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); font-weight: 700; font-size: 16px; }
#sheet { display: flex; justify-content: center; align-items: flex-start; gap: 12px; z-index: 2; }
#sheet .paper { --hs: clamp(22px, min(6.4vw, 4.2vh), 32px); padding: 16px 14px; }
#sheet .means { list-style: none; display: flex; flex-direction: column; gap: 6px; max-width: 14em; font-size: 14.5px; padding-top: 4px; }
#sheet .means li { background: rgba(21, 24, 42, .92); color: var(--paper); border: 1.5px solid var(--paper); padding: 5px 9px; line-height: 1.45; animation: in .35s both; }
#sheet .means li b { font-family: var(--brush); font-weight: 400; font-size: 17px; margin-right: 6px; color: var(--gold); }
#app.choosing #sheet { display: none; }

/* 장 사이 카드 */
#card { position: absolute; inset: 0; z-index: 8; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px; animation: in .4s both; }
#card-in { max-width: 24em; }
#card .seal { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--red); color: #f8ecd6; font-family: var(--brush); font-size: 44px; line-height: 1; border-radius: 6px; transform: rotate(-4deg); box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--red); }
#card .seal.red { background: var(--night); box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--gold); color: var(--gold); }
#card h2 { font-size: 32px; margin-bottom: 10px; letter-spacing: .08em; }
#card .c-sub { color: #cbbf9f; margin-bottom: 4px; letter-spacing: .3em; }
#card ul { list-style: none; text-align: left; border-top: 1.5px solid #6a5f4f; margin: 14px 0; }
#card li { padding: 8px 2px; border-bottom: 1.5px solid #6a5f4f; font-size: 15.5px; }
#card li b { color: var(--gold); margin-right: 8px; }
#card .c-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#card #mine-save { background: var(--gold); }
#card #mine-saved:empty { display: none; }
#card button { margin-top: 14px; padding: 10px 28px; background: var(--paper); color: var(--ink); border: 0; font-weight: 700; font-size: 16px; }
#card .c-small { font-size: 13px; color: #a89c82; margin-top: 16px; }

/* ── 둘째 안에서 더한 것 (12-01 밤) ───────────────────── */
#text blockquote em { display: block; font-style: normal; font-size: 12.5px; color: var(--gold); letter-spacing: .2em; margin-bottom: 2px; }
#text p.heard .say { font-size: 1.12em; letter-spacing: .04em; }
#text p.heard b:not(.who) { color: var(--gold); }
#text b { color: var(--gold); font-weight: 700; }
#text .who { color: #14110d; }
#text p.glyph.sm { font-size: 60px; }
#text p.glyph small { display: block; font-family: var(--font); font-size: 15px; line-height: 1.4; opacity: .85; }
/* 목소리 셋: 마을의 바탕글은 내 속말, 궁의 바탕글은 해설(딱지가 붙음), 낱말 풀이는 작은 글 */
#text small.gloss { display: block; margin-top: 6px; padding-top: 5px; border-top: 1px dashed rgba(241, 232, 210, .35); font-size: 13.5px; line-height: 1.5; color: #cbbf9f; }
#text small.gloss b { margin-right: 6px; font-size: 13px; background: rgba(192, 138, 46, .25); padding: 0 6px; }
#app.palace #text { border-color: #8fa0c8; box-shadow: inset 0 0 0 3px #14110d, inset 0 0 0 4px rgba(143, 160, 200, .5); }
#app.palace #text p.cur:not(.talk):not(.picked)::before { content: '해설'; position: absolute; top: -37px; left: -6px; background: #8fa0c8; color: #14110d; padding: 0 12px; font-size: 14.5px; font-weight: 700; line-height: 1.75; }
/* 목표와 살림 */
#goal { position: absolute; top: 40px; right: 10px; z-index: 3; font-size: 13px; color: var(--paper); background: rgba(20, 17, 13, .85); padding: 3px 10px; border: 1.5px solid var(--ochre); cursor: pointer; text-shadow: 0 1px 2px #000; display: flex; align-items: center; gap: 6px; }
#goal:empty { display: none; }
#goal b { color: var(--gold); font-size: 15px; }
#goal.bump { animation: glow .9s; }
@keyframes glow { 30% { background: var(--ochre); color: #14110d; box-shadow: 0 0 14px var(--gold); } }
.ic.chest { width: 17px; height: 13px; border-radius: 3px 3px 1px 1px; background: var(--ochre); box-shadow: inset 0 4px 0 #8a6220, inset 0 5px 0 #14110d; opacity: 1; }
#chestv { position: absolute; inset: 0; z-index: 9; background: rgba(20, 17, 13, .96); overflow-y: auto; display: flex; padding: 22px 14px; animation: in .25s both; }
#chestv-in { margin: auto; display: flex; flex-wrap: wrap; gap: 16px 14px; justify-content: center; align-items: flex-end; max-width: 760px; }
#chestv h3 { flex: 0 0 100%; text-align: center; color: var(--gold); font-size: 22px; letter-spacing: .4em; text-indent: .4em; }
#chestv figure { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#chestv .paper { --hs: clamp(17px, 4.8vw, 24px); padding: 12px 9px; gap: 7px; }
#chestv .letter .col { font-size: 15px; max-height: 210px; }
#chestv figcaption { color: var(--paper); font-size: 13.5px; text-align: center; max-width: 11em; line-height: 1.4; }
#chestv figcaption small { display: block; color: #cbbf9f; font-size: 12px; }
#chestv figure.read figcaption small { color: var(--gold); }
#chestv-x { flex: 0 0 auto; margin: 6px 30% 0; padding: 9px 24px; background: var(--paper); color: var(--ink); border: 0; font-weight: 700; font-size: 15px; }
.thing { width: 90px; height: 120px; background: #f8f1dc; border: 1.5px solid #8d7f63; position: relative; }
.thing::after { content: ''; position: absolute; left: 44px; top: 14px; width: 3px; height: 92px; background: #5e564a; border-radius: 2px; transform: rotate(8deg); }
.thing.knot::before { content: ''; position: absolute; left: 39px; top: 52px; width: 13px; height: 11px; background: #5e564a; border-radius: 50%; z-index: 1; }
.ic.land { border-radius: 2px; background: none; border: 2px solid currentColor; box-shadow: inset 5px 0 0 -3px currentColor, inset 0 5px 0 -3px currentColor; }
.lamps { display: inline-flex; gap: 4px; margin-left: 2px; }
.lamp { width: 11px; height: 13px; border-radius: 4px 4px 2px 2px; border: 1.5px solid var(--paper); display: inline-block; }
.lamp.l2 { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }
.lamp.l1 { background: linear-gradient(transparent 55%, var(--ochre) 55%); border-color: var(--ochre); }
.lamp.l0 { opacity: .45; }
.lamp.q { border-style: dashed; opacity: .8; }
.moves li.l2::before { background: var(--gold); color: #14110d; box-shadow: 0 0 8px var(--gold); }
.moves li.l0::before { background: #4a433a; color: #a89c82; }
.moves li.l1::before { background: var(--ochre); color: #14110d; }
.opt.locked { opacity: .5; filter: grayscale(1); cursor: not-allowed; }
.opt small.lock::before { content: '✕ '; }
/* 못 읽는 선택지 */
.paper.blind { gap: 10px; }
.paper.blind .col { background: none; border: 1.5px dashed #8d7f63; padding: 8px 5px; color: #25211b; cursor: pointer; }
.paper.blind .col:active, .twopapers button:active { background: rgba(192, 138, 46, .35); }
.twopapers { display: flex; gap: 14px; align-items: flex-start; justify-content: center; }
.twopapers button { background: none; border: 0; padding: 0; cursor: pointer; }
#over-sheet .twopapers .paper { --hs: clamp(19px, min(5.4vw, 4vh), 30px); padding: 14px 9px; gap: 7px; transform: none; }
#over-sheet .twopapers .letter .col { font-size: clamp(15px, 4.2vw, 19px); max-height: min(46vh, 330px); }
/* 같은 모양 찾기 */
.paper .col i.tap { cursor: pointer; padding: 1px 0; border-radius: 3px; transition: background .15s; }
.paper .col i.sel { background: rgba(155, 45, 36, .28); opacity: 1; }
.paper .col i.done { opacity: 1; color: #000; }
.paper .col i.done.p0 { background: rgba(192, 138, 46, .55); }
.paper .col i.done.p1 { background: rgba(36, 54, 92, .32); }
.paper .col i.no { animation: no .3s; }
@keyframes no { 30% { transform: translateX(-3px); } 70% { transform: translateX(3px); } }
#over { overflow-y: auto; }
#over-cap b { color: var(--gold); }
/* 그림책 석 장 */
.panels { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.panels figure { position: relative; border: 2px solid #8d7f63; background: #f8f1dc; box-shadow: 3px 4px 0 rgba(0, 0, 0, .35); }
.panels img { display: block; height: min(21vh, 200px); width: auto; max-width: 84vw; }
.panels figcaption { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center; background: var(--red); color: #f8ecd6; font-family: var(--brush); font-size: 15px; }
@media (min-aspect-ratio: 1/1) and (min-width: 800px) { .panels { flex-direction: row; } .panels img { height: min(42vh, 300px); max-width: 30vw; } }
/* 손마디 */
.signbox { display: flex; align-items: flex-end; gap: 14px; background: #f8f1dc; border: 1.5px solid #8d7f63; box-shadow: 4px 5px 0 rgba(0, 0, 0, .35); padding: 14px; }
.signbox .paper { border: 0; box-shadow: none; padding: 6px 4px; --hs: clamp(22px, min(6.4vw, 4.4vh), 34px); transform: none !important; }
.signarea { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 112px; }
.h-zone { position: relative; width: 78px; padding: 6px 9px 0; border: 1.5px dashed #b9aa85; border-bottom: 0; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; background: radial-gradient(ellipse at 50% 60%, rgba(192, 138, 46, .18), transparent 70%); }
.h-zone.hold { background: radial-gradient(ellipse at 50% 60%, rgba(155, 45, 36, .22), transparent 72%); }
.h-zone.lined { cursor: crosshair; }
.hand { display: block; width: 100%; height: min(28vh, 200px); pointer-events: none; }
.hand path { fill: none; stroke: #25211b; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.hand .h-out { transition: stroke-dashoffset .25s; }
.hand .h-out.on { stroke-dashoffset: 0; transition: stroke-dashoffset 1.5s linear; }
.hand .h-j { stroke-width: 2.8; transition: stroke-dashoffset .28s ease-out; }
.hand .h-j.on { stroke-dashoffset: 0; }
.h-hint { min-height: 3em; font-size: 13px; line-height: 1.45; text-align: center; color: #25211b; }
.h-hint b { color: var(--red); }
#over-cap small.gloss { display: block; margin-top: 6px; font-size: 13px; color: #cbbf9f; }
#over-cap small.gloss b { margin-right: 6px; background: rgba(192, 138, 46, .25); padding: 0 6px; color: var(--paper); }
/* 스물여덟 자 판 */
.g28 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px; background: rgba(20, 17, 13, .88); border: 2px solid var(--ochre); }
.g28 i { width: clamp(30px, 9.5vw, 42px); aspect-ratio: 1; display: grid; place-items: center; font-style: normal; font-family: var(--brush), 'Malgun Gothic', sans-serif; font-size: clamp(19px, 5.8vw, 26px); color: transparent; border: 1.5px dashed rgba(241, 232, 210, .3); }
.g28 i.on { color: var(--ink); background: var(--paper); border: 1.5px solid var(--paper); }
.g28 i.new { animation: stamp .5s both; background: var(--gold); }
.g28.full i { animation: stamp .5s both; }
.g28.full i:nth-child(n+8) { animation-delay: .15s; } .g28.full i:nth-child(n+15) { animation-delay: .3s; } .g28.full i:nth-child(n+22) { animation-delay: .45s; }
@keyframes stamp { from { transform: scale(1.6); opacity: 0; } to { transform: none; opacity: 1; } }
.g28n { align-self: flex-end; background: var(--ochre); color: #14110d; font-weight: 700; padding: 0 8px; font-size: 14px; }
#sheet:has(.g28) { flex-direction: column; align-items: center; gap: 0; }
#app.choosing #sheet:has(.g28) { display: flex; }
@media (max-height: 700px) { #app.choosing #sheet:has(.g28) { display: none; } }
/* 입 안 그림 */
.mouthbox { display: flex; align-items: center; gap: 12px; }
.mouthbox b { font-family: var(--brush), 'Malgun Gothic', sans-serif; font-size: 52px; line-height: 1; font-weight: 400; }
.mouthbox span { font-size: 15.5px; }
.mouth { width: 84px; height: 84px; flex: none; }
.mouth path { fill: none; stroke: var(--paper); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.mouth .m-hit { stroke: var(--gold); stroke-width: 5; opacity: 1; stroke-dasharray: 1; animation: drawin .8s both; }
@keyframes drawin { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* 내가 쓰는 글 */
.own { display: flex; flex-direction: column; gap: 8px; }
.own input { font: inherit; font-size: 17px; padding: 11px 12px; border: 2px solid var(--ochre); background: var(--paper); color: var(--ink); width: 100%; }
.letter .col { white-space: normal; max-height: min(54vh, 400px); font-size: clamp(19px, 5.2vw, 25px); line-height: 1.5; letter-spacing: .02em; font-family: var(--brush), SbBody, serif; }
.letter .col b { font-weight: 400; background: rgba(155, 45, 36, .25); }
.letter.mean .col { font-family: var(--font); font-size: clamp(16px, 4.6vw, 20px); }
.letter.mine { transform: rotate(-.8deg); }
.letter.mine .col { font-family: var(--brushall); }
.letter.mine .col:nth-child(odd) { transform: translateY(5px) rotate(.6deg); }
.letter.mine .col:nth-child(even) { transform: translateY(-3px) rotate(-.7deg); }
.letter.sawol .col { font-size: clamp(21px, 5.8vw, 28px); letter-spacing: .08em; }
.letter.wallw { background: #d9d2c0; border-color: #a39a84; box-shadow: none; padding: 34px 30px; }
.letter.wallw .col { font-size: clamp(22px, 6vw, 30px); color: #17140f; }
/* 카드에 쌓이는 것 */
#card { overflow-y: auto; align-items: flex-start; }
#card-in { margin: auto; width: 100%; }
#card .c-h { color: var(--gold); letter-spacing: .25em; font-size: 13.5px; margin-top: 16px; }
.moves { list-style: none; text-align: left; margin: 6px 0 14px; counter-reset: mv; }
#card .moves li { counter-increment: mv; padding: 7px 2px 7px 30px; position: relative; font-size: 15px; line-height: 1.5; border-bottom: 1.5px solid #6a5f4f; }
.moves li::before { content: counter(mv); position: absolute; left: 2px; top: 9px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--red); color: #f8ecd6; font-size: 12.5px; font-weight: 700; }
.moves li b { font-size: 12.5px; opacity: .8; }
.moves small { display: block; color: #cbbf9f; font-size: 13.5px; }
.moves small::before { content: '→ '; }
.moves small.q { color: var(--gold); }
#card .pre { text-align: left; }
#card .pre section { border-top: 1.5px solid #6a5f4f; padding: 12px 0; }
#card .pre blockquote { font-size: 16.5px; border-left: 4px solid var(--ochre); padding-left: 10px; margin-bottom: 8px; }
#card .pre p { font-size: 14.5px; line-height: 1.6; margin-bottom: 6px; }
#card .pre p b { color: var(--gold); margin-right: 6px; }
#card .pre .sp { background: rgba(192, 138, 46, .16); padding: 6px 9px; }
#card .pre .sp b { display: block; font-size: 16px; }
#card ul.facts { border: 0; margin: 4px 0 0; }
#card ul.facts li { border: 0; padding: 3px 0 3px 14px; font-size: 14px; line-height: 1.55; position: relative; }
#card ul.facts li::before { content: '·'; position: absolute; left: 2px; }
#card ol.asks { text-align: left; padding-left: 22px; margin-top: 10px; }
#card ol.asks li { border: 0; padding: 7px 0; font-size: 15.5px; line-height: 1.6; }
.minebox { display: flex; justify-content: center; margin: 10px 0 4px; }
.minebox .paper { color: var(--ink); }

/* 임금이 손수 쓴 글 */
#verse { position: absolute; inset: 0; z-index: 9; background: radial-gradient(ellipse at 50% 45%, rgba(20, 17, 13, .78), rgba(12, 10, 8, .96) 75%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 26px 22px; overflow: hidden; cursor: pointer; animation: in .8s both; }
#verse-han { position: absolute; inset: 0; display: flex; flex-direction: row-reverse; justify-content: center; align-items: center; gap: clamp(8px, 3vw, 22px); pointer-events: none; opacity: .11; }
#verse-han div { writing-mode: vertical-rl; font-family: var(--brush); font-size: clamp(22px, 6.4vw, 40px); letter-spacing: .12em; color: var(--paper); white-space: nowrap; }
#verse-in { position: relative; text-align: center; }
#verse-in p { font-family: var(--brush); font-size: clamp(15.5px, 4.5vw, 25px); line-height: 2.05; color: var(--paper); opacity: 0; transform: translateY(8px); transition: opacity 1.1s, transform 1.1s; text-shadow: 0 1px 8px #000; }
#verse-in p.on { opacity: 1; transform: none; }
#verse-in p.gold { color: var(--gold); font-size: clamp(21px, 6vw, 29px); margin: .25em 0; }
#verse-src { position: relative; font-size: 12.5px; letter-spacing: .12em; color: #a89c82; opacity: 0; transition: opacity 1.4s .6s; }
#verse-src.on { opacity: 1; }
#verse-go { position: relative; background: none; border: 0; color: var(--gold); font-size: 14px; font-weight: 700; padding: 10px 22px; min-width: 120px; animation: blink 1.4s infinite; }
#verse-go.end { animation: none; border: 1.5px solid var(--gold); letter-spacing: .15em; }

/* 표지: 그림이 화면을 채우고, 아래에 제목과 단추 */
#title { position: absolute; inset: 0; z-index: 10; background: #14110d; color: var(--paper); overflow: hidden; }
#title img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 43% 40%; animation: tzoom 24s ease-out both; }
@keyframes tzoom { from { transform: scale(1.12); } to { transform: scale(1); } }
#title::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(20, 17, 13, .55) 55%, rgba(20, 17, 13, .96) 82%); pointer-events: none; }
.t-in { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 0 24px calc(26px + env(safe-area-inset-bottom)); text-align: center; animation: in .9s .2s both; }
.t-cells { display: grid; grid-template-columns: repeat(14, 11px); gap: 4px; justify-content: center; margin-bottom: 14px; }
.t-cells i { height: 11px; border: 1px dashed rgba(241, 232, 210, .55); }
#title h1 { font-family: var(--brush); font-weight: 400; font-size: clamp(42px, 13vw, 68px); letter-spacing: .1em; line-height: 1.15; text-shadow: 0 2px 10px #000; display: flex; align-items: center; justify-content: center; gap: .22em; }
.t-seal { flex: none; width: .78em; height: .78em; display: grid; place-items: center; background: var(--red); color: #f8ecd6; font-style: normal; font-size: .5em; letter-spacing: 0; border-radius: 4px; transform: rotate(-5deg); box-shadow: 0 0 0 2px #14110d, 0 0 0 3.5px var(--red); text-shadow: none; }
.t-line { margin: 10px 0 20px; font-size: 16.5px; line-height: 1.7; color: #e9dfc6; text-shadow: 0 1px 4px #000; }
.t-btns { display: flex; flex-direction: column; gap: 9px; align-items: center; }
.t-btns button { width: min(280px, 82%); padding: 12px 10px; font-size: 18px; font-weight: 700; letter-spacing: .12em; border: 2px solid var(--gold); }
#start { background: var(--gold); color: #14110d; }
#start:active { background: var(--paper); }
#resume { background: rgba(20, 17, 13, .6); color: var(--gold); font-size: 16px; }
#resume:disabled { border-color: #6a5f4f; color: #7d725f; cursor: default; }
.t-how { margin-top: 14px; font-size: 13px; letter-spacing: .1em; color: #b3a88f; }
@media (min-aspect-ratio: 1/1) and (min-width: 800px) {
  #title img { object-position: 30% 45%; }
  #title::after { background: linear-gradient(90deg, transparent 38%, rgba(20, 17, 13, .7) 60%, rgba(20, 17, 13, .96) 80%); }
  .t-in { left: auto; right: 0; top: 0; bottom: 0; width: 42%; padding: 0 40px; display: flex; flex-direction: column; justify-content: center; }
  .t-cells { grid-template-columns: repeat(14, 14px); gap: 5px; margin-bottom: 20px; }
  .t-cells i { height: 14px; }
}

/* ══ 시안 가: 장면 가득 ══════════════════════════════════
   그림이 화면을 채우고, 말 상자와 선택지가 그 위에 뜹니다. 한 번에 한 줄. */
.ui-a #app { background: #14110d; color: var(--paper); max-width: calc(100dvh * 16 / 9); }
.ui-a #pic { position: absolute; inset: 0 0 34% 0; }
.ui-a #shade { position: absolute; inset: 0; background: linear-gradient(#14110d 0, transparent 14%, transparent 62%, #14110d 100%); pointer-events: none; }
.ui-a #hud { position: absolute; inset: 0 0 auto 0; color: var(--paper); text-shadow: 0 1px 2px #000; }
.ui-a #cap { top: 62px; left: 10px; }
.ui-a #sheet { position: absolute; inset: 52px 8px auto 8px; }
.ui-a #bottom { position: absolute; inset: auto 0 0 0; padding: 0 10px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.ui-a #text { position: relative; min-height: 128px; background: rgba(20, 17, 13, .93); border: 2px solid var(--ochre); box-shadow: inset 0 0 0 3px #14110d, inset 0 0 0 4px rgba(192, 138, 46, .5); padding: 20px 18px 14px; font-size: 17.5px; cursor: pointer; }
.ui-a #text:empty { visibility: hidden; }
.ui-a #text > :not(.cur) { display: none; }
.ui-a #text .cur { animation: in .25s both; }
.ui-a #text .cur { position: relative; }
.ui-a #text .who { position: absolute; top: -37px; left: -6px; background: var(--ochre); color: #14110d; padding: 0 12px; font-size: 14.5px; line-height: 1.75; }
.ui-a #text p.picked { color: var(--gold); }
.ui-a #text p.picked::before { content: '▸ '; }
.ui-a #text blockquote { font-size: 16px; }
.ui-a .opt { background: var(--paper); color: var(--ink); border: 0; border-left: 8px solid var(--ochre); box-shadow: 0 3px 0 #000; animation: in .3s both; }
.ui-a .opt:nth-child(2) { animation-delay: .07s; } .ui-a .opt:nth-child(3) { animation-delay: .14s; }
.ui-a .opt:active { background: var(--gold); }
.ui-a #next { align-self: flex-end; margin-top: -46px; margin-right: 8px; position: relative; background: none; border: 0; color: var(--gold); font-size: 13.5px; font-weight: 700; padding: 8px 10px; }
.ui-a #next::after { content: ' ▼'; animation: blink 1.1s infinite; }
.ui-a #app.palace #pic { inset: 0; }
.ui-a #app.palace #shade { background: linear-gradient(#14110d 0, transparent 12%, transparent 50%, rgba(20, 17, 13, .9) 100%); }
.ui-a #app.palace #img { transform: scale(1.22); }
@media (min-aspect-ratio: 1/1) and (min-width: 800px) {
  .ui-a #pic { inset: 0; }
  .ui-a #shade { background: linear-gradient(rgba(20, 17, 13, .75) 0, transparent 16%, transparent 55%, rgba(20, 17, 13, .92) 100%); }
  .ui-a #img { object-position: 50% 42% !important; }
  .ui-a #hud { padding: 10px 18px; font-size: 15px; }
  .ui-a #cap { top: 56px; left: 18px; font-size: 14px; }
  .ui-a #bottom { left: 50%; right: auto; width: min(820px, 92%); transform: translateX(-50%); padding-bottom: 22px; }
  .ui-a #text { font-size: 19px; min-height: 124px; padding: 22px 24px 16px; }
  .ui-a #opts { width: min(560px, 100%); align-self: center; }
  .ui-a #sheet { inset: 64px 0 auto 0; }
  .ui-a #app.palace #img { transform: none; object-position: 50% 62% !important; }
}

/* 소리 단추. 처음 화면에는 글과 함께, 위쪽 띠에는 그림만(눌러서 끄고 켬) */
.snd-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.snd-btn svg { width: 18px; height: 18px; flex: none; }
.snd-btn path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.snd-btn .sp { fill: currentColor; }
.snd-btn .x { display: none; }
.snd-btn[aria-pressed="false"] .wv { display: none; }
.snd-btn[aria-pressed="false"] .x { display: inline; }
.t-snd { margin-top: 10px; padding: 6px 12px; font-size: 13px; letter-spacing: .06em; color: #b3a88f; }
.h-snd { padding: 4px; margin: -4px -4px -4px 2px; opacity: .85; }
.h-snd span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h-snd[aria-pressed="false"] { opacity: .55; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
