/* 결말 연출(js/ending-story.js): 화면 가득 암전 위에 그림이 천천히 겹쳐 바뀌고, 아래 대사 창에 한 줄씩 */
.es { position: fixed; inset: 0; z-index: 9000; background: #0E0A08; color: #2A211E; overflow: hidden; cursor: pointer; font-family: 'Paperlogy', var(--head); animation: esIn .6s ease-out; -webkit-tap-highlight-color: transparent; }
.es.out { opacity: 0; transition: opacity .5s ease-in; }
body.es-on { overflow: hidden; }
@keyframes esIn { from { opacity: 0; } }

/* 그림: 걸어온 길은 도트 배경(가운데 자르기, 아주 천천히 다가감), 결말은 일러스트를 크게 */
.es-bgs { position: absolute; inset: 0; }
.es-bg { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease-in-out; }
.es-bg.in { opacity: 1; }
.es-bg.big { transition-duration: 2.6s; }
.es-bg > i { position: absolute; inset: 0; background: var(--img) center / cover no-repeat; }
.es-blur { filter: blur(16px) brightness(.45) saturate(.9); transform: scale(1.15); }
/* 세로 화면: 그림 전체를 위쪽 가운데에(장면 이름 아래, 대사 창 위). 아주 천천히 다가간다 */
.es-art { background-size: min(100%, 720px) auto !important; background-position: center 36% !important; transform: scale(1.06); transition: transform 14s linear; }
.es-bg:not(.big) .es-art { image-rendering: pixelated; filter: brightness(.9); }
.es-bg.in .es-art { transform: scale(1); }
.es-bg.big .es-art { transition-duration: 20s; }
/* 가로 화면(PC·태블릿 가로): 화면 가득 */
@media (min-aspect-ratio: 1/1) { .es-blur { display: none; } .es-art { background-size: cover !important; background-position: center !important; } }
.es-bg.calm, .es-bg.calm .es-art { transition: opacity .2s; transform: none; }
.es-go:focus:not(:focus-visible) { outline: none; }
.es::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(14,10,8,.35), transparent 22%, transparent 52%, rgba(14,10,8,.82)); }   /* 위아래 그늘(글자가 잘 보이게) */

/* 장면 이름 */
.es-title { position: absolute; z-index: 2; left: 0; right: 0; top: max(14%, 70px); text-align: center; padding: 0 20px; color: #FFF6DE; font: 800 clamp(26px, 6.4vw, 44px)/1.2 'Paperlogy', var(--head); letter-spacing: -.01em;
  text-shadow: 0 2px 0 #2A211E, 0 0 18px rgba(0,0,0,.65); animation: esTitle 2.2s ease-out both; word-break: keep-all; }
@keyframes esTitle { from { opacity: 0; transform: translateY(8px); letter-spacing: .12em; } }

/* 대사 창: 크림 판(선택지 판과 같은 그림) */
.es-box { position: absolute; z-index: 2; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, calc(100% - 24px)); box-sizing: border-box; min-height: 118px;
  border: 14px solid transparent; border-image: url(../assets/hud/choice.webp) 30 fill / 14px; padding: 4px 6px 10px; }
.es-line { margin: 0; font: 600 17px/1.62 'Paperlogy', var(--head); word-break: keep-all; overflow-wrap: anywhere; min-height: 3.24em; }
.es-next { position: absolute; right: 4px; bottom: -2px; font-size: 12px; color: #B07820; opacity: 0; }
.es.wait .es-next { opacity: 1; animation: esNext 1s steps(2, end) infinite; }
@keyframes esNext { 50% { transform: translateY(3px); } }
.es.done .es-box { display: none; }

/* 버튼 */
.es-skip { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); right: 14px; padding: 6px 14px; border: 1px solid rgba(255,246,222,.45); border-radius: 999px; background: rgba(14,10,8,.45); color: #FFF6DE; font: 700 13px 'Paperlogy', var(--head); cursor: pointer; }
.es.done .es-skip { display: none; }
.es-go { position: absolute !important; z-index: 3; left: 0 !important; right: 0 !important; bottom: max(36px, env(safe-area-inset-bottom)); width: min(420px, calc(100% - 40px)) !important; margin: 0 auto !important; animation: esIn .8s ease-out both !important; }   /* 가운데 맞춤은 margin으로(transform은 공통 버튼의 마우스 올림·누름 효과가 쓴다) */
@media (prefers-reduced-motion: reduce) { .es, .es-title, .es.wait .es-next { animation: none; } }
