:root {
  color-scheme: light;
  --paper: #f8f6ef;
  --ink: #211b35;
  --muted: #5f586b;
  --line: #dcd6df;
  --violet: #6c42e3;
  --lime: #ddf68b;
  --radius: 16px;
  --body-font: "Inter", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --display-font: "Bricolage Grotesque", "Avenir Next", "Arial Black", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 500 16px/1.5 var(--body-font); }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, select:focus-visible, .playfield:focus-visible {
  outline: 3px solid #5e35d0; outline-offset: 4px;
}
[hidden] { display: none !important; }
p, h1, h2, h3 { margin: 0; text-wrap: pretty; }

.masthead, .workbench, .site-footer { width: min(1248px, calc(100% - 80px)); margin-inline: auto; }
.masthead {
  display: flex; min-height: 79px; align-items: center; gap: 36px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0; text-decoration: none;
  font: 800 23px/1 var(--display-font); letter-spacing: -.052em;
}
.wordmark > span:last-child { color: #5b36c4; }
.logo {
  display: inline-block; position: relative; width: 28px; height: 28px; margin-right: 9px;
  border-radius: 8px; transform: rotate(-11deg); background: var(--violet);
  box-shadow: inset 0 2px 1px #ffffff50, inset 0 -2px 0 #4824b1;
}
.logo::after {
  content: ""; position: absolute; inset: 5px 8px 4px 9px; background: var(--paper);
  clip-path: polygon(62% 0, 100% 0, 61% 42%, 88% 48%, 27% 100%, 0 98%, 29% 59%, 5% 54%);
}
.top-nav { display: flex; gap: 26px; margin-left: auto; align-items: center; font-weight: 650; font-size: 14px; }
.top-nav a { text-decoration: none; }
.top-nav a:hover { text-decoration: underline; }
.sound-button, .action {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 17px; border: 1px solid #cfc7da; border-radius: 11px;
  background: #fffcf5; font-weight: 700; white-space: nowrap;
}
.sound-button { font-size: 14px; margin-left: 0; }
.sound-button:hover, .action:hover { background: #eee8ff; border-color: #a896cb; }
.sound-button[aria-pressed="false"] { color: var(--muted); }
.sound-bars { display: inline-flex; min-width: 18px; gap: 2px; align-items: center; justify-content: center; height: 15px; }
.sound-bars i { display: block; width: 2px; height: 8px; border-radius: 2px; background: currentColor; }
.sound-bars i:nth-child(2) { height: 14px; }
.sound-bars i:nth-child(3) { height: 10px; }
.sound-button[aria-pressed="false"] .sound-bars i { height: 2px; }

.workbench { padding-block: 38px 0; }
.studio {

  display: grid; grid-template-columns: minmax(236px, .76fr) minmax(0, 1.85fr);
  grid-template-areas: "intro player" "materials player"; grid-template-rows: auto 1fr;
  column-gap: clamp(28px, 5vw, 75px); row-gap: 30px;
}
.intro { grid-area: intro; align-self: start; padding-top: 11px; }
.intro h1 { font: 850 clamp(50px, 5.7vw, 84px)/.94 var(--display-font); letter-spacing: -.062em; }
.intro h1 span { color: #6e48dc; }
.lede { max-width: 24ch; margin-top: 22px; color: var(--muted); font-size: clamp(16px, 1.7vw, 20px); line-height: 1.48; }
.key-tip { display: flex; align-items: center; gap: 9px; margin-top: 21px; font-size: 12px; color: var(--muted); }
kbd { padding: 3px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--ink); background: #fffaf5; font: 700 11px/1.15 var(--body-font); }

.player { grid-area: player; min-width: 0; scroll-margin-top: 20px; }
.stage {
  --stage-light: #f9e3cd;
  --stage-dark: #c58c72;
  position: relative; isolation: isolate; overflow: hidden;
  height: clamp(390px, 40vw, 535px); border-radius: 23px;
  border: 1px solid #211b3526;
  background: radial-gradient(ellipse at 43% 39%, #ffffffaa 0%, #ffffff00 60%),
    linear-gradient(153deg, var(--stage-light), var(--stage-dark));
}
.stage-grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .34;
  background-image: radial-gradient(#3e2b7547 .65px, transparent .9px);
  background-size: 15px 15px;
  mask-image: radial-gradient(ellipse at 50% 55%, transparent 22%, #000 82%);
}
.stage-caption, .shell-status {
  position: absolute; top: 21px; z-index: 2; display: flex; flex-direction: column;
  pointer-events: none;
}
.stage-caption { left: 24px; }
.shell-status { right: 25px; align-items: flex-end; }
.stage-caption strong { font-size: 17px; font-weight: 800; letter-spacing: -.025em; }
.stage-caption > span, .shell-status > span { font-size: 12px; color: #403655; }
.shell-status strong { font-size: 24px; line-height: 1.12; font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.playfield {
  position: absolute; inset: 0; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
}
.playfield:focus-visible { outline-offset: -5px; border-radius: inherit; }
.playfield[data-pressed] { cursor: grabbing; }
.playfield canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.play-tip {
  pointer-events: none; position: absolute; left: 50%; bottom: 17px; transform: translateX(-50%);
  z-index: 1; background: #fffaf5c9; padding: 7px 13px; border: 1px solid #fff8;
  color: #38304c; border-radius: 40px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.play-tip span { display: inline-block; margin-right: 3px; color: #5739a7; }

.stage-error { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; width: max-content; max-width: 85%; font-weight: 700; }
.player-toolbar { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.action { font-size: 14px; }
.action > span { font-size: 19px; line-height: 1; }
.action.primary { background: var(--lime); border-color: #c0d770; }
.action.primary:hover { background: #d1ef60; border-color: #a1bc41; }
.action[aria-expanded="true"] { background: #e9dfff; border-color: #ab94e2; }
.action[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.shuffle { margin-left: auto; }

.materials { grid-area: materials; align-self: start; border: 0; min-inline-size: 0; margin: 0; padding: 0; }
.materials legend { margin-bottom: 10px; padding: 0; font-size: 16px; font-weight: 850; letter-spacing: -.025em; }
.material-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.material {
  --swatch-hue: #8c63f0; --swatch-deep: #5b33bc;
  display: flex; align-items: center; gap: 7px; text-align: left;
  min-height: 50px; min-width: 0; padding: 6px 8px;
  border: 1px solid #e1d9e7; border-radius: 9px; background: #fffcf6;
  font: 700 clamp(11px, 1.08vw, 13px)/1.2 var(--body-font); white-space: nowrap;
}
.material:hover { border-color: #9b83c5; }
.material[aria-pressed="true"] { border-color: #6742cc; box-shadow: inset 0 0 0 1px #6742cc; background: #eee6ff; background: color-mix(in srgb, var(--swatch-hue) 20%, #fffcf6); }
.swatch {
  position: relative; flex: 0 0 20px; height: 19px; scale: 1.10;
  filter: drop-shadow(0 1px 1px #25153d38);
}
.peach { --swatch-hue:#ff987e; --swatch-deep:#d64448; }
.frost { --swatch-hue:#abe4ff; --swatch-deep:#5088c9; }
.caramel { --swatch-hue:#ffc774; --swatch-deep:#b4541c; }
.pistachio { --swatch-hue:#d3e394; --swatch-deep:#699451; }
.cocoa { --swatch-hue:#ad7555; --swatch-deep:#502716; }
.pearl { --swatch-hue:#fff7d9; --swatch-deep:#cba6a5; }
.berry { --swatch-hue:#f082b0; --swatch-deep:#ac2c63; }

.cocoa .swatch {
  height: 16px; border-radius: 3px; transform: rotate(-11deg);
  background:
    linear-gradient(90deg, transparent 46%, var(--swatch-deep) 47% 54%, #fff3 55% 59%, transparent 60%),
    linear-gradient(transparent 44%, var(--swatch-deep) 45% 53%, #fff3 54% 59%, transparent 60%),
    linear-gradient(147deg, var(--swatch-hue), var(--swatch-deep));
  box-shadow: inset 0 0 0 1px #50271690, inset 0 2px #fff3;
}
.grape .swatch {
  clip-path: polygon(22% 12%, 75% 6%, 98% 38%, 71% 76%, 45% 97%, 5% 55%);
  background:
    linear-gradient(142deg, #fff6 0 24%, transparent 25%),
    conic-gradient(from 32deg at 53% 43%, var(--swatch-hue) 0 58deg, var(--swatch-deep) 59deg 116deg,
      #a681ef 117deg 174deg, var(--swatch-deep) 175deg 244deg, #b9a0ff 245deg 299deg, var(--swatch-hue) 300deg);
}
.peach .swatch {
  height: 13px; border: 1px solid var(--swatch-deep); border-radius: 2px 2px 11px 11px;
  transform: rotate(-18deg);
  background: repeating-conic-gradient(from 90deg at 50% 6%, var(--swatch-hue) 0 26deg, #ffe2b8 27deg 31deg);
  box-shadow: inset 0 0 0 1px #fff2cd;
}
.frost .swatch {
  clip-path: polygon(42% 2%, 58% 2%, 60% 32%, 87% 17%, 95% 31%, 70% 50%,
    95% 69%, 87% 83%, 60% 68%, 58% 98%, 42% 98%, 40% 68%, 13% 83%, 5% 69%,
    30% 50%, 5% 31%, 13% 17%, 40% 32%);
  background:
    radial-gradient(circle at 48% 42%, #f0fcff 0 13%, transparent 15%),
    linear-gradient(135deg, var(--swatch-hue) 15%, #7dc9ef 49%, var(--swatch-deep) 80%);
}
.caramel .swatch {
  height: 12px; border-radius: 3px 3px 5px 5px; transform: rotate(9deg);
  background:
    linear-gradient(transparent 43%, #a64b167f 45% 57%, #fff5 59% 65%, transparent 66%),
    linear-gradient(145deg, var(--swatch-hue), var(--swatch-deep));
  box-shadow: inset 0 2px #fff5, inset 0 -2px #92461775;
}
.pistachio .swatch {
  height: 14px; border-radius: 62% 46% 57% 44%;
  transform: rotate(-29deg);
  background:
    radial-gradient(ellipse at 54% 37%, #eef3bb 0 11%, transparent 13%),
    radial-gradient(ellipse at 52% 45%, var(--swatch-hue) 0 36%, var(--swatch-deep) 38% 49%, transparent 51%),
    linear-gradient(155deg, #fff2d5, #cbac7c);
  box-shadow: inset 0 0 0 1px #94764c45;
}
.pearl .swatch {
  background:
    radial-gradient(circle at 36% 29%, #fff 0 5%, var(--swatch-hue) 6% 16%, var(--swatch-deep) 34%, transparent 37%) 1px 1px / 13px 13px no-repeat,
    radial-gradient(circle at 38% 29%, #fff 0 5%, var(--swatch-hue) 6% 16%, var(--swatch-deep) 34%, transparent 37%) 9px 6px / 11px 11px no-repeat,
    radial-gradient(circle at 42% 32%, #fff 0 4%, var(--swatch-hue) 6% 18%, var(--swatch-deep) 34%, transparent 37%) 3px 10px / 11px 11px no-repeat;
}
.berry .swatch {
  background:
    radial-gradient(ellipse at 38% 35%, #ffe5f1 0 8%, var(--swatch-hue) 11% 24%, var(--swatch-deep) 48%, transparent 51%) 0 0 / 12px 14px no-repeat,
    radial-gradient(ellipse at 38% 36%, #ffd3e6 0 8%, var(--swatch-hue) 11% 24%, var(--swatch-deep) 48%, transparent 51%) 8px 6px / 11px 13px no-repeat;
}
.berry .swatch::after {
  content: ""; position: absolute; top: 1px; left: 6px; width: 6px; height: 4px;
  border-radius: 75% 0 65% 0; background: #639553; transform: rotate(-18deg);
}

.lemon { --swatch-hue:#ffce60; --swatch-deep:#b97516; }
.maple { --swatch-hue:#d59565; --swatch-deep:#873e20; }
.cloud { --swatch-hue:#edcce8; --swatch-deep:#ae76a5; }
.star { --swatch-hue:#68cabc; --swatch-deep:#287a73; }
.lemon .swatch {
  flex-basis: 18px; height: 18px; margin-inline: 1px; border: 2px solid var(--swatch-deep); border-radius: 50%;
  background: repeating-conic-gradient(from 12deg, #fff2a8 0 5deg, #ffc344 7deg 39deg, #ffdf80 41deg 45deg);
  box-shadow: inset 0 0 0 1px #ffec9c;
}
.maple .swatch {
  height: 13px; border: 1px solid var(--swatch-deep); border-radius: 3px; transform: rotate(-9deg);
  background:
    repeating-linear-gradient(45deg, transparent 0 3px, #71391e70 4px 5px),
    repeating-linear-gradient(-45deg, transparent 0 3px, #71391e70 4px 5px),
    linear-gradient(#f2bc8c, var(--swatch-hue));
}
.cloud .swatch {
  background:
    radial-gradient(circle at 49% 37%, #fff6ff, var(--swatch-hue) 55%, var(--swatch-deep) 70%, transparent 73%) 4px 1px / 12px 12px no-repeat,
    radial-gradient(ellipse at 41% 33%, #fbe5f8, var(--swatch-hue) 53%, var(--swatch-deep) 71%, transparent 74%) 0 7px / 20px 10px no-repeat;
}
.star .swatch {
  clip-path: polygon(50% 0%, 65% 33%, 100% 50%, 66% 66%, 50% 100%, 33% 66%, 0 50%, 33% 33%);
  background: radial-gradient(ellipse at 42% 35%, #e3fff5 0%, var(--swatch-hue) 29%, var(--swatch-deep) 75%);
}

.mix-panel {
  margin-top: 24px; padding: 24px; background: #f2edff; border: 1px solid #d9ccee; border-radius: var(--radius);
}
.mix-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mix-header h2, .instructions h2 { font-size: 27px; letter-spacing: -.05em; line-height: 1.12; }
.mix-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin-top: 20px; }
.mix-fields label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.mix-fields select {
  min-height: 44px; width: 100%; padding: 8px 10px; background: #fffcf8;
  border: 1px solid #cfc4dd; border-radius: 8px;
}

.mix-saved { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.mix-saved:empty { display: none; }
.mix-saved button { white-space: normal; line-height: 1.2; }
.instructions { border-top: 1px solid var(--line); margin-top: 47px; padding-block: 28px 40px; scroll-margin-top: 20px; }
.instructions-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 30px; margin-top: 19px; }
.instructions-grid h3 { font-size: 16px; }
.instructions-grid p { color: var(--muted); font-size: 14px; margin-top: 5px; max-width: 34ch; }
.site-footer {
  display: flex; justify-content: space-between; gap: 14px; color: var(--muted);
  padding-block: 18px 28px; border-top: 1px solid var(--line); font-size: 12px;
}
.site-footer span:first-child { font-weight: 800; color: var(--ink); }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 850px) {
  .masthead, .workbench, .site-footer { width: min(100% - 40px, 700px); }
  .studio { grid-template-columns: minmax(0,1fr); grid-template-areas: "intro" "player" "materials"; gap: 20px; }
  .workbench { padding-top: 24px; }
  .intro { padding-top: 0; }
  .intro h1 { font-size: clamp(46px, 8.4vw, 68px); }
  .title-break { display: none; }
  .lede { max-width: 45ch; margin-top: 10px; font-size: 16px; }
  .key-tip { display: none; }
  .stage { height: clamp(300px, 67vw, 495px); }
  .material { padding-inline: 10px; font-size: 13px; }
  .material-list { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 590px) {
  .masthead, .workbench, .site-footer { width: calc(100% - 28px); }
  .masthead { min-height: 61px; gap: 14px; }
  .wordmark { font-size: 21px; }
  .top-nav { display: none; }
  .sound-button { margin-left: auto; }
  .workbench { padding-top: 19px; }
  .studio { gap: 16px; }
  .intro h1 { font-size: clamp(40px, 10.4vw, 60px); }
  .lede { font-size: 15px; line-height: 1.38; max-width: 33ch; }
  .stage { height: clamp(295px, 84vw, 440px); border-radius: 17px; }
  .stage-caption { top: 13px; left: 14px; }
  .shell-status { top: 14px; right: 14px; }
  .shell-status strong { font-size: 21px; }
  .play-tip { bottom: 11px; font-size: 12px; }
  .player-toolbar { gap: 6px; margin-top: 8px; }
  .player-toolbar .action { padding-inline: 10px; gap: 5px; font-size: 13px; }
  .material-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mix-panel { padding: 16px; }
  .mix-fields { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .mix-header h2 { font-size: 21px; }
  .instructions { margin-top: 32px; padding-top: 21px; }
  .instructions-grid { grid-template-columns: minmax(0,1fr); gap: 15px; }
  .site-footer { flex-wrap: wrap; }
}
@media (pointer: coarse) { .key-tip { display: none; } }


/* --- long-form sections below the game --- */
.explainer { border-top: 1px solid var(--line); margin-top: 44px; padding-block: 28px 4px; scroll-margin-top: 20px; }
.explainer h2 { font: 850 clamp(25px, 3vw, 33px)/1.12 var(--display-font); letter-spacing: -.045em; }
.explainer-lede { margin-top: 13px; max-width: 68ch; color: var(--muted); }
.explainer-copy { margin-top: 13px; max-width: 68ch; }
.explainer-copy p { color: var(--ink); font-size: 16px; line-height: 1.62; }
.explainer-copy p + p { margin-top: 13px; }
.shell-grid {
  margin: 20px 0 0; padding: 0; list-style: none; display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.shell-grid li { display: grid; gap: 5px; padding: 16px 18px 18px; background: var(--paper); }
.shell-grid strong { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.shell-grid span { color: var(--muted); font-size: 14px; line-height: 1.52; }
.tips { margin: 18px 0 0; padding-left: 1.2em; max-width: 70ch; display: grid; gap: 11px; }
.tips li { color: var(--muted); font-size: 15px; line-height: 1.55; }
.tips li strong { color: var(--ink); }
.faq details { border-bottom: 1px solid var(--line); padding-block: 14px; }
.faq details:first-of-type { border-top: 1px solid var(--line); margin-top: 18px; }
.faq summary {
  cursor: pointer; font-weight: 800; letter-spacing: -.015em; list-style: none;
  display: flex; align-items: baseline; justify-content: space-between; gap: 18px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: #6e48dc; font-weight: 800; font-size: 19px; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin-top: 9px; color: var(--muted); max-width: 70ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }

/* --- document pages (privacy, terms) --- */
.doc { width: min(1248px, calc(100% - 40px)); margin-inline: auto; padding-block: 52px 56px; }
.doc h1 { font: 850 clamp(33px, 4.3vw, 50px)/1.06 var(--display-font); letter-spacing: -.05em; }
.doc .updated { margin-top: 12px; font-size: 13px; color: var(--muted); }
.doc .prose { margin-top: 24px; max-width: 72ch; }
.prose h2 { font: 800 22px/1.22 var(--display-font); letter-spacing: -.03em; margin-top: 32px; }
.prose h3 { font-size: 17px; margin-top: 22px; }
.prose p, .prose li { color: var(--muted); font-size: 16px; line-height: 1.62; margin-top: 11px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-top: 6px; }
.prose a { color: #5828d6; }
.prose strong { color: var(--ink); }

@media (max-width: 700px) {
  .shell-grid { grid-template-columns: minmax(0,1fr); }
  .explainer { margin-top: 34px; padding-top: 22px; }
  .doc { padding-block: 34px 40px; }
}


/* --- review pass: headline scale, shell dots, mobile nav --- */
.intro { max-width: 520px; }
.intro h1 { font: 850 clamp(44px, 4.9vw, 72px)/.98 var(--display-font); letter-spacing: -.058em; }
@media (min-width: 851px) {
  .intro h1 { font-size: clamp(35px, 3.75vw, 51px); text-wrap: balance; }
  .title-break { display: none; }
}
.intro .lede { max-width: 26ch; margin-top: 18px; }
.shell-grid li strong::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 9px; border-radius: 3px;
  background: var(--dot, var(--violet)); transform: rotate(-9deg); vertical-align: 1px;
}

@media (max-width: 590px) {
  .masthead { flex-wrap: wrap; row-gap: 4px; padding-bottom: 10px; }
  .top-nav {
    display: flex; order: 3; width: 100%; margin-left: 0;
    gap: 20px; padding-top: 2px; overflow-x: auto; font-size: 13px;
  }
  .intro { max-width: none; }
}

/* Full-screen play keeps the same canvas, size observer and toolbar. */
.fullscreen-action { min-inline-size: 44px; }
.fullscreen-action > .fullscreen-label { font-size: inherit; }

.player[data-fullscreen] {
  display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 12px;
  width: 100%; height: 100vh; height: 100dvh;
  padding: max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right))
    max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  background: var(--paper); color: var(--ink);
}
.player[data-fullscreen] .stage { height: auto; min-height: 0; }
.player[data-fullscreen] .player-toolbar { margin-top: 0; }
.player[data-fullscreen] #customize { display: none; }
.player[data-viewport-fullscreen] { position: fixed; inset: 0; z-index: 10; }
html[data-game-fullscreen] { overflow: hidden; overscroll-behavior: none; }

@media (max-width: 590px) {
  .player-toolbar { flex-wrap: wrap; }
  .player-toolbar .fullscreen-action { padding-inline: 9px; }
  .fullscreen-action > .fullscreen-label { display: none; }
}
@media (max-width: 370px) {
  .player-toolbar .action { padding-inline: 7px; gap: 4px; }
  .player-toolbar .chevron { display: none; }
}
