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

/* Xinling's Ming text keeps the Jiayu-home glow; Yuting's rounded type stays flat. */
.park-yuting-dialogue-line:not(.speaker-yuting) {
  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: #172017;
}

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 {
  pointer-events: auto;
  -webkit-backdrop-filter: blur(13px);
  backdrop-filter: blur(13px);
}

.park-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: #172017;
}

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

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

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

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

.park-yuting-hotspot {
  position: absolute;
  z-index: 5;
  padding: 0;
  border: 0;
  border-radius: 45%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.park-yuting-hotspot:hover,
.park-yuting-hotspot:focus,
.park-yuting-hotspot:focus-visible,
.park-yuting-hotspot:active {
  outline: 0;
  background: transparent;
  box-shadow: none;
}
.park-yuting-hotspot[hidden] { display: none; }

.park-yuting-foreground {
  position: fixed;
  z-index: 6;
  right: clamp(-54px, -2vw, -12px);
  bottom: -24vh;
  height: min(92vh, 860px);
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 1;
  transform: translateX(112%);
  transform-origin: 70% 100%;
  transition: transform .84s cubic-bezier(.22, .78, .24, 1);
  cursor: pointer;
  filter: drop-shadow(-9px 12px 14px rgba(0, 0, 0, .32));
  -webkit-tap-highlight-color: transparent;
}

.park-yuting-foreground img {
  display: block;
  width: auto;
  height: 100%;
  pointer-events: none;
}

.park-yuting-foreground.is-visible {
  transform: translateX(0);
}
.park-yuting-foreground[hidden] { display: none; }
.park-yuting-foreground:focus-visible { outline: 3px solid rgba(255, 255, 255, .88); outline-offset: -9px; }

.park-yuting-dialogue {
  position: fixed;
  z-index: 30;
  left: clamp(250px, 17vw, 330px);
  right: clamp(280px, 19vw, 370px);
  bottom: clamp(16px, 2.5vh, 30px);
  width: auto;
  opacity: 1;
  transform: translateY(14px);
  transition: transform .34s ease;
  pointer-events: none;
}

.park-yuting-dialogue[hidden] { display: none; }
.park-yuting-dialogue.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}
.park-yuting-dialogue.is-hiding { transform: translateY(8px); }

.park-yuting-dialogue-card {
  display: block;
  width: 100%;
  min-height: min(76vh, 620px);
  padding: 0;
  border: 0;
  border-radius: 0;
  color: rgba(255, 255, 255, .96);
  background: transparent;
  box-shadow: none;
  text-align: left;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.park-yuting-dialogue-card:hover,
.park-yuting-dialogue-card:focus,
.park-yuting-dialogue-card:focus-visible {
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
}

.park-yuting-dialogue-lines {
  position: relative;
  display: flex;
  min-height: min(68vh, 560px);
  max-height: 82vh;
  overflow: hidden;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}

.park-yuting-dialogue-line {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  color: rgba(255, 255, 255, .98);
  font-family: "I.MingCP", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-size: clamp(23px, 2.1vw, 35px);
  font-weight: 600;
  line-height: 1.72;
  letter-spacing: .16em;
  text-wrap: pretty;
  -webkit-text-stroke: 0;
  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);
  transition: opacity .48s ease, transform .48s cubic-bezier(.2, .74, .24, 1), filter .48s ease;
}

.park-yuting-dialogue-line.speaker-yuting {
  color: #ffe28a;
  font-family: "源泉圓體丹 R", "GenSenRounded2 PJP R", "HGMaruGothicMPRO", sans-serif;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: .16em;
  -webkit-text-stroke: 0;
  text-shadow:
    0 0 3px rgba(255, 226, 138, .82),
    0 0 10px rgba(255, 226, 138, .46),
    0 2px 8px rgba(0, 0, 0, .62);
}

.park-yuting-dialogue-line.speaker-xinling {
  color: #fff;
}

.park-yuting-dialogue-line.is-oldest { opacity: .36; filter: blur(.35px); }
.park-yuting-dialogue-line.is-middle { opacity: .68; }
.park-yuting-dialogue-line.is-moving { will-change: transform, opacity; }
.park-yuting-dialogue-lines { overflow-anchor: none; }
.park-yuting-dialogue-line.is-current { opacity: 1; }
.park-yuting-dialogue-line.is-entering {
  opacity: 1;
  filter: none;
  transform: none;
}
.park-yuting-dialogue-line.is-entering.is-visible {
  opacity: 1;
  filter: none;
  transform: none;
}

.park-yuting-dialogue-line.is-final-thought {
  position: relative;
  top: -1.65em;
}
.park-yuting-dialogue-line.is-ghost {
  position: absolute;
  z-index: 2;
  margin: 0;
  opacity: .36;
  pointer-events: none;
}
.park-yuting-dialogue-line.is-ghost.is-fading {
  opacity: 0;
  filter: blur(3px);
  transform: translateY(-18px);
}

.park-yuting-dialogue-card small {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, .74);
  font: 400 13px/1.2 "Microsoft JhengHei", sans-serif;
  letter-spacing: .08em;
  text-align: right;
}

.park-panorama-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #f4f4f4;
  background: #172017;
  text-align: center;
}

.park-panorama-fallback[hidden] { display: none; }

.park-back {
  position: fixed;
  z-index: 4;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  width: 42px;
  height: 42px;
  padding: 0 0 3px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 4px;
  color: #fff;
  background: rgba(21, 30, 23, .62);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .34);
  font: 700 26px/1 "Segoe UI Symbol", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(2px);
}

.park-back:hover,
.park-back:focus-visible {
  background: rgba(21, 30, 23, .86);
  outline: 2px solid rgba(255, 255, 255, .9);
  outline-offset: 2px;
}

.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 (max-width: 640px) {
  .park-back {
    width: 38px;
    height: 38px;
    font-size: 23px;
  }
  .park-yuting-foreground {
    right: max(4px, env(safe-area-inset-right));
    bottom: -9vh;
    width: min(68vw, 360px);
    height: 65vh;
  }
  .park-yuting-foreground img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
  }
  .park-yuting-dialogue {
    top: max(18px, env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    bottom: auto;
    width: auto;
  }
  .park-yuting-dialogue-card {
    min-height: 34vh;
    padding: 0;
  }
  .park-yuting-dialogue-lines {
    min-height: 29vh;
    max-height: 38vh;
    gap: 10px;
  }
  .park-yuting-dialogue-line {
    font-size: clamp(20px, 5.35vw, 26px);
    line-height: 1.55;
    letter-spacing: .06em;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
  .park-panorama-canvas { transition: none; }
  .park-yuting-foreground { transition: none; }
  .park-yuting-dialogue { transition: none; }
  .park-yuting-dialogue-line { transition: none; }
}
