/* 머털도사 복원 사이트. 게임 화면을 따른다: 바탕은 타이틀의 하늘과 산, 글은 대화창(한 칸 건너 검은 점무늬 바탕과
   나무결 금테, 이름은 "[ 이름 ]"). 문단은 중간에 줄을 끊지 않고 낱말 단위로 이어 흐른다. 그림은 art/(원본에서 뽑음). */
:root {
  --ink: #fffbe9;
  --dim: #d8cfae;
  --name: #ffe27a;
  --gold: #e8b45a;
  --wood: #6b2a0c;
  --link: #ffd36a;
  --accent: #8fd7ff;
  --red: #c4472c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: #0b1a3a; }
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.8 "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: #0b1a3a url(art/sky.webp) center top / cover fixed;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(5, 10, 30, .15), rgba(5, 10, 30, .55) 60%, rgba(5, 10, 30, .8));
}
p, li, td, th, dd, summary, figcaption, h1, h2, h3 { word-break: keep-all; overflow-wrap: break-word; }
a { color: var(--link); }
a:hover { color: #fff1b0; }
img { max-width: 100%; height: auto; }

.top, .bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px;
  padding: 8px 20px; background: rgba(0, 0, 0, .62); border-bottom: 2px solid var(--wood);
}
.bottom { justify-content: center; border: 0; border-top: 2px solid var(--wood); color: var(--dim); font-size: 13px; margin-top: 40px; }
.top .archive { color: var(--dim); text-decoration: none; font-size: 13px; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.top nav a { color: var(--ink); text-decoration: none; padding: 2px 0; }
.top nav a.here { color: var(--name); border-bottom: 2px solid var(--gold); }

.hero { text-align: center; padding: 34px 16px 10px; }
.hero.small { padding: 22px 16px 0; }
.hero .logo { width: min(560px, 90vw); image-rendering: pixelated; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.hero.small .logo { width: min(380px, 80vw); }
.hero .subtitle { margin: 4px 0 0; color: var(--name); font-weight: 700; letter-spacing: .3em; text-shadow: 0 2px 4px #000; }
/* 첫 화면의 게임 화면(원작 그대로 640×480): 소개 글 옆에 타이틀, 아래 칸에 세 장면. 좁은 화면에서는 세로로 */
.screen { margin: 0; }
.screen img { display: block; width: 100%; height: auto; border: 2px solid var(--wood); box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
.screen figcaption { margin-top: 4px; color: var(--dim); font-size: 13px; text-align: center; }
.lead .screen.title { float: right; width: min(420px, 46%); margin: 4px 0 12px 22px; }
.lead::after { content: ""; display: block; clear: both; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) {
  .lead .screen.title { float: none; width: 100%; margin: 0 0 12px; }
  .shots { grid-template-columns: 1fr; }
}

main { max-width: 1080px; margin: 0 auto; padding: 22px 16px; }

/* 대화창: 원작 테두리 9조각(art/frame.png, 모서리 17·왼쪽 20, 변은 48칸 조각 그대로)과 점무늬 바탕.
   테두리 바깥 11칸만 불투명하고 안쪽은 비어 있으므로 바탕을 테두리 밑까지 깐다(게임도 안쪽은 점무늬). */
.window {
  position: relative; margin: 0 0 24px; padding: 14px 18px 12px;
  border-style: solid; border-width: 17px 17px 17px 20px;
  border-image: url(art/frame.png) 17 17 17 20 round;
  background:
    repeating-conic-gradient(rgba(0, 0, 0, .92) 0 25%, rgba(0, 0, 0, .55) 0 50%) 0 0 / 2px 2px;
  image-rendering: pixelated;
}
.window h1, .window h2, .window h3 { margin: 0 0 10px; line-height: 1.5; }
.window h1 { font-size: clamp(22px, 3.4vw, 30px); color: var(--name); }
.window h2 { font-size: 20px; color: var(--name); }
.window h2::before { content: "[ "; color: var(--gold); }
.window h2::after { content: " ]"; color: var(--gold); }
.window h3 { font-size: 16px; color: var(--name); margin-top: 16px; }
.window p { margin: 0 0 10px; }
.window p:last-child { margin-bottom: 0; }
.window ul, .window ol { margin: 0 0 10px; padding-left: 1.3em; }
.window.lead p { font-size: 17px; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 760px) { .columns { grid-template-columns: 1fr; } }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
button, .button {
  font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; text-decoration: none;
  background: linear-gradient(#7a3a12, #4a1c06); border: 2px solid; border-color: #f0c070 #3a1404 #3a1404 #f0c070;
  padding: 6px 14px; display: inline-block; border-radius: 0;
}
button:hover, .button:hover { background: linear-gradient(#9a4c18, #5a240a); color: #fff; }
/* hidden 속성은 늘 숨긴다: 위 button의 display가 브라우저 기본 [hidden]을 이겨서, 숨긴 단추(관리자만 보는 4:3/16:9 등)가
   그대로 보였다(2026-10-27 사용자 지적 "로그인도 안했는데 4:3 버튼이 보였음"). */
[hidden] { display: none !important; }
button:disabled { opacity: .45; cursor: default; }
.button.primary, button.primary { font-weight: 700; color: #fff7d8; background: linear-gradient(#c4472c, #7a1c0c); }
button.on { background: linear-gradient(#1f6a86, #0c2e3c); border-color: #9fe0ff #0a2430 #0a2430 #9fe0ff; }
button.off { color: var(--dim); }
.status { color: var(--dim); }

.window p.note { color: var(--dim); font-size: 14px; }
.faces { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.faces img { width: 84px; height: 84px; object-fit: cover; object-position: top; image-rendering: pixelated; background: rgba(0, 0, 0, .35); }

.toc ol { columns: 2; column-gap: 30px; margin: 0; }
@media (max-width: 560px) { .toc ol { columns: 1; } }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px 20px; }
.person { display: grid; grid-template-columns: 100px 1fr; gap: 12px; align-items: start; }
.person img { width: 100px; height: 100px; object-fit: cover; object-position: top; image-rendering: pixelated; background: rgba(0, 0, 0, .35); }
.person h3 { margin: 0 0 4px; }
.person h3::before { content: "[ "; color: var(--gold); }
.person h3::after { content: " ]"; color: var(--gold); }
.person p { margin: 0 0 6px; font-size: 15px; }
details { margin: 4px 0 8px; }
details summary { cursor: pointer; color: var(--accent); }
details[open] summary { margin-bottom: 6px; }

figure.map { margin: 10px 0 16px; }
figure.map img { width: 100%; image-rendering: auto; border: 2px solid var(--wood); }
figcaption { color: var(--dim); font-size: 13px; }

.regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 20px; }
.region h3 { margin: 8px 0 2px; font-size: 15px; }
.region ul { list-style: none; padding: 0; margin: 0; }
.region li { font-size: 15px; }
.code { color: var(--dim); font-family: Consolas, monospace; font-size: 12px; margin-right: 4px; }

table.list { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 15px; }
table.list th { text-align: left; color: var(--name); border-bottom: 2px solid var(--gold); padding: 6px 8px; }
table.list td { padding: 6px 8px; border-bottom: 1px solid rgba(232, 180, 90, .28); vertical-align: top; }

/* 실행 페이지(씰 방식): 창 전체가 게임. 위에 메뉴 한 줄, 가운데 게임 화면(4:3, 창에 맞춤), 판 이력·세이브·조작·화면 키·디버그는
   메뉴를 누르면 게임 위에 뜨는 창. 시작 단추와 받기 진행은 게임 화면 위에 덮는다. */
body.play { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; background: #050a18; }
body.play::before { display: none; }
.playbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; flex: none; position: relative; z-index: 3;
  background: linear-gradient(#3a1606, #200b02); border-bottom: 2px solid var(--gold);
}
.playbar .back { color: var(--dim); text-decoration: none; white-space: nowrap; font-size: 14px; }
.barmenu { display: contents; }
#menubtn { display: none; }
.playbar .back:hover { color: var(--ink); }
.playbar h1 { margin: 0; font-size: 15px; color: var(--name); white-space: nowrap; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.playbar button, .playbar .login { font-size: 13px; padding: 4px 10px; min-height: 32px; white-space: nowrap; }
.playbar .login { color: #1c1408; background: linear-gradient(#ffe27a, #e8b45a); text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; }
.playbar .login[hidden] { display: none; }
.playbar button[aria-expanded="true"] { background: linear-gradient(#1f6a86, #0c2e3c); }
.playbar .ver { font-size: 12px; padding: 1px 6px; min-height: 0; margin-left: 6px; vertical-align: 1px; }
.vol { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; white-space: nowrap; }
.vol input { width: 96px; accent-color: var(--gold); }
#volv { min-width: 3em; }
/* 좁은 화면·낮은 화면(휴대폰 세로·가로): 줄에는 「← 머털도사」·판·「☰ 메뉴」만, 나머지는 메뉴를 누르면 아래로 펼쳐지는 목록
   (2026-10-27 사용자 지적 "모바일 최적화 하나도 안된거 같던데", 전에는 줄이 화면 밖으로 넘쳐 단추 대부분이 안 보였다) */
@media (max-width: 900px), (max-height: 520px) {
  .playbar { gap: 6px; padding: 4px 8px; }
  .playbar .title { display: none; }
  .playbar .ver { margin-left: 0; }
  #menubtn { display: inline-block; flex: none; }
  .barmenu {
    display: none; position: absolute; right: 6px; top: calc(100% + 4px); flex-direction: column; align-items: stretch; gap: 8px;
    min-width: 13em; max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); overflow: auto; padding: 12px;
    background: linear-gradient(#3a1606, #200b02); border: 2px solid var(--gold); box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
  }
  .playbar.open { z-index: 20; }
  .playbar.open .barmenu { display: flex; }
  .barmenu > button, .barmenu > .login { min-height: 40px; font-size: 15px; justify-content: center; }
  .barmenu .vol input { flex: 1; width: auto; }
  #menubtn[aria-expanded="true"] { background: linear-gradient(#1f6a86, #0c2e3c); }
}
@media (max-height: 520px) {
  .playbar { padding: 3px 8px; }
  .playbar > button, .playbar .back { min-height: 28px; font-size: 12px; padding: 2px 8px; }
  .playbar h1 { font-size: 13px; }
}

body.play main { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.playarea { position: relative; display: flex; flex-direction: column; height: min(100%, 75vw); aspect-ratio: 4 / 3; }
.playarea.tall { height: 100%; width: 100%; aspect-ratio: auto; justify-content: flex-start; }
/* 화면 키가 켜진 가로 화면(휴대폰): 게임 칸이 메뉴 줄 아래를 다 쓰고 게임 화면은 가운데 높이에 꽉, 화면 키는 양옆 빈 칸에 놓인다 */
.playarea.side, .playarea.wide.side { height: 100%; width: 100%; aspect-ratio: auto; justify-content: center; align-items: center; }
.playarea.side .stage { width: auto; height: min(100%, 75vw); }
.playarea.wide.side .stage { height: min(100%, 56.25vw); }
.stage { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; flex: none; }
.stage canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: none; outline: none; touch-action: none; }
.padspace { display: none; flex: 1; }
.playarea.tall .padspace { display: block; }
.playarea:fullscreen { background: #000; height: 100%; width: 100%; aspect-ratio: auto; justify-content: center; }
.playarea:fullscreen .stage { width: auto; height: min(100%, 75vw); margin: 0 auto; }
/* 16:9(docs/widescreen.md): 엔진이 양옆 띠를 붙인 854×480을 보낸다 */
.playarea.wide { height: min(100%, 56.25vw); aspect-ratio: 16 / 9; }
.playarea.wide .stage { aspect-ratio: 16 / 9; }
.playarea.wide.tall { height: 100%; aspect-ratio: auto; }
.playarea.wide:fullscreen { height: 100%; aspect-ratio: auto; }
.playarea.wide:fullscreen .stage { height: min(100%, 56.25vw); }
.playbar button[aria-pressed="true"]#widebtn { background: linear-gradient(#1f6a86, #0c2e3c); }
.playarea:fullscreen .padspace { display: none; }

.cover {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center; background: #0b1a3a url(art/sky.webp) center / cover;
}
.cover[hidden] { display: none; }
.cover .logo { width: min(70%, 460px); image-rendering: pixelated; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.cover .subtitle { margin: 0; color: var(--name); font-weight: 700; letter-spacing: .3em; text-shadow: 0 2px 4px #000; }
.cover .status { margin: 6px 0 0; max-width: 32em; color: var(--ink); text-shadow: 0 1px 3px #000; background: rgba(0, 0, 0, .45); padding: 4px 10px; }
.cover .go { font-size: 18px; padding: 10px 30px; font-weight: 700; color: #fff7d8; background: linear-gradient(#c4472c, #7a1c0c); }
.cover .buttons { justify-content: center; }
.cover .rotate { display: none; margin: 4px 0 0; color: var(--name); font-size: 14px; text-shadow: 0 1px 3px #000; }
@media (orientation: portrait) and (pointer: coarse) { .cover .rotate { display: block; } }
@media (max-height: 520px) {
  .cover { gap: 6px; padding: 10px 20px; }
  .cover .logo { width: min(46%, 340px); }
  .cover .go { font-size: 16px; padding: 8px 26px; }
}
#pick.over { outline: 3px dashed var(--accent); outline-offset: 4px; }
.meter { width: min(320px, 70vw); height: 10px; margin: 10px auto 0; background: rgba(0, 0, 0, .55); border: 1px solid var(--gold); }
.meter[hidden] { display: none; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe27a, #e8b45a); }

/* 메뉴의 창은 게임 대화창 모양(나무결 금테·점무늬 바탕). 디버그 창은 게임 화면 안쪽 가운데에 뜬다. */
.panel {
  position: absolute; right: 10px; top: 8px; z-index: 4; width: min(32em, calc(100vw - 20px)); max-height: calc(100% - 16px); overflow: auto;
  border-style: solid; border-width: 17px 17px 17px 20px; border-image: url(art/frame.png) 17 17 17 20 round;
  background: repeating-conic-gradient(rgba(0, 0, 0, .95) 0 25%, rgba(0, 0, 0, .78) 0 50%) 0 0 / 2px 2px;
  padding: 6px 10px; font-size: 14px; image-rendering: pixelated;
}
.panel h2::before { content: "[ "; color: var(--gold); }
.panel h2::after { content: " ]"; color: var(--gold); }
.stage .panel.ingame { right: auto; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(24em, 92%); max-height: 92%; z-index: 6; }
.panel[hidden] { display: none; }
.panel h2 { margin: 0 0 6px; font-size: 16px; color: var(--name); }
.panel h3 { margin: 14px 0 4px; font-size: 14px; color: var(--name); }
.panel p { margin: 6px 0; }
.panel .buttons { margin: 8px 0 2px; gap: 6px; }
.panel button, .panel .button { font-size: 13px; padding: 4px 10px; }

.pad { position: absolute; inset: 0; pointer-events: none; z-index: 2; --s: 1; --o: .55; }
.pad[hidden] { display: none; }
.pad .k {
  position: absolute; transform: translate(-50%, -50%); width: calc(var(--s) * 62px); height: calc(var(--s) * 62px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px;
  pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: rgba(60, 22, 6, .6); border: 2px solid rgba(240, 192, 112, .9); color: #fff8e0;
  font: 700 calc(var(--s) * 15px)/1.1 "Noto Sans KR", "Malgun Gothic", sans-serif; opacity: var(--o);
}
.pad .k.sm { width: calc(var(--s) * 50px); height: calc(var(--s) * 50px); font-size: calc(var(--s) * 13px); }
.pad .k.pill { width: auto; height: calc(var(--s) * 32px); border-radius: 9px; padding: 0 calc(var(--s) * 10px); white-space: nowrap; font-size: calc(var(--s) * 12px); }
.pad .k.long { font-size: calc(var(--s) * 12px); letter-spacing: -.04em; }
.pad .k.down { background: rgba(232, 180, 90, .85); color: #2a1000; border-color: #fff; }
.pad .k.on { background: rgba(31, 106, 134, .9); border-color: #9fe0ff; opacity: max(var(--o), .85); }
.pad .k.arm { background: linear-gradient(90deg, rgba(232, 180, 90, .9) var(--fill, 0%), rgba(60, 22, 6, .6) var(--fill, 0%)); }
.pad .k.idle { opacity: calc(var(--o) * .3); border-style: dashed; }
.pad .k.off { display: none; }
.pad .joy { width: calc(var(--s) * 150px); height: calc(var(--s) * 150px); background: rgba(60, 22, 6, .4); }
.pad .joy i { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; margin: -21% 0 0 -21%; border-radius: 50%; background: rgba(255, 240, 200, .55); pointer-events: none; }
.pad .joy b { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; font-size: calc(var(--s) * 12px); color: #fff8e0; text-shadow: 0 1px 2px #000; white-space: nowrap; pointer-events: none; }
.pad .joy.cur { width: calc(var(--s) * 120px); height: calc(var(--s) * 120px); }
/* 이동 패드: 십자 모양(커서 패드와 구별). 끝까지 밀면 뛰기(테두리가 밝아짐) */
.pad .joy.walk {
  background:
    linear-gradient(rgba(240, 192, 112, .32), rgba(240, 192, 112, .32)) center / 30% 84% no-repeat,
    linear-gradient(rgba(240, 192, 112, .32), rgba(240, 192, 112, .32)) center / 84% 30% no-repeat,
    rgba(60, 22, 6, .4);
}
.pad .joy.walk.run { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 226, 122, .7); }
.pad .gear { width: calc(var(--s) * 40px); height: calc(var(--s) * 40px); border-radius: 8px; font-size: calc(var(--s) * 18px); }
.pad.edit .k { outline: 2px dashed var(--accent); outline-offset: 3px; opacity: max(var(--o), .6); }
.pad.edit .k.off { display: flex; }
.pad.edit::before {
  content: "끌어서 옮기세요 — 다 옮겼으면 「옮기기 끝」"; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .85); border: 1px solid var(--accent); color: var(--accent); padding: 4px 12px; font-size: 13px; white-space: nowrap;
}
.padset label, .padmode label { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.padset input[type=range] { flex: 1; accent-color: var(--gold); }
.padmode { border: 0; margin: 6px 0; padding: 0; }
.padmode legend { color: var(--dim); padding: 0; }
.padset .opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: 0 10px; margin: 0 0 6px; }
#padedit.down { background: linear-gradient(#1f6a86, #0c2e3c); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; }

/* 판 단추와 판 이력 */
.ver { font-size: 13px; font-weight: 400; padding: 2px 8px; margin-left: 8px; vertical-align: middle; }
.changes ol { list-style: none; margin: 0; padding: 0; }
.changes ol > li { padding: 8px 0; border-top: 1px solid rgba(232, 180, 90, .28); }
.changes .when { margin: 0; color: var(--name); font-weight: 700; }
.changes .when em { font-style: normal; color: var(--accent); font-weight: 400; margin-left: 8px; }
.changes ul { margin: 4px 0 0; padding-left: 1.2em; }
.toast, .error {
  position: absolute; left: 50%; transform: translateX(-50%); top: 10px; z-index: 5; max-width: calc(100% - 32px);
  padding: 8px 16px; background: rgba(0, 0, 0, .88); border: 2px solid var(--gold);
}
.error { top: auto; bottom: 10px; border-color: var(--red); color: #ffd6cc; }
table.keys { width: 100%; border-collapse: collapse; }
table.keys th { text-align: left; white-space: nowrap; vertical-align: top; color: var(--name); padding: 6px 14px 6px 0; }
table.keys td { padding: 6px 0; border-bottom: 1px solid rgba(232, 180, 90, .25); }
.saves { padding-left: 18px; }
.saves li { margin: 4px 0; }
.saves button { font-size: 13px; padding: 2px 8px; margin-left: 6px; }
.cloud { color: var(--accent); }
.cloud.bad { color: #ffb4a4; }

@media (max-width: 640px) {
  body { font-size: 15px; background-attachment: scroll; }
  main { padding: 14px 8px; }
  .window { padding: 10px 10px 8px; }
  .person { grid-template-columns: 72px 1fr; }
  .person img { width: 72px; height: 72px; }
  table.keys th { display: block; padding-bottom: 0; }
  table.keys td { display: block; }
  table.list { font-size: 14px; }
}

/* 자료집 탭: 자바스크립트가 있으면 고른 탭 하나만 보인다(없으면 모두 펼침). 차례는 위에 붙어 따라온다. */
.tabs {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; padding: 6px 0;
  background: rgba(8, 14, 34, .88); backdrop-filter: blur(4px);
}
.tabs a {
  font-size: 14px; color: var(--ink); text-decoration: none; padding: 3px 10px;
  background: linear-gradient(#7a3a12, #4a1c06); border: 2px solid; border-color: #f0c070 #3a1404 #3a1404 #f0c070;
}
.tabs a:hover { background: linear-gradient(#9a4c18, #5a240a); color: #fff; }
.tabs a.here { color: #2a1000; font-weight: 700; background: linear-gradient(#ffe27a, #e8b45a); }
.wiki.tabbed main > .tab { display: none; }
.wiki.tabbed main > .tab.on { display: block; }
.spoiler { margin-top: 16px; padding-top: 10px; border-top: 1px solid rgba(232, 180, 90, .35); }
.twists { display: grid; grid-template-columns: 5em 1fr; gap: 6px 12px; margin: 0; }
.twists dt { color: var(--name); font-weight: 700; }
.twists dd { margin: 0; }

/* 장 고르기 단추와 지도 보기 */
.chapters { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.chapters button { font-size: 13px; padding: 3px 9px; }
.vstatus { color: var(--name); font-size: 14px; min-height: 1.6em; margin: 4px 0 !important; }
.viewer { position: relative; height: min(72vh, 760px); background: #181818; border: 2px solid var(--wood); overflow: hidden; }
.viewer canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; image-rendering: auto; }
.viewer canvas.drag { cursor: grabbing; }
.viewer:fullscreen { height: 100%; border: 0; }
.vlabel {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); pointer-events: none;
  background: rgba(0, 0, 0, .82); border: 1px solid var(--gold); padding: 2px 8px; font-size: 13px;
}
.vlabel:empty { display: none; }
.vzoom { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.vzoom button { font-size: 14px; padding: 2px 10px; min-width: 2.2em; }
.viewer noscript p { padding: 16px; }
.maplist { columns: 3 220px; list-style: none; padding: 0 !important; margin: 6px 0 0; }
.maplist button { background: none; border: 0; color: var(--link); padding: 0; font-size: 14px; text-align: left; }
.maplist button:hover { background: none; color: #fff1b0; text-decoration: underline; }

/* 아이템 표와 요괴 */
table.items td { vertical-align: middle; }
table.items td.icon { width: 72px; text-align: center; padding: 4px; }
table.items img, .monster img, td span.icon img { image-rendering: pixelated; }
td span.icon img { vertical-align: middle; margin-right: 6px; }
.desc { color: var(--dim); font-size: 13px; }
td.num { text-align: right; white-space: nowrap; }
.monsters { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.monster { background: rgba(0, 0, 0, .35); padding: 10px 12px; border: 1px solid rgba(232, 180, 90, .35); }
.monster .pic { display: flex; align-items: flex-end; justify-content: center; min-height: 130px; }
.monster .pic img { max-height: 300px; width: auto; }
.monster h3 { margin: 8px 0 2px; }
.monster table.list { font-size: 13px; margin: 4px 0; }
.monster table.list td, .monster table.list th { padding: 2px 6px; }
.monster .where { font-size: 13px; color: var(--dim); margin: 4px 0 0; }

/* 대사집 */
.find { font: inherit; font-size: 15px; width: min(24em, 100%); padding: 4px 8px; color: var(--ink); background: rgba(0, 0, 0, .55); border: 1px solid var(--gold); }
.dlgareas { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 4px 0 8px; font-size: 14px; }
.dlg section { scroll-margin-top: 60px; }
.dlg h3 { margin: 18px 0 4px; }
.line { display: grid; grid-template-columns: 9em 1fr; gap: 0 12px; padding: 4px 0; border-bottom: 1px solid rgba(232, 180, 90, .16); }
.line b { color: var(--name); font-weight: 700; font-size: 14px; }
.line p { margin: 0 !important; white-space: pre-line; }
.line[hidden], .dlg section[hidden] { display: none; }
@media (max-width: 640px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; font-size: 13px; padding: 2px 8px; }
  table.items tr:first-child { display: none; }
  table.items tr { display: grid; grid-template-columns: 56px 1fr; padding: 6px 0; border-bottom: 1px solid rgba(232, 180, 90, .28); }
  table.items td { border: 0; padding: 1px 4px; }
  table.items td.icon { grid-row: span 4; width: auto; }
  table.items td.num { text-align: left; }
  table.items td.num::before { content: "값 "; color: var(--dim); }
  table.items td:last-child::before { content: "파는 곳 "; color: var(--dim); }
  .line { grid-template-columns: 1fr; }
  .twists { grid-template-columns: 1fr; }
  .twists dd { margin-bottom: 6px; }
}
