/* Mini Me Maker: big taps, big type, bright and playful.
   Phones stack the picture over the choices. Tablets and laptops split the screen:
   picture on the left, a part list and a full grid of choices on the right, so nothing needs scrolling. */
:root {
  --mm-bg: #fff7ed;
  --mm-ink: #1f2937;
  --mm-card: #ffffff;
  --mm-accent: #f97316;
  --mm-accent-dark: #c2410c;
  --mm-line: #fed7aa;
  --mm-glass: rgba(255, 255, 255, 0.78);
  --mm-title-face: #fff7d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mm-bg: #1c1917;
    --mm-ink: #fef3c7;
    --mm-card: #292524;
    --mm-accent: #fb923c;
    --mm-accent-dark: #fdba74;
    --mm-line: #57534e;
    --mm-glass: rgba(41, 37, 36, 0.82);
  }
}
:root[data-theme="dark"] {
  --mm-bg: #1c1917;
  --mm-ink: #fef3c7;
  --mm-card: #292524;
  --mm-accent: #fb923c;
  --mm-accent-dark: #fdba74;
  --mm-line: #57534e;
  --mm-glass: rgba(41, 37, 36, 0.82);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--mm-ink);
  font-family: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 18px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  /* Sunny sky with soft colour blobs */
  background:
    radial-gradient(circle at 12% 18%, rgba(253, 224, 71, 0.55) 0 120px, transparent 121px),
    radial-gradient(circle at 88% 12%, rgba(244, 114, 182, 0.45) 0 150px, transparent 151px),
    radial-gradient(circle at 92% 92%, rgba(56, 189, 248, 0.45) 0 170px, transparent 171px),
    radial-gradient(circle at 6% 94%, rgba(134, 239, 172, 0.45) 0 150px, transparent 151px),
    linear-gradient(160deg, #fff1c7 0%, #ffe0ef 45%, #dbeafe 100%);
}

/* ---------- Top bar with the 3D title ---------- */
.mm-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px 12px;
  padding: 10px 16px 6px;
}
/* The title is styled by variables, set per style below. The button in the top bar cycles through them. */
.mm-title {
  margin: 0;
  justify-self: center;
  text-align: center;
  font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(44px, 7.5vw, 84px);
  line-height: 1;
  letter-spacing: 1px;
  color: transparent;
  background: var(--t-face);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: var(--t-stroke, 0px transparent);
  paint-order: stroke fill;
  filter: var(--t-filter, none);
}
.mm-title span {
  background: var(--t-face2, var(--t-face));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mm-title-style {
  justify-self: end;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--mm-glass);
  color: var(--mm-accent-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(194, 65, 12, 0.25);
  white-space: nowrap;
}

/* Title styles 1 to 12. Each sets the face, the "Maker" face, the outline and the 3D depth. */
.mm-title[data-style="1"] { /* Candy */
  --t-face: linear-gradient(180deg, #fef08a 0%, #fde047 30%, #fb923c 58%, #f472b6 80%, #c084fc 100%);
  --t-face2: linear-gradient(180deg, #e0f2fe 0%, #7dd3fc 35%, #38bdf8 60%, #a78bfa 100%);
  --t-stroke: 4px #ffffff;
  --t-filter: drop-shadow(0 1px 0 #4c1d95) drop-shadow(0 2px 0 #4c1d95) drop-shadow(0 3px 0 #4c1d95) drop-shadow(0 4px 0 #3b0764) drop-shadow(0 5px 0 #3b0764) drop-shadow(0 6px 0 #3b0764) drop-shadow(0 10px 12px rgba(59, 7, 100, 0.35));
}
.mm-title[data-style="2"] { /* Gold */
  --t-face: linear-gradient(180deg, #fffbeb 0%, #fde047 45%, #f59e0b 62%, #fde68a 100%);
  --t-face2: linear-gradient(180deg, #fff7ed 0%, #fdba74 50%, #ea580c 100%);
  --t-stroke: 2px #78350f;
  --t-filter: drop-shadow(0 1px 0 #d97706) drop-shadow(0 2px 0 #b45309) drop-shadow(0 3px 0 #92400e) drop-shadow(0 4px 0 #78350f) drop-shadow(0 5px 0 #78350f) drop-shadow(0 10px 12px rgba(120, 53, 15, 0.4));
}
.mm-title[data-style="3"] { /* Ice */
  --t-face: linear-gradient(180deg, #ffffff 0%, #bae6fd 55%, #38bdf8 100%);
  --t-face2: linear-gradient(180deg, #e0f2fe 0%, #0ea5e9 100%);
  --t-stroke: 3px #0c4a6e;
  --t-filter: drop-shadow(0 1px 0 #0c4a6e) drop-shadow(0 2px 0 #0c4a6e) drop-shadow(0 3px 0 #082f49) drop-shadow(0 4px 0 #082f49) drop-shadow(0 9px 10px rgba(8, 47, 73, 0.35));
}
.mm-title[data-style="4"] { /* Neon glow */
  --t-face: linear-gradient(180deg, #ffffff 0%, #fbcfe8 100%);
  --t-face2: linear-gradient(180deg, #f5d0fe 0%, #e879f9 100%);
  --t-stroke: 0px transparent;
  --t-filter: drop-shadow(0 0 4px #fbcfe8) drop-shadow(0 0 14px #ec4899) drop-shadow(0 0 26px #db2777);
}
.mm-title[data-style="5"] { /* Bubblegum */
  --t-face: linear-gradient(180deg, #fdf2f8 0%, #f472b6 100%);
  --t-face2: linear-gradient(180deg, #fce7f3 0%, #ec4899 100%);
  --t-stroke: 4px #ffffff;
  --t-filter: drop-shadow(0 1px 0 #9d174d) drop-shadow(0 2px 0 #9d174d) drop-shadow(0 3px 0 #9d174d) drop-shadow(0 4px 0 #831843) drop-shadow(0 5px 0 #831843) drop-shadow(0 6px 0 #831843) drop-shadow(0 9px 10px rgba(131, 24, 67, 0.35));
}
.mm-title[data-style="6"] { /* Emerald */
  --t-face: linear-gradient(180deg, #d1fae5 0%, #34d399 50%, #047857 100%);
  --t-face2: linear-gradient(180deg, #ecfdf5 0%, #10b981 100%);
  --t-stroke: 2px #064e3b;
  --t-filter: drop-shadow(0 1px 0 #065f46) drop-shadow(0 2px 0 #065f46) drop-shadow(0 3px 0 #064e3b) drop-shadow(0 4px 0 #064e3b) drop-shadow(0 5px 0 #022c22) drop-shadow(0 10px 12px rgba(2, 44, 34, 0.4));
}
.mm-title[data-style="7"] { /* Sunset */
  --t-face: linear-gradient(180deg, #fde68a 0%, #fb923c 50%, #e11d48 100%);
  --t-face2: linear-gradient(180deg, #fef3c7 0%, #f43f5e 60%, #9f1239 100%);
  --t-stroke: 2px #881337;
  --t-filter: drop-shadow(0 1px 0 #881337) drop-shadow(0 2px 0 #881337) drop-shadow(0 3px 0 #4c0519) drop-shadow(0 4px 0 #4c0519) drop-shadow(0 9px 10px rgba(76, 5, 25, 0.4));
}
.mm-title[data-style="8"] { /* Retro stripes: hard-edged colour bands */
  --t-face: linear-gradient(180deg, #fef3c7 0 33%, #f97316 33% 66%, #be123c 66%);
  --t-face2: linear-gradient(180deg, #ffffff 0 33%, #facc15 33% 66%, #0ea5e9 66%);
  --t-stroke: 2px #1f2937;
  --t-filter: drop-shadow(0 2px 0 #1f2937) drop-shadow(0 4px 0 #1f2937) drop-shadow(0 6px 0 #111827);
}
.mm-title[data-style="9"] { /* Comic: thick black outline and a hard shadow */
  --t-face: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  --t-face2: linear-gradient(180deg, #fde047 0%, #fde047 100%);
  --t-stroke: 6px #111827;
  --t-filter: drop-shadow(3px 4px 0 #ef4444) drop-shadow(6px 8px 0 #111827);
}
.mm-title[data-style="10"] { /* Chrome: silver with a hard horizon line */
  --t-face: linear-gradient(180deg, #ffffff 0%, #cbd5e1 45%, #475569 50%, #e2e8f0 75%, #94a3b8 100%);
  --t-face2: linear-gradient(180deg, #f1f5f9 0%, #64748b 50%, #1e293b 100%);
  --t-stroke: 2px #1e293b;
  --t-filter: drop-shadow(0 1px 0 #334155) drop-shadow(0 2px 0 #334155) drop-shadow(0 3px 0 #1e293b) drop-shadow(0 4px 0 #1e293b) drop-shadow(0 9px 10px rgba(15, 23, 42, 0.4));
}
.mm-title[data-style="11"] { /* Sky */
  --t-face: linear-gradient(180deg, #ffffff 0%, #7dd3fc 60%, #2563eb 100%);
  --t-face2: linear-gradient(180deg, #fef9c3 0%, #fde047 100%);
  --t-stroke: 4px #1d4ed8;
  --t-filter: drop-shadow(0 1px 0 #1e40af) drop-shadow(0 2px 0 #1e40af) drop-shadow(0 3px 0 #1e3a8a) drop-shadow(0 8px 10px rgba(30, 58, 138, 0.35));
}
.mm-title[data-style="12"] { /* Balloon: glossy red with a gold shine */
  --t-face: linear-gradient(180deg, #fecaca 0%, #ef4444 45%, #991b1b 100%);
  --t-face2: linear-gradient(180deg, #fef08a 0%, #facc15 50%, #a16207 100%);
  --t-stroke: 3px #ffffff;
  --t-filter: drop-shadow(0 1px 0 #7f1d1d) drop-shadow(0 2px 0 #7f1d1d) drop-shadow(0 4px 0 #450a0a) drop-shadow(0 10px 12px rgba(69, 10, 10, 0.4));
}

/* The inline Create pill after the last accessory choice, and the bald head outline */
.mm-inline-create { margin-top: 12px; }
.mm-bald { width: 86%; height: 86%; display: block; }
.mm-back {
  justify-self: start;
  color: var(--mm-accent-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--mm-glass);
  box-shadow: 0 4px 0 rgba(194, 65, 12, 0.25);
  white-space: nowrap;
}
.mm-tagline {
  justify-self: end;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-accent-dark);
  text-align: right;
}

/* ---------- Layout: phone first, then tablet and laptop ---------- */
.mm-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 12px 12px;
  display: grid;
  grid-template-rows: minmax(0, 38dvh) minmax(0, 1fr);
  gap: 10px;
}

/* Picture and Create button */
.mm-stage {
  background: linear-gradient(170deg, #a5f3fc 0%, #c4b5fd 55%, #f9a8d4 100%);
  border: 3px solid #fff;
  border-radius: 28px;
  padding: 12px;
  text-align: center;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 0 rgba(139, 92, 246, 0.25), 0 18px 30px rgba(76, 29, 149, 0.2);
}
.mm-result {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Soft solid background */
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  border-radius: 22px;
  overflow: hidden;
  position: relative;
}
.mm-placeholder {
  margin: 0;
  padding: 22px 28px;
  max-width: 92%;
  color: #5b21b6;
  background: #ffffff;
  border: 3px solid #ddd6fe;
  border-radius: 28px;
  box-shadow: 0 6px 0 #ddd6fe, 0 12px 22px rgba(139, 92, 246, 0.15);
  text-align: center;
}
.mm-placeholder p {
  margin: 4px 0;
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 42px);
  line-height: 1.2;
}
/* Little sparkle rows above and below the words */
.mm-deco {
  display: block;
  font-size: clamp(18px, 2.4vw, 24px);
  letter-spacing: 10px;
  color: #c084fc;
}
.mm-placeholder .mm-deco:last-child { color: #f472b6; }
/* Picture backdrop: deep blue-violet, so pale skin stands out clearly from it */
.mm-result {
  background:
    radial-gradient(circle at 50% 28%, #38bdf8 0%, #4f46e5 62%, #312e81 100%);
}
.mm-result::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 2px, transparent 2.5px) 0 0 / 24px 24px;
  pointer-events: none;
}
.mm-placeholder { position: relative; }
/* Fill the whole picture box, so no white strip shows above or below the picture */
.mm-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 85%; display: block; }
.mm-picture[hidden], .mm-placeholder[hidden], .mm-chips[hidden] { display: none; }

/* Picked pieces, shown on the left as the child clicks through */
.mm-chips {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}
.mm-chip {
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 6px 4px;
  box-shadow: 0 3px 0 rgba(139, 92, 246, 0.2);
}
.mm-chip img { width: 64px; height: 64px; object-fit: contain; display: block; }
.mm-chip-swatch { width: 52px; height: 52px; border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2); display: block; }
.mm-chip-name { font-size: 12px; font-weight: 600; color: #374151; text-align: center; line-height: 1.1; }

.mm-hello { margin: 0; font-weight: 700; font-size: 20px; color: #4c1d95; }
.mm-note { margin: 0; font-size: 13px; color: #5b21b6; opacity: 0.85; }

.mm-btn {
  min-height: 56px;
  width: 100%;
  padding: 0 22px;
  border-radius: 999px;
  border: 3px solid #fff;
  font: inherit;
  font-weight: 700;
  font-size: 19px;
  cursor: pointer;
  color: #ffffff;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.mm-save {
  background: linear-gradient(180deg, #fb923c 0%, #f97316 60%, #ea580c 100%);
  box-shadow: 0 6px 0 #c2410c, 0 10px 18px rgba(234, 88, 12, 0.35);
}
.mm-save:active { transform: translateY(4px); box-shadow: 0 2px 0 #c2410c; }
.mm-btn:focus-visible { outline: 4px solid #fde047; outline-offset: 3px; }
.mm-btn:disabled { opacity: 0.6; cursor: wait; }

/* Part list and choices */
.mm-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Patterned picker: soft lilac-to-sky with a faint dot grid, so the white choice tiles stand out */
  background:
    radial-gradient(circle, rgba(139, 92, 246, 0.14) 2px, transparent 2.5px) 0 0 / 26px 26px,
    linear-gradient(160deg, #ede9fe 0%, #e0f2fe 50%, #fce7f3 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 3px solid #fff;
  border-radius: 28px;
  padding: 10px;
  box-shadow: 0 10px 0 rgba(139, 92, 246, 0.2), 0 18px 30px rgba(76, 29, 149, 0.15);
}
.mm-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 0 0 auto;
  scrollbar-width: thin;
}
.mm-tab {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid #fdba74;
  background: linear-gradient(180deg, #fffbeb, #ffedd5);
  color: var(--mm-ink);
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #fdba74;
}
.mm-tab[aria-pressed="true"] {
  background: linear-gradient(180deg, #fb923c, #f97316);
  border-color: #fff;
  color: #ffffff;
  box-shadow: 0 4px 0 #c2410c, 0 6px 12px rgba(234, 88, 12, 0.3);
}
.mm-tab-name { display: block; }
.mm-tab-sub { display: none; }

.mm-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
}
.mm-group { height: 100%; display: flex; flex-direction: column; gap: 10px; }
.mm-group[hidden] { display: none; }
.mm-group h2 {
  display: none;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #5b21b6;
}
/* Boy or girl already has its name on each card and on its tab, so no heading above them */
.mm-group[data-group="gender"] h2 { display: none; }
.mm-sub { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: #6d28d9; opacity: 0.85; }
/* Hair tab: color on top, hairstyles below, split by a dashed line */
.mm-hair-top { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 2px dashed #c4b5fd; }
.mm-hair-bottom { display: flex; flex-direction: column; gap: 10px; }
/* Face tab: face shape on top, nose in the middle, lips at the bottom */
.mm-face-part { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 2px dashed #c4b5fd; }
.mm-face-part:last-child { padding-bottom: 0; border-bottom: 0; }
.mm-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  align-content: start;
}

/* Every choice is a big square tile, at least 64px so small fingers can tap it. */
.mm-choice {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 64px;
  border-radius: 20px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #ffffff, #f5f3ff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font: inherit;
  color: var(--mm-ink);
  box-shadow: 0 4px 0 #ddd6fe;
  transition: transform 0.12s ease;
}
.mm-choice:hover { transform: translateY(-2px); }
.mm-choice:focus-visible { outline: 4px solid #fde047; outline-offset: 2px; }
.mm-choice[aria-pressed="true"] {
  border-color: #fb923c;
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  box-shadow: 0 4px 0 #fb923c, 0 0 0 4px #fde68a;
  transform: translateY(-2px);
}
.mm-choice.mm-text { font-weight: 600; font-size: 14px; text-align: center; line-height: 1.15; }

/* Picture tiles */
.mm-pic { padding: 4px; }
.mm-thumb { width: 86%; height: 86%; object-fit: contain; display: block; }
.mm-layer { position: relative; display: block; width: 100%; height: 100%; }
.mm-layer .mm-thumb { position: absolute; inset: 7%; width: 86%; height: 86%; }
.mm-layer .mm-hair-layer { z-index: 1; }
.mm-hair-layer[hidden] { display: none; }

/* My Mini Mes: its own panel, opened from the top bar */
/* The My Mini Mes button: under the title on small screens, above the saved rail on wide ones */
.mm-saved-open-btn {
  justify-self: center;
  min-height: 56px;
  padding: 0 32px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #c4b5fd, #7c3aed);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 6px 0 #5b21b6, 0 10px 18px rgba(91, 33, 182, 0.35);
  white-space: nowrap;
}
.mm-saved-open-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #5b21b6; }
.mm-saved-small { grid-column: 2; grid-row: 2; }
.mm-saved-wide { display: none; }

/* Saved Mini Mes down the right-hand side (wide screens only) */
.mm-rail { display: none; }

/* Folding steps: a picked step shrinks to one line; the next open step is highlighted */
.mm-step { display: flex; flex-direction: column; gap: 8px; border-radius: 22px; }
.mm-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 6px 16px;
  border: 2px solid #fdba74;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffbeb, #ffedd5);
  color: var(--mm-ink);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #fdba74;
  text-align: left;
}
.mm-step-value { font-size: 14px; font-weight: 600; color: #6d28d9; text-align: right; }
.mm-step-body { display: none; }
.mm-step.is-open .mm-step-body { display: block; }
.mm-step.is-done .mm-step-head { background: linear-gradient(180deg, #ecfdf5, #d1fae5); border-color: #6ee7b7; box-shadow: 0 3px 0 #6ee7b7; }
.mm-step.is-done .mm-step-value { color: #047857; }
.mm-step.mm-current {
  padding: 6px;
  background: rgba(253, 224, 71, 0.35);
  box-shadow: 0 0 0 4px #fde047, 0 0 22px rgba(250, 204, 21, 0.6);
  animation: mm-step-glow 1.6s ease-in-out infinite alternate;
}
.mm-step.mm-current .mm-step-head { border-color: #f97316; }
@keyframes mm-step-glow {
  from { box-shadow: 0 0 0 4px #fde047, 0 0 10px rgba(250, 204, 21, 0.4); }
  to { box-shadow: 0 0 0 4px #fde047, 0 0 26px rgba(250, 204, 21, 0.9); }
}

/* Big look at one saved Mini Me. Covers the screen; a tap on the dark area outside the box closes it. */
.mm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 27, 75, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mm-lightbox[hidden] { display: none; }
.mm-lightbox-box {
  width: min(520px, 100%);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #fff7ed;
  border: 4px solid #fff;
  border-radius: 28px;
  box-shadow: 0 14px 0 rgba(76, 29, 149, 0.35), 0 24px 40px rgba(0, 0, 0, 0.25);
}
.mm-lightbox-box img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 28%, #38bdf8 0%, #4f46e5 62%, #312e81 100%);
}
.mm-lightbox-name { margin: 0; font-size: 22px; font-weight: 700; color: #5b21b6; }
.mm-lightbox-show { width: auto; padding: 0 28px; min-height: 52px; }
.mm-fav-btn {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  border: 2px solid #f9a8d4;
  background: #fff;
  color: #be185d;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.mm-fav-btn[aria-pressed="true"] { background: linear-gradient(180deg, #f9a8d4, #ec4899); color: #fff; border-color: #fff; }
.mm-rail-item.is-fav { border-color: #f9a8d4; }

/* Review marks: an X on each picture tile */
.mm-choice { position: relative; }
.mm-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #f87171;
  background: #ffffff;
  color: #dc2626;
  font-size: 18px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  z-index: 2;
}
.mm-choice.is-marked { outline: 3px solid #f87171; outline-offset: 2px; opacity: 0.6; }
.mm-copy-marks {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 40;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #fef2f2;
  color: #b91c1c;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(185, 28, 28, 0.25);
}
.mm-rail-list { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding: 4px; }
.mm-rail-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 3px solid #fff;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 4px 0 #ddd6fe;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}
.mm-rail-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 14px;
  background: linear-gradient(170deg, #a5f3fc 0%, #c4b5fd 55%, #f9a8d4 100%);
  display: block;
}
.mm-rail-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mm-rail-item:hover { transform: translateY(-2px); }
.mm-rail-item:focus-visible { outline: 4px solid #fde047; outline-offset: 2px; }

/* Create button, lit up once the child has picked None under Accessories */
.mm-save.mm-ready {
  outline: 4px solid #fde047;
  outline-offset: 3px;
  animation: mm-ready-pulse 1.1s ease-in-out infinite;
}
@keyframes mm-ready-pulse {
  from { transform: scale(1); box-shadow: 0 6px 0 #c2410c, 0 0 0 0 rgba(253, 224, 71, 0.7); }
  to { transform: scale(1.03); box-shadow: 0 6px 0 #c2410c, 0 0 0 14px rgba(253, 224, 71, 0); }
}
.mm-saved-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 24px;
  background: rgba(76, 29, 149, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.mm-saved-overlay[hidden] { display: none; }
.mm-saved-panel {
  width: min(760px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  background: #fff7ed;
  border: 4px solid #fff;
  border-radius: 28px;
  padding: 18px;
  box-shadow: 0 12px 0 rgba(76, 29, 149, 0.25);
}
.mm-saved-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mm-saved-head h2 { margin: 0; font-size: 24px; color: #5b21b6; }
.mm-saved-close {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid #fdba74;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--mm-ink);
}

/* My Mini Mes: saved creations, one card each */
.mm-saved-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; font-weight: 600; color: #6d28d9; }
/* The panel sits over the right-hand side only, so the preview on the left stays visible */
.mm-panel { position: relative; }
.mm-saved-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #f3f4f6; display: block; }
.mm-saved-card { background: #ffffff; border: 3px solid #fff; border-radius: 18px; padding: 12px; box-shadow: 0 4px 0 #ddd6fe; display: flex; flex-direction: column; gap: 8px; }
.mm-saved-name { font-size: 15px; color: #374151; }
.mm-saved-btn { min-height: 40px; border-radius: 999px; border: 2px solid #fdba74; background: linear-gradient(180deg, #fffbeb, #ffedd5); font: inherit; font-weight: 700; cursor: pointer; color: var(--mm-ink); }
.mm-saved-del { border-color: #fca5a5; background: #fff1f2; color: #b91c1c; }

/* Face shapes: crop the top of the head off, so each tile starts at the ears. Hair is not drawn on these tiles. */
.mm-choice[data-part="face"] { position: relative; overflow: hidden; }
.mm-choice[data-part="face"] .mm-thumb {
  position: absolute;
  left: 50%;
  top: -48%;
  width: 150%;
  height: auto;
  transform: translateX(-50%);
  object-fit: contain;
}

/* Colour tiles (skin) */
.mm-swatch { border-radius: 50%; border: 3px solid #ffffff; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2); color: transparent; }
.mm-swatch[aria-pressed="true"] { border-color: #ffffff; outline: 3px solid #f97316; outline-offset: 2px; }

/* Boy or girl: one full-height colour half each, with the name across the middle */
.mm-row[data-part="gender"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 100%;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
.mm-gender-card {
  aspect-ratio: auto;
  min-height: 0;
  height: 100%;
  border-radius: 28px;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  border: 4px solid #fff;
  box-shadow: 0 8px 0 rgba(15, 23, 42, 0.12);
}
/* Whole body shown below the name band. Top-aligned, so the head tops of boy and girl sit at the same height */
.mm-gender-img {
  position: absolute;
  top: 76px;
  left: 0;
  width: 100%;
  height: calc(100% - 76px);
  object-fit: contain;
  object-position: center top;
  z-index: 0;
}
.mm-gender-boy { background: linear-gradient(180deg, #93c5fd 0%, #2563eb 100%); }
.mm-gender-girl { background: linear-gradient(180deg, #fbcfe8 0%, #ec4899 100%); }
.mm-gender-card[aria-pressed="true"] { outline: 6px solid #fde047; outline-offset: 3px; }
/* Name sits in a band across the top, above the figure */
.mm-gender-name {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.22);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.mm-none-btn {
  aspect-ratio: auto;
  width: auto;
  min-height: 56px;
  align-self: flex-start;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 600;
}

/* ---------- Tablet (768px to 1099px): picture and Create across the top, part chips, then a wide grid ---------- */
@media (min-width: 768px) {
  .mm-wrap {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 0 16px 16px;
  }
  .mm-stage {
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 8px;
    align-items: center;
    padding: 14px 18px;
    text-align: left;
  }
  .mm-result { grid-column: 1; grid-row: 1 / span 3; height: clamp(200px, 30dvh, 280px); width: 100%; }
  .mm-hello { grid-column: 2; font-size: 24px; }
  .mm-btn { grid-column: 2; width: 100%; max-width: 360px; min-height: 60px; font-size: 20px; }
  .mm-note { grid-column: 2; font-size: 14px; }

  .mm-panel { padding: 12px; }
  .mm-tabs { flex-wrap: wrap; overflow: visible; }
  .mm-tab { min-height: 48px; padding: 0 20px; font-size: 17px; }
  .mm-group h2 { display: block; }
  .mm-sub { font-size: 17px; }
  .mm-row { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
  .mm-choice.mm-text { font-size: 15px; }
}

/* Laptop and landscape tablet (1100px and wider): picture on the left, part list and full grid on the right */
@media (min-width: 1100px) {
  .mm-wrap {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(170px, 210px);
    gap: 16px;
    max-width: 1600px;
  }
  .mm-saved-small { display: none; }
  .mm-saved-wide { display: block; flex: 0 0 auto; align-self: center; margin-bottom: 10px; }
  .mm-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--mm-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 3px solid #fff;
    border-radius: 28px;
    padding: 10px;
    box-shadow: 0 10px 0 rgba(139, 92, 246, 0.2), 0 18px 30px rgba(76, 29, 149, 0.15);
  }
  .mm-stage { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px; gap: 10px; }
  .mm-result { flex: 1 1 auto; height: auto; min-height: 0; width: 100%; border-radius: 24px; }
  .mm-hello { font-size: 24px; }
  .mm-btn { width: 100%; max-width: none; }
  .mm-note { font-size: 13px; }

  .mm-panel {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 12px;
  }
  .mm-tabs { flex-direction: column; flex-wrap: nowrap; overflow-x: hidden; overflow-y: auto; gap: 8px; }
  .mm-tab {
    width: 100%;
    min-height: 58px;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 17px;
  }
  .mm-tab-sub { display: block; font-size: 12px; font-weight: 500; opacity: 0.9; }
  .mm-row { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ---------- Look and feel pass: one main colour (purple), one action colour (orange) ---------- */
body {
  background:
    radial-gradient(circle at 10% 15%, rgba(196, 181, 253, 0.35) 0 140px, transparent 141px),
    radial-gradient(circle at 92% 88%, rgba(196, 181, 253, 0.3) 0 170px, transparent 171px),
    linear-gradient(160deg, #faf5ff 0%, #f5f3ff 50%, #eef2ff 100%);
}
.mm-panel { background: #fbfaff; }
.mm-tab { background: #ffffff; border-color: #e9e5ff; box-shadow: 0 3px 0 #e9e5ff; }
.mm-tab[aria-pressed="true"] { background: linear-gradient(180deg, #fb923c, #f97316); border-color: #fff; box-shadow: 0 4px 0 #c2410c; }
.mm-tab.is-done .mm-tab-name::after { content: " \2713"; color: #16a34a; }
.mm-tab[aria-pressed="true"].is-done .mm-tab-name::after { color: #fff; }
.mm-step-head { background: #ffffff; border-color: #ddd6fe; box-shadow: 0 3px 0 #ede9fe; }
.mm-step.is-done .mm-step-head { background: #f5f3ff; border-color: #ddd6fe; box-shadow: 0 3px 0 #ede9fe; }
.mm-step.is-done .mm-step-value { color: #6d28d9; }
.mm-step.mm-current { background: rgba(237, 233, 254, 0.6); animation: none; box-shadow: 0 0 0 3px #a78bfa; }
.mm-step.mm-current .mm-step-head { border-color: #a78bfa; }

/* Progress line over the tabs */
.mm-progress { display: flex; flex-direction: column; gap: 4px; padding: 2px 4px 6px; font-size: 13px; font-weight: 700; color: #6d28d9; }
.mm-progress-bar { display: block; height: 8px; border-radius: 999px; background: #ede9fe; overflow: hidden; }
.mm-progress-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #a78bfa, #7c3aed); transition: width 0.3s ease; }

/* Create looks greyed out until every pick is in (it still works, and jumps to what is missing) */
.mm-save.mm-not-ready { background: linear-gradient(180deg, #e5e7eb, #d1d5db); color: #6b7280; box-shadow: 0 6px 0 #9ca3af; }

/* Next card when a tab is finished */
.mm-next-card {
  align-self: center;
  margin-top: 24px;
  min-height: 64px;
  padding: 0 32px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #fb923c, #f97316);
  color: #fff;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #c2410c;
}
.mm-next-card[hidden] { display: none; }

/* Boy and Girl cards: one soft colour behind the whole figure, the name on a solid band */
.mm-gender-boy { background: #dbeafe; }
.mm-gender-girl { background: #fce7f3; }
.mm-gender-boy .mm-gender-name { background: #3b82f6; }
.mm-gender-girl .mm-gender-name { background: #ec4899; }
.mm-gender-img { mix-blend-mode: multiply; }

/* Starting screen: soft outline of a kid */
.mm-outline { width: 46%; max-width: 160px; display: block; margin: 0 auto 8px; fill: none; stroke: #c4b5fd; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 10 8; }
.mm-placeholder { background: rgba(255, 255, 255, 0.92); border: 0; box-shadow: none; }
.mm-placeholder p { font-size: clamp(24px, 3.4vw, 32px); }

/* Name box under the picture */
.mm-name {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid #ddd6fe;
  background: #fff;
  font: inherit;
  font-size: 18px;
  color: var(--mm-ink);
  text-align: center;
}
.mm-name:focus { outline: 3px solid #a78bfa; outline-offset: 2px; }

/* Testing helpers stay hidden unless the address ends in ?review=1 */
.mm-title-style, .mm-x, .mm-copy-marks { display: none; }
.mm-review .mm-title-style, .mm-review .mm-copy-marks { display: inline-block; }
.mm-review .mm-x { display: block; }
/* ---------- Start screen: big title and the 9-step checklist on the blue ---------- */
.mm-start {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  text-align: center;
  color: #fff;
}
.mm-start[hidden] { display: none; }
.mm-start-title {
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 3px 0 #3730a3, 0 6px 16px rgba(30, 27, 75, 0.45);
}
.mm-start-title span {
  display: block;
  font-size: 1.45em;
  color: #fde047;
  text-shadow: 0 4px 0 #b45309, 0 8px 18px rgba(30, 27, 75, 0.5);
}
.mm-start-sub {
  margin: 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 17px;
  font-weight: 700;
}
.mm-start-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.mm-start-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 70px;
  padding: 8px 4px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.mm-start-step:hover { background: rgba(255, 255, 255, 0.22); }
.mm-start-icon { font-size: 24px; line-height: 1.1; }
.mm-start-name { font-size: 12px; font-weight: 700; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-start-step.is-done { background: #ffffff; border-color: #ffffff; color: #4c1d95; }
.mm-start-step.is-done .mm-start-icon { color: #16a34a; font-weight: 800; }
/* ---------- Back to the Lab: purple pill with a beaker that wiggles ---------- */
.mm-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 10px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  box-shadow: 0 5px 0 #5b21b6, 0 10px 18px rgba(91, 33, 182, 0.3);
  transition: transform 0.12s ease;
}
.mm-back:hover { transform: translateY(-2px); }
.mm-back:active { transform: translateY(3px); box-shadow: 0 2px 0 #5b21b6; }
.mm-back-arrow { font-size: 18px; opacity: 0.9; }
.mm-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  font-size: 20px;
  box-shadow: inset 0 -3px 0 #ede9fe;
}
.mm-back:hover .mm-back-icon { animation: mm-beaker 0.6s ease-in-out; }
@keyframes mm-beaker {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg); }
  75% { transform: rotate(14deg); }
}

/* A little room under the title, so its 3D shadow does not touch the panels */
.mm-top { padding-bottom: 16px; }

/* Boy and Girl stand on the same ground: both figures sit on the bottom of their card */
.mm-gender-img { object-position: center bottom; height: calc(100% - 84px); top: 76px; }

/* Create at the end of the tab list */
.mm-nav-create {
  flex: 0 0 auto;
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  border-radius: 18px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #fb923c, #f97316);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 #c2410c;
}
.mm-nav-create:active { transform: translateY(3px); box-shadow: 0 2px 0 #c2410c; }