/* ============================================================================
   Pokémon Center — Warm Lit Cream Curtain & Partner Silhouette Scene
   ============================================================================ */

#app .run-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: clamp(12px, 3vh, 28px);
  padding: clamp(20px, 4vh, 44px) clamp(20px, 5vw, 68px) clamp(22px, 4vh, 40px);
  overflow: hidden;
  background: linear-gradient(180deg, #e8d8b9 0%, #dcc6a0 68%, #6d4f38 68.5%, #4d3524 100%) !important;
  color: #2f2116 !important;
}

/* ---------- Full-room Curtain & Floor Stage ---------- */
.center-curtain-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Warm ambient light behind the cream curtain */
.center-curtain-backlight {
  position: absolute;
  inset: 0 0 30% 0;
  background:
    radial-gradient(ellipse 46% 62% at 67% 46%, rgba(255, 224, 152, 0.92) 0%, rgba(255, 198, 112, 0.45) 42%, transparent 74%),
    radial-gradient(ellipse 70% 55% at 50% 35%, rgba(255, 241, 206, 0.65) 0%, transparent 72%);
  animation: centerGlowBreathe 5.6s ease-in-out infinite;
}

/* Curtain Rod */
.center-curtain-rod {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: linear-gradient(180deg, #6b4c35 0%, #8c6647 45%, #4a3322 100%);
  border-bottom: 2px solid rgba(42, 26, 16, 0.45);
  box-shadow: 0 4px 12px rgba(45, 28, 16, 0.25);
  z-index: 5;
}

/* Cream Fabric Curtain Panels */
.center-curtain-panels {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  bottom: 30%;
  z-index: 3;
}

.center-curtain-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: #f7ebd2;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 250, 238, 0.55) 0px,
      rgba(255, 250, 238, 0.55) 18px,
      rgba(222, 198, 156, 0.34) 36px,
      rgba(248, 236, 208, 0.48) 54px,
      rgba(212, 185, 140, 0.38) 72px
    ),
    linear-gradient(180deg, rgba(255, 247, 226, 0.35) 0%, rgba(255, 229, 173, 0.18) 55%, rgba(168, 134, 92, 0.22) 100%);
  box-shadow: inset 0 -10px 22px rgba(126, 92, 58, 0.18);
  transform-origin: top center;
}

.center-curtain-panel.is-left {
  left: -2%;
  width: 68.5%;
  border-right: 2px solid rgba(255, 242, 208, 0.8);
  box-shadow:
    inset -18px 0 28px rgba(255, 222, 152, 0.45),
    6px 0 18px rgba(74, 48, 28, 0.14);
  animation: centerCurtainSway 7.2s ease-in-out infinite;
}

.center-curtain-panel.is-right {
  right: -2%;
  width: 34.5%;
  border-left: 2px solid rgba(255, 242, 208, 0.8);
  box-shadow:
    inset 18px 0 28px rgba(255, 222, 152, 0.42),
    -6px 0 18px rgba(74, 48, 28, 0.12);
  animation: centerCurtainSwayRight 8.4s ease-in-out infinite;
}

/* Warm-lit Curtain Seam / Gap */
.center-curtain-seam {
  position: absolute;
  top: 12px;
  bottom: 30%;
  left: 66.2%;
  width: 14px;
  transform: translateX(-50%);
  z-index: 2;
  background: linear-gradient(90deg, rgba(255, 214, 130, 0.2), rgba(255, 244, 210, 0.95) 50%, rgba(255, 214, 130, 0.2));
  filter: blur(2px);
  opacity: 0.85;
  transition: width 0.9s ease, opacity 0.9s ease, filter 0.9s ease;
}

/* Partner Silhouette Projected Onto the Curtain */
.center-shadow-rig {
  position: absolute;
  left: 59%;
  bottom: 30.5%;
  width: clamp(130px, 16vw, 210px);
  height: clamp(130px, 22vh, 210px);
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.center-shadow-body {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-origin: center bottom;
  animation: centerShadowRest 4.6s ease-in-out infinite;
  transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1), opacity 1.1s ease, filter 1.1s ease;
}

.center-shadow-sprite {
  max-width: 82%;
  max-height: 82%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: brightness(0) sepia(0.42) hue-rotate(-8deg) blur(2.6px);
  opacity: 0.34;
  mix-blend-mode: multiply;
  transform-origin: center bottom;
  animation: centerShadowTwitch 6.8s ease-in-out infinite;
}

/* Tail-then-Head Peek Out at Curtain Edge */
.center-peek-group {
  position: absolute;
  left: 66.5%;
  bottom: 31%;
  width: 110px;
  height: 120px;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.55s ease;
}

.center-peek-tail,
.center-peek-head {
  position: absolute;
  left: -6px;
  transform-origin: left center;
  color: rgba(62, 40, 24, 0.44);
  filter: blur(1.2px);
  mix-blend-mode: multiply;
}

.center-peek-tail {
  bottom: 16px;
  width: 58px;
  height: 48px;
  animation: centerPeekTail 8.5s ease-in-out infinite;
}

.center-peek-head {
  bottom: 54px;
  width: 54px;
  height: 58px;
  animation: centerPeekHead 8.5s ease-in-out infinite;
}

.center-peek-tail svg,
.center-peek-head svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Warm Wooden Floor */
.center-room-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30.5%;
  z-index: 1;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 232, 198, 0.05) 0px,
      rgba(255, 232, 198, 0.05) 2px,
      transparent 2px,
      transparent 26px
    ),
    linear-gradient(180deg, #866246 0%, #6d4d35 48%, #523825 100%);
  box-shadow: inset 0 12px 24px rgba(38, 22, 12, 0.34);
}

/* Warm Light Sweeping Across the Floor from the Curtain Seam */
.center-floor-beam {
  position: absolute;
  left: 66.2%;
  top: 69.5%;
  bottom: 0;
  width: clamp(90px, 14vw, 180px);
  transform: translateX(-50%) skewX(-18deg);
  transform-origin: top center;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(255, 236, 178, 0.62) 0%,
    rgba(255, 214, 134, 0.28) 52%,
    rgba(255, 200, 110, 0) 100%
  );
  filter: blur(5px);
  opacity: 0.45;
  transition: opacity 0.6s ease;
}

/* Floating Dust Motes in Warm Light */
.center-dust-motes {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.center-dust-mote {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 245, 212, 0.78);
  box-shadow: 0 0 8px rgba(255, 224, 140, 0.75);
  animation: centerMoteFloat 7s ease-in-out infinite;
}

.center-dust-mote.m1 { left: 58%; top: 34%; animation-delay: 0s; }
.center-dust-mote.m2 { left: 65%; top: 46%; width: 4px; height: 4px; animation-delay: -1.8s; }
.center-dust-mote.m3 { left: 71%; top: 28%; width: 6px; height: 6px; animation-delay: -3.4s; }
.center-dust-mote.m4 { left: 63%; top: 58%; width: 3.5px; height: 3.5px; animation-delay: -4.9s; }
.center-dust-mote.m5 { left: 52%; top: 48%; width: 4px; height: 4px; animation-delay: -2.6s; }

/* ---------- Healing State (When Clicking 「回复」) ---------- */
.run-center.is-healing .center-curtain-backlight {
  filter: brightness(1.16);
}

.run-center.is-healing .center-curtain-seam {
  width: 28px;
  opacity: 1;
  filter: blur(4px);
}

.run-center.is-healing .center-shadow-body {
  animation: none;
  transform: translateY(18px) scaleY(0.72) scaleX(1.14);
  opacity: 0.44;
}

.run-center.is-healing .center-shadow-sprite {
  animation: none;
  filter: brightness(0) sepia(0.48) hue-rotate(-8deg) blur(3.2px);
}

.run-center.is-healing .center-peek-group {
  opacity: 0;
  transform: translateX(-16px);
}

.run-center.is-healing .center-floor-beam {
  animation: centerFloorBeamSweep 1.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ---------- Foreground UI Layout (Cozy Warm Room Controls) ---------- */
#app .run-center .center-choices {
  position: relative;
  z-index: 6;
  width: min(100%, 490px);
  padding: 20px 22px 22px;
  border-radius: 14px;
  background: rgba(252, 245, 229, 0.9);
  border: 2px solid rgba(92, 66, 42, 0.38);
  box-shadow: 0 10px 28px rgba(48, 30, 16, 0.22);
  backdrop-filter: blur(6px);
  text-align: left;
}

#app .run-center .center-choices h1 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3vw, 32px);
  color: #3a2618;
  letter-spacing: 0.02em;
}

/* Room HP Meter (animates smoothly with floor light sweep) */
.center-hp-meter {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(244, 231, 204, 0.85);
  border: 1.5px solid rgba(112, 82, 52, 0.28);
}

.center-hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: #4a3220;
}

.center-hp-val {
  font-variant-numeric: tabular-nums;
  color: #2f5e42;
}

.center-hp-track {
  position: relative;
  height: 11px;
  border-radius: 999px;
  background: rgba(74, 52, 34, 0.18);
  overflow: hidden;
  border: 1px solid rgba(74, 52, 34, 0.25);
}

.center-hp-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  transition: width 1.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.center-hp-fill.hp-mid {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.center-hp-fill.hp-low {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.run-center .center-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#app .run-center .center-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: #fff9ec !important;
  border: 2px solid #75563b !important;
  border-radius: 10px !important;
  color: #362315 !important;
  padding: 10px 10px 12px;
  box-shadow: 3px 3px 0 rgba(74, 50, 32, 0.28);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

#app .run-center .center-action-card:hover:not(:disabled) {
  background: #fffdf6 !important;
  transform: translate(-1.5px, -2px);
  box-shadow: 4.5px 5px 0 rgba(74, 50, 32, 0.36);
}

#app .run-center .center-action-card:disabled {
  opacity: 0.56;
  cursor: default;
}

#app .run-center .center-action-card strong {
  color: #2f1e12 !important;
  font-size: 14px;
}

#app .run-center .center-action-card small {
  color: #6b533e !important;
  font-size: 11.5px;
  line-height: 1.4;
}

#app .run-center .center-action-art {
  display: grid;
  place-items: center;
  min-height: 54px;
  width: 100%;
  background: radial-gradient(ellipse at 50% 56%, rgba(252, 222, 152, 0.65), rgba(235, 214, 174, 0.55) 70%);
  border-radius: 6px;
}

#app .run-center .center-action-art img {
  width: 44px;
  height: auto;
  image-rendering: pixelated;
}

/* Trainer resting in foreground left */
#app .run-center .center-companions {
  position: absolute;
  right: 8%;
  bottom: 12%;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(38, 22, 12, 0.35));
}

#app .run-center .center-trainer {
  height: clamp(72px, 19vh, 148px);
  transform: scaleX(-1);
  image-rendering: pixelated;
}

/* ---------- Keyframes ---------- */
@keyframes centerGlowBreathe {
  0%, 100% { opacity: 0.88; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

@keyframes centerCurtainSway {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(0.45deg); }
}

@keyframes centerCurtainSwayRight {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(-0.5deg); }
}

@keyframes centerShadowRest {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50% { transform: scaleY(1.025) scaleX(0.988); }
}

@keyframes centerShadowTwitch {
  0%, 38%, 48%, 76%, 86%, 100% { transform: rotate(0deg) translateY(0); }
  41% { transform: rotate(-2.4deg) translateY(-2px); }
  44% { transform: rotate(1.6deg) translateY(0); }
  79% { transform: rotate(2deg) translateY(-1px); }
  82% { transform: rotate(-1.2deg) translateY(0); }
}

/* Tail peeks out of curtain edge FIRST (16% -> 76%) */
@keyframes centerPeekTail {
  0%, 14% {
    opacity: 0;
    transform: translateX(-28px) rotate(-14deg) scale(0.86);
  }
  23% {
    opacity: 1;
    transform: translateX(4px) rotate(6deg) scale(1);
  }
  33% {
    opacity: 1;
    transform: translateX(8px) rotate(-8deg) scale(1);
  }
  44% {
    opacity: 1;
    transform: translateX(6px) rotate(9deg) scale(1);
  }
  56% {
    opacity: 1;
    transform: translateX(7px) rotate(-4deg) scale(1);
  }
  68% {
    opacity: 1;
    transform: translateX(2px) rotate(2deg) scale(0.96);
  }
  78%, 100% {
    opacity: 0;
    transform: translateX(-28px) rotate(-14deg) scale(0.86);
  }
}

/* Head & ears follow AFTER the tail (30% -> 74%) */
@keyframes centerPeekHead {
  0%, 28% {
    opacity: 0;
    transform: translateX(-34px) rotate(-10deg) scale(0.88);
  }
  39% {
    opacity: 1;
    transform: translateX(6px) rotate(5deg) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(10px) rotate(10deg) scale(1.02);
  }
  60% {
    opacity: 1;
    transform: translateX(7px) rotate(2deg) scale(1);
  }
  74%, 100% {
    opacity: 0;
    transform: translateX(-34px) rotate(-10deg) scale(0.88);
  }
}

/* Floor light beam sweeps across the room on heal */
@keyframes centerFloorBeamSweep {
  0% {
    opacity: 0.45;
    width: clamp(90px, 14vw, 180px);
    transform: translateX(-50%) skewX(-18deg);
  }
  35% {
    opacity: 0.95;
    width: clamp(190px, 28vw, 360px);
    transform: translateX(-68%) skewX(-24deg);
  }
  75% {
    opacity: 0.88;
    width: clamp(240px, 36vw, 460px);
    transform: translateX(-92%) skewX(-28deg);
  }
  100% {
    opacity: 0.65;
    width: clamp(220px, 32vw, 410px);
    transform: translateX(-82%) skewX(-24deg);
  }
}

@keyframes centerMoteFloat {
  0%, 100% { opacity: 0.25; transform: translate(0, 0); }
  50% { opacity: 0.85; transform: translate(-8px, -16px); }
}

@media (max-width: 780px) {
  #app .run-center {
    align-items: center;
    padding: 16px 14px 20px;
  }
  .center-shadow-rig {
    left: 52%;
    bottom: 34%;
  }
  .center-curtain-panel.is-left { width: 58.5%; }
  .center-curtain-panel.is-right { width: 44.5%; }
  .center-curtain-seam,
  .center-floor-beam { left: 56.2%; }
  .center-peek-group { left: 56.5%; bottom: 34%; }
  #app .run-center .center-companions { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .center-curtain-backlight,
  .center-curtain-panel,
  .center-shadow-body,
  .center-shadow-sprite,
  .center-peek-tail,
  .center-peek-head,
  .center-dust-mote {
    animation: none !important;
  }
}
