/* Shared Xinling white narrative typography; controls such as the music
   player keep their own UI fonts, and other speakers retain their identity. */
:root { --xinling-narrative-font: "I.MingCP", "Noto Serif TC", "Songti TC", "PMingLiU", serif; }
:is(.home-arrival-caption, .fair-arrival-caption, .construction-thought,
    .construction-warning-message, .ebook-fold-thought, .ebook-fold-choice,
    .ebook-fold-clue-form, .riverside-thought, .riverside-choice, .riverside-answer,
    .story-dialogue-line.speaker-xinling) {
  font-family: var(--xinling-narrative-font);
  font-weight: 600;
}
:is(.ebook-fold-clue-input, .riverside-answer input) {
  font-family: var(--xinling-narrative-font);
  font-weight: 600;
}
/* A thin white edge belongs to inner thoughts, never spoken dialogue or UI.
   Set it on glyph descendants too: the shared * shadow reset blocks inheritance. */
:is(.home-arrival-caption, .fair-arrival-caption, .construction-thought,
    .construction-warning-message, .ebook-fold-thought, .ebook-fold-choice,
    .ebook-fold-clue-form, .fair-search-caption, .riverside-thought),
:is(.home-arrival-caption, .fair-arrival-caption, .construction-thought,
    .construction-warning-message, .ebook-fold-thought, .ebook-fold-choice,
    .ebook-fold-clue-form, .fair-search-caption, .riverside-thought) *,
#parkYutingDialogue .park-yuting-dialogue-line.is-final-thought,
#parkYutingDialogue .park-yuting-dialogue-line.is-final-thought * {
  text-shadow: 0 0 1px rgba(255, 255, 255, .62),
               0 0 4px rgba(255, 255, 255, .28) !important;
}

/* Home only: broad ambient shade, not a frosted text tile. Window and wall
   detail stay sharp; the shade dissolves far beyond the sentence bounds. */
:is(.home-arrival-caption, .riverside-thought)::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: calc(50% - 80vw);
  top: calc(50% - 60vh);
  width: 160vw;
  height: 120vh;
  border: 0;
  background: radial-gradient(ellipse at center,
    rgba(26, 31, 35, .26) 0%,
    rgba(26, 31, 35, .13) 42%,
    rgba(26, 31, 35, 0) 72%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
  animation: home-thought-veil-arrive .28s ease-out both;
}
:is(.home-arrival-caption, .riverside-thought) > span { position: relative; z-index: 1; }
@keyframes home-thought-veil-arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.home-arrival-caption, .riverside-thought)::before { animation: none; }
}

/* New riverside scenes use the same typography and glyph timing as home.
   Keep their centered placement, not home's object-specific positioning. */
.riverside-thought {
  color: rgba(255, 255, 255, .96);
  font-family: "I.MingCP", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: clamp(23px, 2.45vw, 40px);
  font-weight: 600;
  line-height: 1.72;
  letter-spacing: .16em;
  text-align: left;
  white-space: normal;
  cursor: default;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.riverside-thought .inner-thought-character {
  display: inline-block;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(.22em);
  animation: inner-thought-character .72s cubic-bezier(.2,.72,.25,1) forwards;
  animation-delay: calc(.35s + var(--character-index) * .12s);
}
.riverside-thought.is-ready { cursor: pointer; pointer-events: auto; }
.riverside-thought.is-dismissing {
  pointer-events: none;
  animation: riverside-thought-dismiss .85s ease-in-out forwards;
}
.riverside-thought:focus-visible { outline:none !important; }
@keyframes inner-thought-character {
  to { opacity:1; filter:blur(0); transform:translateY(0); }
}
@keyframes riverside-thought-dismiss {
  from { opacity:1; filter:blur(0); transform:translate(-50%,-50%); }
  to { opacity:0; filter:blur(7px); transform:translate(calc(-50% + 16px),-50%); }
}
@media(prefers-reduced-motion:reduce) {
  .riverside-thought .inner-thought-character { opacity:1; filter:none; transform:none; animation:none; }
  .riverside-thought.is-dismissing { animation:none; }
}
