/* Episode reader — mobile first. Loaded only on /series/<slug>/ep-N/ pages. */
.reader-body { background: #0b060b; }
.reader-body footer { display: none; }

/* Top & bottom bars: auto-hide on scroll down, show on scroll up / tap */
.rbar {
  position: fixed; left: 0; right: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 0 12px; height: 56px; background: color-mix(in srgb, #0b060b 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .25s ease;
}
.rbar-top { top: 0; border-bottom: 1px solid var(--line); }
.rbar-bottom { bottom: 0; border-top: 1px solid var(--line); height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); justify-content: space-between; }
.reader-hidden .rbar-top { transform: translateY(-100%); }
.reader-hidden .rbar-bottom { transform: translateY(100%); }
.rbar a, .rbar button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px;
  border: 0; background: none; color: var(--text); font: 600 14px var(--body); cursor: pointer; border-radius: 10px; padding: 0 10px;
}
.rbar a:hover, .rbar button:hover { background: var(--surface); }
.rbar svg { width: 22px; height: 22px; }
.rbar .rtitle { flex: 1; min-width: 0; line-height: 1.2; }
.rbar .rtitle b { display: block; font: 700 15px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rbar .rtitle span { font-size: 12px; color: var(--dim); }
.rbar [aria-disabled="true"] { opacity: .35; pointer-events: none; }
.rprogress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* Episode column */
.episode { max-width: 720px; margin: 0 auto; padding: 72px 0 96px; }
.ep-notice {
  margin: 0 12px 16px; padding: 10px 14px; border-radius: 12px; font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line);
}
.ep-notice b { color: var(--accent-2); }

/* Title card (first "slice") */
.ep-cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.ep-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.85)); }
.ep-cover .ep-cover-text { position: absolute; left: 20px; right: 20px; bottom: 24px; z-index: 1; }
.ep-cover small { display: block; color: var(--accent-2); font: 700 13px var(--body); letter-spacing: .12em; text-transform: uppercase; }
.ep-cover h1 { font-size: clamp(30px, 8vw, 44px); font-weight: 800; margin: 6px 0 0; color: #fff; }

/* Production mode: image slices, gapless */
.slices img { display: block; width: 100%; height: auto; }

/* Storyboard mode: one block per panel */
.panel {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 12px;
  padding: 44px 18px 22px; overflow: hidden;
  background:
    radial-gradient(120% 80% at 80% 0%, color-mix(in srgb, var(--sb-accent) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--sb-bg1), var(--sb-bg2));
  border-top: 1px solid rgba(255,255,255,.04);
}
.panel.h-short { aspect-ratio: 1 / .55; }
.panel.h-medium { aspect-ratio: 1 / .9; }
.panel.h-tall { aspect-ratio: 1 / 1.35; }
.panel.h-splash { aspect-ratio: 1 / 1.8; }
.panel + .panel { margin-top: 28px; }             /* webtoon gutter */
.panel.scene-start { margin-top: 64px; }         /* longer beat between scenes */
.panel-meta {
  position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 10px;
  font: 600 10.5px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.45);
}
.panel-visual { font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.55); font-style: italic; text-align: center; max-width: 460px; margin: 0 auto; }
.panel-lines { display: flex; flex-direction: column; gap: 10px; }

.b-dialogue, .b-thought, .b-caption, .b-text, .b-lyrics {
  max-width: 82%; font-size: 15px; line-height: 1.4; padding: 10px 14px; position: relative;
}
.b-dialogue { align-self: flex-start; background: #fff; color: #140b14; border-radius: 18px; }
.b-dialogue.r, .b-thought.r { align-self: flex-end; }  /* second speaker in the panel sits right */
.b-dialogue .spk, .b-thought .spk, .b-lyrics .spk {
  display: block; font: 700 10px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .55; margin-bottom: 4px;
}
.b-thought { align-self: flex-start; background: rgba(255,255,255,.9); color: #140b14; border-radius: 22px; border: 2px dashed #b9a6b6; font-style: italic; }
.b-caption { align-self: flex-start; background: #f3e3c7; color: #2a1a10; border-radius: 4px; font-family: Georgia, serif; font-style: italic; }
.b-text { align-self: center; background: #f6f1ea; color: #2a2a33; border-radius: 3px; font-family: "Courier New", monospace; font-size: 13.5px; transform: rotate(-1deg); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.b-lyrics { align-self: center; text-align: center; color: #ffe7c2; font-style: italic; }
.b-lyrics::before { content: "♪ "; color: var(--sb-accent); }
.b-sfx {
  align-self: center; font: 800 clamp(26px, 8vw, 40px)/1 var(--display); letter-spacing: .02em; color: var(--sb-accent);
  -webkit-text-stroke: 1px rgba(0,0,0,.4); transform: rotate(-4deg); text-shadow: 0 4px 18px rgba(0,0,0,.5);
}

/* End of episode */
.ep-end { margin: 56px 12px 0; padding: 28px 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.ep-end h2 { font-size: 26px; font-weight: 800; margin: 8px 0 8px; }
.ep-end p { color: var(--muted); margin: 0 0 18px; }
.ep-next { display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); margin-bottom: 18px; }
.ep-next img { width: 64px; height: 85px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.ep-next b { display: block; font: 700 16px var(--display); }
.ep-next span { font-size: 13.5px; color: var(--muted); }
.ep-end .btn { width: 100%; }
.ep-end .btn + .btn { margin-top: 10px; }

/* Resume toast */
.resume {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 55; max-width: 480px; margin: 0 auto;
  display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.5); font-size: 14px;
}
.resume.show { display: flex; }
.resume .btn { height: 36px; padding: 0 14px; font-size: 13px; }

@media (min-width: 760px) {
  .episode { padding-top: 88px; }
  .panel { padding: 56px 40px 32px; }
  .ep-notice, .ep-end { margin-left: 0; margin-right: 0; }
}
