/* 이야기책 (/story/): site.css 의 적벽 밤 색을 그대로 쓰고, 대사 말풍선은 게임처럼 반투명 한지색 */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
html { scroll-padding: 80px 0 220px; }
body { background: var(--bg); }
.top-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lang-pick select {
  appearance: none; -webkit-appearance: none; background: rgba(255, 255, 255, .08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffc83d' d='M0 0h10L5 6z'/%3E%3C/svg%3E") no-repeat right 10px center/9px;
  color: var(--text); border: 1px solid rgba(255, 200, 61, .25); border-radius: 9px; padding: 7px 28px 7px 10px; font: 500 14px var(--sans); cursor: pointer;
}
.lang-pick option { color: #222; }
.chip { display: flex; align-items: center; gap: 8px; max-width: 46vw; background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 6px 12px; font: 500 13px var(--sans); cursor: pointer; }
.chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { color: var(--gold); white-space: nowrap; }
.chip:hover { background: rgba(255, 255, 255, .14); }

/* ---------- 로그인 ---------- */
.gate { position: relative; min-height: calc(100vh - 60px); display: flex; align-items: center; overflow: hidden; }
.gate-bg { position: absolute; inset: 0; background: url(img/bg/19.jpg) center bottom/cover; filter: saturate(1.1); }
.gate-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(23, 19, 74, .96) 0%, rgba(42, 21, 14, .86) 48%, rgba(42, 21, 14, .45) 100%), linear-gradient(to top, var(--bg), transparent 40%); }
.gate-in { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding-block: 48px; width: 100%; }
.kicker { color: var(--gold); font-weight: 700; letter-spacing: .18em; font-size: 13px; margin-bottom: 12px; }
.gate h1 { font-size: clamp(34px, 5.4vw, 60px); text-shadow: 0 4px 24px rgba(0, 0, 0, .5); }
.gate .lead { color: #f1dfc4; font-size: 17px; max-width: 34em; margin: 18px 0; }
.gate-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gate-points li { padding-left: 28px; position: relative; color: var(--muted); }
.gate-points li::before { content: "卷"; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 4px; background: var(--red); color: #fff; font-size: 12px; display: grid; place-items: center; }
.login { background: rgba(43, 22, 14, .88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); display: grid; gap: 10px; }
.login h2 { font-size: 26px; }
.muted { color: var(--muted); margin: 0 0 4px; font-size: 14px; }
.sns { width: 100%; background: #fff; color: #222; border-bottom-color: rgba(0, 0, 0, .3); }
.sns.apple { background: #000; color: #fff; border-bottom-color: #333; }
.sns.kakao { background: #fee500; color: #191600; border-bottom-color: #c9b400; }
.sns svg { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.email-form { display: grid; gap: 8px; }
.email-form input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--text); font: 15px var(--sans); }
.email-form input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.email-form .btn { width: 100%; }
.err { color: #ff9a9a; font-size: 14px; margin: 0; }
.fine { color: #a8907a; font-size: 12px; margin: 4px 0 0; line-height: 1.5; }
@media (max-width: 860px) {
  .gate-in { grid-template-columns: 1fr; gap: 24px; padding-block: 28px 40px; }
  .gate .lead { font-size: 15.5px; }
}

/* ---------- 안내 ---------- */
.notice { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.notice-card { text-align: center; max-width: 460px; margin: 40px auto; display: grid; gap: 12px; justify-items: center; }
.notice-card p { margin: 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 200, 61, .2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
.notice.done .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#notice-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- 이야기책 ---------- */
.book { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; background: linear-gradient(var(--night), #1d1238 40%, #21120c); border-right: 1px solid rgba(255, 200, 61, .14); padding-bottom: 90px; overscroll-behavior: contain; }
.me { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); position: sticky; top: 0; background: rgba(23, 19, 74, .96); z-index: 1; }
.me-name { font-family: var(--display); font-size: 22px; }
.me-stage { color: var(--gold); font-size: 14px; font-weight: 700; }
.meter { height: 6px; background: rgba(255, 255, 255, .1); border-radius: 9px; margin: 10px 0 6px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold2), var(--gold)); border-radius: 9px; transition: width .6s; }
.me-count { color: var(--muted); font-size: 12px; }
.toc-list { padding: 8px 10px; }
.toc-part { font-family: var(--display); color: var(--gold); font-size: 15px; padding: 14px 8px 4px; letter-spacing: .02em; }
.toc-part.locked { color: #8a7a92; }
.toc-item { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; color: #e9dcc6; padding: 7px 8px; border-radius: 8px; cursor: pointer; font: 14px/1.4 var(--sans); }
.toc-item b { color: #b7aed8; font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.toc-item:hover { background: rgba(255, 255, 255, .06); }
.toc-item.on { background: rgba(255, 200, 61, .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.toc-item.on b { color: var(--gold); }
.toc-item .part-dot { color: var(--gold2); font-size: 11px; margin-left: 4px; }
.toc-item.locked { cursor: default; color: #7f7287; }
.toc-item.locked:hover { background: none; }
.toc-item.locked span::before { content: "🔒 "; font-size: 11px; }
.toc-more { color: #7f7287; font-size: 12px; padding: 4px 8px 10px 68px; }
.pbtn.toc-btn { display: none; }
.toc-shade { display: none; }

.reader { padding: 0 0 240px; min-width: 0; }
.stage { position: relative; min-height: 340px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.stage-bg { position: absolute; inset: 0; background: center bottom/cover no-repeat; transition: opacity .5s; transform: scale(1.02); }
.stage::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 2%, rgba(42, 21, 14, .55) 45%, rgba(23, 19, 74, .25)); pointer-events: none; }
.stage-head { position: relative; z-index: 1; padding: 28px clamp(16px, 4vw, 48px) 14px; }
.stage-no { display: inline-block; background: var(--red); color: #fff; font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 6px; letter-spacing: .06em; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .6); }
.stage-part { font-size: clamp(30px, 4.6vw, 48px); margin-top: 8px; text-shadow: 0 3px 18px rgba(0, 0, 0, .65); }
.stage-titles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stage-titles span { background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 200, 61, .3); color: #f6e3c2; padding: 3px 10px; border-radius: 999px; font-size: 13px; }

/* 재생 중 큰 자막 (비주얼 노벨): 재생 막대 위에 떠서, 대본을 내려 읽는 동안에도 지금 대사가 보인다 */
.theater { position: fixed; z-index: 14; left: calc(300px + clamp(16px, 4vw, 48px)); right: clamp(16px, 4vw, 48px); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); max-width: 860px; margin: 0 auto; display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; background: rgba(20, 12, 30, .9); border: 1px solid rgba(255, 200, 61, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; pointer-events: none; }
.theater.on { opacity: 1; transform: none; }
.theater.right { flex-direction: row-reverse; text-align: right; }
.th-face { width: 84px; height: 84px; border-radius: 14px; background: #f3e6cc; border: 3px solid var(--gold); flex: none; object-fit: cover; }
.th-box { min-width: 0; }
.th-name { color: var(--gold); font-weight: 700; font-size: 14px; }
.th-text { font-size: clamp(17px, 2.2vw, 21px); line-height: 1.55; color: #fff; }

.script { padding: 6px clamp(16px, 4vw, 48px); max-width: 920px; }
.ev-h { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-family: var(--display); font-size: 20px; color: var(--gold); }
.ev-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 200, 61, .35), transparent); }
.ev-h small { font-family: var(--sans); font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }
.line { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start; margin: 10px 0; scroll-margin: 140px 0 140px; }
.line.r { grid-template-columns: minmax(0, 1fr) 56px; }
.line.r .face { order: 2; }
.line.r .say { justify-self: end; }
.face { width: 56px; height: 56px; border-radius: 12px; background: #f3e6cc; border: 2px solid rgba(255, 200, 61, .6); }
.say { position: relative; max-width: 640px; background: rgba(255, 246, 228, .92); color: #2b1b10; border-radius: 4px 16px 16px 16px; padding: 8px 14px 10px; cursor: pointer; text-align: left; border: 0; font: inherit; box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .7); transition: transform .15s, box-shadow .15s, background .15s; }
.line.r .say { border-radius: 16px 4px 16px 16px; }
.say:hover { background: #fff; }
.say .who { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #9a5a12; }
.say .who .vo { color: #b49a7a; font-weight: 500; }
.say .txt { font-size: 16px; line-height: 1.6; display: block; word-break: keep-all; overflow-wrap: anywhere; }
.say .me-n { color: #2f5bd6; font-weight: 700; }
.line.now .say { background: #fff; box-shadow: 0 0 0 3px var(--gold), 0 12px 26px -10px rgba(255, 200, 61, .55); transform: scale(1.015); }
.line.now .face { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 61, .35); }
.line.done .say { opacity: .82; }
.gap { height: 1px; background: rgba(255, 255, 255, .07); margin: 18px 0 18px 66px; }
.chapter-end { padding: 22px clamp(16px, 4vw, 48px) 0; max-width: 920px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chapter-end .end-hint { color: var(--muted); font-size: 14px; flex-basis: 100%; }
.pending { margin-top: 18px; padding: 14px 16px; border: 1px dashed rgba(255, 200, 61, .35); border-radius: 12px; color: var(--muted); font-size: 14px; }

/* 하단 재생 막대 */
.player { position: fixed; left: 300px; right: 0; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 10px clamp(12px, 3vw, 28px) calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(23, 19, 74, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid rgba(255, 200, 61, .2); }
.pbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: var(--text); font-size: 15px; cursor: pointer; flex: none; display: grid; place-items: center; }
.pbtn:hover { background: rgba(255, 255, 255, .18); }
.pbtn:disabled { opacity: .35; cursor: default; }
.pbtn.play { width: 52px; height: 52px; background: var(--gold); color: #3a1c00; font-size: 19px; box-shadow: 0 6px 18px -6px rgba(255, 200, 61, .7); }
.pbtn.play:hover { background: #ffd35f; }
.p-info { flex: 1; min-width: 0; }
.p-now { font-size: 13px; color: #e2d8f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-bar { height: 4px; background: rgba(255, 255, 255, .12); border-radius: 9px; margin-top: 6px; overflow: hidden; }
.p-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.tog { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #d9cff0; white-space: nowrap; cursor: pointer; }
.tog input { accent-color: var(--gold); width: 16px; height: 16px; }

@media (max-width: 900px) {
  .book { grid-template-columns: 1fr; }
  .toc { position: fixed; top: 60px; left: 0; bottom: 0; width: min(320px, 86vw); height: auto; z-index: 30; transform: translateX(-102%); transition: transform .25s; box-shadow: 20px 0 40px -20px rgba(0, 0, 0, .8); }
  .toc.open { transform: none; }
  .toc-shade:not([hidden]) { display: block; position: fixed; inset: 60px 0 0; background: rgba(0, 0, 0, .5); z-index: 29; }
  .pbtn.toc-btn { display: grid; background: var(--red); color: #fff; }
  .player { left: 0; flex-wrap: wrap; row-gap: 6px; }
  .p-info { order: 5; flex-basis: 100%; }
  .tog { margin-left: auto; }
  .tog + .tog { margin-left: 0; }
  .stage { min-height: 280px; }
  .theater { left: 12px; right: 12px; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); padding: 10px; gap: 10px; }
  .th-text { font-size: 16px; }
  .th-face { width: 60px; height: 60px; }
  .line { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  .line.r { grid-template-columns: minmax(0, 1fr) 44px; }
  .face { width: 44px; height: 44px; border-radius: 10px; }
  .say .txt { font-size: 15px; }
  .gap { margin-left: 52px; }
  .reader { padding-bottom: 280px; }
}
@media (max-width: 420px) {
  .chip .chip-x { display: none; }
  .chip::after { content: "⎋"; color: var(--gold); }
}
@media (prefers-reduced-motion: reduce) {
  .theater, .toc, .say, .meter i, .p-bar i { transition: none; }
  .spinner { animation-duration: 3s; }
}
