/* The image stays in view while the reader moves through the text. */
.scene-frame {
  width: min(100% - 8rem, 70rem);
  scroll-margin-top: 0;
}
.scene-frame > .frame-bar { padding: 0.7rem 1.4rem; }
.scene-frame .scene-context { margin: 0; padding: 0.7rem 1.4rem; }
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  border-block: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}
.reader-music { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
#music-toggle {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--control);
  border-radius: 4px;
  background: transparent;
  font-size: 0.875rem;
  white-space: nowrap;
}
#music-toggle[aria-pressed="true"] { color: var(--accent-hover); border-color: var(--accent); }
.music-volume { display: flex; align-items: center; gap: 0.6rem; }
.music-volume input { width: 4.5rem; min-height: 2.75rem; accent-color: var(--accent); }
.reader-layout { height: min(680px, calc(100svh - var(--reader-chrome, 180px) - var(--reader-offset, 104px) - 12px)); min-height: 280px; }
.js-ready .reader-layout { display: grid; grid-template-columns: 1fr 1fr; }
.reader-visual { display: none; }
.js-ready .reader-visual {
  display: flex;
  position: relative;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #18171d;
  isolation: isolate;
}
.reader-visual::before {
  position: absolute;
  z-index: -1;
  inset: -3rem;
  content: "";
  background: var(--scene-background) center / cover;
  opacity: 0.24;
  filter: blur(28px);
}
.reader-art-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  margin: 0;
}
#reader-art { display: block; width: 100%; height: auto; max-height: 100%; object-fit: contain; }
#art-unavailable { padding: 2rem; color: var(--muted); line-height: 1.7; }
.reader-scene-caption { padding: 1.25rem 1.5rem; background: rgb(9 9 11 / 55%); }
#current-scene-label { font-family: "Noto Serif KR", serif; font-size: 1.125rem; }
#current-music-title { margin-top: 0.45rem; color: var(--muted); font-size: 0.8125rem; }
.reader-scroll {
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #817392 #1a1a22;
  scrollbar-width: thin;
  border-left: 1px solid var(--line);
}
.reader-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.illustrated-scene { padding-top: 0; }
.story-copy { padding: 1.8rem 2rem 2rem; max-width: none; font-size: 1.1875rem; line-height: 1.95; }
.story-beat + .story-beat { border-top: 1px solid var(--line); }
.story-copy .dialogue { margin-block: 1.4rem; padding-left: 1rem; }
.story-copy .story-handoff { margin-top: 2rem; }
.choices { padding: 1.8rem 2rem 2rem; }
.choice { grid-template-columns: 1fr auto; }
.scene-result { min-height: 100%; padding: 2rem; }
.result-heading h3 { font-size: 1.625rem; line-height: 1.4; }
.result-prose { font-size: 1.1875rem; line-height: 1.9; }
.full-scene > summary { padding-inline: 2rem; }
.full-scene .scene-prose { padding: 1.8rem 2rem 2rem; font-size: 1.1875rem; }
.static-art { display: block; width: 100%; height: auto; }
.music-error { padding: 0.8rem 1.4rem; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); }
@media (max-width: 1023px) {
  .scene-frame { width: calc(100% - 4rem); }
}
@media (max-width: 767px) {
  .scene-frame { width: calc(100% - 2.5rem); }
  .scene-context { gap: 0.5rem 1rem; }
  .reader-toolbar { flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 1rem; }
  .reader-music { gap: 0.75rem; justify-content: space-between; width: 100%; }
  .scene-frame > .frame-bar { padding: 0.5rem 1rem; }
  .scene-frame .scene-context { padding: 0.5rem 1rem; font-size: 0.75rem; }
  .reader-layout { height: min(640px, calc(100svh - var(--reader-chrome, 180px) - var(--reader-offset, 84px) - 12px)); min-height: max(280px, calc(22rem - 72px)); }
  .js-ready .reader-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .js-ready .reader-visual { height: clamp(120px, 24svh, 230px); }
  .reader-art-frame { min-height: 0; }
  .reader-scene-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 1rem; }
  #current-scene-label { font-size: 0.9375rem; }
  #current-music-title { margin-top: 0; font-size: 0.75rem; }
  .reader-scroll { border-left: none; border-top: 1px solid var(--line); }
  .story-copy, .scene-result, .full-scene .scene-prose { padding: 1.4rem; font-size: 1.125rem; }
  .choices { padding: 1.4rem; }
  .full-scene > summary { padding-inline: 1.4rem; }
  .choice { padding: 1rem; }
  .choice-title { font-size: 1.0625rem; }
  .choice-arrow { font-size: 1.125rem; }
}
@media (max-height: 540px) and (max-width: 767px) {
  .js-ready .reader-visual { height: 120px; }
}
