:root {
  color-scheme: light;
  --ink: #22174c;
  --muted: #665b83;
  --purple: #5b38d9;
  --line: #e9e2f6;
  --pale: #f4efff;
  font: 16px/1.4 "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f9f7ff; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .37; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #633cf1; outline-offset: 3px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner, .page { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 24px; font-weight: 900; letter-spacing: -.07em; }
.brand-dot { color: #6a42ee; }
.mascot { width: 34px; height: 34px; border-radius: 47% 52% 45% 33%; transform: rotate(-12deg); background: #754ef3; box-shadow: inset -4px -4px #5d39cf; position: relative; }
.mascot::before, .mascot::after { content: ""; position: absolute; width: 4px; height: 5px; top: 12px; background: white; border-radius: 50%; }
.mascot::before { left: 10px; }
.mascot::after { left: 20px; }
.mascot i { position: absolute; left: 13px; top: 18px; width: 9px; height: 6px; border-bottom: 2px solid white; border-radius: 50%; }
.top-actions, .tool-group { display: flex; align-items: center; gap: 8px; }
.button { min-height: 40px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 14px; font-weight: 800; }
.button:not(:disabled):hover { border-color: #b59ef9; background: var(--pale); }
.button.save { background: #ffdc75; color: #32224e; border-color: #ffdc75; }
.button.save:hover { background: #ffd15a; border-color: #ffd15a; }
.save span { margin-right: 4px; font-size: 19px; line-height: 0; }
.intro { padding: 34px 0 26px; }
.intro h1 { font-size: clamp(34px, 5vw, 66px); line-height: 1; letter-spacing: -.074em; margin: 0 0 12px; font-weight: 900; }
.intro h1 span { color: var(--purple); }
.intro p, .gallery p { color: var(--muted); margin: 0; }
.workspace { display: grid; grid-template-columns: 266px minmax(0, 1fr); align-items: start; gap: 16px; padding-bottom: 35px; }
.card { border: 1px solid var(--line); border-radius: 23px; background: #fff; box-shadow: 0 5px 0 #ede7f9; }
.gallery, .studio { padding: 16px; }
.gallery h2, .studio h2 { margin: 0; font-size: 23px; font-weight: 900; letter-spacing: -.045em; }
.gallery p { margin-top: 2px; font-size: 14px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 14px; }
.choice { display: grid; grid-template-rows: 71px auto; justify-items: center; gap: 1px; padding: 4px 2px 7px; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 13px; font-weight: 800; }
.choice canvas { width: 100%; max-width: 105px; height: 71px; border-radius: 10px; background: var(--tile); }
.choice:hover, .choice[aria-pressed="true"] { border-color: #8a65f1; background: #f4eeff; }
.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #8a65f1; }
.studio-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.eyebrow { color: #6d579d; font-size: 10px; letter-spacing: .12em; font-weight: 900; }
.switch { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #f8f5ff; }
.switch button { padding: 7px 11px; min-height: 35px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 800; }
.switch button[aria-pressed="true"] { background: var(--purple); color: #fff; }
.stage { position: relative; border: 1px solid #e9dffb; border-radius: 18px; overflow: hidden; background: radial-gradient(circle, #d9ccf2 1px, transparent 1.35px) center/19px 19px, #fbf8ff; }
.stage-art { display: grid; place-items: center; min-width: 0; position: relative; }
.stage canvas { z-index: 1; display: block; width: min(100%, 598px); height: auto; cursor: crosshair; touch-action: none; user-select: none; }
.stage-3d { background: radial-gradient(ellipse at 50% 66%, #e5d5fc, #f7f0ff 69%); }
.stage-3d canvas { cursor: grab; }
.stage-3d canvas:active { cursor: grabbing; }
.stage-spark { position: absolute; color: #b395f3; font-size: clamp(25px, 6vw, 55px); line-height: 1; }
.stage-spark.one { left: 17%; top: 22%; }
.stage-spark.two { right: 17%; top: 44%; color: #e9a951; font-size: clamp(18px, 5vw, 35px); }
.hint { margin: 0; padding: 7px 10px 9px; text-align: center; font-size: 13px; color: var(--muted); background: #faf7ff; }
.spin { position: absolute; bottom: 6px; right: 8px; z-index: 2; }
.spin[aria-pressed="true"], .tool[aria-pressed="true"] { background: var(--pale); border-color: #cdbbf7; color: #4d2cae; }
.tools { display: flex; justify-content: space-between; gap: 8px; padding: 11px 0; }
.icon { min-width: 40px; padding-inline: 7px; font-size: 18px; line-height: 1; }
.shuffle { color: #6640d2; }
.palette-area { border-top: 1px solid var(--line); padding: 10px 0 2px; }
.palette-label { display: flex; align-items: baseline; gap: 9px; margin-bottom: 8px; }
.palette-label h3 { margin: 0; font-size: 15px; }
.palette-label span { color: var(--muted); font-size: 13px; }
.palette { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px; }
.swatch { position: relative; width: 33px; height: 33px; border: 1px solid #3a2a551f; border-radius: 50%; background: var(--color); }
.swatch[aria-pressed="true"] { outline: 2px solid var(--purple); outline-offset: 2px; }
.swatch[aria-pressed="true"]::after { content: "✓"; color: #231646; font-weight: 900; background: #fffd; border-radius: 50%; position: absolute; width: 16px; height: 16px; font-size: 12px; line-height: 16px; inset: 0; margin: auto; }
.custom-color { display: grid; place-items: center; cursor: pointer; }
.custom-color input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.custom-color:focus-within { outline: 3px solid #633cf1; outline-offset: 3px; }
.notice { position: fixed; z-index: 4; bottom: 15px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); width: max-content; padding: 9px 15px; border-radius: 12px; box-shadow: 0 5px 18px #2a1b4a24; background: #39246a; color: #fff; font-size: 14px; }
.noscript { text-align: center; }
@media (max-width: 820px) {
  .topbar-inner, .page { width: calc(100% - 32px); }
  .workspace { grid-template-columns: 1fr; }
  .choices { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .intro { padding: 24px 0 18px; }
}
@media (max-width: 520px) {
  .topbar-inner { min-height: 59px; }
  .topbar-inner, .page { width: calc(100% - 24px); }
  .brand { gap: 6px; font-size: 21px; }
  .mascot { scale: .83; margin-left: -3px; }
  .print-button { display: none; }
  .gallery, .studio { padding: 10px; border-radius: 17px; }
  .gallery h2 { font-size: 18px; }
  .gallery p { display: none; }
  .choices { gap: 5px; margin-top: 8px; }
  .choice { font-size: 10px; grid-template-rows: auto auto; padding: 3px 0 4px; border-radius: 8px; }
  .choice canvas { height: auto; border-radius: 6px; }
  .button { padding-inline: 7px; font-size: 12px; }
  .icon { min-width: 31px; font-size: 16px; }
  .tool-group { gap: 3px; }
  .switch button { padding-inline: 7px; font-size: 12px; }
  .stage-spark.one { left: 10%; }
  .stage-spark.two { right: 10%; }
}
@media print {
  body { background: #fff; }
  .topbar, .intro, .gallery, .studio-head, .tools, .palette-area, .hint, .stage-spark, .notice, .stage-3d { display: none !important; }
  .page, .workspace { width: 100%; display: block; }
  .studio, .stage { border: 0; box-shadow: none; background: #fff; }
  #flat-stage { display: grid !important; }
  .stage canvas { width: 100%; max-height: none; }
}
