@font-face { font-family: 'GameSerif'; src: url('../assets/fonts/game-serif-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'GameSerif'; src: url('../assets/fonts/game-serif-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
:root { --u: 10px; --ink: #2b2118; --paper: #f3e7c9; --paper2: #e6d3a8; --red: #8b2e22; --blue: #2f4a6b; --gold: #c99a3a; --muted: #7a6a55; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #120d09; overflow: hidden; touch-action: manipulation; }
body { font-family: 'GameSerif', 'Noto Serif KR', 'Noto Serif CJK KR', 'Nanum Myeongjo', 'AppleMyungjo', 'Batang', serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); overflow: hidden; background: #000; font-size: calc(var(--u) * 1.6); }
#scene, #bg, #spots { position: absolute; inset: 0; }
#bg img { width: 100%; height: 100%; object-fit: cover; display: block; }
#bg.night img { filter: brightness(.55) saturate(.8) hue-rotate(-10deg); }
#bg.dusk img { filter: brightness(.8) sepia(.15); }
#bg.bright img { filter: brightness(1.12) saturate(1.1); }
.ph-bg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u)*.8); background: repeating-linear-gradient(45deg, #3a2e24 0 calc(var(--u)*2), #33281f calc(var(--u)*2) calc(var(--u)*4)); color: #e9dcc0; text-align: center; }
.ph-bg b { font-size: calc(var(--u)*3); } .ph-bg span { font-size: calc(var(--u)*1.6); opacity: .8; } .ph-bg small { opacity: .55; }
.title-ph { background: radial-gradient(ellipse at 50% 40%, #6b5236, #1d1510 75%); }

/* 조사 영역 */
.spot { position: absolute; background: transparent; border: 0; padding: 0; border-radius: calc(var(--u)*.6); }
.spot .spot-label { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); white-space: nowrap; font-size: calc(var(--u)*1.25); background: rgba(30,22,15,.82); color: #f3e7c9; padding: .15em .6em; border-radius: 1em; opacity: 0; pointer-events: none; transition: opacity .15s; }
.spot:hover .spot-label, .spot:focus-visible .spot-label { opacity: 1; }
.spot:hover { box-shadow: inset 0 0 0 2px rgba(243,231,201,.55), 0 0 calc(var(--u)*1.5) rgba(255,214,140,.35); }
#spots.reveal .spot:not(.hidden-spot) { box-shadow: inset 0 0 0 3px rgba(255,214,140,.9); background: rgba(255,214,140,.12); animation: glow 1.2s ease-in-out infinite; }
#spots.reveal .spot:not(.hidden-spot) .spot-label { opacity: 1; }
#bg.placeholder ~ #spots .spot:not(.hidden-spot) { box-shadow: inset 0 0 0 2px rgba(243,231,201,.5); }
#bg.placeholder ~ #spots .spot:not(.hidden-spot) .spot-label { opacity: 1; top: 50%; transform: translate(-50%,-50%); }
.spot.exit::after { content: '➜'; position: absolute; right: 6%; bottom: 6%; color: #f3e7c9; font-size: calc(var(--u)*2.4); text-shadow: 0 0 6px #000; animation: nudge 1.6s ease-in-out infinite; }
.back-btn { left: 1%; top: 9%; width: auto; height: auto; }
.back-btn .spot-label { position: static; opacity: 1; transform: none; display: inline-block; font-size: calc(var(--u)*1.2); }
@keyframes glow { 50% { background: rgba(255,214,140,.25); } }
@keyframes nudge { 50% { transform: translateX(4px); } }
body.busy #spots, body.busy #inventory { pointer-events: none; }

/* 인물 */
#portrait { position: absolute; left: 3%; bottom: 22%; height: 62%; width: 30%; pointer-events: none; opacity: 0; transition: opacity .25s; }
#portrait.show { opacity: 1; }
#portrait img { height: 100%; width: auto; object-fit: contain; object-position: bottom left; filter: var(--tone, brightness(1)) drop-shadow(0 4px 12px rgba(0,0,0,.5)); }
.ph-portrait { position: absolute; bottom: 0; left: 0; width: 60%; height: 75%; border-radius: 45% 45% 8% 8%; background: var(--c); opacity: .9; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #f3e7c9; box-shadow: 0 0 0 3px rgba(243,231,201,.4); }
.ph-portrait span { font-size: calc(var(--u)*2); } .ph-portrait small { opacity: .7; font-size: calc(var(--u)*1); }

/* HUD */
#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--u)*.8) calc(var(--u)*1); pointer-events: none; }
#hud-place { pointer-events: none; background: rgba(30,22,15,.7); color: #f3e7c9; padding: .25em .9em; border-radius: 1em; font-size: calc(var(--u)*1.3); }
#hud-right { display: flex; gap: calc(var(--u)*.6); pointer-events: none; align-items: center; }
#hud-right .hud-btn { pointer-events: auto; }
#hud-tools { display: flex; gap: calc(var(--u)*.6); pointer-events: none; }
#hud-right:not(.open) #hud-tools { display: none; }
#hud-right.open #btn-tools { background: rgba(120,88,52,.95); }
.hud-btn { width: calc(var(--u)*4.6); height: calc(var(--u)*4.6); border-radius: 50%; border: 2px solid rgba(243,231,201,.6); background: rgba(30,22,15,.75); font-size: calc(var(--u)*2.1); display: flex; align-items: center; justify-content: center; }
.hud-btn:hover { background: rgba(80,58,38,.9); }

/* 보관함 */
#inventory { position: absolute; right: 1%; top: 12%; display: flex; flex-direction: column; align-items: flex-end; gap: calc(var(--u)*.5); max-height: 70%; overflow-y: auto; pointer-events: none; } #inventory > * { pointer-events: auto; }
.inv-item { display: flex; align-items: center; gap: .4em; background: rgba(243,231,201,.92); border: 2px solid #8a6f4d; border-radius: calc(var(--u)*.8); padding: .25em .6em; font-size: calc(var(--u)*1.2); min-width: calc(var(--u)*12); text-align: left; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.inv-item.sel { border-color: var(--red); background: #fff3d6; box-shadow: 0 0 0 3px rgba(139,46,34,.45); }
.inv-icon { font-size: calc(var(--u)*1.8); }
.inv-bag { display: flex; align-items: center; gap: .4em; align-self: flex-end; background: rgba(30,22,15,.82); color: #f3e7c9; border: 2px solid rgba(243,231,201,.6); border-radius: 2em; padding: .2em .8em .2em .5em; font-size: calc(var(--u)*1.2); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.inv-bag.open { background: rgba(120,88,52,.95); }
.inv-bag.holding { background: #fff3d6; color: var(--ink); border-color: var(--red); box-shadow: 0 0 0 3px rgba(139,46,34,.45); }

/* 대화창 */
#dialog { position: absolute; left: 2%; right: 2%; bottom: 2.5%; min-height: 20%; background: rgba(243,231,201,.96); border: 3px solid #6b5236; border-radius: calc(var(--u)*1); padding: calc(var(--u)*1.4) calc(var(--u)*2.2); box-shadow: 0 6px 20px rgba(0,0,0,.5); cursor: pointer; }
#dialog.hidden { display: none; }
#dialog-name { position: absolute; top: calc(var(--u)*-2); left: calc(var(--u)*2); background: #6b5236; color: #f3e7c9; padding: .2em 1em; border-radius: .6em; font-weight: 700; }
#dialog-text { font-size: calc(var(--u)*1.9); line-height: 1.6; white-space: pre-wrap; min-height: 3.2em; }
#dialog-note { font-size: calc(var(--u)*1); color: var(--muted); position: absolute; right: calc(var(--u)*2); bottom: calc(var(--u)*.5); }
#dialog-next { position: absolute; right: calc(var(--u)*1.2); bottom: calc(var(--u)*.8); color: #6b5236; animation: nudge 1s infinite; font-size: calc(var(--u)*1.2); }
#dialog.kind-n { background: rgba(25,18,12,.9); color: #f3e7c9; border-color: #8a6f4d; text-align: center; }
#dialog.kind-n #dialog-next { color: #e6d3a8; }
#dialog.kind-t { background: rgba(225,232,240,.95); border-color: var(--blue); font-style: italic; }
#dialog.kind-t #dialog-text::before { content: '💭 '; font-style: normal; }
#dialog.kind-g { background: rgba(255,244,200,.97); border-color: var(--gold); font-family: system-ui, sans-serif; }
#dialog.kind-g #dialog-text { font-size: calc(var(--u)*1.6); }
#dialog.kind-g #dialog-text::before { content: '안내 · '; color: #9a7420; font-weight: 700; }

/* 알림·암전 */
#toast { position: absolute; left: 50%; top: 9%; transform: translate(-50%, -10px); background: rgba(30,22,15,.9); color: #f3e7c9; padding: .5em 1.2em; border-radius: 2em; font-size: calc(var(--u)*1.35); opacity: 0; transition: all .25s; pointer-events: none; max-width: 80%; text-align: center; z-index: 30; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .5s; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u)*3); }
#fade.on { opacity: 1; pointer-events: auto; }
.card-text { color: #f3e7c9; text-align: center; font-size: calc(var(--u)*2.4); line-height: 1.8; max-width: 75%; animation: rise 1s ease; }
.card-text p { margin: .3em 0; }
#fade.fail .fail-main { font-size: calc(var(--u)*2.1); }
#fade.fail .fail-note { font-size: calc(var(--u)*1.7); color: #e6d3a8; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* 패널 */
#overlay { position: absolute; inset: 0; background: rgba(10,7,4,.55); display: flex; align-items: center; justify-content: center; z-index: 20; }
#overlay.hidden { display: none; }
#overlay.title { background: linear-gradient(90deg, rgba(10,7,4,.75), rgba(10,7,4,.1) 70%); justify-content: flex-start; }
.panel { position: relative; background: var(--paper); border: 3px solid #6b5236; border-radius: calc(var(--u)*1.2); padding: calc(var(--u)*2) calc(var(--u)*2.4); width: 70%; max-height: 90%; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,.6); font-size: calc(var(--u)*1.55); animation: rise .25s ease; }
.panel.small { width: 46%; } .panel.wide { width: 84%; }
.panel.title { width: 38%; margin-left: 5%; background: transparent; border: 0; box-shadow: none; color: #f3e7c9; }
.panel-title { margin: 0 0 .6em; font-size: calc(var(--u)*2.1); color: #4a3726; border-bottom: 2px solid var(--paper2); padding-bottom: .3em; }
.panel-close { position: absolute; top: calc(var(--u)*1); right: calc(var(--u)*1.2); width: calc(var(--u)*3.6); height: calc(var(--u)*3.6); border-radius: 50%; border: 2px solid #8a6f4d; background: #fff8e6; font-size: calc(var(--u)*1.6); }
.btn { display: inline-block; border: 2px solid #6b5236; background: #fff8e6; padding: .45em 1.2em; border-radius: .6em; margin: .25em; font-size: calc(var(--u)*1.55); }
.btn:hover { background: #fff; } .btn.primary { background: var(--red); color: #fff; border-color: #5c1d15; }
.btn.small { font-size: calc(var(--u)*1.25); padding: .3em .9em; } .btn.ghost { background: transparent; } .btn.danger { border-color: var(--red); color: var(--red); }
.btn.pulse { animation: pulse 1s infinite; } @keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(201,154,58,.5); } }
.muted { color: var(--muted); font-size: .85em; }
.title-menu .game-title { font-size: calc(var(--u)*6); margin: 0; line-height: 1.1; text-shadow: 0 3px 12px rgba(0,0,0,.7); }
.title-menu .game-title span { display: block; font-size: calc(var(--u)*3); letter-spacing: .1em; }
.title-menu .subtitle { opacity: .8; margin: .4em 0 1.2em; }
.title-btns { display: flex; flex-direction: column; align-items: flex-start; }
.title-btns .btn { min-width: 60%; text-align: left; background: rgba(243,231,201,.92); color: var(--ink); }
.title-btns .btn.primary { background: var(--red); color: #fff; } .title-btns .btn.ghost { background: rgba(30,22,15,.6); color: #e6d3a8; border-color: #8a6f4d; }
.title-foot { font-size: calc(var(--u)*1.05); opacity: .7; margin-top: 1.5em; }
.choice-q { font-size: calc(var(--u)*1.8); margin-top: 0; }
.choice-btn { display: block; width: 100%; text-align: left; margin: .4em 0; padding: .6em 1em; border: 2px solid #8a6f4d; border-radius: .6em; background: #fff8e6; font-size: calc(var(--u)*1.65); }
.choice-btn:hover { background: #fff; border-color: var(--red); } .choice-btn.locked { opacity: .45; cursor: default; text-align: center; }
.slot-btn { display: block; width: 100%; text-align: left; margin: .3em 0; padding: .6em .8em; border: 2px solid #8a6f4d; border-radius: .5em; background: #fff8e6; }
.slot-btn:disabled { opacity: .55; }
.code-input { font: inherit; font-size: calc(var(--u)*1.8); padding: .3em .6em; border: 2px solid #8a6f4d; border-radius: .4em; width: 12em; letter-spacing: .15em; text-transform: uppercase; background: #fff; }
.code-show { font-family: ui-monospace, monospace; font-size: calc(var(--u)*3.4); letter-spacing: .15em; text-align: center; background: #fff; border: 2px dashed var(--red); border-radius: .4em; padding: .3em; margin: .5em 0; user-select: text; -webkit-user-select: text; }
.code-show.small { font-size: calc(var(--u)*2); }
.set-row { display: flex; justify-content: space-between; align-items: center; padding: .4em 0; border-bottom: 1px solid var(--paper2); }
.row { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
select { font: inherit; padding: .2em .4em; }
.gm .btn { display: block; width: 100%; text-align: left; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; }
.gal-item { border: 2px solid #8a6f4d; border-radius: .5em; padding: .8em; text-align: center; background: #e8dbbd; display: flex; flex-direction: column; gap: .3em; }
.gal-item.open { background: #fff8e6; }
.fail-rec { font-size: .85em; margin: .3em 0; }

/* 문서 */
.doc { background: #fffaf0; border: 1px solid #d8c59c; padding: 1.2em 1.6em; line-height: 1.8; font-size: calc(var(--u)*1.7); box-shadow: inset 0 0 30px rgba(160,130,80,.25); }
.doc.letter { background: #fbf3df; } .doc.news { columns: 1; font-size: calc(var(--u)*1.5); background: #efe7d4; }
.doc.news h4 { margin: 0 0 .4em; border-bottom: 2px solid #333; }
.doc.telegram { background: #f4ecd8; font-family: ui-monospace, monospace; letter-spacing: .05em; }
.doc .sign { text-align: right; }
.doc-note { font-size: calc(var(--u)*1.1); color: var(--muted); margin: .6em 0 0; }
.doc table { border-collapse: collapse; width: 100%; } .doc td, .doc th { border: 1px solid #b9a57e; padding: .25em .5em; text-align: left; }

/* 정리 화면 */
.sum-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8em; }
.sum-card { background: #fff8e6; border: 2px solid #c9ae7c; border-radius: .6em; padding: .8em; }
.sum-card h3 { margin: 0 0 .4em; color: var(--red); font-size: 1.05em; } .sum-card p { margin: 0; font-size: .9em; line-height: 1.6; }
.sum-more { font-size: .9em; background: #efe2c2; padding: .6em .8em; border-radius: .5em; }
.sum-table { width: 100%; border-collapse: collapse; font-size: .85em; margin-top: .6em; }
.sum-table th, .sum-table td { border: 1px solid #c9ae7c; padding: .4em .6em; vertical-align: top; width: 50%; }
.sum-table th { background: #e6d3a8; } .sum-rec, .sum-swap { margin: .6em 0 0; }

/* 수첩·기록장 */
.notebook { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.notebook section { background: #fbf3df; border: 1px solid #d8c59c; padding: .8em; border-radius: .4em; }
.notebook h3 { margin: 0 0 .4em; font-size: 1em; color: #6b5236; }
.cipher { border-collapse: collapse; font-size: .75em; width: 100%; } .cipher td { border: 1px solid #c9ae7c; text-align: center; padding: .1em; } .cipher b { display: block; color: var(--red); }
.hand { font-style: italic; color: #4a3726; }
.nb-map { width: 100%; background: #cdd6cf; border-radius: .3em; } .nb-map .land { fill: #f3e7c9; stroke: #8a6f4d; stroke-width: 1.2; stroke-linejoin: round; } .nb-map .route { fill: none; stroke: var(--red); stroke-width: 2; stroke-dasharray: 5 4; } .nb-map circle { fill: #fff; stroke: #8a6f4d; stroke-width: 2; } .nb-map circle.on { fill: var(--red); } .nb-map text { font-size: 13px; fill: #4a3726; paint-order: stroke; stroke: #f3e7c9; stroke-width: 3px; }
.tabbar { display: flex; gap: .3em; flex-wrap: wrap; border-bottom: 2px solid var(--paper2); margin-bottom: .6em; }
.tab { border: 0; background: transparent; padding: .4em .8em; border-radius: .4em .4em 0 0; } .tab.on { background: #e6d3a8; font-weight: 700; }
.rec-list { list-style: none; padding: 0; margin: 0; } .rec-list li { padding: .4em 0; border-bottom: 1px dashed #d8c59c; } .rec-list small { display: block; color: var(--muted); }
.link { border: 0; background: none; color: var(--blue); text-decoration: underline; padding: 0; }
.item-desc { text-align: center; } .big-icon { font-size: calc(var(--u)*5); }
.hints .hint { background: #fff8e6; border-left: 4px solid var(--gold); padding: .5em .8em; margin: .4em 0; }
.ans { width: 100%; border-collapse: collapse; font-size: .8em; } .ans td, .ans th { border: 1px solid #c9ae7c; padding: .3em .5em; vertical-align: top; }
.teacher h3 { margin: 1em 0 .3em; font-size: 1.05em; color: #6b5236; }
.about p { line-height: 1.7; }

/* 퍼즐 */
.pz-prompt { margin-bottom: .6em; line-height: 1.6; }
.pz-figure { margin: .4em 0 .8em; } .pz-figure svg, .pz-figure img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.pz-feedback { min-height: 1.6em; margin: .4em 0; font-weight: 700; } .pz-feedback.bad { color: var(--red); } .pz-feedback.good { color: #2e6b34; } .pz-feedback.info { color: var(--blue); }
.pz-bar { display: flex; justify-content: flex-end; gap: .4em; flex-wrap: wrap; }
.pz-tip { font-size: .8em; color: var(--muted); }
.pz-hints .hint { background: #fff8e6; border-left: 4px solid var(--gold); padding: .4em .7em; margin: .3em 0; font-size: .9em; }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.dials { display: flex; justify-content: center; gap: 1em; }
.dial { display: flex; flex-direction: column; align-items: center; background: #3a2e24; border-radius: .6em; padding: .3em; }
.dial-btn { border: 0; background: #6b5236; color: #f3e7c9; width: 3em; height: 2.2em; border-radius: .4em; font-size: 1.1em; }
.dial-val { font-family: ui-monospace, monospace; font-size: calc(var(--u)*4); color: #f3e7c9; width: 1.6em; text-align: center; }
.hg-slots { display: flex; justify-content: center; gap: .4em; margin: .4em 0; }
.hg-slot { width: 2.6em; height: 2.6em; font-size: calc(var(--u)*2.4); border: 3px solid #8a6f4d; border-radius: .4em; background: #fff; }
.hg-slot.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,74,107,.3); } .hg-slot.ok { background: #d7ecd2; border-color: #2e6b34; } .hg-slot.no { background: #f3d0c9; }
.hg-gap { width: 1.2em; }
.hg-step { font-size: .85em; color: var(--muted); margin: .4em 0 .2em; }
.hg-keys { display: flex; flex-wrap: wrap; gap: .3em; }
.hg-key { min-width: 2.4em; height: 2.4em; font-size: calc(var(--u)*1.8); border: 2px solid #8a6f4d; border-radius: .4em; background: #fff8e6; } .hg-key.wide { min-width: 5em; font-size: calc(var(--u)*1.3); }
.ord-list { display: flex; flex-direction: column; gap: .4em; }
.ord-list.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.ord-list.row6 { flex-direction: row; flex-wrap: wrap; justify-content: center; } .ord-list.row6 .ord-row { flex-direction: column; }
.ord-row { display: flex; align-items: stretch; gap: .5em; }
.ord-num, .ord-left { min-width: 2em; display: flex; align-items: center; justify-content: center; background: #e6d3a8; border-radius: .4em; font-weight: 700; padding: 0 .5em; }
.ord-left { min-width: 6em; }
.ord-item { flex: 1; text-align: left; border: 2px solid #8a6f4d; background: #fff8e6; border-radius: .5em; padding: .5em .8em; line-height: 1.5; }
.ord-item.sel { border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px rgba(139,46,34,.3); }
.quiz-step { font-size: .8em; color: var(--muted); } .quiz-q { font-weight: 700; margin: .2em 0 .6em; font-size: 1.1em; }
.quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; } .quiz-opts.one { grid-template-columns: 1fr; } .quiz-opts.three { grid-template-columns: 1fr 1fr 1fr; } .quiz-opts.many { grid-template-columns: repeat(3, 1fr); font-size: .85em; }
.quiz-opt { text-align: left; border: 2px solid #8a6f4d; background: #fff8e6; border-radius: .5em; padding: .5em .8em; line-height: 1.45; }
.quiz-opt:hover { border-color: var(--red); background: #fff; }
.sel-info { font-weight: 700; margin-bottom: .4em; } .sel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4em; }
.sel-item { border: 2px solid #8a6f4d; background: #fbf3df; border-radius: .4em; padding: .5em; font-size: .8em; text-align: left; line-height: 1.4; min-height: 6em; }
.sel-item.on { border-color: #2e6b34; background: #e5f2df; box-shadow: 0 0 0 3px rgba(46,107,52,.3); }
.mini { font-size: .8em; color: var(--muted); display: block; }
.wall { display: inline-flex; flex-direction: column; align-items: center; gap: .2em; }
@media (max-aspect-ratio: 4/3) { .panel, .panel.small { width: 90%; } }
.type-ico { display: inline-flex; align-items: center; justify-content: center; width: 1.3em; height: 1.3em; background: #8a8478; color: #1d1a16; border-radius: .15em; font-weight: 700; font-size: .85em; box-shadow: inset 0 0 0 2px #5d574d; }
.type-big { display: flex; align-items: center; justify-content: center; width: 2.2em; height: 2.2em; margin: 0 auto .2em; background: #8a8478; color: #1d1a16; border-radius: .2em; font-size: calc(var(--u)*3); font-weight: 700; box-shadow: inset 0 0 0 3px #5d574d; }
.ord-list.row6 .ord-item { text-align: center; min-width: 6em; }
.nums { display: block; font-family: ui-monospace, monospace; margin-top: .3em; }
.sel-item b, .sel-item .mini { display: block; }
.testimony p { margin: .2em 0; font-size: .9em; } .testimony b { color: var(--red); margin-right: .4em; }
.walls { max-height: 30vh; }
.ord-item .mini { display: block; }
.ord-left { flex: none; width: 11em; justify-content: flex-start; text-align: left; line-height: 1.3; }
.panel.wide.puzzle, .panel.puzzle { max-height: 96%; padding-top: calc(var(--u)*1.4); }
.spot.has-char { overflow: visible; }
.char-fig, .char-ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom center; pointer-events: none; filter: var(--tone, brightness(1)) drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.char-ph svg { width: 100%; height: 100%; opacity: .78; }

/* 말하는 인물은 장면에서 잠시 숨김 */
.spot.talking .char-fig, .spot.talking .char-ph { opacity: 0; transition: opacity .2s; }
.char-fig, .char-ph { transition: opacity .25s; }
.spot.flip .char-fig, .spot.flip .char-ph { transform: scaleX(-1); }
/* 한국어 낱말이 중간에서 잘리지 않게 */
body, .panel, #dialog-text, .card-text, button { word-break: keep-all; overflow-wrap: break-word; }

.inv-bag.pulse { animation: bagpulse .8s ease-in-out 3; } @keyframes bagpulse { 50% { transform: scale(1.12); box-shadow: 0 0 calc(var(--u)*1.5) rgba(255,214,140,.9); } }

/* ---- 6장 새 퍼즐: 짝 배정·증거 내밀기·전령 배치 ---- */
.asg { display: flex; flex-direction: column; gap: .5em; }
.asg-row { display: flex; gap: .6em; align-items: center; border-bottom: 1px dashed #c9b48e; padding-bottom: .4em; }
.asg-who { flex: 0 0 9.5em; font-weight: 700; line-height: 1.35; }
.asg-who .mini { display: block; font-weight: 400; font-size: .78em; color: #6b5236; }
.asg-opts { display: flex; flex-wrap: wrap; gap: .3em; flex: 1; }
.asg-opt { border: 2px solid #8a6f4d; background: #fff8e6; border-radius: .5em; padding: .35em .7em; font-size: .9em; }
.asg-opt.on { border-color: #2e6b34; background: #e5f2df; box-shadow: 0 0 0 3px rgba(46,107,52,.25); font-weight: 700; }
.pre-say { background: #3a2c1f; color: #fbf3df; border-radius: .6em; padding: .7em 1em; margin: .3em 0 .6em; line-height: 1.55; }
.pre-say b { color: #f0c987; margin-right: .5em; }
.pre-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35em; max-height: 46vh; overflow-y: auto; padding-right: .2em; }
.pre-ev { text-align: left; border: 2px solid #8a6f4d; background: #fff8e6; border-radius: .5em; padding: .4em .6em; line-height: 1.35; font-size: .85em; }
.pre-ev:hover { border-color: var(--red); background: #fff; }
.pre-ev b, .pre-ev .mini { display: block; } .pre-ev .mini { font-size: .82em; color: #5a4632; margin-top: .15em; }
.dsp-meter { display: flex; flex-wrap: wrap; gap: .4em; margin: .6em 0 .3em; }
.dsp-m { background: #efe2c4; border-radius: 1em; padding: .2em .8em; font-weight: 700; font-size: .9em; }
.dsp-m.over { background: #f3c9c0; color: #8b2e22; }
.dsp-rules { font-size: .82em; color: #5a4632; line-height: 1.45; } .dsp-rules p { margin: .15em 0; }
.dec-row { display: flex; align-items: center; gap: .6em; margin: .35em 0; }
.dec-q { flex: 0 0 12em; font-weight: 700; }
.dec-sel { flex: 1; font: inherit; padding: .35em; border: 2px solid #8a6f4d; border-radius: .4em; background: #fff8e6; }
@media (max-width: 700px) { .asg-row { flex-direction: column; align-items: stretch; } .asg-who { flex: none; } .pre-grid { grid-template-columns: 1fr; } .dec-row { flex-direction: column; align-items: stretch; } .dec-q { flex: none; } }
.sum-mine { background: #eef3e4; border-left: 4px solid #2e6b34; border-radius: .4em; padding: .5em .9em; margin: .6em 0; }
.sum-mine ul { margin: .3em 0 0; padding-left: 1.2em; line-height: 1.6; }
.ans + .warn, .warn { background: #fbe9e4; border: 1px solid #d9a497; border-radius: .4em; padding: .6em .8em; line-height: 1.55; }
/* 보관함을 펼쳤을 때 목록을 손가락·휠로 스크롤할 수 있게 */
#inventory:has(.inv-bag.open) { pointer-events: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-right: .2em; }
#inventory::-webkit-scrollbar { width: 6px; } #inventory::-webkit-scrollbar-thumb { background: rgba(243,231,201,.5); border-radius: 3px; }
.inv-bag { position: sticky; top: 0; z-index: 1; flex-shrink: 0; } .inv-item { flex-shrink: 0; }

.pz-evi { background: #fbf4e2; border: 1px solid #d8c69a; border-radius: 8px; padding: .4em .8em; margin: .4em 0; max-height: 34vh; overflow-y: auto; font-size: .88em; }
.pz-evi ul { margin: 0; padding-left: 1.1em; }
.pz-evi li { margin: .3em 0; }
.task-bar { position: absolute; right: 1.2%; bottom: 4%; display: flex; flex-direction: column; align-items: flex-end; gap: calc(var(--u)*.5); z-index: 5; }
.task-btn { pointer-events: auto; background: rgba(150,105,40,.95); color: #fff6dd; border: 2px solid #f3d58a; border-radius: 1.4em; padding: .45em 1.1em; font: inherit; font-size: calc(var(--u)*1.35); font-weight: 700; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.45); animation: taskPulse 2.4s ease-in-out infinite; }
.task-btn:hover { background: rgba(175,125,50,1); }
@keyframes taskPulse { 0%,100% { box-shadow: 0 3px 10px rgba(0,0,0,.45); } 50% { box-shadow: 0 0 0 4px rgba(243,213,138,.45), 0 3px 10px rgba(0,0,0,.45); } }

.hw-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6em; margin: .3em 0; }
.hw-card { background: #f6ecd2; border: 1px solid #cdb88a; border-radius: 6px; padding: .45em .6em; box-shadow: inset 0 0 18px rgba(140,100,40,.12); }
.hw-card.key { border: 2px solid #9a6a2a; background: #f3e3bd; grid-column: 1 / -1; }
.hw-head { display: flex; flex-wrap: wrap; gap: .1em .6em; align-items: baseline; font-size: .9em; }
.hw-head span { color: #6b5638; font-size: .92em; }
.hw-row { display: flex; gap: .5em; flex-wrap: wrap; margin-top: .25em; }
.hw-cell { margin: 0; text-align: center; }
.hw-g { width: 84px; height: 84px; background: repeating-linear-gradient(0deg, transparent 0 24px, rgba(120,90,50,.08) 24px 25px); border-radius: 4px; }
.hw-cell figcaption { font-size: .78em; color: #6b5638; }
.hw-table { margin-top: .5em; }
/* 첫 화면: 노트북처럼 화면이 낮아도 메뉴가 한눈에 들어오게, 스크롤 막대는 숨김 */
.panel.title { max-height: 98%; padding-top: calc(var(--u)*1.2); padding-bottom: calc(var(--u)*1); scrollbar-width: none; }
.panel.title::-webkit-scrollbar { display: none; }
.title-btns .btn { padding: .3em 1.2em; margin: .16em .25em; }
.title-menu .subtitle { margin: .3em 0 .8em; }
.title-foot { margin-top: .8em; }

.asg-opt.off { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
