:root {
  color-scheme: light;
  --ink: #352649;
  --muted: #615471;
  --paper: #fffdf8;
  --edge: #d9cde3;
  --purple: #654295;
  --purple-dark: #492e71;
  --blush: #fae8dc;
  --wash: #f5f0fa;
  font: 16px/1.45 ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; color: var(--ink); background: #f8f4fc; }
button, a { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible, a:focus-visible { outline: 3px solid #8450c4; outline-offset: 4px; }
a { color: var(--purple-dark); }
svg { display: block; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.home svg, button svg, footer svg, .overline svg, .tool-heading svg {
  width: 1.23em; height: 1.23em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.shell { max-width: 1236px; margin: auto; padding: 0 clamp(12px, 3vw, 38px); }
.topbar { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.home { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; font-weight: 900; }
.top-actions { display: flex; align-items: center; gap: .4rem; }
.utility, .primary {
  display: inline-flex; gap: .45rem; align-items: center; justify-content: center; min-height: 42px; padding: .5rem .8rem;
  border-radius: .7rem; font-weight: 800; text-decoration: none;
}
.utility { background: #fffdf9; border: 1px solid var(--edge); }
.utility:hover:not(:disabled), .utility[aria-pressed=true]:not(#sound) { border-color: var(--purple); background: #f1e8fa; }
.primary { background: var(--purple-dark); color: white; border: 1px solid var(--purple-dark); box-shadow: 0 3px 0 #35224d; }
.primary:hover:not(:disabled) { background: var(--purple); }
.icon-only { min-width: 42px; padding-inline: .5rem; }
.cover {
  position: relative; overflow: hidden; border-radius: 24px; min-height: 245px; display: grid; align-items: center; grid-template-columns: minmax(310px, .97fr) 1fr;
  padding: clamp(1.2rem, 3.8vw, 3.4rem); background: radial-gradient(ellipse at 75% 30%, #8b64ac 0%, transparent 60%), #4b3270;
  color: #fff8ed; box-shadow: 0 8px 22px #45306025;
}
.cover-copy { position: relative; z-index: 1; }
.overline { margin: 0; font-size: .73rem; line-height: 1.25; font-weight: 900; letter-spacing: .16em; color: var(--purple-dark); }
.cover .overline { display: flex; align-items: center; gap: .55rem; color: #ffda8b; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; font-weight: 900; line-height: 1.06; }
h1 { margin: .38rem 0 .5rem; font-size: clamp(2.8rem, 6.2vw, 5.7rem); letter-spacing: -.073em; }
h1 em { color: #ffcf8b; font-family: Georgia, serif; font-weight: 700; letter-spacing: -.095em; }
h2 { font-size: clamp(1.6rem, 3.3vw, 2.45rem); letter-spacing: -.048em; }
h3 { font-size: 1.2rem; letter-spacing: -.024em; }
.tagline { margin: 0; font-size: clamp(.98rem, 2vw, 1.28rem); color: #f4e9fd; font-weight: 650; }
.cover-art { position: relative; height: 100%; min-height: 175px; }
.cover-card {
  position: absolute; width: 48%; aspect-ratio: 4/3; border: 7px solid var(--paper); border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 20px #24133a55; background: var(--paper);
}
.cover-card svg { width: 100%; height: 100%; }
.cover-card:first-child { left: 4%; top: 12%; transform: rotate(-13deg); }
.cover-card:nth-child(2) { left: 29%; top: 15%; transform: rotate(4deg) scale(1.14); z-index: 2; }
.cover-card:nth-child(3) { left: 54%; top: 9%; transform: rotate(15deg); }
.cover-card:nth-child(2)::after { content: ''; position: absolute; inset: 0; border: 1px solid #5e49763c; border-radius: 4px; pointer-events: none; }
.cover-art::after { content: '✦'; position: absolute; top: 1%; right: 1%; color: #fbd78d; font-size: 2.8rem; z-index: 3; }
body.in-studio .cover { min-height: 0; padding: .7rem 1.1rem; grid-template-columns: 1fr; }
body.in-studio .cover h1 { margin: .15rem 0 .18rem; font-size: clamp(1.7rem, 4vw, 2.5rem); }
body.in-studio .cover :is(.tagline, .cover-art, .overline) { display: none; }
.steps { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; min-height: 60px; padding: .65rem 0; }
.steps .step { display: inline-flex; align-items: center; gap: .38rem; padding: .32rem .62rem; min-height: 34px; border: 1px solid #e6ddea; border-radius: 20px; background: #fffafc; color: var(--muted); font-size: .83rem; font-weight: 850; }
.steps .step[aria-current=step] { background: #eadcf8; color: var(--purple-dark); border-color: #c7ace3; }
.steps .step span { display: inline-grid; width: 1.35em; height: 1.35em; border-radius: 100%; place-items: center; background: #eae2ef; font-size: .79em; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; margin: 0 0 .85rem; }
.section-heading .overline { margin-bottom: .33rem; }
.section-note { max-width: 36ch; text-align: right; margin: 0; color: var(--muted); font-weight: 650; font-size: .93rem; }
.choices { display: grid; gap: .85rem; }
.choices.levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices.categories { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choices.pictures { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choice {
  display: flex; flex-direction: column; align-items: stretch; min-width: 0; position: relative; padding: 0; text-align: left;
  border: 1px solid var(--edge); border-radius: 17px; background: #fffdf9; overflow: hidden; box-shadow: 0 3px 0 #e4daeb;
}
.choice:hover { border-color: #8d63bf; box-shadow: 0 3px 0 #c6adde; }
.choice .copy { display: grid; gap: .32rem; padding: .72rem .82rem .9rem; }
.choice .name { display: block; font-size: 1rem; font-weight: 900; line-height: 1.16; }
.choice .note { color: var(--muted); font-size: .8rem; }
.levels .choice { padding: .9rem; flex-direction: row; align-items: center; gap: .3rem; }
.levels .choice .name { font-size: clamp(1.04rem, 2vw, 1.35rem); }
.level-icon { display: grid; place-items: center; flex: 0 0 auto; width: 54px; height: 54px; border-radius: 16px; color: #3d604e; background: #e1f0df; }
.level-icon.intermediate { color: #773e4b; background: #f9dfdb; }
.level-icon.advanced { color: var(--purple-dark); background: #eedff6; }
.level-icon svg { width: 28px; height: 28px; }
.choice .preview { display: grid; place-items: center; aspect-ratio: 4 / 2.7; width: 100%; overflow: hidden; background: #f4edf8; }
.choice .preview svg { width: 100%; height: 100%; object-fit: contain; }
.categories .preview svg { width: 78%; height: 100%; }
.choice .marker { position: absolute; top: .45rem; right: .45rem; padding: .24rem .46rem; border-radius: 20px; background: #e1f0df; color: #30533c; font-size: .68rem; font-weight: 900; }
.pages { margin-top: 1.15rem; display: flex; align-items: center; justify-content: center; gap: .65rem; }
.pages .utility { min-width: 85px; }
.empty { margin: 0; padding: 1rem; border: 1px dashed #c5b3d1; background: #fffdf9; border-radius: 12px; color: var(--muted); }
.workspace {
  display: grid; align-items: start; grid-template-columns: minmax(0, 1.8fr) minmax(265px, 1fr);
  grid-template-areas: "paper palette" "paper tools"; gap: .85rem;
}
.paper-stage {
  grid-area: paper; margin: 0; padding: clamp(6px, 1.6vw, 16px); border-radius: 17px; background: #e7dbee; border: 1px solid #d5c4df;
}
#drawing { border-radius: 11px; overflow: hidden; background: var(--paper); box-shadow: 0 1px 8px #41305631; }
#drawing > svg { width: 100%; max-height: 65vh; }
#drawing [data-region] { cursor: crosshair; touch-action: manipulation; }
#drawing.is-eraser [data-region] { cursor: cell; }
#drawing [data-region]:focus { outline: none; }
#drawing [data-region]:focus-visible { stroke: #7a35ca; stroke-width: 3px; }
.paper-stage figcaption { padding: .48rem .18rem .02rem; color: #554566; font-size: .78rem; font-weight: 650; }
.toolbox { padding: .9rem; background: #fffdf9; border: 1px solid var(--edge); border-radius: 17px; }
.palette { grid-area: palette; align-self: end; }
.tools { grid-area: tools; }
.tool-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.tool-heading .overline { margin-bottom: .28rem; }
.tool-heading > svg { width: 26px; height: 26px; color: var(--purple-dark); }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .32rem; }
.swatch {
  min-width: 0; min-height: 41px; aspect-ratio: 1; max-height: 61px; border: 2px solid #33274730; border-radius: .62rem;
  background: var(--swatch); display: grid; place-items: center; box-shadow: inset 0 -3px 0 #34253c20;
}
.swatch[aria-pressed=true] { box-shadow: inset 0 0 0 2px #fff9, 0 0 0 2px var(--purple-dark); }
.swatch svg { display: none; width: 55%; height: 55%; stroke-width: 3; }
.swatch[aria-pressed=true] svg { display: block; }
.selected { margin: .57rem 0 0; color: var(--muted); font-size: .85rem; font-weight: 850; }
.edits { display: flex; flex-wrap: wrap; gap: .36rem; }
.edits .utility { min-height: 39px; padding: .4rem .65rem; font-size: .86rem; }
.paper-actions { margin-top: .75rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
.save-status { margin: .72rem 0 0; color: var(--muted); font-size: .84rem; font-weight: 700; }
.earned { padding: 0; margin: .65rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; }
.earned li { font-size: .75rem; font-weight: 850; background: #f7e9ba; color: #5b4116; border-radius: 22px; padding: .2rem .55rem; }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.3rem 0 1rem; }
footer :is(a,button) { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; color: var(--purple-dark); font-weight: 850; }
footer button { padding: 0; border: 0; background: transparent; }
dialog:not(#paps-welcome-banner) { max-width: min(94vw, 30rem); border: 1px solid var(--edge); border-radius: 19px; padding: 0; color: var(--ink); background: #fffdf9; }
dialog:not(#paps-welcome-banner)::backdrop { background: #291c3ab0; }
.dialog-inner { padding: 1.25rem; }
.dialog-inner h2 { margin-top: .38rem; }
.dialog-inner li { margin-bottom: .5rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; }
#print-sheet { display: none; }

@media (max-width: 880px) {
  .choices.categories, .choices.pictures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cover { min-height: 205px; }
}
@media (max-width: 690px) {
  .cover { grid-template-columns: minmax(0, 1fr) minmax(0, .68fr); min-height: 0; }
  .cover-art { min-height: 100px; }
  .cover-card { border-width: 4px; top: 24% !important; }
  .cover-art::after { display: none; }
  .levels .choice { flex-direction: column; align-items: flex-start; padding: .6rem; }
  .choice .copy { padding: .6rem; }
  .levels .choice .copy { padding: .28rem 0 .2rem; }
  .level-icon { width: 44px; height: 44px; }
  .choices.categories, .choices.pictures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; grid-template-areas: "palette" "paper" "tools"; }
  .swatches { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .swatch { min-height: 36px; max-height: 43px; }
  .tool-heading { margin-bottom: .46rem; }
  .tool-heading .overline { display: none; }
  .toolbox { padding: .65rem; }
}
@media (max-width: 440px) {
  .topbar { min-height: 58px; }
  .home { font-size: .85rem; }
  .utility { padding-inline: .52rem; }
  .top-actions .utility { font-size: .75rem; min-height: 38px; }
  .top-actions .icon-only { min-width: 36px; }
  .cover { padding: 1rem; }
  .cover h1 { font-size: clamp(2.25rem, 10vw, 3.1rem); line-height: .95; }
  .cover .tagline { font-size: .84rem; }
  .cover-art { min-height: 98px; }
  .cover-card { width: 66%; }
  .cover-card:first-child { left: -2%; }
  .cover-card:nth-child(2) { left: 16%; }
  .cover-card:nth-child(3) { left: 30%; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-note { text-align: left; }
  .choices { gap: .6rem; }
  .choices.categories, .choices.pictures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice .note { font-size: .74rem; }
  .levels .choice .note { font-size: .7rem; }
  .swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .swatch { min-height: 40px; }
}
@media (max-width: 360px) {
  #sound span { display: none; }
  #sound { min-width: 36px; }
}
@media print {
  @page { margin: 14mm; }
  body { min-width: 0; background: white; }
  body > :not(#print-sheet) { display: none !important; }
  #print-sheet { display: block; text-align: center; color: #222; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #print-sheet h1 { font: 800 25pt/1.25 Georgia, serif; margin: 8mm 0 1mm; letter-spacing: 0; }
  #print-sheet p { font-size: 11pt; margin: 0 0 6mm; }
  #print-sheet svg { width: 100%; max-height: 176mm; }
}
