.dressup-scene {
  position: absolute;
  z-index: 40;
  inset: 0;
  overflow: hidden;
  background: #f6efe0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 620ms ease;
}

.dressup-scene.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dressup-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: scale(1.055);
  transform-origin: 72% 42%;
  transition: transform 980ms cubic-bezier(0.18, 0.76, 0.18, 1);
}

.dressup-scene.is-visible .dressup-canvas {
  transform: scale(1);
}

.dressup-background {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}

.dressup-layer,
.dressup-character {
  position: absolute;
  display: block;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}

.dressup-background {
  z-index: 0;
}

.garment-rail {
  position: absolute;
  z-index: 3;
  inset: 0;
}

.garment-slot {
  position: absolute;
  top: var(--slot-y);
  left: var(--slot-x);
  width: var(--slot-w);
  height: var(--slot-h);
  transform-origin: var(--pivot-x) var(--pivot-y);
  pointer-events: none;
  will-change: transform;
}

.slot-cuteez {
  --slot-x: 58.0729%;
  --slot-y: 12.6852%;
  --slot-w: 10%;
  --slot-h: 51.5741%;
  --pivot-x: 45.77%;
  --pivot-y: 2.94%;
  --hanger-x: 38.021%;
  --hanger-w: 16.146%;
  --hanger-h: 43.986%;
  --garment-y: 13.645%;
  --garment-h: 86.355%;
  z-index: 3;
}

.slot-plaid {
  --slot-x: 65.625%;
  --slot-y: 12.6852%;
  --slot-w: 7.2917%;
  --slot-h: 38.3333%;
  --pivot-x: 54.24%;
  --pivot-y: 3.95%;
  --hanger-x: 43.571%;
  --hanger-w: 22.143%;
  --hanger-h: 59.179%;
  --garment-y: 17.874%;
  --garment-h: 82.126%;
  z-index: 2;
}

.slot-henley {
  --slot-x: 71.5104%;
  --slot-y: 12.6852%;
  --slot-w: 7.3958%;
  --slot-h: 43.0556%;
  --pivot-x: 51.24%;
  --pivot-y: 3.52%;
  --hanger-x: 40.845%;
  --hanger-w: 21.831%;
  --hanger-h: 52.688%;
  --garment-y: 16.344%;
  --garment-h: 83.656%;
  z-index: 1;
}

.hanger-layer {
  z-index: 0;
  top: 0;
  left: var(--hanger-x);
  width: var(--hanger-w);
  height: var(--hanger-h);
}

.garment-layer {
  z-index: 1;
  top: var(--garment-y);
  left: 0;
  width: 100%;
  height: var(--garment-h);
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: var(--pivot-x) 14.2%;
  transition:
    opacity 260ms ease,
    transform 430ms cubic-bezier(0.2, 0.9, 0.25, 1.2),
    filter 240ms ease;
}

.garment-slot.is-selected .garment-layer {
  opacity: 0;
  transform: translateY(-1.7%) scale(0.9);
  filter: blur(1px);
}

.garment-slot.is-selected .garment-hit {
  cursor: default;
  pointer-events: auto;
}

.garment-hit,
.dressup-suitcase-hotspot,
.bear-costume-hit {
  position: absolute;
  z-index: 5;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.garment-hit,
.dressup-suitcase-hotspot,
.bear-costume-hit {
  pointer-events: auto;
}

.dressup-scene:not(.is-visible) .garment-hit,
.dressup-scene:not(.is-visible) .dressup-suitcase-hotspot,
.dressup-scene:not(.is-visible) .bear-costume-hit {
  pointer-events: none;
}

.garment-hit:active {
  cursor: grabbing;
}

.garment-slot:not(.is-selected).is-hovered .garment-layer,
.garment-slot:not(.is-selected):focus-within .garment-layer {
  filter:
    brightness(1.07)
    drop-shadow(0 0 2px rgb(255 250 224 / 96%))
    drop-shadow(0 0 8px rgb(115 151 55 / 88%));
  transform: translateY(-0.45%) scale(1.012);
}

.garment-hit:focus-visible,
.dressup-suitcase-hotspot:focus-visible,
.bear-costume-hit:focus-visible {
  outline: 2px dashed rgb(79 116 29 / 76%);
  outline-offset: 2px;
}

.garment-hit {
  inset: 0;
}

.dressup-suitcase-hotspot {
  z-index: 8;
  top: 70.6%;
  left: 69.5%;
  width: 16.2%;
  height: 20.7%;
  cursor: pointer;
}

.dressup-suitcase-hotspot::after {
  position: absolute;
  top: 38%;
  left: 50%;
  width: 20%;
  aspect-ratio: 1;
  border: 2px solid rgb(255 249 232 / 74%);
  border-radius: 50%;
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
  pointer-events: none;
}

.dressup-suitcase-hotspot.is-tapped::after {
  animation: suitcase-tap 440ms ease-out;
}

.bear-costume-wrap {
  position: absolute;
  z-index: 9;
  top: 71.1111%;
  left: 70.8854%;
  width: 11.4583%;
  height: 10.3704%;
  opacity: 0;
  transform: translateY(1.8%) scale(0.72);
  transform-origin: 49.87% 90.54%;
  pointer-events: none;
}

.bear-costume-wrap.is-unlocked {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: none;
  animation: bear-costume-pop 620ms cubic-bezier(0.18, 0.86, 0.2, 1.22);
}

.bear-costume-wrap.is-previewing .hidden-bear-costume {
  opacity: 0;
  transform: translateY(-1.2%) scale(0.88);
}

.bear-costume-wrap.is-previewing .bear-costume-hit {
  pointer-events: none;
}

.hidden-bear-costume {
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  filter: none;
  transform: translateY(0) scale(1);
  transform-origin: 49.87% 90.54%;
  transition:
    opacity 260ms ease,
    transform 380ms cubic-bezier(0.2, 0.85, 0.24, 1.08),
    filter 220ms ease;
}

.bear-costume-hit {
  inset: -8%;
  cursor: pointer;
}

.bear-costume-wrap:not(.is-unlocked) .bear-costume-hit {
  pointer-events: none;
}

.bear-costume-wrap.is-unlocked:not(.is-previewing).is-hovered .hidden-bear-costume,
.bear-costume-wrap.is-unlocked:not(.is-previewing):focus-within .hidden-bear-costume {
  filter:
    brightness(1.07)
    drop-shadow(0 0 2px rgb(255 250 224 / 96%))
    drop-shadow(0 0 8px rgb(115 151 55 / 88%));
  transform: translateY(-0.35%) scale(1.018);
}

.dressup-character-sway,
.dressup-character-pop {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
}

.dressup-character {
  top: var(--character-y, 26.6667%);
  left: var(--character-x, 0.6771%);
  width: var(--character-w, 33.6458%);
  height: var(--character-h, 68.7037%);
}

.dressup-character-hotspot {
  position: absolute;
  z-index: 6;
  left: 0.6771%;
  top: 26.6667%;
  width: 33.6458%;
  height: 68.7037%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: none;
}

.dressup-scene.is-visible .dressup-character-hotspot:not(:disabled) {
  pointer-events: auto;
}

.dressup-character-hotspot:focus-visible {
  outline: 2px dashed var(--leaf-dark);
  outline-offset: -4px;
}

.dressup-character-sway {
  transform-origin: 18.1% 94.7%;
  animation: dressup-idle-sway 4.1s ease-in-out infinite;
  will-change: transform;
}

.dressup-character-pop {
  transform-origin: 18.1% 89%;
}

.dressup-character-pop.is-leaving {
  animation: character-change-out 180ms ease-in forwards;
}

.dressup-character-pop.is-arriving {
  animation: character-change-in 520ms cubic-bezier(0.18, 0.9, 0.2, 1.22);
}

.dressup-sparkles {
  position: absolute;
  z-index: 9;
  top: 48%;
  left: 18%;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dressup-sparkles.is-active {
  opacity: 1;
}

.dressup-sparkles i {
  position: absolute;
  width: clamp(5px, 0.55vw, 11px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff8d7;
  box-shadow: 0 0 0.7vw rgb(255 250 215 / 78%);
  opacity: 0;
}

.dressup-sparkles.is-active i {
  animation: dressup-spark 520ms ease-out forwards;
}

.dressup-sparkles i:nth-child(1) { --sx: -7vw; --sy: -8vh; background: #789b3d; }
.dressup-sparkles i:nth-child(2) { --sx: 6vw; --sy: -9vh; animation-delay: 35ms; }
.dressup-sparkles i:nth-child(3) { --sx: -8vw; --sy: 3vh; animation-delay: 70ms; background: #e7bc55; }
.dressup-sparkles i:nth-child(4) { --sx: 7vw; --sy: 4vh; animation-delay: 25ms; background: #789b3d; }
.dressup-sparkles i:nth-child(5) { --sx: -2vw; --sy: 9vh; animation-delay: 80ms; }
.dressup-sparkles i:nth-child(6) { --sx: 2vw; --sy: -12vh; animation-delay: 60ms; background: #e7bc55; }

.dressup-dialogue {
  position: absolute;
  z-index: 12;
  top: 34.5%;
  left: 35.5%;
  width: max-content;
  max-width: 10.5em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms ease;
}

.dressup-dialogue.is-visible {
  opacity: 1;
}

.dressup-dialogue.is-resetting {
  opacity: 0;
  transition: none;
}

.dressup-dialogue p {
  margin: 0;
  color: #fffefa;
  font-family: var(--font-hand-en);
  max-width: 10.5em;
  font-size: clamp(17px, 1.58vw, 30px);
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: 0.025em;
  -webkit-text-stroke: 0.075em rgb(71 40 23 / 78%);
  paint-order: stroke fill;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-shadow:
    0 0.07em 0.08em rgb(49 30 20 / 72%),
    0 0 0.24em rgb(49 30 20 / 30%);
}

html[lang="zh"] .dressup-dialogue p {
  font-family: var(--font-hand-zh);
  letter-spacing: 0.06em;
}

html[lang="ko"] .dressup-dialogue p {
  font-family: var(--font-hand-ko);
  letter-spacing: 0.035em;
}

.dressup-confirm-button {
  position: absolute;
  z-index: 18;
  right: 42%;
  bottom: 8.2%;
  min-width: clamp(92px, 9.2vw, 176px);
  padding: clamp(7px, 0.7vw, 13px) clamp(14px, 1.6vw, 30px);
  border: 2px solid currentColor;
  border-radius: 999px 880px 960px 820px / 820px 960px 850px 990px;
  background: rgb(255 250 240 / 82%);
  color: var(--leaf-dark);
  font-family: var(--font-hand-en);
  font-size: clamp(15px, 1.35vw, 26px);
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 0.25vw 0.8vw rgb(70 48 33 / 15%);
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    background-color 220ms ease;
}

html[lang="zh"] .dressup-confirm-button {
  font-family: var(--font-hand-zh);
}

html[lang="ko"] .dressup-confirm-button {
  font-family: var(--font-hand-ko);
}

.dressup-confirm-button:not(:disabled):hover,
.dressup-confirm-button:not(:disabled):focus-visible {
  background: rgb(245 250 224 / 96%);
  transform: translateY(-3px) rotate(-0.8deg);
}

.dressup-confirm-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}

.dressup-time {
  position: absolute;
  z-index: 15;
  top: 5.6%;
  left: 2.25%;
  margin: 0;
  color: var(--leaf-dark);
  font-family: Georgia, serif;
  font-size: clamp(20px, 2.5vw, 48px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  pointer-events: none;
}

.dressup-controls {
  position: absolute;
  z-index: 16;
  top: 11.8%;
  left: 2.15%;
  display: grid;
  gap: clamp(8px, 0.75vw, 15px);
  justify-items: center;
  color: var(--leaf-dark);
}

.dressup-bgm-credit {
  top: 3.6%;
  right: 3.1%;
  opacity: 0.82;
}

.dressup-bgm-toggle .speaker-body {
  fill: currentColor;
}

.dressup-bgm-toggle .speaker-waves,
.dressup-bgm-toggle .speaker-slash,
.dressup-back-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dressup-bgm-toggle .speaker-slash {
  display: none;
  stroke-width: 2;
}

.dressup-bgm-toggle.is-muted .speaker-waves {
  display: none;
}

.dressup-bgm-toggle.is-muted .speaker-slash {
  display: block;
}

@keyframes dressup-idle-sway {
  0%, 100% { transform: translateY(0) rotate(-0.55deg); }
  50% { transform: translateY(-0.24%) rotate(0.55deg); }
}

@keyframes character-change-out {
  to { opacity: 0; transform: scale(0.91) rotate(-2deg); }
}

@keyframes character-change-in {
  0% { opacity: 0; transform: scale(0.88) rotate(2deg); }
  55% { opacity: 1; transform: scale(1.045) rotate(-0.8deg); }
  78% { transform: scale(0.982) rotate(0.35deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes dressup-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.25); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(1.1); }
}

@keyframes bear-costume-pop {
  0% { opacity: 0; transform: translateY(2.2%) scale(0.68) rotate(-3deg); }
  58% { opacity: 1; transform: translateY(-0.45%) scale(1.08) rotate(1.4deg); }
  78% { transform: translateY(0.16%) scale(0.96) rotate(-0.45deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes suitcase-tap {
  0% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.35); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  .dressup-scene *,
  .dressup-scene *::before,
  .dressup-scene *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}


/* v2.6 fixes */
.dressup-dialogue {
  max-width: min(520px, 38vw);
}
.dressup-dialogue p {
  line-height: 1.5;
  overflow-wrap: break-word;
}
.garment-slot.is-hovered .garment-layer {
  filter: drop-shadow(0 0 8px rgb(106 144 41 / 65%));
}
.dressup-confirm-button {
  left: 24px;
  right: auto;
  bottom: 24px;
}
.dressup-character {
  transform-origin: 50% 90%;
}

.dressup-dialogue p { max-width: 32ch; }
.dressup-confirm-button { color: var(--leaf); }
