.closet-world {
  --ink: #56294f;
  --outline: #7c3f70;
  --cream: #fff1c9;
  --panel-shadow: #75406c;
  --chrome: linear-gradient(180deg, #fff2fd 0%, #e7bef6 12%, #c68bd6 28%, #ebc4e7 48%, #aa6aaf 85%, #824e86 100%);
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  isolation: isolate;
  overflow-x: clip;
  overflow-y: auto;
  color: var(--ink);
  text-align: left;
  font: 600 16px/1.15 "Trebuchet MS", Verdana, sans-serif;
  background: #f6a5c5 url("closet-scenery.webp") center center / cover no-repeat;
}
.closet-world *, .closet-world *::before, .closet-world *::after { box-sizing: border-box; }
:where(.closet-world) button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.closet-world button:focus-visible { outline: 3px solid #361745; outline-offset: 3px; z-index: 4; }
.closet-world button::-moz-focus-inner { border: 0; }
.closet-interior {
  position: relative;
  width: min(100%, 1630px);
  height: 100dvh;
  min-height: 550px;
  margin-inline: auto;
  padding: clamp(13px, 2.4vh, 32px) clamp(25px, 4.5vw, 96px) clamp(17px, 3vh, 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(15px, 3.4vh, 39px);
}
.closet-head {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.closet-sign {
  position: relative;
  margin: 0;
  padding-left: .4em;
  font: italic bold clamp(36px, min(5.25vw, 7.5vh), 88px)/1.08 Georgia, 'Times New Roman', serif;
  letter-spacing: -.072em;
  color: #fff1dd;
  -webkit-text-stroke: .06em #922551;
  paint-order: stroke fill;
  text-shadow: 0 .065em #cb3574, .026em .105em #66274d, .036em .15em .045em #9b417696;
  transform: rotate(-3deg);
  transform-origin: 40% 60%;
  white-space: nowrap;
}
.closet-logo-star {
  position: absolute;
  width: .42em; height: .42em;
  left: -.035em; top: .02em;
  background: #fff5a8;
  filter: drop-shadow(0 1px 1px #9d4a57);
  clip-path: polygon(50% 0, 61% 35%, 100% 45%, 65% 61%, 52% 100%, 40% 66%, 0 55%, 36% 39%);
}
.closet-sign::after {
  content: "✦"; position: absolute; right: -.65em; top: -.05em;
  color: #fff2a3; font: normal .45em/1 Georgia, serif;
  -webkit-text-stroke: .05em #b86272;
  text-shadow: .04em .07em #bd6084;
}
.closet-home, .closet-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .52em;
  border: 2px solid var(--ink);
  border-radius: 80px;
  box-shadow: inset 0 2px #fff5e6, inset 0 -3px #dc8da8a6, 0 3px 0 #7d4772, 0 5px 10px #71335b32;
  background: linear-gradient(#fff7d9 4%, #ffe3bc 44%, #ffc39f 53%, #ffd5aa 90%);
}
.closet-home {
  padding: .55em 1.1em .62em .9em;
  color: #562542;
  font-size: clamp(14px, 1.27vw, 20px);
  font-weight: bold;
}
.closet-home svg, .closet-reset svg { display: block; width: 1.3em; height: 1.3em; flex: none; }
.closet-home:hover, .closet-reset:not(:disabled):hover { filter: brightness(1.065); }
.closet-home:active, .closet-reset:not(:disabled):active { transform: translateY(1px); }

.closet-studio {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: clamp(16px, 4.5vw, 92px);
  min-height: 0;
  padding: 0 2.3% 1%;
}
.closet-fitting {
  --platform-bottom: 6%;
  --platform-depth: 9%;
  position: relative; min-width: 0; min-height: 0; isolation: isolate;
}
.closet-mirror {
  position: absolute;
  inset: 1.4% 4% 8%;
  border: clamp(2px, .22vw, 4px) solid #85496f;
  border-radius: 49% 49% 42% 42% / 28% 28% 13% 13%;
  background: linear-gradient(105deg,#ac729e 0%,#fff0ed 4%,#c88ebb 9%,#f7d9d9 18%,#d895bd 34%,#ffece8 49%,#d5a2c4 68%,#aa6a9b 91%,#f1d7e1 97%);
  box-shadow: inset 0 0 0 clamp(2px,.3vw,5px) #fff2e4b8, 3px 6px 0 #8e5f8659, 5px 10px 16px #67325a52;
}
.closet-glass {
  position: absolute;
  inset: 2.3% 5% 2%;
  overflow: hidden;
  border-radius: inherit;
  border: 2px solid #9a6794;
  box-shadow: inset 0 0 0 3px #fff2ff8f, inset 1px 7px 13px #80568345;
  background:
    linear-gradient(122deg,transparent 18%,#ffffff56 18.5% 24%,transparent 24.4% 26%,#ffffff54 26.6% 27.8%,transparent 28.2% 61%,#fff5ff26 61.6% 67.2%,transparent 67.6%),
    linear-gradient(165deg,#be98c6 1%,#dec7e9 27%,#eddbee 50%,#fff2df 80%,#e7acd0);
}
.closet-glint {
  position: absolute;
  width: 5%; aspect-ratio: 1;
  background: #fffbef;
  clip-path: polygon(50% 0,61% 36%,100% 50%,62% 61%,50% 100%,38% 62%,0 50%,38% 38%);
}
.closet-glint.g1 { left: 19%; top: 19%; }
.closet-glint.g2 { left: 25%; top: 17%; width: 2.4%; }
.closet-glint.g3 { right: 14%; top: 54%; width: 3.5%; }
.closet-lamps {
  position: absolute;
  top: 19%; bottom: 14%; width: 6%; display: flex; flex-flow: column;
  justify-content: space-between; align-items: center;
}
.closet-lamps.left { left: -.7%; }
.closet-lamps.right { right: -.7%; }
.closet-lamps i {
  width: 94%; max-width: 25px; aspect-ratio: 1; border-radius: 100%;
  border: 1px solid #a46c75;
  background: radial-gradient(circle at 36% 31%, white 8%,#fff9d5 44%,#ffd6a4 73%,#c98885);
  box-shadow: 0 1px 0 #82476a,0 0 7px 2px #ffedc9a1;
}
.closet-platform {
  position: absolute; bottom: var(--platform-bottom); left: 0; width: 100%; height: var(--platform-depth);
  border-radius: 50%;
  border: 2px solid #9e6089;
  background: radial-gradient(ellipse at 50% 40%, #d49ec3 12%, #edbfd5 60%,#fee3e2 71%,#ce8ba9 75%);
  box-shadow: 0 4px 0 #9d6490, 0 9px 15px #7d42624a;
}
.closet-doll-stage {
  position: absolute;
  top: 5%; left: 4%; right: 4%;
  bottom: calc(var(--platform-bottom) + var(--platform-depth) * .42);
  min-width: 0; min-height: 0; overflow: hidden;
  pointer-events: none;
}
.closet-doll-stage > canvas {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0;
  object-position: center bottom;
}
.closet-world[data-view="vanity"] .closet-glass { container-type: size; }
.closet-world[data-view="vanity"] .closet-doll-stage {
  inset: 5% 0 0; max-width: 115cqh; margin-inline: auto;
}
.closet-world[data-view="vanity"] .closet-doll-stage canvas {
  object-fit: cover !important;
  object-position: center top;
}
.closet-reset {
  position: absolute; z-index: 2; left: 50%; bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: clamp(12px, 1vw, 16px);
  padding: .46em .9em;
}
.closet-reset:not(:disabled):active { transform: translate(-50%,1px); }
.closet-reset:disabled { color: #765263; cursor: default; }

.closet-cabinet {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) clamp(16px, 3.3vh, 37px);
  min-height: 0; min-width: 0;
  align-self: stretch;
  margin: 1% 0 1.2%;
  padding: clamp(9px,1.2vh,18px) clamp(9px,1.05vw,19px) clamp(5px,.8vh,12px);
  border: clamp(2px,.22vw,4px) solid #63365d;
  border-radius: 7% 7% 3% 3% / 4% 4% 3% 3%;
  background: linear-gradient(94deg,#995c9f, #efd6ef 2.1%, #ba81bf 4.5%, #edd2eb 10%,#c092c6 29%,#e9c5de 53%, #c08ec3 90%,#945d9c 97%,#d0a4d0);
  box-shadow: inset 0 0 0 2px #ffedf3a6, inset 0 6px 6px #f8dae7ac, 3px 5px 0 #8e5480, 6px 12px 15px #6c345638;
}
.closet-crown {
  position: absolute;
  width: 23%; height: 27px; min-height: 16px;
  top: -18px; left: 38.5%;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  color: #fddea4;
  text-shadow: -1px -1px #865170, 1px 2px #865170;
}
.closet-crown i {
  width: 38%; height: 4px; transform: rotate(6deg);
  background: linear-gradient(#fff1e6,#a672a8);
  border-radius: 100%; box-shadow: 0 1px #795775;
}
.closet-crown i:last-child { transform: rotate(-6deg); }
.closet-crown b { font: bold 25px/1 Georgia, serif; }
.closet-switches {
  display: flex; justify-content: center; gap: 1.4%;
  padding: 0 10% clamp(7px,1.1vh,15px);
}
.closet-switches button {
  position: relative;
  display: flex; justify-content: center; align-items: center;
  gap: .28em;
  flex: 1;
  padding: .18em .5em .24em;
  border: 2px solid #754473;
  border-radius: 100px;
  box-shadow: inset 0 2px #fae4fd, inset 0 -2px #a777ab, 0 2px #9d699b;
  background: var(--chrome);
  font: italic bold clamp(20px,2.05vw,32px)/1.15 Georgia,serif;
}
.closet-switches button svg { width: 1.15em; height: 1.15em; flex: none; }
.closet-switches button[aria-selected="true"] {
  background: linear-gradient(#ffe4ef,#ffaccb 38%,#f282b2 51%,#fab2ce 93%);
  border-color: #85365e;
  color: #6c284e;
  box-shadow: inset 0 2px #fff5e8, inset 0 -2px #d5709e, 0 2px #965183;
}
.closet-switches button:hover { filter: brightness(1.05); }
.closet-rack {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  min-width: 0; min-height: 0;
  overflow: hidden;
  border: 2px solid #794975;
  border-radius: 13px 13px 9px 9px;
  background: #f2c3d9;
  box-shadow: inset 3px 4px 8px #78254e62,0 2px 0 #f9dfec;
}
.closet-categories {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: clamp(2px, .38vw, 7px);
  padding: clamp(5px,1vh,12px) 2.5%;
  border-bottom: 2px solid #a77493;
  background: linear-gradient(#e5b1cc, #f8d4df 26%, #dab0c4 95%);
  box-shadow: inset 0 2px 2px #fff2f4a8, 0 2px 4px #71365030;
}
.closet-categories button {
  flex: 1;
  min-width: 0; min-height: 34px;
  padding: .18em .12em .25em;
  border: 1px solid #ae7995;
  border-radius: 4px 7px 5px 7px;
  background: linear-gradient(#fff5e6, #f2cbd5 93%);
  box-shadow: inset 0 1px #fff8f3, 0 1px 1px #ac779088;
  color: #63384e;
  font: italic bold clamp(13px,1.3vw,21px)/1.04 Georgia, serif;
}
.closet-categories button[aria-pressed="true"] {
  color: #57293d;
  border-color: #96546d;
  background: linear-gradient(#fff6ce, #ffd6a0 80%);
  box-shadow: inset 0 1px #fffbe8,0 2px #b2768f;
}
.closet-categories button:hover, .closet-pages button:hover { filter: brightness(1.06); }
.closet-shelves {
  display: grid;
  grid-template-rows: minmax(0,1fr);
  min-height: 0;
}
.closet-shelves[data-rows="2"] { grid-template-rows: repeat(2, minmax(0,1fr)); }
.closet-shelves.has-clear { grid-template-rows: minmax(0,1fr) auto; }
.closet-shelves.has-clear[data-rows="2"] { grid-template-rows: repeat(2, minmax(0,1fr)) auto; }
.closet-clear-strip {
  grid-row: -2 / -1;
  display: flex; justify-content: center;
  padding: 3px 6px;
  border-top: 1px solid #bc91a6;
  background: linear-gradient(#f9dde6, #e7bdcd);
}
.closet-pages {
  display: flex;
  align-items: center; justify-content: center; gap: .8em;
  min-height: 34px;
  padding: 3px;
  border-top: 1px solid #ab7694;
  color: #683852;
  background: linear-gradient(#f2ccd7, #edc0d4);
}
.closet-pages[hidden] { display: none; }
.closet-pages button {
  width: 37px; height: 27px; padding: 0 0 .12em;
  display: grid; place-items: center;
  border: 1px solid #a26b86;
  border-radius: 16px;
  background: linear-gradient(#fff9e6 8%,#fbd9be 77%,#eeb7ae);
  box-shadow: inset 0 1px white,0 1px #b688a6;
  font: bold 21px/.8 Georgia,serif;
  color: #6d3654;
}
.closet-page-count { min-width: 3em; text-align: center; font: bold 13px/1.2 Verdana,sans-serif; }
.closet-shelf {
  --shelf-bg: #f2c4da;
  --rail-top: clamp(9px, 1.55vh, 21px);
  position: relative;
  min-height: 0; min-width: 0;
  display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr);
  padding: var(--rail-top) 3.5% clamp(6px,1vh,14px);
  background:
    radial-gradient(ellipse at 50% 36%, #fff9eeab, transparent 72%),
    repeating-linear-gradient(90deg,transparent 0 14px,#fff3f818 15px 24px),
    linear-gradient(90deg,#c78da9, var(--shelf-bg) 8% 92%, #c78da9);
  box-shadow: inset 0 4px 8px #8b49632b;
}
.closet-shelf + .closet-shelf {
  border-top: clamp(5px,.85vh,11px) solid transparent;
  border-image: linear-gradient(180deg,#754969 0 11%,#f5cfe2 18% 39%,#c391c1 52%,#89557f 100%) 1;
}
.closet-shelf::before {
  content: ''; position: absolute; top: var(--rail-top); left: 2.4%; right: 2.4%;
  height: clamp(4px,.7vh,8px); border: 1px solid #966c72; border-radius: 20px;
  background: linear-gradient(#fff5d4 12%,#edd2ad 42%,#c39588 66%,#ae8086 96%);
  box-shadow: 0 2px 2px #9a627342;
}
.closet-shelf[data-section="shoes"] { --shelf-bg: #e5c4da; }
.closet-shelf[data-section="shoes"]::before,
.closet-shelf[data-section="hair"]::before,
.closet-shelf[data-section="glasses"]::before,
.closet-shelf[data-section="jewelry"]::before,
.closet-shelf[data-section="bags"]::before { display: none; }
.closet-shelf[data-section="hair"] { --shelf-bg: #f7d3b4; }
.closet-shelf[data-section="glasses"], .closet-shelf[data-section="jewelry"] { --shelf-bg: #fbc5d4; }
.closet-items {
  display: grid; grid-template: minmax(0,1fr) / repeat(3,minmax(0,1fr));
  gap: clamp(4px,.95vw,18px);
  min-width: 0; min-height: 0;
}
.closet-piece {
  position: relative;
  isolation: isolate;
  min-width: 0; min-height: 0;
  display: grid; grid-template: minmax(0,1fr) 2.5em / minmax(0,1fr); align-items: stretch;
  font-size: clamp(12px,.94vw,15px);
  justify-items: stretch; gap: clamp(3px,.65vh,8px);
  border: 0; padding: 0 1px; margin: 0;
  border-radius: 12px; background: transparent;
}
.closet-piece::before {
  content: ''; position: absolute; z-index: -1; inset: 7% 0 1%;
  border-radius: 44% 44% 32% 32%;
  background: radial-gradient(ellipse,#fff4ca8a, #fff5ff40 54%, transparent 73%);
  opacity: 0; transition: opacity .14s ease-out;
}
.closet-piece:hover::before, .closet-piece[aria-pressed="true"]::before { opacity: 1; }
.closet-thumbnail {
  position: relative;
  display: block;
  margin-inline: 3%;
  min-width: 0; min-height: 0;
  pointer-events: none;
  filter: drop-shadow(1px 3px 1px #81436736);
  transform-origin: 50% 0;
  transition: transform .16s ease-out;
}
.closet-thumbnail > svg, .closet-thumbnail > img, .closet-thumbnail > canvas {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  object-fit: contain; min-height: 0; min-width: 0;
}
.closet-piece[data-hung] .closet-thumbnail > canvas { object-position: 50% 0; }
.closet-piece[data-group="jewelry"] .closet-thumbnail,
.closet-piece[data-group="glasses"] .closet-thumbnail { margin: 8% 10%; }
.closet-clear-strip .closet-piece {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 25px; padding: 2px 10px 2px 7px;
  border: 1px solid #b38a9c; border-radius: 20px;
  background: #fff3e6; box-shadow: inset 0 1px #fff8f6;
}
.closet-clear-strip .closet-piece[aria-pressed="true"] { border-color: #b57c80; background: #ffe9bf; }
.closet-clear-strip [data-item="none"] .closet-thumbnail { width: 15px; height: 15px; margin: 0; }
.closet-clear-strip .closet-piece[data-item] .closet-piece-name { padding: 0; background: transparent; box-shadow: none; }
.closet-piece:hover .closet-thumbnail { transform: rotate(-1.6deg); }
.closet-piece:active .closet-thumbnail { transform: scale(.98); }
.closet-piece-name {
  align-self: center; justify-self: center;
  position: relative;
  line-height: 1.12; text-align: center;
  font-size: inherit; text-wrap: balance;
  font-weight: 700;
  color: #623950;
  max-width: 100%;
  padding: .14em .43em .2em;
  border-radius: .8em;
}
.closet-piece[aria-pressed="true"] .closet-piece-name {
  background: #fff0ca;
  box-shadow: 0 0 0 1px #c48885, 0 2px #ba819c40;
}
.closet-piece[aria-pressed="true"] .closet-piece-name::before {
  content: '✓'; display: inline; font-weight: bold; color: #8c3658; padding-right: .26em;
}
.closet-drawers {
  position: relative;
  display: flex; gap: 1.5%;
  padding: clamp(3px,.5vh,7px) 4% 0;
}
.closet-drawers i {
  position: relative; flex: 1;
  display: grid; place-items: center;
  border-radius: 2px 2px 11px 11px; border: 1px solid #9c6d9e;
  box-shadow: inset 0 1px #f9d9e6;
  background: linear-gradient(#d5aed3,#c493be 90%);
}
.closet-drawers i::before {
  content: ''; width: 20%; height: 30%; min-height: 3px; border-radius: 100px;
  border: 1px solid #936080; background: linear-gradient(#fff0d4,#e9b692 75%); box-shadow: 0 1px #b57c9e;
}
.closet-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Keep the figure and the rail in view together on a phone. */
@media (max-width: 700px) and (max-aspect-ratio: 1/1) {
  .closet-world { background-position: 49% center; }
  .closet-interior {
    min-height: min(625px, 100dvh);
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    gap: 3px;
  }
  .closet-head { padding: 1px 2px 2px; gap: 4px; }
  .closet-sign { font-size: clamp(27px,7.5vw,46px); }
  .closet-home { font-size: clamp(11px,2.85vw,15px); gap: .3em; padding: .5em .65em; min-height: 35px; }
  .closet-studio {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0,.82fr) minmax(min(335px,54dvh),1.18fr);
    gap: clamp(5px,.9vh,12px);
    padding: 0;
  }
  .closet-fitting { --platform-bottom: 2%; width: min(100%, 560px); justify-self: center; }
  .closet-mirror { inset: 2% 13% 4%; border-radius: 48% 48% 40% 40% / 26% 26% 10% 10%; }
  .closet-lamps i { max-width: 16px; }
  .closet-platform { left: 14%; width: 72%; }
  .closet-doll-stage { top: 3.5%; left: 7%; right: 7%; }
  .closet-reset { bottom: 0; left: auto; right: 0; transform: none; font-size: 11px; padding: .5em .68em; min-height: 31px; }
  .closet-reset:not(:disabled):active { transform: translateY(1px); }
  .closet-cabinet {
    margin: 0; padding: 5px 6px 3px;
    grid-template-rows: auto minmax(0,1fr) 11px;
    border-radius: 17px 17px 13px 13px;
  }
  .closet-crown { display: none; }
  .closet-switches { padding: 0 17% 5px; gap: 5px; }
  .closet-switches button { font-size: clamp(16px,4.3vw,21px); min-height: 34px; }
  .closet-rack { border-radius: 9px 9px 6px 6px; }
  .closet-categories { padding: 4px 2%; }
  .closet-categories button { min-height: 31px; font-size: 14px; }
  .closet-pages { min-height: 29px; padding: 1px; }
  .closet-shelf { --rail-top: 7px; padding: var(--rail-top) 3% 3px; }
  .closet-shelf + .closet-shelf { border-top-width: 5px; }
  .closet-shelf::before { height: 4px; }
  .closet-piece { font-size: clamp(11px,2.7vw,14px); gap: 2px; }
  .closet-items { gap: 5px; }
  .closet-drawers { padding-top: 3px; }
}

@media (orientation: landscape) and (max-height: 590px) {
  .closet-interior { min-height: 317px; padding: 5px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left)); gap: 3px; }
  .closet-sign { font-size: clamp(23px,7vh,37px); }
  .closet-home { min-height: 32px; font-size: 12px; padding: .3em .7em; }
  .closet-studio { padding: 0 2%; gap: 3%; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); }
  .closet-cabinet { margin: 0; padding: 4px 7px; grid-template-rows: auto minmax(0,1fr) 9px; }
  .closet-crown { display: none; }
  .closet-switches { padding: 0 16% 3px; }
  .closet-categories { padding: 2px 2%; }
  .closet-categories button { min-height: 24px; font-size: 13px; }
  .closet-pages { min-height: 23px; padding: 0; }
  .closet-pages button { height: 21px; }
  .closet-switches button { padding: .1em .4em .16em; font-size: 16px; min-height: 28px; }
  .closet-shelf { --rail-top: 5px; padding: var(--rail-top) 3.5% 2px; }
  .closet-shelf + .closet-shelf { border-top-width: 4px; }
  .closet-shelf::before { height: 3px; }
  .closet-piece { font-size: 11px; grid-template-rows: minmax(0,1fr) 1.5em; gap: 2px; }
  .closet-reset { font-size: 11px; min-height: 26px; padding: .2em .55em; }
  .closet-lamps i { max-width: 16px; }
  .closet-drawers { padding-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .closet-world *, .closet-world *::before, .closet-world *::after {
    scroll-behavior: auto;
    transition-duration: 0s;
    animation-duration: 0s;
  }
}
