/* The clean sky stage temporarily removes liquid-surface detail behind videos. */
.lake, .horizon-glow { display: none !important; }

/* Aligned raster characters; SVG remains available for poses without artwork. */
.character-bank {
  position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(180deg,#111a31,#0a1225 55%,#060e1f);
  mask-image: linear-gradient(180deg,transparent 0,#000 28px,#000 100%);
  -webkit-mask-image: linear-gradient(180deg,transparent 0,#000 28px,#000 100%);
}
.character-bank[hidden] { display: none; }
body.character-scene-active .world {
  width: var(--rig-width); height: var(--rig-height);
  left: var(--rig-left); top: var(--rig-top);
  transform: translate(var(--rig-anchor-x),var(--rig-anchor-y)); overflow: visible;
}
.world.has-raster-character #girlScene { visibility: hidden; }
.character-rig { position: absolute; inset: 0; pointer-events: none; }
.character-rig[hidden] { display: none; }
.character-rig.masked-stage {
  mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
}
.character-rig img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.character-layers { position: absolute; inset: 0; visibility: hidden; }
.character-rig.rig-ready .character-layers { visibility: visible; }
.character-rig.rig-ready .character-static { visibility: hidden; }
.character-rig.is-static .character-layers { visibility: hidden; }
.character-rig.is-static .character-static { visibility: visible; }
body.character-scene-active .girl-hitbox {
  left: var(--rig-hit-left); top: var(--rig-hit-top);
  width: var(--rig-hit-width); height: var(--rig-hit-height); border-radius: 18%;
}
body.character-scene-active .girl-hitbox:focus-visible { outline: 1px solid #d4cfba; outline-offset: 5px; }
.character-surface {
  display: none;
}
.character-surface::after {
  content: ''; position: absolute; width: 75%; height: 40%; left: 12.5%; top: 38%;
  border-bottom: 1px solid #61718a33; border-radius: 50%;
}
.keypose-stage { position: absolute; inset: 0; z-index: 3; display: none; pointer-events: none; }
.keypose-stage.active { display: block; }
.keypose-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; opacity: 0; pointer-events: none; user-select: none;
  z-index: 1;
  transform: translate(var(--keypose-offset-x,0%),var(--keypose-offset-y,0%));
}
.keypose-stability-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none; user-select: none; z-index: 2;
}
.keypose-stability-overlay[hidden] { display: none; }
.keypose-video-preview {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: contain; pointer-events: none;
  z-index: 3; opacity: 0; transition: opacity .36s cubic-bezier(.22,.61,.36,1);
  mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
}
.keypose-video-preview.ready { opacity: 1; }
.keypose-video-preview.leaving { opacity: 0; }
.default-video-stage {
  position: absolute; inset: 0; display: none; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg,#111a31,#0a1225 55%,#060e1f);
  mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 61%,#000 48%,transparent 84%);
}
.default-video-stage.active { display: block; }
.default-video-preview {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: contain; pointer-events: none;
  mix-blend-mode: lighten; opacity: 0; transition: opacity .22s ease;
}
.default-video-preview.ready { opacity: 1; }
body.action-daze .default-video-stage[data-character-action="daze"] {
  background: linear-gradient(180deg, #12172e, #0a1225 55%, #070e1f);
  mask-image: linear-gradient(90deg, transparent 0%, #000 11%, #000 89%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 11%, #000 89%, transparent 100%);
}
body.action-daze .default-video-stage[data-character-action="daze"] .default-video-preview {
  mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 86%, transparent 96%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 86%, transparent 96%);
}
body.action-daze .default-video-stage[data-character-action="daze"]::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10,18,38,.95) 0%, rgba(10,18,38,0) 16%, rgba(10,18,38,0) 84%, rgba(10,18,38,.95) 100%),
    linear-gradient(180deg, rgba(18,23,46,.96) 0%, rgba(18,23,46,0) 18%, rgba(9,17,36,0) 78%, rgba(9,17,36,.96) 100%);
}
@media (orientation: landscape) and (max-height: 500px) {
  body.action-rest .speech {
    left: 34%;
    top: 4%;
    max-width: 220px;
    transform: translateX(-50%);
  }
  body.action-rest .speech.quiet { transform: translateX(-50%) translateY(8px); }
}
.character-surface[data-surface=deck] {
  width: 126%; height: 15%; left: -13%; top: calc(var(--rig-surface-top) - 2%);
  background: linear-gradient(176deg,#172037,#121b30 66%,#0c1428);
  border-radius: 1%; clip-path: polygon(15% 0,86% 0,100% 78%,89% 100%,8% 100%,0 78%);
  box-shadow: inset 0 1px #8490a326; opacity: .97;
}
.character-surface[data-surface=deck]::after {
  inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0;
  background: repeating-linear-gradient(178deg,transparent 0 11px,#69779115 12px,transparent 13px 21px);
}
body.character-scene-active .interaction-visual { top: 32%; }
.star-reaction {
  position: fixed; inset: 0; z-index: 18; pointer-events: none;
  visibility: hidden; opacity: 0; transition: opacity .4s ease, visibility 0s linear .4s;
}
.star-reaction.active { visibility: visible; opacity: 1; transition: opacity .35s ease; }
.star-reaction.leaving { opacity: 0; }
.star-reaction-caption {
  position: fixed; z-index: 12; left: 50%; bottom: 108px;
  transform: translate(-50%,8px); display: flex; align-items: flex-start; gap: 9px;
  max-width: min(390px,calc(100vw - 36px)); padding: 10px 15px;
  border: 1px solid rgba(208,214,229,.11); border-radius: 5px 16px 16px 16px;
  background: rgba(13,20,40,.48); backdrop-filter: blur(14px);
  opacity: 0; transition: opacity .35s ease, transform .45s ease;
}
.star-reaction.active .star-reaction-caption { opacity: 1; transform: translate(-50%,0); }
.star-reaction.awaiting-text:not(.active) .star-reaction-caption { opacity: 0; }
.star-reaction.active.awaiting-text .star-reaction-caption { opacity: 0; transform: translate(-50%,5px); }
.star-reaction-caption p {
  margin: 0; color: #c8c6c6; font-family: var(--serif); font-size: 12px;
  line-height: 1.75; letter-spacing: .08em; opacity: 1;
}
.star-reaction-caption p.line-in { animation: reactionLineIn .42s ease-out both; }
.star-reaction-mark { color: #d5c6a7; line-height: 1.65; }
body.star-reaction-share #sky { filter: brightness(.84) saturate(.88); }
body.star-reaction-share .speech { opacity: 0; pointer-events: none; }
@media (orientation: portrait) {
}
@media (max-width: 640px) {
  .star-reaction-caption { bottom: 88px; max-width: calc(100vw - 30px); padding: 9px 13px; }
  .star-reaction-caption p { font-size: 10px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.character-scene-active .topbar { height: 65px; padding: 12px 22px; }
  body.character-scene-active .lunar-info { top: 22%; left: 4%; gap: 3px; }
  body.character-scene-active .lunar-info strong { font-size: 18px; margin: 0; }
  body.character-scene-active .time-line { margin-top: 3px; }
  body.character-scene-active .moon-wrap { width: 80px; height: 80px; top: 18%; right: 14%; }
  body.character-scene-active .speech { top: 18%; left: 40%; max-width: 230px; padding: 9px 12px; }
  body.character-scene-active .speech p { font-size: 10px; }
  body.character-scene-active .dock { bottom: 9px; padding: 3px 8px; }
  body.character-scene-active .dock-btn { height: 44px; }
  .star-reaction-caption { left: 4%; bottom: 68px; transform: translateY(6px); max-width: 230px; padding: 7px 11px; }
  .star-reaction.active .star-reaction-caption { transform: translateY(0); }
  .star-reaction-caption p { font-size: 9px; }
}

/* Scene reactions use one shared coordinate system around the approved character rig. */
.scene-reaction-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}
.scene-reaction-fx > span,
.scene-reaction-fx i {
  position: absolute;
  display: block;
  pointer-events: none;
}
.reaction-glow {
  left: 50%;
  top: 42%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(222,207,178,.13), rgba(152,171,199,.05) 38%, transparent 68%);
  filter: blur(7px);
  transform: translate(-50%,-50%) scale(.96);
}
.reaction-halo {
  left: 50%;
  top: 43%;
  width: 51%;
  height: 33%;
  border: 1px solid rgba(222,209,186,.22);
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    0 0 22px rgba(202,193,177,.06),
    inset 0 0 28px rgba(189,201,218,.035);
  transform: translate(-50%,-50%) scale(.96);
}
.reaction-motes i {
  width: 3px;
  height: 3px;
  top: 29%;
  left: 51%;
  border-radius: 50%;
  opacity: 0;
  background: #dfd1b6;
  box-shadow: 0 0 8px rgba(223,209,182,.55);
}
.reaction-motes i:nth-child(2) { top: 32%; left: 46%; width: 2px; height: 2px; }
.reaction-motes i:nth-child(3) { top: 27%; left: 57%; width: 2px; height: 2px; }
.reaction-motes i:nth-child(4) { top: 37%; left: 59%; }
.reaction-motes i:nth-child(5) { top: 38%; left: 43%; width: 2px; height: 2px; }
.reaction-glimmer i {
  width: 8px;
  height: 8px;
  top: 44%;
  left: 64%;
  opacity: 0;
  background: #ded4c1;
  clip-path: polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);
  filter: drop-shadow(0 0 5px rgba(224,216,196,.48));
}
.reaction-glimmer i:nth-child(2) { top: 37%; left: 59%; transform: scale(.55); }
.reaction-glimmer i:nth-child(3) { top: 53%; left: 70%; transform: scale(.42); }
.reaction-haze {
  left: 50%;
  top: 49%;
  width: 90%;
  height: 56%;
  opacity: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 48% 46%, rgba(128,145,179,.08), transparent 51%),
    linear-gradient(90deg, transparent, rgba(178,190,209,.045), transparent);
  filter: blur(10px);
  transform: translate(-50%,-50%);
}
.reaction-snack {
  left: 71%;
  top: 88%;
  width: 13%;
  height: 12%;
  opacity: 0;
  transform: translateY(9px) scale(.82);
  transform-origin: 50% 100%;
}
.snack-plate {
  left: 7%;
  bottom: 7%;
  width: 88%;
  height: 24%;
  border: 1px solid rgba(200,197,195,.25);
  border-radius: 50%;
  background: rgba(106,105,122,.25);
  box-shadow: 0 3px 8px rgba(1,4,13,.26);
}
.snack-bun {
  bottom: 20%;
  width: 37%;
  height: 35%;
  border-radius: 50% 50% 42% 42%;
  background: linear-gradient(145deg,#d7c2a1,#b59a7e);
  box-shadow: inset 0 1px rgba(255,245,224,.35), 0 2px 4px rgba(2,5,13,.2);
}
.snack-bun-a { left: 20%; }
.snack-bun-b { left: 46%; bottom: 22%; width: 34%; height: 32%; }
.snack-steam {
  bottom: 54%;
  width: 1px;
  height: 30%;
  border-left: 1px solid rgba(224,220,207,.34);
  border-radius: 50%;
  opacity: 0;
}
.snack-steam-a { left: 34%; }
.snack-steam-b { left: 59%; height: 23%; }
body.lakeside-reaction-active {
  --reaction-caption-width: min(390px,calc(100vw - 36px));
}
body.scene-reaction-active .speech { opacity: 0; pointer-events: none; }
body.scene-reaction-active #sky { filter: brightness(.9) saturate(.92); }
body.scene-reaction-active[data-scene-reaction="daze"] #sky { filter: brightness(.8) saturate(.76); }
body.scene-reaction-active[data-scene-reaction="daze"] .lake::before { animation-duration: 24s; }
body.lakeside-reaction-active .speech { opacity: 0; pointer-events: none; }
body.lakeside-reaction-active #sky { filter: brightness(.9) saturate(.92); }
body.video-reaction-active.lakeside-reaction-active #sky { filter: none; }
body.video-reaction-active.lakeside-reaction-active[data-scene-reaction] #sky { filter: none; }
body.lakeside-reaction-active[data-lakeside-reaction="daze"] #sky { filter: brightness(.8) saturate(.76); }
body.lakeside-reaction-active[data-lakeside-reaction="daze"] .moon-halo {
  opacity: .84;
  transform: scale(1.035);
}
body.lakeside-reaction-active[data-lakeside-reaction="daze"] .lake::before { animation-duration: 24s; }
body.lakeside-reaction-active[data-lakeside-reaction="smile"] .reaction-glow,
body.lakeside-reaction-active[data-lakeside-reaction="hug"] .reaction-glow,
body.lakeside-reaction-active[data-lakeside-reaction="food"] .reaction-glow {
  animation: reactionGlow 4.8s cubic-bezier(.25,.05,.2,1) both;
}
body.lakeside-reaction-active[data-lakeside-reaction="smile"] .reaction-glimmer i {
  animation: reactionGlimmer 3.4s ease-in-out .7s both;
}
body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i {
  animation: reactionMote 3.7s ease-out both;
}
body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i:nth-child(2) { animation-delay: .22s; }
body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i:nth-child(3) { animation-delay: .46s; }
body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i:nth-child(4) { animation-delay: .68s; }
body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i:nth-child(5) { animation-delay: .9s; }
body.lakeside-reaction-active[data-lakeside-reaction="hug"] .reaction-halo {
  animation: reactionHalo 4.5s cubic-bezier(.26,.05,.2,1) both;
}
body.lakeside-reaction-active[data-lakeside-reaction="daze"] .reaction-haze {
  animation: reactionHaze 6.1s ease-in-out both;
}
body.lakeside-reaction-active[data-lakeside-reaction="food"] .reaction-snack {
  animation: snackArrive 5s cubic-bezier(.22,.65,.3,1) both;
}
body.lakeside-reaction-active[data-lakeside-reaction="food"] .snack-steam {
  animation: snackSteam 3.7s ease-out .75s both;
}
body.lakeside-reaction-active[data-lakeside-reaction="stars"] .reaction-glimmer i {
  animation: starGlimmer 3.2s ease-in-out .9s both;
}
@keyframes reactionGlow {
  0%, 10% { opacity: 0; transform: translate(-50%,-50%) scale(.9); }
  34%, 70% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.025); }
}
@keyframes reactionGlimmer {
  0%, 12% { opacity: 0; transform: scale(.4) rotate(-7deg); }
  34% { opacity: .95; transform: scale(1) rotate(0); }
  52% { opacity: .42; transform: scale(.72); }
  70% { opacity: .88; transform: scale(.92); }
  100% { opacity: 0; transform: scale(.55); }
}
@keyframes reactionMote {
  0% { opacity: 0; transform: translate(0,8px) scale(.6); }
  26% { opacity: .82; }
  62% { opacity: .46; transform: translate(8px,-18px) scale(.84); }
  100% { opacity: 0; transform: translate(15px,-35px) scale(.55); }
}
@keyframes reactionHalo {
  0%, 12% { opacity: 0; transform: translate(-50%,-50%) scale(.92); }
  34%, 63% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  82% { opacity: .32; transform: translate(-50%,-50%) scale(1.035); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.06); }
}
@keyframes reactionHaze {
  0%, 10% { opacity: 0; transform: translate(-50%,-50%) scale(.98); }
  34%, 72% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.025); }
}
@keyframes snackArrive {
  0%, 8% { opacity: 0; transform: translate(8px,12px) scale(.72); }
  24%, 70% { opacity: 1; transform: translate(0,0) scale(1); }
  86% { opacity: .98; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(-2px,5px) scale(.93); }
}
@keyframes snackSteam {
  0% { opacity: 0; transform: translate(0,5px) scaleY(.7); }
  28% { opacity: .62; }
  68% { opacity: .28; transform: translate(4px,-11px) scaleY(1); }
  100% { opacity: 0; transform: translate(7px,-19px) scaleY(.8); }
}
@keyframes starGlimmer {
  0%, 15% { opacity: 0; transform: scale(.35) rotate(-8deg); }
  42% { opacity: .88; transform: scale(1.08) rotate(0); }
  65% { opacity: .35; transform: scale(.72); }
  100% { opacity: 0; transform: scale(.58); }
}
@keyframes reactionLineIn {
  from { opacity: .35; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
  body.lakeside-reaction-active { --reaction-caption-width: calc(100vw - 30px); }
  .reaction-snack { left: 67%; top: 87%; }
}
@media (prefers-reduced-motion: reduce) {
  body.lakeside-reaction-active[data-lakeside-reaction="smile"] .reaction-glow,
  body.lakeside-reaction-active[data-lakeside-reaction="hug"] .reaction-glow,
  body.lakeside-reaction-active[data-lakeside-reaction="food"] .reaction-glow {
    opacity: .72;
    transform: translate(-50%,-50%);
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="smile"] .reaction-glimmer i,
  body.lakeside-reaction-active[data-lakeside-reaction="stars"] .reaction-glimmer i {
    opacity: .68;
    transform: none;
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="pat"] .reaction-motes i {
    opacity: .62;
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="hug"] .reaction-halo {
    opacity: .78;
    transform: translate(-50%,-50%);
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="daze"] .reaction-haze {
    opacity: .8;
    transform: translate(-50%,-50%);
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="food"] .reaction-snack {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
  body.lakeside-reaction-active[data-lakeside-reaction="food"] .snack-steam {
    opacity: .38;
    animation: none !important;
  }
}
