:root {
  color-scheme: dark;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
}

/* Narrative Ming text keeps only the faint white outer glow used at Jiayu's home. */
.fair-arrival-caption {
  text-shadow:
    0 0 2px rgba(255, 255, 255, .55),
    0 0 .28em rgba(255, 255, 255, .32) !important;
}

/* Project-wide typography rule: text stays flat and shadow-free. */
*,
*::before,
*::after {
  text-shadow: none !important;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #79a9c7;
}

body { overscroll-behavior: none; }

body::after {
  content: "";
  position: fixed;
  z-index: 9999;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, .001);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: -webkit-backdrop-filter 1s ease-in-out, backdrop-filter 1s ease-in-out;
}

body.is-arriving::after,
body.is-leaving::after {
  pointer-events: auto;
  -webkit-backdrop-filter: blur(13px);
  backdrop-filter: blur(13px);
}

.fair-panorama-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #79a9c7;
}

.fair-panorama-shell.is-dragging { cursor: grabbing; }

.fair-panorama-shell:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .8);
  outline-offset: -3px;
}

.fair-panorama-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .28s ease-out;
}

.fair-panorama-canvas.is-ready { opacity: 1; }

.fair-panorama-loading,
.fair-panorama-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(255, 255, 255, .92);
  background: #79a9c7;
  text-align: center;
  letter-spacing: .08em;
}

.fair-panorama-loading { transition: opacity .2s ease-out; }
.fair-panorama-loading.is-hidden { opacity: 0; pointer-events: none; }
.fair-panorama-fallback[hidden] { display: none; }

.fair-arrival-caption {
  position: fixed;
  z-index: 48;
  top: 47%;
  right: clamp(34px, 7vw, 118px);
  width: auto;
  max-width: min(52vw, 760px);
  padding: .36em .18em .44em .36em;
  border: 0;
  color: rgba(255, 255, 255, .96);
  background: transparent;
  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;
  text-shadow:
    0 0 3px rgba(255, 255, 255, .82),
    0 0 10px rgba(244, 248, 255, .5),
    0 2px 8px rgba(0, 0, 0, .62);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .56s ease, filter .56s ease, transform .56s ease;
}

.fair-arrival-caption.is-visible { opacity: 1; }

.fair-arrival-caption.is-ready.is-dismissible {
  cursor: pointer;
  pointer-events: auto;
}

.fair-arrival-caption.is-ready.is-dismissible:focus-visible {
  outline: none;
}

.fair-arrival-caption.is-dismissing {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(-5px);
  pointer-events: none;
}

.fair-arrival-caption p { margin: 0 0 .32em; }
.fair-arrival-caption p:last-child { margin-bottom: 0; }

.fair-arrival-caption [data-caption-character] {
  display: inline-block;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(.22em);
  animation: fair-arrival-character .72s cubic-bezier(.2, .72, .25, 1) forwards;
  animation-delay: var(--character-delay, calc(.35s + var(--character-index) * .12s));
}

.fair-arrival-caption a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: .055em;
  text-underline-offset: .18em;
  outline: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.fair-arrival-caption.is-ready a {
  cursor: pointer;
  pointer-events: auto;
}

.fair-arrival-caption.is-ready a:hover,
.fair-arrival-caption.is-ready a:focus-visible {
  color: #fff;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 1),
    0 0 15px rgba(255, 255, 255, .78),
    0 2px 8px rgba(0, 0, 0, .62);
}

@keyframes fair-arrival-character {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
  .fair-panorama-canvas,
  .fair-panorama-loading { transition: none; }
  .fair-arrival-caption [data-caption-character] {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }
  .fair-arrival-caption { transition: none; }
}

@media (max-width: 640px) {
  .fair-arrival-caption {
    top: 34%;
    right: 18px;
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
    font-size: clamp(19px, 5.8vw, 26px);
    line-height: 1.75;
    letter-spacing: .11em;
  }
}

.fair-hide-seek-reunion {
  position: fixed;
  z-index: 72;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

.fair-hide-seek-reunion[hidden] { display: none; }

.fair-hide-seek-reunion__character {
  display: flex;
  flex: 1 1 50%;
  align-items: flex-end;
  justify-content: center;
  width: 50%;
  height: 100vh;
  margin: 0;
  opacity: 0;
  transition: opacity .68s ease-out, transform .92s cubic-bezier(.2, .78, .22, 1);
  will-change: opacity, transform;
}

.fair-hide-seek-reunion__character--left {
  --reunion-portrait-height: 115vh;
  transform: translate3d(-112%, 0, 0);
}

.fair-hide-seek-reunion__character--right {
  --reunion-portrait-height: 103vh;
  transform: translate3d(112%, 0, 0);
}

.fair-hide-seek-reunion.is-visible .fair-hide-seek-reunion__character {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.fair-hide-seek-reunion__character img {
  display: block;
  width: auto;
  height: var(--reunion-portrait-height);
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform: translate3d(0, 31vh, 0);
  transform-origin: center bottom;
  filter: drop-shadow(0 12px 18px rgba(13, 23, 30, .32));
}

@media (prefers-reduced-motion: reduce) {
  .fair-hide-seek-reunion__character { transition: none; }
}

.panorama-character-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.panorama-character-trigger { pointer-events: none; }

.fair-panorama-shell.has-character-dialogue {
  cursor: default;
}

.panorama-character-dialogue {
  --portrait-height: 88vh;
  --portrait-image-height: 88vh;
  position: fixed;
  z-index: 72;
  right: clamp(18px, 4vw, 76px);
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: min(56vw, 920px);
  height: min(var(--portrait-height), calc(100vh - 24px));
  opacity: 1;
  transform: translate3d(112%, 0, 0);
  transition: transform .84s cubic-bezier(.22, .78, .24, 1);
  pointer-events: none;
  overflow: hidden;
  filter: drop-shadow(0 12px 18px rgba(13, 23, 30, .36));
}

.panorama-character-dialogue[hidden] { display: none; }

.panorama-character-dialogue.is-visible {
  transform: translate3d(0, 0, 0);
}

.panorama-character-portrait {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  width: auto;
  height: var(--portrait-image-height);
  max-width: none;
  object-fit: contain;
  object-position: right top;
  pointer-events: none;
}

.panorama-character-name {
  display: none;
}

.panorama-character-close {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.panorama-character-close:hover,
.panorama-character-close:focus-visible {
  color: transparent;
  background: transparent;
  outline: none;
}
@media (prefers-reduced-motion: reduce) {
  .panorama-character-dialogue { transition: none; }
}

@media (max-width: 760px) {
  .panorama-character-dialogue {
    right: max(8px, env(safe-area-inset-right));
    bottom: -8vh;
    width: min(66vw, 360px);
    height: 68vh;
    overflow: visible;
  }

  .panorama-character-portrait {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    max-height: 68vh;
    object-position: right bottom;
  }

  .panorama-character-name { display: none; }
}
