:root {
  --ink: #35174d;
  --muted: #634775;
  --pink: #ff71b6;
  --lemon: #fcf58a;
  --cream: #fffbf9;
  --white: #fff;
  --edge: #e8d7fb;
  --outline: #4a226e;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  color: var(--ink);
  font: 700 16px/1.3 "Trebuchet MS", system-ui, sans-serif;
}

button, a { font: inherit; color: inherit; }
button { padding: 0; }
button:focus-visible, a:focus-visible {
  outline: 3px solid #5921b5;
  outline-offset: 3px;
}
button { transition: translate .15s, box-shadow .15s; }
button:active { translate: 0 2px; }

.page {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background:
    linear-gradient(160deg, #5213c2ab, #6d23e386 72%, #461095aa),
    #7937f6 url("paw-prints.jpg") center top / min(100vw, 560px) auto repeat;
}

.shell { width: min(100%, 1030px); margin: 0 auto; }

.masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 0 12px;
}

.back, h1 {
  border: 2px solid var(--outline);
  box-shadow: 0 3px 0 var(--outline);
  background: var(--cream);
}

.back {
  min-height: 46px;
  min-width: 46px;
  padding: 0 13px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.back > :first-child { font-size: 31px; line-height: .8; margin-top: -3px; }

h1, h2, h3, p { margin: 0; }
h1 {
  padding: 6px 13px 7px;
  border-radius: 16px;
  font-size: clamp(22px, 6.2vw, 36px);
  font-weight: 1000;
  line-height: 1.12;
  letter-spacing: -.055em;
}
h1 > span { color: #bd216f; }
h1 > b { color: #a441d1; padding-left: 2px; font-size: .75em; vertical-align: 8%; }

.studio { display: grid; gap: 12px; }

.stage, .runway-scene {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #7937f6 url("paw-prints.jpg") center center / max(100%, 375px) auto repeat;
}

.stage {
  height: clamp(250px, 42svh, 390px);
  border: 4px solid #fff0fc;
  border-radius: 29px;
  outline: 2px solid var(--outline);
  outline-offset: -1px;
  box-shadow: 0 4px 0 var(--outline);
}

.stage::before, .runway-scene::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: radial-gradient(ellipse at center, #ffe7ff6b, transparent 68%);
}

.stage-floor {
  position: absolute;
  z-index: -1;
  inset: 65% -5% -10%;
  background: linear-gradient(transparent, #450c9477);
}

.stage canvas, .runway-scene canvas {
  display: block;
  width: auto;
  height: 96%;
  min-height: 0;
  max-width: 100%;
  object-fit: contain;
}

.sparkle {
  position: absolute;
  color: var(--lemon);
  line-height: 1;
  text-shadow: 1px 2px #8f3db1;
  pointer-events: none;
}
.sparkle-one { left: 12%; top: 16%; font-size: clamp(23px, 5vw, 46px); rotate: -9deg; }
.sparkle-two { right: 11%; top: 38%; font-size: clamp(22px, 4vw, 42px); color: #ffb8ea; }
.sparkle-three { left: 14%; bottom: 17%; font-size: 28px; color: #bffff2; }
.sparkle-four { right: 14%; bottom: 12%; font-size: 22px; }

.closet {
  border: 2px solid var(--outline);
  border-radius: 25px;
  padding: 12px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--outline);
}

.closet-head, .choices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.closet-head h2 { font-size: clamp(22px, 5.7vw, 34px); font-weight: 1000; letter-spacing: -.055em; }

.shuffle {
  min-height: 44px;
  padding: 0 10px;
  border: 2px solid var(--outline);
  border-radius: 13px;
  box-shadow: 0 2px var(--outline);
  background: var(--lemon);
  font-size: .82rem;
  white-space: nowrap;
}
.shuffle span { color: #b02d73; margin-right: 2px; }

.categories, .choices { display: grid; gap: 5px; }
.categories { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-block: 12px 10px; }
.choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.category, .choice {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
}
.category {
  gap: 1px;
  min-height: 63px;
  border-radius: 13px;
  background: #f0e6fd;
  font-size: .75rem;
}
.category > canvas { width: 44px; height: 30px; object-fit: contain; }
.category[aria-pressed="true"] {
  background: #ffc4e2;
  border-color: var(--outline);
  box-shadow: 0 2px var(--outline);
}

.choices-head { margin-bottom: 6px; }
.choices-head h3 { font-weight: 900; font-size: 1.04rem; }
.choices-head p { color: var(--muted); font-size: .78rem; }

.choice {
  position: relative;
  justify-content: start;
  min-height: 76px;
  padding: 3px 1px 4px;
  border-color: var(--edge);
  border-radius: 13px;
  background: #fff;
  font-size: .71rem;
  line-height: 1.08;
}
.choice::before {
  content: "";
  position: absolute;
  inset: 3px 3px auto;
  height: 44px;
  border-radius: 9px;
  background: var(--swatch, #f5eaff);
}
.choice > canvas { z-index: 0; width: 100%; height: 44px; object-fit: contain; }
.choice > span { margin-top: 4px; text-wrap: balance; }
.choice[aria-pressed="true"] { border-color: var(--outline); background: #ffe4f2; }
.choice[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  right: 2px;
  top: 2px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--outline);
  color: #fff;
  font-size: 11px;
}

.show-button {
  width: 100%;
  min-height: 49px;
  margin-top: 12px;
  padding: 6px 12px;
  border: 2px solid var(--outline);
  border-radius: 14px;
  background: var(--pink);
  box-shadow: 0 3px 0 var(--outline);
  font-size: 1.03rem;
  font-weight: 1000;
}
.show-button span { color: #fff798; text-shadow: 1px 1px var(--outline); }

.runway {
  width: min(calc(100% - 26px), 440px);
  max-height: calc(100% - 20px);
  padding: 11px;
  border: 2px solid var(--outline);
  border-radius: 24px;
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 5px 0 var(--outline);
}
.runway::backdrop { background: #281044bd; }
.runway h2 { margin-bottom: 8px; font-size: clamp(20px, 6vw, 29px); letter-spacing: -.035em; }
.runway h2 span { color: #ad35bc; }
.runway-scene { height: min(61svh, 510px); border-radius: 16px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute;
  left: var(--left);
  top: var(--top);
  width: 11px;
  height: 18px;
  border-radius: 4px;
  background: var(--color);
  rotate: var(--tilt);
}
.confetti i:nth-child(1) { --left: 11%; --top: 13%; --color: #ff92d2; --tilt: -28deg; }
.confetti i:nth-child(2) { --left: 83%; --top: 14%; --color: #faff88; --tilt: 21deg; }
.confetti i:nth-child(3) { --left: 17%; --top: 40%; --color: #8efaf0; --tilt: 32deg; }
.confetti i:nth-child(4) { --left: 89%; --top: 42%; --color: #ff91d5; --tilt: -29deg; }
.confetti i:nth-child(5) { --left: 6%; --top: 64%; --color: #fbfb8d; --tilt: -26deg; }
.confetti i:nth-child(6) { --left: 79%; --top: 71%; --color: #8efaf0; --tilt: 27deg; }
.confetti i:nth-child(7) { --left: 20%; --top: 84%; --color: #ff91d5; --tilt: -31deg; }
.confetti i:nth-child(8) { --left: 91%; --top: 88%; --color: #faff88; --tilt: 26deg; }

@media (prefers-reduced-motion: no-preference) {
  .runway[open] .confetti i { animation: fall-in .7s cubic-bezier(.2, .75, .4, 1) both; }
  .runway[open] .confetti i:nth-child(even) { animation-delay: .12s; }
  @keyframes fall-in {
    from { translate: 0 -110px; opacity: 0; }
    to { translate: 0; opacity: 1; }
  }
}

@media (max-width: 390px) {
  .back-label { display: none; }
}

@media (min-width: 700px) {
  .page { padding-inline: 24px; }
  .masthead { margin-block: 12px 20px; }
  .studio { grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); gap: 17px; align-items: start; }
  .stage { height: clamp(385px, calc(100svh - 114px), 584px); }
  .closet { padding: clamp(14px, 2vw, 24px); }
  .categories, .choices { gap: 8px; }
  .categories { margin-block: 22px 22px; }
  .category { min-height: 72px; font-size: .79rem; }
  .category > canvas { width: 52px; height: 36px; }
  .choices-head { margin-bottom: 8px; }
  .choice { min-height: 102px; font-size: .8rem; padding-top: 5px; }
  .choice::before, .choice > canvas { height: 64px; }
  .show-button { margin-top: 20px; min-height: 56px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
