/* css/06-theater.css — 06 どうぶつ げきじょう ＋ dialog#episode（unit=theater）
   ルール: ポスター・スチルは等倍の拡縮と位置だけ。キャラ画像には色や形を変える効果をかけない（drop-shadow の縁だけ）。
   skew は .perf と .frame-border だけ（2-28）。blur は .ep-title の文字だけ（1-31）。 */

.sec-theater {
  --th-film: #15142a;
  --th-gold: #FFC83A;
  padding-bottom: var(--sp-9);
}
.sec-theater .th-inner { position: relative; }

/* ---------- 見出しと看板（ルビが遅れて出る） ---------- */
.th-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: var(--sp-6);
}
.th-head .poptitle { margin-bottom: var(--sp-4); }
.th-lead { grid-column: 1 / -1; max-width: 34em; margin: 0; font-weight: 700; }
.th-sign {
  position: relative;
  justify-self: end;
  margin: 0 var(--sp-2) var(--sp-5) 0;
  padding: 18px 20px;
  background: var(--do);
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--sh-step-lg);
  transform: rotate(3deg);
}
.th-sign-in {
  position: relative; z-index: 1;
  display: grid; justify-items: center;
  padding: 6px 22px 12px;
  background: var(--paper-hi);
  border: var(--line);
  border-radius: 14px;
}
.th-sign-sub { font-family: var(--f-body); font-weight: 900; font-size: .95rem; letter-spacing: .3em; margin-bottom: -2px; }
.th-ruby { font-family: var(--f-pop); font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1.05; ruby-position: over; color: var(--ink); }
.th-ruby rt {
  font-family: var(--f-body); font-weight: 900; font-size: max(.3em, 12px); letter-spacing: .2em; color: var(--do);
  display: ruby-text;
}
.sec-theater[data-armed] .th-ruby rt { opacity: 0; transform: translateY(.6em); transition: opacity .5s var(--ease-soft), transform .7s var(--ease-spring); }
.sec-theater[data-armed] .th-sign.is-ruby-on .th-ruby rt { opacity: 1; transform: none; }
.bulbs { position: absolute; inset: 5px 10px; display: flex; flex-wrap: wrap; justify-content: space-between; align-content: space-between; pointer-events: none; }
.bulbs i {
  width: 9px; height: 9px; border-radius: 50%;
  flex: 0 0 9px; margin: 0 2px;
  background: var(--mi); border: 1.5px solid var(--ink);
  animation: th-bulb 1.2s steps(2, jump-none) infinite;
  animation-delay: calc(var(--i) * -.13s);
}
.bulbs i:nth-child(n+10) { animation-delay: calc(var(--i) * -.13s - .6s); }
@keyframes th-bulb { 0% { background: var(--mi); box-shadow: 0 0 0 2px rgba(255, 225, 74, .5); } 100% { background: #fff6c8; box-shadow: none; } }
html[data-reduced] .bulbs i { animation: none; }
@media (max-width: 599px) {
  .th-head { grid-template-columns: 1fr; }
  .th-sign { justify-self: start; margin: 0 0 var(--sp-5) var(--sp-2); padding: 14px 16px; }
  .th-sign-in { grid-auto-flow: column; align-items: end; gap: 10px; padding: 4px 16px 8px; }
}

/* ---------- よこくへん ---------- */
.trailer { position: relative; margin: var(--sp-7) auto 0; max-width: 1080px; outline: none; }
.trailer:focus-visible { border-radius: var(--r-l); }
.trailer-top { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; padding-inline: 4px; }
.trailer-label {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 12px;
  background: var(--ink); color: var(--paper-hi);
  border-radius: var(--r-pill);
  font-family: var(--f-pop); font-size: 1.05rem; letter-spacing: .08em;
  box-shadow: 0 4px 0 var(--do);
}
.rec { width: 11px; height: 11px; border-radius: 50%; background: var(--do); box-shadow: 0 0 0 3px rgba(255, 75, 43, .35); animation: th-rec 1.4s steps(2, jump-none) infinite; }
@keyframes th-rec { to { opacity: .25; } }
html[data-reduced] .rec { animation: none; }
.trailer-count { font-size: var(--fs-mono); color: var(--ink-soft); }
.trailer-count b { color: var(--ink); font-weight: 500; font-size: 1.25em; }

:where(.sec-theater, #episode) .stage {
  position: relative;
  padding: 44px clamp(22px, 5.5vw, 64px) 26px;
  background: var(--th-film);
  border: var(--line);
  border-radius: var(--r-l) var(--r-l) 14px 14px;
  box-shadow: var(--sh-step-lg), 0 40px 60px -30px var(--shadow);
  overflow: hidden;
}
/* ねんど色の幕（左右の垂れ幕と上の飾り幕） */
.drape {
  position: absolute; top: 0; bottom: 0; width: clamp(20px, 5vw, 58px); z-index: 2;
  background:
    linear-gradient(90deg, rgba(28, 27, 51, .0), rgba(28, 27, 51, .18)),
    repeating-linear-gradient(90deg, var(--clay) 0 9px, #f29c86 9px 13px, var(--clay) 13px 20px, var(--clay-deep) 20px 24px);
}
.drape--l { left: 0; border-right: 3px solid var(--ink); border-radius: 0 0 60% 0 / 0 0 22% 0; transform-origin: 0 0; }
.drape--r { right: 0; border-left: 3px solid var(--ink); border-radius: 0 0 0 60% / 0 0 0 22%; transform-origin: 100% 0; background:
    linear-gradient(270deg, rgba(28, 27, 51, .0), rgba(28, 27, 51, .18)),
    repeating-linear-gradient(270deg, var(--clay) 0 9px, #f29c86 9px 13px, var(--clay) 13px 20px, var(--clay-deep) 20px 24px); }
.valance {
  position: absolute; left: 0; right: 0; top: 0; height: 34px; z-index: 3;
  background:
    radial-gradient(circle at 50% 0, var(--clay-deep) 0 21px, transparent 22px) 0 0 / 44px 34px repeat-x,
    linear-gradient(var(--clay-deep), var(--clay-deep)) 0 0 / 100% 12px no-repeat;
  filter: drop-shadow(0 3px 0 var(--ink));
}
.valance::after {
  content: ''; position: absolute; left: 0; right: 0; top: 16px; height: 8px;
  background: radial-gradient(circle, var(--th-gold) 0 3px, transparent 3.5px) 0 0 / 22px 8px repeat-x;
}
.screen {
  position: relative; z-index: 1;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 6px #2a2848, 0 0 40px 6px rgba(255, 225, 74, .12);
}
.slides { position: absolute; inset: 6% 0; overflow: hidden; }
.slide[data-kind="poster"] img { object-position: 50% 18%; transform-origin: 50% 25%; }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; }
.slide.is-on { opacity: 1; visibility: visible; }
.slide img { display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; will-change: transform; }
.scope { position: absolute; left: 0; right: 0; height: 6%; background: #07070f; z-index: 2; pointer-events: none; }
.scope--t { top: 0; } .scope--b { bottom: 0; }
.caption {
  position: absolute; left: 50%; bottom: 12%; z-index: 3;
  width: max-content; max-width: 88%;
  margin: 0; transform: translateX(-50%);
  perspective: 700px; text-align: center; pointer-events: none;
}
.caption-in {
  display: inline-block;
  padding: .28em .9em .32em;
  background: rgba(10, 10, 22, .74);
  color: #fff;
  border-radius: 8px;
  font-weight: 900; font-size: clamp(.95rem, 2.2vw, 1.45rem); line-height: 1.45; letter-spacing: .06em;
  text-shadow: 0 2px 0 var(--ink);
  transform-origin: 50% 100%;
  backface-visibility: hidden;
}
.meter { position: absolute; right: 2.5%; top: 11%; z-index: 3; width: clamp(34px, 5vw, 46px); height: auto; overflow: visible; }
.meter circle { fill: none; stroke-width: 4; }
.meter-bg { stroke: rgba(255, 255, 255, .22); fill: rgba(10, 10, 22, .55) !important; }
.meter-arc { stroke: var(--mi); stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-origin: 50% 50%; }
.meter-pause, .meter-play { fill: #fff; }
.meter-play { display: none; }
.trailer.is-paused .meter-pause { display: none; }
.trailer.is-paused .meter-play { display: block; }
.trailer-ctrl { display: flex; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }
.tbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tbtn-play { min-width: 8.5em; }
@media (max-width: 599px) {
  .trailer { margin-top: var(--sp-6); margin-inline: calc(-1 * var(--gutter) + 6px); }
  :where(.sec-theater, #episode) .stage { padding: 30px 10px 12px; border-radius: 18px 18px 10px 10px; }
  .drape { width: 10px; }
  .valance { height: 24px; background-size: 30px 24px, 100% 9px; }
  .valance::after { top: 11px; }
  .caption { bottom: 10.5%; max-width: 92%; }
  .caption-in { font-size: .9rem; white-space: normal; display: -webkit-inline-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .meter { top: 10%; width: 30px; }
}

/* ---------- フィルムのリール ---------- */
.reel { position: relative; margin: var(--sp-9) calc(-1 * var(--gutter)) 0; }
.reel-stage {
  position: relative;
  background: var(--th-film);
  border-block: 4px solid var(--ink);
  box-shadow: 0 10px 0 rgba(28, 27, 51, .18);
}
.reel-viewport { position: relative; overflow: hidden; }
.reel-track {
  position: relative;
  display: flex; align-items: flex-start; gap: clamp(22px, 3vw, 40px);
  width: max-content;
  margin: 0; padding: 50px var(--gutter) 46px;
  list-style: none;
}
.perf {
  position: absolute; left: 0; right: 0; height: 16px; list-style: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='16'%3E%3Crect x='7' y='2' width='16' height='12' rx='3.5' fill='%23F2EADB'/%3E%3C/svg%3E");
  background-size: 30px 16px; background-repeat: repeat-x;
  opacity: .9; pointer-events: none;
  transform-origin: 50% 50%;
}
.perf--t { top: 14px; }
.reel-head {
  position: absolute; left: var(--gutter); right: var(--gutter); top: -58px; z-index: 3;
  display: flex; align-items: center; gap: var(--sp-4);
}
.reel-no { flex: none; padding: 4px 14px; background: var(--ink); color: var(--paper-hi); border-radius: var(--r-pill); box-shadow: 0 4px 0 var(--do); font-size: .9rem; }
.reel-no b { color: var(--mi); font-weight: 500; font-size: 1.2em; }
.reel-bar { position: relative; flex: 1; height: 8px; border: 2.5px solid var(--ink); border-radius: var(--r-pill); background: var(--paper-hi); overflow: hidden; }
.reel-bar i { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, var(--do) 0 18px, var(--mi) 18px 36px, var(--so) 36px 54px); transform-origin: 0 50%; transform: scaleX(.06); }
.perf--b { bottom: 14px; }
.reel-cell { flex: none; }
.reel-frame {
  appearance: none; -webkit-appearance: none;
  display: grid; gap: 14px;
  width: clamp(250px, 30vw, 440px);
  margin: 0; padding: 0; border: 0; background: none;
  color: var(--paper-hi); text-align: left; font: inherit;
  cursor: pointer;
  transition: opacity .25s var(--ease-soft);
  border-radius: 12px;
}
.reel-frame:focus-visible { outline-color: var(--mi); box-shadow: 0 0 0 7px var(--do); }
.rf-pic { position: relative; display: block; aspect-ratio: 16 / 9; transition: transform .45s var(--ease-spring); }
.rf-clip {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 6px; background: #000;
  border: 3px solid var(--ep-color, var(--mi));
}
.rf-poster, .rf-flips img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rf-flips img { opacity: 0; }
.rf-flips img.is-on { opacity: 1; }
.rf-poster.is-off { opacity: 0; }
/* 額縁のバー（3-48）。JS が動くときだけ最初に閉じておく */
:where(.sec-theater, #episode) .bars { position: absolute; inset: 0; pointer-events: none; }
:where(.sec-theater, #episode) .bar { position: absolute; display: block; transform: scale(0); }
.bar-t { left: 0; right: 0; top: 0; height: 50.5%; background: var(--do); transform-origin: 50% 0; }
.bar-b { left: 0; right: 0; bottom: 0; height: 50.5%; background: var(--so); transform-origin: 50% 100%; }
.bar-l { top: 0; bottom: 0; left: 0; width: 50.5%; background: var(--ep-color, var(--mi)); transform-origin: 0 50%; }
.bar-r { top: 0; bottom: 0; right: 0; width: 50.5%; background: var(--mi); transform-origin: 100% 50%; }
.sec-theater[data-armed] .reel-frame:not(.is-open) .bar-t,
.sec-theater[data-armed] .reel-frame:not(.is-open) .bar-b { transform: scaleY(1); }
.sec-theater[data-armed] .reel-frame:not(.is-open) .bar-l,
.sec-theater[data-armed] .reel-frame:not(.is-open) .bar-r { transform: scaleX(1); }
.frame-border { position: absolute; inset: -9px; pointer-events: none; transform-origin: 50% 50%; }
.frame-border::before {
  content: ''; position: absolute; inset: 0;
  border: 2px solid rgba(242, 234, 219, .38); border-radius: 12px;
}
.frame-border i { position: absolute; width: 14px; height: 14px; border: 3px solid var(--paper-hi); }
.frame-border i:nth-child(1) { left: -2px; top: -2px; border-width: 3px 0 0 3px; }
.frame-border i:nth-child(2) { right: -2px; top: -2px; border-width: 3px 3px 0 0; }
.frame-border i:nth-child(3) { right: -2px; bottom: -2px; border-width: 0 3px 3px 0; }
.frame-border i:nth-child(4) { left: -2px; bottom: -2px; border-width: 0 0 3px 3px; }
.rf-meta { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: end; padding: 0 2px; }
.epno { grid-row: 1 / 3; display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--f-pop); line-height: 1; color: var(--paper-hi); }
.epno-pre, .epno-post { font-size: .95rem; }
.epno-num { position: relative; display: inline-block; font-size: clamp(2.6rem, 4vw, 3.2rem); line-height: .95; letter-spacing: -.02em; }
.epno-num .o { color: transparent; -webkit-text-stroke: 2px var(--mi); }
.epno-num .f {
  position: absolute; left: 0; top: 0; color: var(--mi); -webkit-text-stroke: 2px var(--mi);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1s cubic-bezier(.7, 0, .2, 1);
}
.sec-theater[data-armed] .reel-frame:not(.is-filled) .epno-num .f { clip-path: inset(100% 0 0 0); }
.rf-title { font-weight: 900; font-size: 1.05rem; line-height: 1.4; }
.rf-dur {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 10px; border-radius: var(--r-pill); white-space: nowrap;
  background: var(--paper-hi); color: var(--ink); font-size: .8125rem;
}
.rf-dur::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--ep-color, var(--do)); border: 1.5px solid var(--ink); }
/* 兄弟減光（8-45） */
@media (hover: hover) and (pointer: fine) {
  .reel-track:hover .reel-frame:not(:hover) { opacity: .34; }
  .reel-frame:hover .rf-pic { transform: translateY(-8px) rotate(-1.2deg); }
}
.reel-track:has(.reel-frame:focus-visible) .reel-frame:not(:focus-visible) { opacity: .34; }
.reel-frame:focus-visible .rf-pic { transform: translateY(-8px); }

/* 1024px 未満: 指・ドラッグで動かす横帯（5-28）と scroll-snap */
@media (max-width: 1023px) {
  .reel-viewport { overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .reel-viewport::-webkit-scrollbar { display: none; }
  .reel-viewport.is-dragging { scroll-snap-type: none; cursor: grabbing; }
  .reel-cell { scroll-snap-align: center; }
  .reel-frame { width: min(72vw, 320px); }
  .reel { margin-top: var(--sp-8); }
  .rf-title { font-size: .95rem; }
  .rf-meta { column-gap: 8px; }
  .rf-dur { font-size: .75rem; padding: 0 8px; }
  .reel-track { padding-inline: 14vw; }
}
html[data-reduced] .reel-viewport { overflow-x: auto; scroll-snap-type: x mandatory; }
html[data-reduced] .reel-cell { scroll-snap-align: center; }

/* 横スワイプのヒント（8-47） */
.swipe-hint {
  position: absolute; right: 10px; bottom: -22px; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px;
  background: var(--mi); color: var(--ink);
  border: var(--line); border-radius: var(--r-pill); box-shadow: var(--sh-step);
  font-weight: 900; font-size: var(--fs-small);
  pointer-events: none;
  transition: opacity .4s, transform .4s var(--ease-spring);
}
.swipe-hand { display: inline-block; width: 30px; height: 30px; animation: th-swipe 1.6s var(--ease-soft) infinite; }
.swipe-hand svg { width: 100%; height: 100%; fill: var(--paper-hi); stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
@keyframes th-swipe { 0%, 100% { transform: translateX(-7px) rotate(-10deg); } 50% { transform: translateX(9px) rotate(8deg); } }
.swipe-hint.is-gone { opacity: 0; transform: translateY(10px) scale(.9); }
@media (min-width: 1024px) { .swipe-hint { display: none; } }
html[data-reduced] .swipe-hand { animation: none; }

/* ---------- えんもくひょう と パラパラちょう ---------- */
.th-bottom {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px); align-items: start;
  margin-top: var(--sp-9);
}
@media (max-width: 899px) { .th-bottom { grid-template-columns: 1fr; margin-top: var(--sp-8); } }

.program {
  position: relative;
  padding: clamp(20px, 3vw, 36px);
  background: var(--paper-hi);
  border: var(--line); border-radius: var(--r-l);
  box-shadow: var(--sh-step-lg);
  transform: rotate(-.6deg);
}
.program::before {
  content: ''; position: absolute; inset: 10px; border: 2px dashed var(--ink-line); border-radius: 20px; pointer-events: none;
}
.program-title, .flipbook-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 var(--sp-4); }
.program-list { list-style: none; margin: 0; padding: 0; position: relative; }
.program-item {
  appearance: none; display: grid; grid-template-columns: 2.4em minmax(0, auto) 1fr auto; align-items: baseline; gap: 10px;
  width: 100%; min-height: 44px; margin: 0; padding: 8px 12px;
  border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer;
  background-image: linear-gradient(90deg, var(--mi), var(--mi));
  background-size: 0% 100%; background-repeat: no-repeat;
  transition: background-size .35s var(--ease-soft), transform .3s var(--ease-spring);
}
.program-item:hover, .program-item:focus-visible { background-size: 100% 100%; }
@media (hover: hover) and (pointer: fine) { .program-item:hover { transform: translateX(6px); } }
.pi-no { color: var(--do); font-size: .9rem; }
.pi-title { font-weight: 900; line-height: 1.45; }
.pi-lead { border-bottom: 3px dotted var(--ink-line); transform: translateY(-5px); min-width: 12px; }
.pi-dur { font-size: .8125rem; color: var(--ink-soft); }
@media (max-width: 599px) {
  .program { padding: 18px 12px; }
  .program-item { grid-template-columns: 1.9em minmax(0, 1fr) auto; gap: 8px; padding: 6px 8px; min-height: 44px; }
  .pi-title { font-size: .95rem; line-height: 1.4; }
  .pi-dur { font-size: .75rem; }
  .pi-lead { display: none; }
}
.program-peek {
  position: fixed; left: 0; top: 0; z-index: 50;
  width: 280px; aspect-ratio: 16 / 9;
  border: var(--line); border-radius: 12px; overflow: hidden;
  background: var(--ink);
  box-shadow: var(--sh-step-lg), 0 24px 40px -18px var(--shadow);
  pointer-events: none; opacity: 0; visibility: hidden;
}
.program-peek img { width: 100%; height: 100%; object-fit: cover; display: block; }

.flipbook { position: relative; }
.fb-book { position: relative; padding-top: 18px; }
.fb-pages i {
  position: absolute; left: 0; right: 0; top: 18px; aspect-ratio: 16 / 9;
  background: var(--paper-hi); border: var(--line); border-radius: 14px;
}
.fb-pages i:nth-child(1) { transform: translate(14px, 14px) rotate(2.4deg); background: var(--so); }
.fb-pages i:nth-child(2) { transform: translate(8px, 8px) rotate(1.4deg); background: var(--mi); }
.fb-pages i:nth-child(3) { transform: translate(3px, 3px) rotate(.5deg); background: var(--do); }
.fb-frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--paper-hi); border: var(--line); border-radius: 14px;
  padding: 8px; perspective: 900px;
}
.fb-img, .fb-leaf { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.fb-leaf { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); transform-origin: 50% 0; backface-visibility: hidden; box-shadow: 0 6px 0 rgba(28, 27, 51, .25); }
.fb-no {
  position: absolute; right: 16px; bottom: 16px;
  padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--mi); font-size: 1rem;
}
.fb-ring { position: absolute; left: 8%; right: 8%; top: 4px; display: flex; justify-content: space-between; z-index: 2; pointer-events: none; }
.fb-ring i { width: 14px; height: 30px; border: 3px solid var(--ink); border-radius: 8px; background: linear-gradient(90deg, #d8d4ce, #fff 50%, #b8b2aa); }
.fb-caption { margin: var(--sp-5) 0 var(--sp-3); font-weight: 900; font-size: 1.05rem; min-height: 3em; }
.fb-ctrl { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label label" "range play" "ticks ."; align-items: center; column-gap: var(--sp-4); }
.fb-label { grid-area: label; font-size: var(--fs-small); font-weight: 700; color: var(--ink-soft); }
.fb-play { grid-area: play; }
.fb-ticks { grid-area: ticks; display: flex; justify-content: space-between; color: var(--ink-soft); font-size: .8125rem; }
.fb-range {
  grid-area: range; width: 100%; height: 44px; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
  touch-action: pan-y;
}
.fb-range::-webkit-slider-runnable-track {
  height: 16px; border: var(--line); border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--clay) 0 var(--fill, 0%), var(--paper-hi) var(--fill, 0%));
}
.fb-range::-moz-range-track { height: 12px; border: var(--line); border-radius: var(--r-pill); background: var(--paper-hi); }
.fb-range::-moz-range-progress { height: 12px; background: var(--clay); border-radius: var(--r-pill); }
.fb-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px;
  border-radius: 50%; background: var(--mi); border: var(--line); box-shadow: 0 3px 0 var(--ink);
}
.fb-range::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--mi); border: var(--line); }
.fb-range:focus-visible { outline-offset: 2px; }

/* ---------- dialog#episode ---------- */
dialog.ep-dialog {
  width: min(96vw, 1100px);
  max-height: min(92vh, 980px);
  background: var(--paper-hi);
  overflow-x: hidden;
}
dialog.ep-dialog::backdrop { background: rgba(21, 20, 42, .72); }
.ep-shell { position: relative; }
.ep-topbar { position: sticky; top: 0; z-index: 6; height: 0; display: flex; justify-content: flex-end; }
.ep-close {
  margin: 12px 12px 0 0; flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 4px 16px 4px 12px;
  background: var(--mi); border: var(--line); border-radius: var(--r-pill); box-shadow: var(--sh-step);
  font-weight: 900; cursor: pointer;
}
.ep-close span:first-child { font-size: 1.4rem; line-height: 1; }
.ep-close:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ep-grid { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: clamp(12px, 3vw, 36px); padding: clamp(18px, 3vw, 40px); padding-top: clamp(28px, 4vw, 48px); }
.ep-side { position: relative; }
.ep-vertical {
  position: sticky; top: 24px; margin: 0;
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--f-pop); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.1;
  color: var(--paper-hi);
  padding: 18px 10px; background: var(--ink); border-radius: 60px; border: var(--line); box-shadow: 0 6px 0 var(--do);
  overflow: hidden;
}
.ep-vertical .v { display: inline-block; }
.ep-vertical .v.kana { color: var(--mi); }
.ep-kicker { display: flex; gap: 12px; align-items: center; margin: 0 0 6px; color: var(--ink-soft); }
.ep-dur { padding: 1px 10px; border: 2px solid var(--ink); border-radius: var(--r-pill); color: var(--ink); background: var(--mi); }
.ep-title { font-size: clamp(1.9rem, 4.6vw, 3.4rem); line-height: 1.2; margin: 0 0 var(--sp-5); padding-right: 110px; }
.ep-versions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 var(--sp-5); }
.ep-versions .btn[aria-pressed="true"] { --btn-bg: var(--clay); }
.ep-card-scene { perspective: 1600px; }
.ep-card { position: relative; display: grid; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, 1.35, .4, 1); }
.ep-card.is-flipped { transform: rotateY(180deg); }
html[data-reduced] .ep-card { transition: none; }
.ep-face {
  grid-area: 1 / 1; position: relative;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: var(--line); border-radius: var(--r-l);
  padding: 16px;
  box-shadow: var(--sh-step-lg);
}
.ep-front { background: var(--ink); }
.ep-back {
  transform: rotateY(180deg);
  display: grid; align-content: center; justify-items: center; gap: var(--sp-4);
  background: var(--do); color: var(--paper-hi); text-align: center;
  background-image: repeating-radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .08) 0 18px, transparent 18px 36px);
}
.face-tag {
  position: absolute; left: 22px; top: -18px; z-index: 3;
  padding: 2px 16px; background: var(--mi); color: var(--ink);
  border: var(--line); border-radius: var(--r-pill);
  font-family: var(--f-pop); font-size: 1rem; box-shadow: 0 3px 0 var(--ink);
}
.face-tag--q { background: var(--paper-hi); font-family: var(--f-q); font-style: italic; font-weight: 700; }
.ep-poster-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.ep-poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.ep-poster.is-hidden { visibility: hidden; }
.ep-sub { display: grid; margin-top: 14px; }
.ep-sub > * { grid-area: 1 / 1; }
.ep-summary, .ep-summary-ghost {
  margin: 0; padding: 12px 18px;
  font-weight: 700; font-size: clamp(1rem, 1.9vw, 1.2rem); line-height: 1.8; letter-spacing: .03em;
  color: #fff;
}
.ep-summary-ghost { visibility: hidden; }
.ep-summary.is-typing::after {
  content: ''; display: inline-block; width: .5em; height: 1.1em; margin-left: 2px; vertical-align: -.18em;
  background: var(--mi); animation: th-caret .6s steps(2, jump-none) infinite;
}
@keyframes th-caret { to { opacity: 0; } }
.ep-q { margin: 0; font-family: var(--f-q); font-style: italic; font-weight: 700; font-size: clamp(5rem, 14vw, 9rem); line-height: .9; color: var(--mi); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 6px 7px 0 var(--ink); }
.ep-continue { margin: 0; font-family: var(--f-pop); font-size: clamp(1.2rem, 2.8vw, 1.8rem); text-shadow: 0 3px 0 var(--ink); }
.ep-sns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ep-sns .mp-cta-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 22px;
  background: var(--ink); color: var(--paper-hi); border: 3px solid var(--ink); border-radius: var(--r-pill);
  box-shadow: 0 5px 0 rgba(28, 27, 51, .55); font-weight: 900; text-decoration: none;
}
.ep-sns .sns--youtube { box-shadow: 0 5px 0 var(--mi); }
.ep-sns .sns--instagram { box-shadow: 0 5px 0 var(--so); }
.ep-sns .sns--tiktok { box-shadow: 0 5px 0 var(--paper-hi); }
.ep-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: var(--sp-6) 0 0; }
.ep-flip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ep-cast { margin-top: var(--sp-6); }
.ep-cast-title { font-family: var(--f-body); font-weight: 900; font-size: 1.05rem; margin: 0 0 var(--sp-3); }
.ep-cast-list { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; }
.cast-chip {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 4px 16px 4px 4px;
  background: var(--paper); border: var(--line); border-radius: var(--r-pill); box-shadow: var(--sh-step);
  font-weight: 900; cursor: pointer;
  transition: transform .25s var(--ease-spring), box-shadow .25s var(--ease-spring);
}
.cast-chip .cc-pic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--cc-bg, var(--mi)); border: 2px solid var(--ink); overflow: visible; }
.cast-chip .cc-pic img.chara--cut { width: 50px; height: 50px; object-fit: contain; }
.cast-chip .cc-pic .frame-round { width: 52px; box-shadow: none; border-width: 2px; }
.cast-chip:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.cast-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ep-cast.is-big .cast-chip .cc-pic { width: 88px; height: 88px; }
.ep-cast.is-big .cast-chip .cc-pic img.chara--cut { width: 80px; height: 80px; }
.ep-cast.is-big .cast-chip .cc-pic .frame-round { width: 82px; }
.ep-cast.is-big .cast-chip { font-size: 1.15rem; padding-right: 22px; }
.ep-novideo { margin: var(--sp-6) 0 0; padding: 10px 14px; border-left: 6px solid var(--so); background: var(--paper); border-radius: 0 12px 12px 0; }
.ep-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: var(--sp-6); }
.ep-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ルーペ（5-18） */
.loupe {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 160px; height: 160px; margin: -80px 0 0 -80px;
  border-radius: 50%; border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--paper-hi), 0 10px 0 4px var(--ink);
  background-repeat: no-repeat; background-color: #000;
  pointer-events: none; opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .3s var(--ease-spring);
}
.ep-poster-wrap.loupe-on { cursor: none; }
.ep-poster-wrap.loupe-on.is-in .loupe { opacity: 1; transform: scale(1); }

/* 幕（4-2）: ねんど色。ビューポートいっぱいに降りる */
.curtain {
  position: fixed; inset: 0; z-index: 20;
  display: none;
  pointer-events: none;
}
.ep-dialog.is-curtain .curtain { display: block; }
.curtain-folds {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(28, 27, 51, .18), transparent 18%, transparent 80%, rgba(28, 27, 51, .22)),
    repeating-linear-gradient(90deg, var(--clay) 0 18px, #f6a590 18px 30px, var(--clay) 30px 48px, var(--clay-deep) 48px 62px, var(--clay) 62px 72px);
}
.curtain-top {
  position: absolute; left: 0; right: 0; top: 0; height: 64px;
  background:
    radial-gradient(circle at 50% 0, var(--clay-deep) 0 30px, transparent 31px) 0 22px / 64px 48px repeat-x,
    linear-gradient(var(--clay-deep), var(--clay-deep)) 0 0 / 100% 24px no-repeat;
  filter: drop-shadow(0 4px 0 var(--ink));
}
.curtain-top::after { content: ''; position: absolute; left: 0; right: 0; top: 30px; height: 10px; background: radial-gradient(circle, var(--th-gold) 0 4px, transparent 4.5px) 0 0 / 32px 10px repeat-x; }
.curtain-hem {
  position: absolute; left: 0; right: 0; bottom: -30px; height: 44px;
  background:
    radial-gradient(circle at 50% 0, var(--clay-deep) 0 20px, transparent 21px) 0 0 / 42px 44px repeat-x;
}
.curtain-hem::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 12px; background: var(--th-gold); border-block: 3px solid var(--ink); }
.curtain-body { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: clamp(16px, 3vh, 28px); padding: 24px; }
.curtain-no span { display: inline-block; }
.curtain-no {
  margin: 0; writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--f-pop); font-size: clamp(2.6rem, 9vh, 5.2rem); line-height: 1.05;
  color: var(--paper-hi); -webkit-text-stroke: .08em var(--ink); paint-order: stroke fill; text-shadow: .06em .07em 0 var(--ink);
}
.curtain-cast { display: flex; gap: clamp(8px, 2vw, 20px); align-items: flex-end; justify-content: center; flex-wrap: wrap; max-width: 92vw; }
.curtain-cast .cc { display: grid; justify-items: center; }
.curtain-cast img.chara--cut { width: clamp(64px, 11vh, 120px); height: auto; }
.curtain-cast .frame-round { width: clamp(64px, 11vh, 110px); }
.curtain-cast .cc::after { content: ''; width: 80%; height: 12px; margin-top: -6px; border-radius: 50%; background: radial-gradient(closest-side, rgba(28, 27, 51, .4), transparent); }
.curtain-dots { display: flex; gap: 14px; }
.curtain-dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper-hi); transition: background .1s, transform .25s var(--ease-spring); }
.curtain-dots i.is-lit { transform: scale(1.35); }
.curtain-dots i.d-do.is-lit { background: var(--do); }
.curtain-dots i.d-mi.is-lit { background: var(--mi); }
.curtain-dots i.d-so.is-lit { background: var(--so); }
.ep-poster-fly { position: fixed; z-index: 30; margin: 0; object-fit: cover; border-radius: 14px; border: 3px solid var(--ink); pointer-events: none; box-shadow: 0 24px 40px -16px rgba(0, 0, 0, .5); }

@media (max-width: 599px) {
  dialog.ep-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .ep-grid { grid-template-columns: 48px minmax(0, 1fr); padding: 16px 14px 32px 10px; gap: 12px; }
  .ep-vertical { font-size: 1.5rem; padding: 12px 6px; }
  .ep-title { padding-right: 0; margin-top: 44px; }
  .ep-face { padding: 10px; }
  .ep-summary, .ep-summary-ghost { padding: 10px 8px; }
  .ep-nav .btn { flex: 1; white-space: nowrap; padding-inline: 10px; font-size: .875rem; }
  .ep-back { gap: 10px; padding: 26px 12px 16px; }
  .ep-q { font-size: 3.6rem; -webkit-text-stroke-width: 3px; text-shadow: 4px 5px 0 var(--ink); }
  .ep-continue { font-size: 1.1rem; }
  .ep-sns { flex-direction: column; align-items: stretch; width: 100%; gap: 10px; }
  .ep-sns .mp-cta-btn { min-height: 46px; padding: 6px 14px; }
  .cast-chip { gap: 8px; padding-right: 12px; }
  .cast-chip .cc-pic { width: 44px; height: 44px; }
  .cast-chip .cc-pic img.chara--cut { width: 40px; height: 40px; }
  .cast-chip .cc-pic .frame-round { width: 40px; }
  .ep-cast.is-big .cast-chip .cc-pic { width: 64px; height: 64px; }
  .ep-cast.is-big .cast-chip .cc-pic img.chara--cut { width: 58px; height: 58px; }
  .ep-cast.is-big .cast-chip .cc-pic .frame-round { width: 58px; }
}
