/* 엔딩 (public/js/ending.js) — 공식 실록 한 줄 · 잠룡실록 두루마리(세로쓰기) · 크레딧. 바탕 그림은 #backdrop(title.js 장면) */
#ending { --en-ink: #1e140c; --en-red: #8e1c12; --en-gold: #d9b56a; --en-paper: #efe2c4; --en-dim: rgba(5, 6, 8, 0.45);
  position: fixed; inset: 0; z-index: 200; word-break: keep-all; color: var(--paper, #e8dcc0); font-family: var(--font); background: var(--en-dim); }
#ending.hidden, #ending.pansori { display: none; }
#ending .en-stage { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
#ending .en-stage.on { display: flex; animation: en-fade 1.6s ease both; }
@keyframes en-fade { from { opacity: 0; } to { opacity: 1; } }
#ending .en-skip { position: absolute; right: 22px; bottom: 18px; padding: 6px 14px; font-family: var(--font); font-size: 14px; color: #d9c79e;
  background: rgba(10, 8, 6, 0.55); border: 1px solid rgba(201, 162, 79, 0.5); }

/* ② 공식 실록: 한지 쪽지 한 장, 붉은 인장이 늦게 찍힌다 */
.en-slip { position: relative; width: min(560px, calc(100vw - 32px)); padding: 34px 40px 46px; color: var(--en-ink);
  background: url("../ui/tex_hanji.png") center / 320px, var(--en-paper); box-shadow: 0 18px 60px rgba(0,0,0,0.65), inset 0 0 40px rgba(120, 90, 50, 0.25); }
.en-slip::before, .en-slip::after { content: ''; position: absolute; left: -12px; right: -12px; height: 16px; background: linear-gradient(#6a4a2a, #2e1c10); border-radius: 8px; }
.en-slip::before { top: -16px; } .en-slip::after { bottom: -16px; }
.en-slip-h { font-family: var(--title); font-size: 18px; letter-spacing: 8px; color: #1a2a5a; border-bottom: 1px solid #8a6a4a; padding-bottom: 8px; margin-bottom: 22px; text-align: center; }
.en-slip-b { font-family: 'Noto Serif KR', serif; font-size: clamp(20px, 3.4vw, 30px); line-height: 1.7; text-align: center; letter-spacing: 1px; }
.en-seal { position: absolute; right: 26px; bottom: 18px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  font-family: var(--title); font-size: 20px; line-height: 1; color: #f6dccb; background: var(--en-red); border: 3px double #f6dccb; transform: rotate(-8deg) scale(2.4); opacity: 0;
  box-shadow: 0 0 0 2px var(--en-red); writing-mode: vertical-rl; letter-spacing: 2px; }
.en-official.stamped .en-seal { animation: en-stamp 0.32s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes en-stamp { to { transform: rotate(-8deg) scale(1); opacity: 0.92; } }

/* ③ 잠룡실록: 세로쓰기 두루마리, 오른쪽에서 왼쪽으로 읽힌다 */
.en-roll { position: relative; display: flex; align-items: stretch; height: min(70vh, 620px); width: min(1100px, calc(100vw - 32px)); }
.en-rod { flex: none; width: 18px; background: linear-gradient(90deg, #2e1c10, #7a5634 45%, #3a2414); border-radius: 9px; box-shadow: 0 8px 20px rgba(0,0,0,0.6); }
.en-rod::before, .en-rod::after { content: ''; display: block; width: 26px; height: 14px; margin-left: -4px; background: #1a100a; border-radius: 4px; }
.en-rod::after { margin-top: calc(min(70vh, 620px) - 28px); }
.en-sheet { flex: 1; position: relative; overflow: hidden; color: var(--en-ink); background: url("../ui/tex_hanji.png") center / 340px, var(--en-paper);
  box-shadow: inset 0 0 50px rgba(110, 80, 40, 0.35); }
.en-strip { position: absolute; top: 0; right: 0; height: 100%; display: flex; flex-direction: row-reverse; gap: 0; padding: 30px 26px; box-sizing: border-box; will-change: transform; }
.en-col { writing-mode: vertical-rl; text-orientation: upright; height: 100%; max-height: 100%; padding: 0 12px; font-size: 17px; line-height: 1.95; letter-spacing: 2px;
  border-left: 1px solid rgba(140, 40, 30, 0.35); flex-wrap: wrap; }
.en-col .en-q { display: block; font-family: var(--title); color: var(--en-red); margin-left: 6px; letter-spacing: 3px; }
.en-col-title { font-family: var(--title); font-size: 30px; color: var(--en-red); letter-spacing: 10px; border-left: 2px solid var(--en-red); padding: 0 18px; }
.en-col-foot { font-size: 14px; color: #5a4a36; border-left: none; padding-left: 40px; }

/* ④ 크레딧: 먹빛 바탕 위로 금빛 글이 오른다 */
.en-cwrap { position: relative; width: min(640px, calc(100vw - 32px)); height: 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent); }
.en-clist { position: absolute; left: 0; right: 0; top: 0; text-align: center; will-change: transform; text-shadow: 0 2px 6px #000; }
.en-ctitle { font-family: var(--title); font-size: clamp(40px, 7vw, 66px); color: #c63a2a; letter-spacing: 10px; margin: 0 0 90px; text-shadow: 0 0 30px rgba(200,40,20,0.45), 2px 2px 0 #1a0805; }
.en-ctitle small { display: block; margin-top: 10px; font-size: 18px; color: #d9c79e; letter-spacing: 6px; }
.en-clist section { margin: 0 0 70px; }
.en-clist h4 { font-family: var(--title); font-weight: 400; font-size: 22px; color: var(--en-gold); letter-spacing: 8px; margin: 0 0 18px; }
.en-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 5px 0; font-size: 16px; }
.en-row span { text-align: right; color: #cdbf9e; }
.en-row b { text-align: left; font-weight: 400; color: #f2e6c8; }
.en-note { font-size: 17px; line-height: 2; color: #e8dcc0; margin: 0; }
.en-cend { font-family: var(--title); font-size: 46px; color: #9a2a20; margin: 40px 0 0; }

/* ⑤ 다시 주막촌 */
.en-last-t { font-family: var(--title); font-size: clamp(26px, 4.4vw, 40px); color: #f2e6c8; letter-spacing: 6px; text-align: center; text-shadow: 0 2px 10px #000; }
.en-last-t small { display: block; margin-top: 14px; font-family: var(--font); font-size: 16px; color: #cdbf9e; letter-spacing: 1px; }

@media (max-width: 640px) {
  .en-col { font-size: 15px; line-height: 1.8; }
  .en-roll { height: 64vh; }
  .en-row { grid-template-columns: 1fr; gap: 0; } .en-row span, .en-row b { text-align: center; }
}

/* 역참 장부: 막 머리 (world.js) */
.wp-act { list-style: none; margin: 10px 0 2px; padding: 2px 8px; font-family: var(--title); font-size: 14px; letter-spacing: 4px; color: #8e1c12; border-bottom: 1px solid rgba(142, 28, 18, 0.45); }
.w-travel .line { margin: 4px 0 10px; }

/* 엔딩이 도는 동안 HUD 는 숨긴다 (바탕 그림 #backdrop 이 HUD 아래에 깔려 있어서) */
body.en-on #hud, body.en-on #tracker, body.en-on #touch, body.en-on #chatbox { visibility: hidden; }

/* 영어(html.lang-en, public/js/i18n.js): 잠룡실록 두루마리는 세로쓰기 대신 가로로 쓴 좁은 단을 오른쪽에서 왼쪽으로 */
html.lang-en .en-col { writing-mode: horizontal-tb; text-orientation: mixed; width: min(320px, 70vw); height: 100%; overflow: hidden; letter-spacing: 0; line-height: 1.6; font-size: 16px;
  border-left: 0; border-right: 1px solid rgba(140, 40, 30, 0.35); padding: 0 16px; box-sizing: border-box; }
html.lang-en .en-col .en-q { margin: 0 0 4px; letter-spacing: 0.04em; }
html.lang-en .en-col-title { writing-mode: horizontal-tb; width: min(260px, 60vw); letter-spacing: 0.06em; font-size: 26px; border-left: 0; border-right: 2px solid var(--en-red); }
html.lang-en .en-col-foot { padding-left: 16px; }
