.story-reader { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
.story-reader__back { font-size: .85rem; text-decoration: none; opacity: .7; }
.story-reader__title { margin: .4rem 0 .2rem; font-size: 1.6rem; line-height: 1.25; }
.story-reader__langs { margin: 0 0 .9rem; font-size: .9rem; opacity: .78; font-weight: 600; }

/* The language, kept on screen once the header scrolls away. Hidden until then:
   directly under a heading that says the same thing it is just noise. */
.story-reader__bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: baseline; gap: .6rem;
  margin: 0 -1rem; padding: .5rem 1rem;
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid rgba(0,0,0,.12);
  backdrop-filter: saturate(1.2) blur(6px);
  opacity: 0; transform: translateY(-4px);
  pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.story-reader__bar.is-stuck { opacity: 1; transform: none; }
.story-reader__bar-lang {
  font-weight: 700; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
  color: #8a5a12;
}
.story-reader__bar-title { font-size: .82rem; opacity: .6; }
.story-reader__controls { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  font-size: .85rem; padding-bottom: .9rem; border-bottom: 1px solid rgba(128,128,128,.25); }
.story-reader__controls label { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
/* An explicit display beats the `hidden` attribute, so hiding the readings
   toggle in JS had no visible effect at all — the control stayed on screen and
   still did nothing, which is the complaint it was meant to answer. */
.story-reader__controls label[hidden] { display: none; }
.story-reader__store { margin-left: auto; font-weight: 600; text-decoration: none; }
.story-reader__status { padding: 1.5rem 0; opacity: .7; }
.story-reader__pages { list-style: none; margin: 0; padding: 1rem 0 0; }
.story-reader__page { padding: .85rem 0; border-bottom: 1px solid rgba(128,128,128,.14); }
.story-reader__source { font-size: 1.25rem; line-height: 2.1; margin: 0 0 .35rem; }
.story-reader__translation { margin: 0; font-size: .95rem; opacity: .7; line-height: 1.5; }
.story-reader--no-translation .story-reader__translation { display: none; }
.story-reader--no-reading .story-reader__reading { visibility: hidden; }

/* Alignment highlighting: hovering or tapping a word lights its counterpart in
   the translation, and vice versa. The pairs come from the compiled alignment
   data, so this is the same mapping the app uses rather than a guess. */
.story-reader__t { border-radius: .18rem; transition: background-color .12s ease; cursor: default; }
.story-reader__w.is-aligned,
.story-reader__t.is-aligned { background: rgba(233, 168, 62, .34); }
.story-reader__w.is-aligned { box-shadow: 0 -2px 0 rgba(233,168,62,.34) inset, 0 2px 0 rgba(233,168,62,.34) inset; }

/* A word plus its reading, stacked, so the line stays readable when readings are off. */
.story-reader__w { display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: bottom; margin: 0 .04em; border-radius: .2rem; cursor: pointer; }
.story-reader__w:hover, .story-reader__w:focus { background: rgba(120,160,255,.22); outline: none; }
.story-reader__w--known { box-shadow: inset 0 -2px 0 rgba(120,160,255,.5); }
.story-reader__reading { font-size: .62em; line-height: 1.1; opacity: .6; height: 1.1em; }

/*  DO NOT MAKE THIS PANEL DARK-MODE AWARE.
 *
 *  It was, and the result was an unreadable panel: a prefers-color-scheme block
 *  set the background to #1b1d21 while `color: inherit` kept the site's dark
 *  text, giving rgb(35,34,32) on rgb(27,29,33) — black on black.
 *
 *  The site itself has NO dark styling; the page stays cream with dark text
 *  whatever the OS is set to. A component that responds to the OS scheme inside
 *  a theme that does not is guaranteed to mismatch. Both colours are therefore
 *  stated explicitly and paired, so the panel can never inherit half a scheme. */
.story-reader__panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fffdf8; color: #232220; border-top: 1px solid rgba(0,0,0,.16);
  box-shadow: 0 -8px 24px rgba(0,0,0,.12); padding: 1rem 1.1rem 1.4rem; max-height: 45vh; overflow: auto; }
.story-reader__panel-close { position: absolute; top: .5rem; right: .7rem; background: none;
  border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #232220; opacity: .55; }
.story-reader__panel-word { margin: 0; font-size: 1.5rem; }
.story-reader__panel-reading { margin: .1rem 0 .6rem; opacity: .6; font-size: .9rem; }
.story-reader__panel-senses { margin: 0; padding-left: 1.1rem; }
.story-reader__panel-senses li { margin-bottom: .3rem; }
.story-reader__panel-pos { opacity: .55; font-size: .8em; margin-right: .35rem; }
@media (min-width: 60rem) {
  .story-reader__panel { left: auto; right: 1.5rem; bottom: 1.5rem; width: 22rem;
    border: 1px solid rgba(0,0,0,.16); border-radius: .6rem; max-height: 60vh; }
}
