.dressup-game-body {
  width: 100vw;
  min-height: max(100vh, 720px);
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
  overflow-y: auto;
}

.dressup-game-body::before,
.dressup-game-body::after {
  display: none;
}

.dressup-game-shell {
  width: min(1240px, calc(100vw - 24px));
  min-height: max(100vh, 720px);
  margin: 0 auto;
  padding: 16px 0 18px;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  gap: 10px;
}

.game-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-pill,
.game-command,
.closet-tab {
  appearance: none;
  -webkit-appearance: none;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.game-pill {
  height: 48px;
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #d864d5;
  border-radius: 15px;
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,.72) 0 3px, transparent 4px) 0 0 / 17px 17px,
    linear-gradient(180deg, #f7ffff, #bff9f4);
  color: #a046b5;
  font-size: 1.28rem;
  text-decoration: none;
  box-shadow: 0 4px 0 rgba(160,70,181,.22), inset 0 0 0 2px rgba(255,255,255,.64);
}

.game-wallet {
  height: 44px;
  min-width: 186px;
  display: grid;
  grid-template-columns: 38px 1fr 34px;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 4px;
  border: 3px solid #dca831;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffef7, #fff3c4);
  color: #8b5a24;
  text-decoration: none;
  box-shadow: 0 4px 0 rgba(139,90,36,.16), inset 0 0 0 2px rgba(255,255,255,.62);
}

.coin-medal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 3px solid #dca831;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff7b1 0 18%, #ffd45e 19% 100%);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  text-shadow: 1px 1px 0 #9c6a20;
}

.game-wallet strong {
  min-width: 76px;
  color: #76516f;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
}

.coin-plus {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #d77aff, #914bd5);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: 1px 1px 0 #6935a0;
}

.game-board {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, .68fr) minmax(610px, 1fr);
  gap: 18px;
}

.avatar-area {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 0 8px 8px;
  /* keep the character + worn layers pinned while the closet scrolls */
  align-self: start;
  position: sticky;
  top: 12px;
}

.avatar-tag {
  justify-self: start;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 6px 18px;
  border: 3px solid #ff69c3;
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: #ed5eaa;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(255,105,195,.20);
}

.avatar-workspace {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.layer-panel {
  position: relative;
  z-index: 2;
  align-self: center;
  max-height: min(540px, 78vh);
  overflow: hidden;
}

.layer-stack {
  display: grid;
  gap: 8px;
  max-height: inherit;
  overflow-y: auto;
  padding: 4px 2px 4px 0;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.layer-stack::-webkit-scrollbar {
  width: 7px;
}

.layer-stack::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(72,200,243,.72);
}

.layer-tile {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 5px;
  border: 3px solid #9fc5ed;
  border-radius: 7px;
  background: rgba(205,225,247,.88);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.58), 0 3px 0 rgba(120,154,200,.22);
  cursor: grab;
  touch-action: none;
}

.layer-tile:active {
  cursor: grabbing;
}

.layer-tile.dragging {
  opacity: .55;
  transform: scale(.96);
}

.layer-tile img {
  width: 100%;
  height: 100%;
  max-width: 50px;
  max-height: 50px;
  object-fit: contain;
  pointer-events: none;
}

.layer-tile.layer-skin img {
  max-height: 44px;
  max-width: 44px;
}

.layer-empty {
  width: 64px;
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 3px dashed rgba(159,197,237,.82);
  border-radius: 7px;
  background: rgba(255,255,255,.42);
  color: rgba(118,81,111,.68);
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.avatar-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}

.avatar-stage::after {
  content: '';
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 4%;
  height: 42px;
  border-radius: 50%;
  background: rgba(119,83,188,.14);
  filter: blur(1px);
}

.dressup-frame {
  position: relative;
  z-index: 1;
  width: min(84%, 420px);
  aspect-ratio: 1000 / 1415;
  filter: drop-shadow(0 8px 0 rgba(117,83,188,.13));
}

.dress-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
  outline: 0;
  background: transparent;
  z-index: 1;
}

.dress-layer[hidden] {
  display: none;
}

.dress-base {
  position: relative;
}

.avatar-actions {
  width: 140px;
  display: grid;
  gap: 8px;
}

.game-command {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #d864d5;
  border-radius: 15px;
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,.55) 0 3px, transparent 4px) 0 0 / 17px 17px,
    linear-gradient(180deg, #ffc3eb, #ff86d1);
  color: #fff;
  font-size: 1.18rem;
  text-decoration: none;
  text-shadow: 1px 1px 0 #d84fa2;
  box-shadow: 0 5px 0 rgba(216,79,162,.22), inset 0 0 0 2px rgba(255,255,255,.45);
  cursor: pointer;
}

.game-command:disabled {
  opacity: .55;
  cursor: default;
  filter: grayscale(.12);
}

.closet-area {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 58px minmax(0, 1fr) 30px;
  gap: 8px;
  align-self: stretch;
  padding-top: 2px;
}

.closet-tabs {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  padding: 0 4px;
  overflow: visible;
  background: rgba(255, 247, 253, .86);
  backdrop-filter: blur(6px);
}

.closet-tab {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 3px solid #ff69c3;
  border-radius: 16px 16px 0 0;
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,.75) 0 3px, transparent 4px) 0 0 / 18px 18px,
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,218,240,.92));
  color: #d84fa2;
  font-size: .92rem;
  line-height: 1.05;
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.6);
  cursor: pointer;
}

.closet-tab:first-child {
  border-top-left-radius: 20px;
}

.closet-tab:last-child {
  border-top-right-radius: 20px;
}

.closet-tab.active {
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,.72) 0 3px, transparent 4px) 0 0 / 18px 18px,
    linear-gradient(180deg, #cafff6, #82efe8);
  border-color: #48c8f3;
  color: #178fc8;
  box-shadow: 0 4px 0 rgba(23,143,200,.18), inset 0 0 0 2px rgba(255,255,255,.66);
}

.closet-tab.drop-target {
  transform: translateY(-4px);
  border-color: #8ce666;
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,.72) 0 3px, transparent 4px) 0 0 / 18px 18px,
    linear-gradient(180deg, #fff6aa, #baff93);
  color: #4e9f31;
}

.closet-tab.drop-disabled {
  opacity: .72;
}

.closet-titlebar {
  position: relative;
  z-index: 2;
  width: min(88%, 620px);
  min-height: 56px;
  margin: 0 auto -18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 5px 18px;
  border: 3px solid #d864d5;
  border-radius: 999px;
  background:
    radial-gradient(circle at 8px 8px, rgba(128,239,233,.35) 0 3px, transparent 4px) 0 0 / 18px 18px,
    rgba(255,255,255,.92);
  box-shadow: 0 4px 0 rgba(216,79,162,.18);
}

.closet-titlebar h1 {
  color: #ed5eaa;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-shadow: 2px 2px 0 #fff;
}

.closet-page-indicator {
  display: none;
}

.restock-button {
  min-height: 38px;
  padding: 7px 14px;
  border: 2px solid #ef68ae;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8a9, #ffca5f);
  color: #b94f92;
  font: 700 .92rem/1 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  box-shadow: 0 3px 0 rgba(185,79,146,.22), inset 0 0 0 2px rgba(255,255,255,.55);
  cursor: pointer;
  white-space: nowrap;
}

.restock-button:disabled {
  opacity: .58;
  cursor: wait;
}

.closet-frame {
  position: relative;
  min-height: 0;
  padding: 48px 16px 16px;
  border: 4px solid #ff69c3;
  border-radius: 25px;
  background: rgba(255,245,252,.82);
  box-shadow: 0 7px 0 rgba(178,87,187,.24), inset 0 0 0 4px rgba(255,255,255,.55);
  overflow: hidden;
}

.closet-frame::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(255,255,255,.82);
  border-radius: 18px;
  pointer-events: none;
}

.closet-grid {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(126px, auto);
  gap: 10px;
  padding: 2px 8px 2px 2px;
}

.closet-grid::-webkit-scrollbar {
  width: 12px;
}

.closet-grid::-webkit-scrollbar-track {
  border: 2px solid #ffb6df;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
}

.closet-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #ff69c3;
}

.closet-item,
.closet-empty {
  position: relative;
  min-height: 126px;
  padding: 8px;
  border: 3px solid #8ce666;
  border-radius: 12px;
  background: rgba(255,255,255,.91);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.70);
}

.closet-item {
  display: grid;
  grid-template-rows: minmax(74px, 1fr) auto;
  gap: 6px;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform .14s ease, border-color .14s ease, filter .14s ease;
}

.closet-item:active {
  cursor: pointer;
}

.closet-item img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.closet-item:hover {
  transform: translateY(-3px);
  filter: saturate(1.04);
}

.closet-item.dragging {
  opacity: .62;
  transform: scale(.97);
}

.closet-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: .9;
  box-shadow: 0 14px 30px rgba(92,64,126,.24);
  transition: none;
}

.closet-item.active {
  border-color: #ff69c3;
  box-shadow: 0 0 0 3px rgba(255,145,202,.45), inset 0 0 0 2px rgba(255,255,255,.75);
}

.diy-item-button {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  border: 2px solid #ff69c3;
  background: #ffe2f3;
  color: #d84fa2;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1;
  text-shadow: none;
}

.diy-item-button {
  right: 6px;
  top: 6px;
  min-width: 35px;
  height: 24px;
  border-radius: 999px;
  font-size: .72rem;
}

.variant-prev,
.variant-next {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 30px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
}

.variant-prev {
  left: -6px;
}

.variant-next {
  right: -6px;
}

.variant-arrow-icon {
  width: 24px;
  height: 24px;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.55));
}

.variant-arrow-icon path {
  fill: #ffb6df;
}

.variant-prev:hover .variant-arrow-icon,
.variant-next:hover .variant-arrow-icon {
  transform: scale(1.08);
}

.variant-dots {
  position: absolute;
  left: 50%;
  bottom: 39px;
  z-index: 4;
  display: inline-flex;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  transform: translateX(-50%);
}

.variant-dot {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(166,106,151,.46);
  border-radius: 50%;
  background: var(--dot-color, #ffc3eb);
}

.variant-dot.active {
  box-shadow: 0 0 0 2px #ff69c3;
}

.closet-preview {
  min-height: 74px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(255,247,253,.78));
}

.closet-preview img {
  width: 100%;
  height: 100%;
  max-height: 82px;
  object-fit: contain;
}

.saved-set-card {
  isolation: isolate;
}

.saved-set-preview {
  position: relative;
  width: min(72px, 100%);
  min-height: 92px;
  justify-self: center;
  background: transparent;
}

.saved-set-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.saved-set-preview span {
  color: #c07db1;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 700;
}

.set-context-menu {
  position: fixed;
  z-index: 20;
  padding: 5px;
  border: 3px solid #ff69c3;
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 5px 0 rgba(216,79,162,.18);
}

.set-context-menu button {
  min-width: 82px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: #ffc3eb;
  color: #fff;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .9rem;
  font-weight: 700;
  text-shadow: 1px 1px 0 #d84fa2;
  cursor: pointer;
}

.closet-item-context-menu {
  z-index: 80;
}

.closet-item-context-menu button + button {
  margin-top: 5px;
}

.move-slot-list {
  display: grid;
  gap: 5px;
}

.move-slot-option.active {
  background: #baff93;
  color: #4e9f31;
  text-shadow: none;
}

.context-confirm {
  display: grid;
  gap: 6px;
  min-width: 104px;
  text-align: center;
}

.context-confirm-text {
  margin: 1px 0 2px;
  color: #d84fa2;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.25;
}

.closet-item-context-menu .context-confirm button {
  margin-top: 0;
  width: 100%;
}

.closet-item-context-menu .context-confirm-yes {
  background: #ff5a8a;
}

.none-preview {
  color: #c07db1;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 700;
}

.closet-name {
  min-height: 32px;
  display: grid;
  place-items: center;
  color: #76516f;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.08;
}

.closet-action {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffc3eb;
  color: #fff;
  font-size: .86rem;
  font-weight: 700;
  text-shadow: 1px 1px 0 #d84fa2;
}

.closet-item.locked::before {
  content: 'lock';
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ff78bc;
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
}

.closet-item.locked .closet-preview {
  opacity: .76;
  filter: grayscale(.22);
}

.closet-item.locked .closet-action {
  background: #ffe47a;
  color: #8b5a24;
  text-shadow: none;
}

.closet-empty {
  display: grid;
  place-items: center;
  border-color: rgba(140,230,102,.45);
  color: rgba(170,127,158,.75);
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 700;
  background: rgba(255,255,255,.48);
}

.dressup-note {
  min-height: 26px;
  display: grid;
  place-items: center;
  color: #9b64b7;
  font-size: .92rem;
  font-weight: 700;
  text-align: center;
}

.diy-modal[hidden] {
  display: none;
}

.diy-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(130,91,184,.22);
  backdrop-filter: blur(4px);
}

.diy-panel {
  position: relative;
  width: min(520px, 94vw);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 5px solid #ff69c3;
  border-radius: 20px;
  background:
    radial-gradient(circle, rgba(255,194,226,.45) 0 5px, transparent 6px) 0 0 / 25px 25px,
    rgba(255,255,249,.97);
  box-shadow: 0 11px 0 rgba(216,79,162,.22);
}

.diy-panel h2 {
  justify-self: center;
  margin: 0;
  padding: 8px 24px;
  border: 4px solid #ff69c3;
  border-radius: 999px;
  background: #ffc3eb;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: 2px 2px 0 #d84fa2;
}

.diy-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 3px solid #ff69c3;
  border-radius: 50%;
  background: #fff;
  color: #d84fa2;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
}

.diy-preview-wrap {
  justify-self: center;
  width: min(260px, 70vw);
  aspect-ratio: 1000 / 1415;
  display: grid;
  place-items: center;
  border: 3px dashed #ffb6df;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
}

.diy-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.diy-swatches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.diy-swatch {
  min-width: 42px;
  height: 34px;
  border: 3px solid #ffb6df;
  border-radius: 999px;
  background: var(--swatch-color, #fff);
  color: #76516f;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}

.diy-swatch.active {
  border-color: #ff69c3;
  box-shadow: 0 0 0 3px rgba(255,145,202,.28);
}

.diy-controls {
  display: grid;
  gap: 9px;
}

.diy-controls label {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #9b64b7;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .92rem;
  font-weight: 800;
}

.diy-controls input[type="range"] {
  width: 100%;
  accent-color: #ff69c3;
}

.diy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.diy-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 1px 1px 0 rgba(105,64,143,.45);
}

.diy-reset {
  background: #8ce666;
  box-shadow: 0 4px 0 #55b834;
}

.diy-save {
  background: #ff69c3;
  box-shadow: 0 4px 0 #d84fa2;
}

.purchase-modal[hidden] {
  display: none;
}

.purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(130,91,184,.24);
  backdrop-filter: blur(4px);
}

.purchase-panel {
  width: min(380px, 92vw);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px;
  border: 5px solid #ff69c3;
  border-radius: 20px;
  background:
    radial-gradient(circle, rgba(255,194,226,.45) 0 5px, transparent 6px) 0 0 / 25px 25px,
    rgba(255,255,249,.98);
  box-shadow: 0 11px 0 rgba(216,79,162,.22);
}

.purchase-panel h2 {
  margin: 0;
  padding: 8px 22px;
  border: 4px solid #ff69c3;
  border-radius: 999px;
  background: #ffc3eb;
  color: #fff;
  font-size: 1.18rem;
  line-height: 1;
  text-align: center;
  text-shadow: 2px 2px 0 #d84fa2;
}

.purchase-preview-wrap {
  width: min(150px, 42vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px dashed #ffb6df;
  border-radius: 16px;
  background: rgba(255,255,255,.76);
}

.purchase-preview-wrap img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
}

.purchase-copy {
  display: grid;
  gap: 4px;
  margin: 0;
  color: #76516f;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .96rem;
  font-weight: 800;
  text-align: center;
}

.purchase-copy span {
  color: #9b64b7;
}

.purchase-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.purchase-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 1px 1px 0 rgba(105,64,143,.45);
}

.purchase-cancel {
  background: #8ce666;
  box-shadow: 0 4px 0 #55b834;
}

.purchase-confirm {
  background: #ff69c3;
  box-shadow: 0 4px 0 #d84fa2;
}

@media (max-width: 980px) {
  .dressup-game-body {
    height: auto;
    min-height: 100vh;
    background-size: cover;
    overflow-y: auto;
  }

  .dressup-game-shell {
    width: min(760px, calc(100vw - 20px));
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto;
  }

  .game-board {
    grid-template-columns: 1fr;
  }

  .avatar-area {
    /* single-column on phones: let it scroll normally instead of pinning */
    position: static;
    align-self: stretch;
  }

  .avatar-workspace {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .avatar-stage {
    min-height: 560px;
  }

  .dressup-frame {
    width: min(72vw, 400px);
  }

  .closet-area {
    min-height: 650px;
  }
}

@media (max-width: 620px) {
  .game-topbar {
    flex-wrap: wrap;
  }

  .game-pill,
  .game-wallet {
    min-width: 0;
    flex: 1;
  }

  .avatar-stage {
    min-height: 470px;
  }

  .avatar-workspace {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
  }

  .layer-panel {
    max-height: 430px;
  }

  .layer-stack {
    max-height: 430px;
  }

  .layer-tile,
  .layer-empty {
    width: 52px;
    height: 52px;
  }

  .layer-tile {
    touch-action: pan-y;
  }

  .layer-tile img {
    max-width: 40px;
    max-height: 40px;
  }

  .layer-tile.layer-skin img {
    max-width: 36px;
    max-height: 36px;
  }

  .dressup-frame {
    width: min(82vw, 340px);
  }

  .closet-area {
    grid-template-rows: auto 52px minmax(0, 1fr) 30px;
    min-height: 680px;
  }

  .closet-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .closet-tab,
  .closet-tab.active {
    min-height: 54px;
    border-radius: 15px;
  }

  .closet-titlebar {
    width: 92%;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-inline: 12px;
  }

  .restock-button {
    padding-inline: 10px;
    font-size: .82rem;
  }

  .shop-curl {
    display: none;
  }

  .closet-frame {
    padding-top: 38px;
  }

  .closet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Compact fitting-room layout used inside the Moon Chat wardrobe iframe. */
body.moonchat-embedded {
  height: auto;
  min-height: 100%;
  padding-top: 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.moonchat-embedded .dressup-game-shell {
  width: 100%;
  height: auto;
  min-height: 100%;
  padding: 4px 3px 5px;
  grid-template-rows: 36px auto;
  gap: 4px;
  overflow: visible;
}

.moonchat-embedded .game-topbar {
  min-height: 0;
  padding: 0 3px;
  flex-wrap: nowrap;
  gap: 5px;
}

.moonchat-embedded .game-pill {
  height: 31px;
  min-width: 64px;
  flex: 0 0 64px;
  border-width: 2px;
  border-radius: 10px;
  font-size: .76rem;
  box-shadow: 0 2px 0 rgba(160,70,181,.18), inset 0 0 0 1px rgba(255,255,255,.62);
}

.moonchat-embedded .game-wallet {
  height: 31px;
  min-width: 116px;
  max-width: 138px;
  flex: 0 1 138px;
  grid-template-columns: 25px minmax(36px, 1fr) 21px;
  gap: 4px;
  padding: 2px 5px 2px 3px;
  border-width: 2px;
  box-shadow: 0 2px 0 rgba(139,90,36,.13), inset 0 0 0 1px rgba(255,255,255,.6);
}

.moonchat-embedded .coin-medal {
  width: 23px;
  height: 23px;
  border-width: 2px;
  font-size: .74rem;
}

.moonchat-embedded .game-wallet strong {
  min-width: 0;
  font-size: .86rem;
}

.moonchat-embedded .coin-plus {
  width: 20px;
  height: 20px;
  font-size: .95rem;
}

.moonchat-embedded .game-board {
  height: auto;
  min-height: 0;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(470px, 64vh) 400px;
  gap: 8px;
  overflow: visible;
}

.moonchat-embedded .avatar-area {
  position: relative;
  top: auto;
  min-height: 470px;
  align-self: stretch;
  grid-template-rows: minmax(0, 1fr);
  padding: 0 2px;
  overflow: visible;
}

.moonchat-embedded .avatar-workspace {
  height: 100%;
  min-height: 470px;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
}

.moonchat-embedded .layer-panel,
.moonchat-embedded .layer-stack {
  max-height: 445px;
}

.moonchat-embedded .layer-stack {
  gap: 6px;
  padding: 3px 1px 3px 0;
}

.moonchat-embedded .layer-tile,
.moonchat-embedded .layer-empty {
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 4px;
  border-width: 2px;
  border-radius: 8px;
}

.moonchat-embedded .layer-tile img,
.moonchat-embedded .layer-tile.layer-skin img {
  max-width: 42px;
  max-height: 42px;
}

.moonchat-embedded .avatar-stage {
  height: 100%;
  min-height: 470px;
}

.moonchat-embedded .dressup-frame {
  width: min(79vw, 330px);
  max-height: 100%;
}

.moonchat-embedded .avatar-actions {
  position: absolute;
  z-index: 4;
  right: 3px;
  bottom: 4px;
  width: 58px;
  gap: 5px;
}

.moonchat-embedded .game-command {
  min-height: 28px;
  border-width: 2px;
  border-radius: 9px;
  font-size: .68rem;
  box-shadow: 0 2px 0 rgba(216,79,162,.18), inset 0 0 0 1px rgba(255,255,255,.42);
}

.moonchat-embedded .closet-area {
  height: 400px;
  min-height: 400px;
  padding-top: 0;
  grid-template-rows: 31px 34px minmax(0, 1fr) 18px;
  gap: 2px;
  overflow: hidden;
}

.moonchat-embedded .closet-tabs {
  position: relative;
  top: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px 1px;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.moonchat-embedded .closet-tabs::-webkit-scrollbar {
  display: none;
}

.moonchat-embedded .closet-tab,
.moonchat-embedded .closet-tab.active {
  min-width: 66px;
  min-height: 28px;
  flex: 0 0 auto;
  padding: 3px 7px;
  border-width: 2px;
  border-radius: 10px;
  font-size: .62rem;
  scroll-snap-align: start;
}

.moonchat-embedded .closet-titlebar {
  width: calc(100% - 8px);
  min-height: 32px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  padding: 3px 8px;
  border-width: 2px;
  border-radius: 13px;
  box-shadow: 0 2px 0 rgba(216,79,162,.14);
}

.moonchat-embedded .closet-titlebar h1 {
  overflow: hidden;
  font-size: .82rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moonchat-embedded .closet-page-indicator {
  display: inline-flex;
  align-items: center;
  color: #9b64b7;
  font-family: 'Fredoka', 'Pixelify Sans', system-ui, sans-serif;
  font-size: .66rem;
  font-weight: 800;
  white-space: nowrap;
}

.moonchat-embedded .restock-button {
  min-height: 25px;
  padding: 3px 7px;
  border-width: 2px;
  font-size: .66rem;
  box-shadow: 0 2px 0 rgba(185,79,146,.18), inset 0 0 0 1px rgba(255,255,255,.5);
}

.moonchat-embedded .closet-frame {
  min-height: 0;
  padding: 7px 6px 6px;
  border-width: 3px;
  border-radius: 17px;
  box-shadow: 0 3px 0 rgba(178,87,187,.2), inset 0 0 0 2px rgba(255,255,255,.5);
}

.moonchat-embedded .closet-frame::before {
  inset: 5px;
  border-width: 1px;
  border-radius: 12px;
}

.moonchat-embedded .closet-grid {
  height: 100%;
  grid-template-columns: none;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 12px) / 3);
  grid-auto-rows: unset;
  gap: 6px;
  padding: 1px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.moonchat-embedded .closet-grid::-webkit-scrollbar {
  display: none;
}

.moonchat-embedded .closet-grid > :nth-child(6n + 1) {
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.moonchat-embedded .closet-item,
.moonchat-embedded .closet-empty {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 4px;
  border-width: 2px;
  border-radius: 10px;
}

.moonchat-embedded .closet-item {
  grid-template-rows: minmax(45px, 1fr) auto;
  gap: 3px;
  touch-action: pan-x;
}

.moonchat-embedded .closet-preview {
  min-height: 0;
  border-radius: 7px;
}

.moonchat-embedded .closet-preview img {
  max-height: 62px;
}

.moonchat-embedded .saved-set-preview {
  min-height: 58px;
}

.moonchat-embedded .closet-action {
  min-height: 20px;
  padding: 2px 4px;
  font-size: .62rem;
}

.moonchat-embedded .diy-item-button {
  top: 3px;
  right: 3px;
  min-width: 27px;
  height: 19px;
  border-width: 1px;
  font-size: .58rem;
}

.moonchat-embedded .variant-prev,
.moonchat-embedded .variant-next {
  width: 23px;
  height: 31px;
}

.moonchat-embedded .variant-arrow-icon {
  width: 19px;
  height: 19px;
}

.moonchat-embedded .variant-dots {
  bottom: 27px;
  gap: 2px;
  padding: 2px 3px;
}

.moonchat-embedded .variant-dot {
  width: 6px;
  height: 6px;
}

.moonchat-embedded .dressup-note {
  min-height: 16px;
  overflow: hidden;
  font-size: .64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-height: 700px) {
  .moonchat-embedded .game-board {
    grid-template-rows: 430px 390px;
  }

  .moonchat-embedded .dressup-frame {
    width: min(74vw, 295px);
  }

  .moonchat-embedded .avatar-area,
  .moonchat-embedded .avatar-workspace,
  .moonchat-embedded .avatar-stage {
    min-height: 430px;
  }

  .moonchat-embedded .closet-area {
    height: 390px;
    min-height: 390px;
  }
}
