:root {
  color-scheme: light;
  --canvas: #f7eaf6;
  --panel: #fff9fd;
  --card: #fffafd;
  --hover: #f8e5f4;
  --ink: #321930;
  --muted: #70536b;
  --border: #e1c9de;
  --highlight: #8a316c;
  --chrome: linear-gradient(173deg, #fffaff, #efd5eb 41%, #b981ac 49%, #f9e5f4 52%, #e6afd7 94%);
  --polished-silver: linear-gradient(169deg, #fff 1%, #f4edf4 32%, #bcb3c6 48%, #fff7fd 51%, #e4bcda 86%, #f6dbee 100%);
  --reflection: linear-gradient(90deg, #c15da4, #f8cae7 52%, #a57ac4);
  --page-width: 1330px;
  --gutter: clamp(1rem, 3.6vw, 3rem);
  font: 1rem/1.45 "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 6% 20%, #ffe5f6, transparent 50%), radial-gradient(ellipse at 92% 22%, #e8ddf4, transparent 45%), linear-gradient(145deg, #fbf5fd, var(--canvas));
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.18; }
a, button, input { -webkit-tap-highlight-color: transparent; }
button {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: .64rem;
  padding: .52rem .72rem;
  color: inherit;
  background: var(--card);
  font: inherit;
  cursor: pointer;
  transition: background-color .16s, border-color .16s, box-shadow .16s;
}
button:hover { background-color: var(--hover); border-color: #ac76a1; }
button:disabled { opacity: .48; cursor: default; }
:where(a, button, input, summary):focus-visible { outline: 2px solid #983b82; outline-offset: 3px; }

.site-header {
  border-bottom: 1px solid #fff8;
  background: radial-gradient(ellipse at 18% -60%, #fff 18%, #ffe7f7 48%, transparent 78%), linear-gradient(115deg, #f9d6ec, #f4e8f6 57%, #e8cde7);
  box-shadow: 0 5px 25px #88417616;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  max-width: var(--page-width);
  min-height: 84px;
  margin-inline: auto;
  padding: .18rem var(--gutter);
}
.brand {
  width: clamp(164px, 26vw, 292px);
  flex: none;
}
.brand img { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 5px #401c4140) drop-shadow(0 0 8px #fff7); }
#gallery {
  display: inline-flex;
  align-items: center;
  gap: .53rem;
  padding: .34rem .38rem .34rem .65rem;
  border-radius: 99px;
  border-color: #fff;
  color: #391b38;
  background: var(--polished-silver);
  box-shadow: inset 0 1px #fff, inset 0 -1px #96678380, 0 0 16px #cb8bc042, 0 4px 9px #66305428;
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 720;
}
#gallery::before {
  content: "";
  width: .82rem;
  height: .82rem;
  background: linear-gradient(150deg, #9e4e89, #521d46);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
#gallery:hover { box-shadow: inset 0 1px #fff, inset 0 -1px #96678380, 0 0 20px #f5c6e984, 0 4px 9px #66305428; }
#count {
  display: grid;
  place-items: center;
  min-width: 1.68rem;
  min-height: 1.68rem;
  padding-inline: .25rem;
  border-radius: 99px;
  background: linear-gradient(155deg, #622753, #993f7b);
  box-shadow: inset 0 1px 3px #4e224f80, 0 1px #fff9;
  color: #f3f6ff;
  font-variant-numeric: tabular-nums;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(0, .76fr);
  align-items: start;
  gap: clamp(1rem, 2.4vw, 2rem);
  max-width: var(--page-width);
  margin-inline: auto;
  padding: clamp(1rem, 2.7vw, 2.1rem) var(--gutter) 2rem;
}
.preview {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: .75rem;
  min-width: 0;
  padding: .7rem;
  border: 1px solid #fff;
  border-radius: 1.85rem;
  background: linear-gradient(155deg, #fffbff, #faeef9 68%, #fdf6fb);
  box-shadow: 0 18px 54px #81517b25;
}
.preview-header { padding: .15rem .35rem 0; }
.preview-header h2 { font-size: .87rem; font-weight: 640; color: var(--muted); }
.stage {
  position: relative;
  isolation: isolate;
  height: clamp(385px, calc(100dvh - 234px), 755px);
  overflow: hidden;
  border: 1px solid #eed0ec;
  border-radius: 1.42rem;
  background:
    radial-gradient(ellipse at 85% 20%, #fff7fc, transparent 52%),
    radial-gradient(ellipse at 6% 77%, #f8d2ee, transparent 61%),
    linear-gradient(130deg, #e2cfed, #f7d8ed 56%, #d9bde6);
}
.stage-backdrop {
  position: absolute;
  inset: 4% 17% 3%;
  border: 1px solid #fff;
  border-radius: 50% 50% 10% 10% / 34% 34% 7% 7%;
  background: radial-gradient(ellipse at 48% 37%, #fff8fc 12%, #f3e1f3 54%, #e2c6e9 84%);
  box-shadow: 0 0 48px #fff8, inset 0 0 30px #fff8;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 18% -16%;
  border: 2px solid #fff7;
  border-radius: 50%;
  rotate: -16deg;
  box-shadow: 0 1px 10px #fff6, inset 0 -1px 6px #fff6;
  pointer-events: none;
}
.stage::after, .stage-backdrop::after {
  content: "";
  position: absolute;
  width: clamp(.72rem, 1.75vw, 1.38rem);
  aspect-ratio: 1;
  pointer-events: none;
  background: linear-gradient(142deg, #fff, #f4c6e9 58%, #b477aa);
  clip-path: polygon(50% 0, 58% 41%, 100% 50%, 58% 59%, 50% 100%, 42% 59%, 0 50%, 42% 41%);
}
.stage::after { top: 12%; right: 12%; }
.stage-backdrop::after { bottom: 17%; left: -14%; width: clamp(.65rem, 1.3vw, 1rem); }
.stage-floor {
  position: absolute;
  left: 23%;
  right: 23%;
  bottom: 2.4%;
  height: 7.4%;
  border: 1px solid #fff9;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #88578bac, #d5a9d786 53%, #fef1fc 96%);
  box-shadow: 0 7px 18px #915b9348;
}
.stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 99%;
  object-fit: contain;
  filter: drop-shadow(0 .42rem .45rem #62304c38);
}
.actions { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: .44rem; }
.actions button { padding-inline: .28rem; font-size: .84rem; font-weight: 630; white-space: nowrap; }
.accent, .accent:hover {
  border-color: #c987b5;
  color: #44223e;
  background: var(--chrome);
  box-shadow: inset 0 1px #fff8;
}
.accent:hover { box-shadow: inset 0 1px #fff9, 0 0 15px #eab3d890; }
#status { color: var(--muted); font-size: .8rem; }
#status:empty { display: none; }

.editor {
  min-width: 0;
  min-height: 470px;
  border: 1px solid #fff;
  border-radius: 1.85rem;
  background: var(--panel);
  box-shadow: 0 18px 54px #81517b25;
}
.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: clamp(.95rem, 2vw, 1.48rem);
  border-bottom: 1px solid var(--border);
  border-radius: 1.8rem 1.8rem 0 0;
  background: radial-gradient(ellipse at 95% 0%, #f2b5de73, transparent 65%), linear-gradient(132deg, #fff9fd, #f2e4f8);
}
h1 { font-size: clamp(1.36rem, 2.65vw, 2rem); letter-spacing: -.055em; font-weight: 720; }
#sections, .eye-modes {
  display: flex;
  gap: .25rem;
  padding: .25rem;
  border: 1px solid #ddbbd4;
  border-radius: 99px;
  background: #fff8fc;
}
#sections button, .eye-modes button {
  border-color: transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  padding: .3rem .9rem;
  font-size: .86rem;
  font-weight: 670;
}
#sections button:hover, .eye-modes button:hover { background-color: var(--hover); }
#sections button[aria-pressed=true], .eye-modes button[aria-pressed=true] {
  border-color: #bf80ac;
  background: var(--chrome);
  color: #391c35;
}
#categories {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: .12rem;
  padding-inline: .68rem;
  border-bottom: 1px solid var(--border);
  background: #fbf0f8;
}
#categories button {
  flex: 1 0 auto;
  position: relative;
  min-height: 46px;
  padding: .52rem .49rem;
  border: 0;
  border-radius: .32rem .32rem 0 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-size: .82rem;
}
#categories button:hover { background: #f7e2f2; color: var(--ink); }
#categories button[aria-pressed=true] { color: var(--ink); font-weight: 700; }
#categories button[aria-pressed=true]::after {
  content: "";
  position: absolute;
  inset: auto .44rem 0;
  height: 2px;
  border-radius: 999px;
  background: var(--reflection);
  box-shadow: 0 -1px 12px #e6a3d084;
}
.editor-content { padding: clamp(.9rem, 2.25vw, 1.5rem); }
#subcategories:not(:empty) { display: flex; flex-wrap: wrap; gap: .38rem; margin-bottom: 1.15rem; }
#subcategories button { padding: .32rem .68rem; font-size: .83rem; border-radius: 99px; }
#subcategories button[aria-pressed=true] { color: #5d2350; border-color: #c884b5; background: #f6d7ed; }
#category-title { font-size: 1.15rem; font-weight: 690; letter-spacing: -.01em; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .72rem; }
#options:empty { margin-top: 0; }
#options.face-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#options.eye-options { display: block; }

.choice {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr) .42rem;
  align-items: center;
  gap: .5rem;
  min-height: 43px;
  padding: .47rem .62rem;
  text-align: start;
  color: var(--ink);
  background: var(--card);
  overflow-wrap: anywhere;
  font-size: .86rem;
}
.choice:hover { background: var(--hover); }
.choice[aria-pressed=true] {
  border-color: #ae5b98;
  background: linear-gradient(145deg, #ffe9fa, #f6dbf0 72%);
  box-shadow: inset 0 1px #ffffffe6, 0 0 0 1px #ae5b9870;
}
.choice::after { content: ""; width: .38rem; height: .38rem; border-radius: 50%; }
.choice[aria-pressed=true]::after { background: var(--highlight); }
.chip {
  width: 1rem;
  height: 1rem;
  border: 1px solid #ffffff48;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff8, transparent 60%), var(--chip, #9aa6c7);
}
.face-choice, .choice.eye-shape {
  grid-template-columns: minmax(0, 1fr);
  gap: .38rem;
  min-height: 0;
  padding: .35rem .35rem .5rem;
  text-align: center;
  font-weight: 620;
}
.face-choice::after, .eye-shape::after, .skin-swatch::after { display: none; }
.face-choice > canvas, .face-thumbnail, .eye-thumbnail {
  display: block;
  width: 100%;
  height: clamp(55px, 7vw, 100px);
  object-fit: contain;
  border-radius: .38rem;
  background: radial-gradient(ellipse at 50% 36%, #f2d5e9, #dec1e3 90%);
}
.face-choice > canvas { height: clamp(60px, 7.6vw, 104px); }
.face-choice > span { padding: 0 .12rem; }
.face-thumbnail { padding: .44rem; }
.face-thumbnail path { fill: #ba80b46b; stroke: #744066; stroke-width: 2.15; stroke-linejoin: round; }
.face-choice[aria-pressed=true] .face-thumbnail path { fill: #bf76a98f; }
.body-choice > canvas { height: clamp(78px, 9vw, 124px); }
#options.skin-options, .eye-colors { gap: .43rem; }
.choice.skin-swatch {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  min-height: 36px;
  padding: .24rem;
  border-color: #9ba3b84d;
  text-align: center;
}
.choice.skin-swatch[aria-pressed=true] { border-color: #fff; outline: 2px solid #9b5089; outline-offset: 2px; }
.eye-modes { width: fit-content; margin-bottom: .7rem; }
.eye-shapes, .eye-colors { display: grid; }
.eye-shapes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.eye-colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice.eye-color { grid-template-columns: 1.55rem minmax(0, 1fr); }
.choice.eye-color::after { display: none; }
.iris-swatch, .feature-color-swatch { width: 1.5rem; height: 1.5rem; border-radius: 50%; }
.iris-swatch {
  border: 1px solid #fff7;
  background:
    radial-gradient(circle at 38% 32%, #fff 0 1px, transparent 2px),
    radial-gradient(circle, #272028 0 23%, transparent 29%),
    radial-gradient(circle, #eae5f3 4%, var(--iris-swatch) 47%, #2a2635 83%);
}

#adjustments:not(:empty) { display: grid; gap: .65rem; margin-top: 1rem; padding-top: .88rem; border-top: 1px solid var(--border); }
#adjustments:has(#adjust-jaw) { display: none; }
#adjustments h3 { font-size: .89rem; margin-bottom: .55rem; }
.adjustment { display: grid; grid-template-columns: 1fr auto; gap: .24rem .65rem; font-size: .87rem; }
.adjustment output { color: var(--highlight); font-variant-numeric: tabular-nums; }
.adjustment input { grid-column: 1 / -1; width: 100%; margin: 0; accent-color: #ac5094; cursor: pointer; }
.eye-details summary { color: var(--muted); font-size: .86rem; cursor: pointer; }
.eye-details[open] .adjustment { margin-top: .62rem; }

dialog { width: min(92vw, 490px); max-height: 85vh; padding: 1.1rem; border: 1px solid #e1bfda; border-radius: 1.15rem; color: var(--ink); background: var(--panel); }
dialog::backdrop { background: #291526ab; backdrop-filter: blur(4px); }
dialog header, .saved-look { display: flex; align-items: center; justify-content: space-between; gap: .62rem; }
dialog header { padding-bottom: .6rem; }
.saved-look { border-top: 1px solid var(--border); padding: .54rem 0; font-size: .86rem; }
.saved-look canvas { width: 2.7rem; height: 5rem; object-fit: contain; border-radius: .4rem; background: #ead4e8; }
.saved-look button:first-of-type { margin-left: auto; }
.destello-click { display: none; }

@media (max-width: 805px) {
  .studio { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  #categories { padding: .25rem .45rem; }
  #categories button { min-height: 35px; }
}
@media (max-width: 670px) {
  .header-content { min-height: 62px; }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .stage { height: clamp(340px, 93vw, 480px); }
  .stage-backdrop { inset-inline: 20%; }
  .editor { min-height: 0; }
  #categories { column-gap: .18rem; padding-inline: .4rem; }
  #categories button { font-size: .8rem; }
}
@media (max-width: 365px) {
  #options.face-options, .eye-shapes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-header { gap: .5rem; }
  .actions button { font-size: .78rem; }
  #gallery { gap: .38rem; padding-inline-start: .48rem; }
  #gallery::before { width: .66rem; height: .66rem; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

@media (any-pointer: fine) and (forced-colors: none) {
  body { cursor: url("assets/cursor-cromo.svg") 4 3, auto; }
  a[href], button:not(:disabled), summary, .adjustment input { cursor: url("assets/cursor-mano.svg") 12 3, pointer; }
}

.header-actions { display: flex; align-items: center; gap: .55rem; }
#collection {
  display: flex;
  align-items: center;
  gap: .42rem;
  border-radius: 99px;
  border-color: #fff;
  background: #fff9fdd4;
  color: #5e2c54;
  font-size: .85rem;
  font-weight: 720;
  box-shadow: 0 3px 10px #863b7120;
}
#collection > span:first-child { color: #8b376f; font-size: 1.2rem; line-height: 1; }
#collection-count { font-variant-numeric: tabular-nums; }
.preview-header h2 { color: #623255; font-size: .96rem; }
h1 { font-size: clamp(1.55rem, 3.2vw, 2.45rem); font-weight: 800; }
.stage canvas { height: 100%; }
#options.collectible-options { gap: .72rem; }
.collectible { position: relative; display: grid; min-width: 0; }
.collectible > .choice { width: 100%; height: 100%; }
.favorite-button {
  position: absolute;
  top: .53rem;
  right: .53rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #fff8fded;
  box-shadow: 0 2px 8px #69456532;
  color: #823367;
  font-size: 1.15rem;
  line-height: 1;
}
.favorite-button[aria-pressed=true] { background: #fbd1ec; border-color: #e3a3d1; }
#favorites > .saved-look canvas { max-width: 4rem; height: 3.4rem; }
#favorites, #saved { color: var(--muted); }
@media (max-width: 670px) {
  .header-content { min-height: 68px; flex-wrap: wrap; padding-block: .4rem; }
  .brand { width: clamp(130px, 33vw, 190px); }
  .header-actions { gap: .32rem; }
  #collection, #gallery { font-size: .73rem; padding: .3rem .42rem; gap: .25rem; }
  #count { min-width: 1.25rem; min-height: 1.25rem; }
  #gallery::before { display: none; }
}
