/* Two facing leaves share the same illustration and spoken manuscript at every size. */
#library .intro h1 { color: #29483f; }
#library .feature, #library .book {
  box-shadow: 0 1px 0 #fff7e6 inset, 2px 3px 0 #e8ddc8, 3px 5px 0 #c7bba3;
  border-color: #c8bda5;
}
#library .feature > div { border-inline-start: 6px double #d8c7a8; }
#library .book { border-radius: 3px 8px 7px 3px; }
#library .book div { border-left: 4px solid #768b78; background: #fffbef; }
#library .book:nth-child(3n + 2) div { border-left-color: #9e805a; }
#library .book:nth-child(3n) div { border-left-color: #728797; }
#reader { --olive-ink: #37594b; --antique: #8a704a; }
#reader .spread {
  position: relative;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  isolation: isolate;
  align-items: stretch;
  background: #fffaf0;
  border: 1px solid #c6b69b;
  border-radius: 7px 15px 14px 7px;
  box-shadow: 0 2px 0 #f7efdf, 0 3px 0 #c7b99c, 0 5px 0 #ece1cc, 0 6px 0 #c7b99c,
              0 12px 22px -16px #594b31;
  overflow: hidden;
}
.picture-leaf {
  display: grid; align-items: center; min-width: 0; padding: clamp(10px, 1.6vw, 22px);
  background: linear-gradient(90deg, #f6efde, #fffaf0 9%, #fcf5e5 94%, #e6d9bd);
}
#reader .scene-plate { display: block; min-width: 0; width: 100%; background: transparent; }
.scene-window {
  position: relative; isolation: isolate; width: 100%; aspect-ratio: 11 / 7; overflow: hidden;
  border: 1px solid #c7b99e; border-radius: 2px 5px 2px 3px; background: #efe8d9;
}
#reader #page-art {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
  object-fit: contain; display: block;
}
#reader .scene-window.is-close #page-art, #reader .detail-window img {
  position: absolute; inset: auto; left: var(--crop-left); top: var(--crop-top);
  width: var(--crop-width); height: auto; max-width: none; max-height: none; display: block;
}
.scene-margin { position: relative; margin-top: 9px; min-height: 84px; }
#detail-toggle, .speaker-card {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 84px; text-align: start;
  color: #344a3e; padding: 6px 10px; border: 1px solid #cbbd9e; border-radius: 3px 10px 4px 6px;
  background: linear-gradient(100deg,#fffaf1,#f6edd8);
}
#detail-toggle:hover { background: #fbf1db; }
.detail-window {
  flex: 0 0 auto; display: block; position: relative; width: 84px; aspect-ratio: 1.45;
  overflow: hidden; border-radius: 52% 48% 49% 51%; border: 1px solid #c3b28f; background: #efe6cd;
}
.detail-copy { min-width: 0; display: grid; gap: 1px; }
.detail-copy strong, .speech-copy strong {
  font: 700 clamp(16px,1.45vw,21px)/1.45 "AppleMyungjo","Batang",Georgia,serif; color: #365143;
}
.detail-copy > span { font-size: 13px; font-weight: 550; color: #66583e; }
.magnifier { margin-inline: auto 3px; width: 16px; height: 16px; border: 1.7px solid #647365; border-radius: 50%; position: relative; }
.magnifier::after { content: ""; position: absolute; bottom: -4px; right: -4px; width: 7px; height: 1.7px; background: #647365; transform: rotate(45deg); }
.speaker-card { background: #edf1e6; border-color: #a8b9a5; padding-block: 5px; }
#reader #speaker-art {
  position: absolute; bottom: 3%; right: 2.5%; z-index: 1;
  width: clamp(86px,31%,170px); height: auto; aspect-ratio: 1; max-height: none;
  object-fit: cover; background: #fcf5e4;
  border-radius: 49% 51% 46% 48%; border: 3px solid #fff8e6;
  box-shadow: 0 0 0 1px #a39575, 0 3px 8px #352d2540; pointer-events: none;
}
#reader .portrait-left #speaker-art { left: 2.5%; right: auto; }
.portrait-left .scene-sound { left: auto; right: 4%; }
.speech-copy { min-width: 0; }
.speech-copy p { color: #344a3e; font: 16px/1.5 "AppleMyungjo","Batang",Georgia,serif;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#reader .leaf {
  justify-content: center; padding: clamp(18px,3vw,40px) clamp(18px,3vw,38px);
  background: linear-gradient(90deg,#decfb4 0,#f6edda 2.3%,#fffaee 7%,#fffaf0 95%,#f7edda);
}
.leaf-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 1.1em; padding-bottom: .6em; border-bottom: 1px solid #d9cdb4; }
#reader .leaf h1 { color: var(--olive-ink); line-height: 1.4; margin: 0; font-size: clamp(22px,2.5vw,33px); }
.silk-mark { display: block; width: 10px; height: 24px; background: #6b8278;
  clip-path: polygon(0 0,100% 0,100% 100%,50% 80%,0 100%); flex-shrink: 0; align-self: flex-start; }
#reader #page-text { color: #352f25; line-height: 1.92; font-size: clamp(19px,1.95vw,26px); }
#page-text .spoken { border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
#page-text .spoken[data-kind="dialogue"] {
  display: block; color: #2f564a; font-weight: 650; border-inline-start: 3px solid #a4b6a1;
  margin-block: .35em; padding-inline: .48em .15em;
}
#page-text .spoken.is-current { background: #f1e5c9; }
#page-text .spoken.is-current[data-kind="dialogue"] { background: #e3eddf; border-color: #658571; }
#reader .folio { color:#7a705a; font-variant-numeric: tabular-nums; margin-top: 18px; }
#reader .reader-tools { margin: 0 auto; }
#reader .reader-tools button { min-height: 46px; }
@media(max-width:700px) {
  #reader .spread { grid-template-columns: 100%; margin: 13px 0 18px; }
  .picture-leaf { padding: 8px 8px 0; background: #f7efde; }
  #reader .leaf { padding: 14px clamp(16px,4.5vw,28px) 9px; background: #fffaf0; }
  .scene-margin { min-height: 63px; margin-block: 6px 0; }
  #detail-toggle,.speaker-card { min-height: 63px; gap: 9px; padding: 4px 9px; }
  .detail-window { width: 66px; }

  .speech-copy p { font-size: 14px; line-height: 1.45; }
  .leaf-heading { margin-bottom: .5em; padding-bottom: .32em; }
  #reader .leaf h1 { font-size: 21px; }
  #reader #page-text { font-size: 19px; line-height: 1.78; }
  #reader .folio { margin-top: 7px; }
  #library .feature > div { border-inline-start: 0; border-top: 3px double #d8c7a8; }
}
@media(prefers-reduced-motion:no-preference) {
  .speaker-card:not([hidden]) { animation: ink-appear .24s ease-out; }
  @keyframes ink-appear { from { opacity: .35; } to { opacity: 1; } }
}
.scene-margin.is-speaking { display: grid; grid-template-columns: minmax(0,1fr) 46px; gap: 5px; }
.scene-margin.is-speaking .speaker-card { grid-column: 1; grid-row: 1; }
.scene-margin.is-speaking #detail-toggle { grid-column: 2; grid-row: 1; justify-content: center; padding: 6px; }
.scene-margin.is-speaking #detail-toggle .detail-window,.scene-margin.is-speaking #detail-toggle .detail-copy { display: none; }
.scene-margin.is-speaking .magnifier { margin: 0 4px 4px 0; }
.scene-window { touch-action: pan-y pinch-zoom; }
@media(max-width:700px) {
  #reader .reader-tools {
    position: sticky; bottom: 0; z-index: 2; display: grid;
    grid-template-columns: minmax(0,1.21fr) repeat(3,minmax(0,1fr));
    gap: 4px; padding: 6px 0 max(6px,env(safe-area-inset-bottom));
    background: #f5f1e6; border-top: 1px solid #d5c9b4;
  }
  #reader .reader-tools > div { display: contents; }
  #reader .reader-tools button { min-width: 0; padding: 4px 3px; font-size: 14px; line-height: 1.25; }
}
.scene-sound {
  position: absolute; inset: auto auto 5% 4%; max-width: 85%; padding: .1em .65em .2em;
  border: 1px solid #a99772; border-radius: 45% 35% 40% 30%;
  background: #fff8e9f5; color: #4d4937;
  font: 700 clamp(16px,2.1vw,26px)/1.4 "AppleMyungjo","Batang",Georgia,serif;
  pointer-events: none;
}
.cast-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 17px; margin: 10px 0 16px; padding: 0; }
.cast-list li { display: flex; align-items: center; gap: 6px; color: #3b5142; font-weight: 650; font-size: .88rem; }
#library .feature .cast-list img { width: 40px; min-height: 0; height: 40px; border: 1px solid #c6b897; border-radius: 50%; object-fit: cover; }
