/*
  Glueberry: cut-and-stick picture app for children (Screenery template)
  1. Tokens: the eight paint pots, paper, type (Gluten for hand-cut display, Comfortaa for reading), space, radius.
  2. Page: every section is a painted sheet with a deckled top edge; the first plate is ultramarine with pinned shapes.
  3. The app: a drawn ink tablet holding the sheet drawer, the canvas, the shape tray and the tool row; then wall, pots, cards, rules, plans, questions.
*/

:root {
  /* The paint pots. Text pairs used: ink on chalk, lemon, cerulean, rose, vermilion; chalk on ultramarine, emerald, ink. */
  --vermilion: #ef5130;
  --lemon: #f5cf1d;
  --ultramarine: #2343b0;
  --cerulean: #49a9d9;
  --emerald: #0e7a4f;
  --rose: #e0548c;
  --ink: #1d1b22;
  --chalk: #fbf5e8;
  --kraft: #efe3cb;           /* the table top under the tablet */
  --ink-soft: #46404f;        /* secondary text on light sheets (9.2:1 on chalk) */
  --ultra-deep: #18307f;

  --display: "Gluten", "Comfortaa", cursive;
  --body: "Comfortaa", ui-rounded, system-ui, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --r-s: 10px; --r-m: 18px; --r-l: 30px;
  --wrap: 1200px;
  --bar-h: 68px;
  --shadow: 0 3px 8px rgb(29 27 34 / .2), 0 10px 26px -8px rgb(29 27 34 / .28);
  --ease: cubic-bezier(.16, 1, .3, 1);

  /* Deckled scissor edge, repeated along the top of every sheet */
  --deckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 18' preserveAspectRatio='none'%3E%3Cpath d='M0 18L0 8L6 6.9L10 3.7L15 6.7L19 12.1L26 3.4L36 7.2L43 3.9L53 3.6L58 12.5L62 8.8L72 3.5L79 3.5L85 5.9L91 8.4L99 8.6L105 4L112 6.7L117 8.6L124 8L134 10.8L145 8.9L156 6.6L163 10.9L170 3.8L178 8.3L187 10.3L195 9.1L200 4.2L210 4.6L219 4.5L230 7.2L235 10.6L240 8L240 18Z'/%3E%3C/svg%3E");

  color-scheme: light;
  accent-color: var(--ultramarine);
  caret-color: var(--vermilion);
  scrollbar-color: var(--ultramarine) var(--chalk);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font: 500 1.0625rem/1.65 var(--body);
  color: var(--ink);
  background: var(--chalk);
  overflow-x: clip;
}
::selection { background: var(--lemon); color: var(--ink); }
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.02; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-size: clamp(2.3rem, 4.6vw, 3.9rem); }
h3 { font-size: 1.6rem; line-height: 1.1; }
p { margin: 0; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; box-shadow: 0 0 0 6px var(--lemon); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--lemon); color: var(--ink); padding: 10px 16px; border-radius: var(--r-s); font-weight: 700; }
.skip:focus { top: 12px; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Paint fills for drawn cut-outs */
.c-vermilion { fill: var(--vermilion); } .c-lemon { fill: var(--lemon); } .c-ultramarine { fill: var(--ultramarine); }
.c-cerulean { fill: var(--cerulean); } .c-emerald { fill: var(--emerald); } .c-rose { fill: var(--rose); }
.c-ink { fill: var(--ink); } .c-chalk { fill: var(--chalk); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 22px;
  font: 700 1.15rem/1 var(--display); letter-spacing: .01em;
  border: 2.5px solid transparent; border-radius: 999px; text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s;
}
.btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px) scale(.98); box-shadow: none; }
.btn-lemon { background: var(--lemon); color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--chalk); }
.btn-chalk { background: var(--chalk); color: var(--ink); }
.btn-ultramarine { background: var(--ultramarine); color: var(--chalk); }
.btn-vermilion { background: var(--vermilion); color: var(--ink); }
.btn-line { border-color: var(--chalk); color: var(--chalk); }
.btn-line-ink { border-color: var(--ink); color: var(--ink); background: transparent; }

/* ---------- Header ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  height: var(--bar-h); display: flex; align-items: center; gap: var(--s5);
  padding-inline: max(16px, calc((100% - var(--wrap)) / 2));
  background: var(--chalk); border-bottom: 2.5px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 1.7rem/1 var(--display); }
.brand svg { width: 38px; height: 38px; overflow: visible; }
.bar nav { margin-left: auto; }
.bar ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.bar nav a { display: block; padding: 10px 12px; font-weight: 700; text-decoration: none; border-radius: 999px; font-size: .98rem; }
.bar nav a:hover { background: var(--lemon); }
.bar-cta { gap: 0; white-space: nowrap; min-height: 44px; padding: 8px 18px; font-size: 1.02rem; }

/* ---------- Sheet edges ---------- */
.table, .wall, .pots, .cards, .grownups, .plans, .faq, .foot { position: relative; }
.table::before, .wall::before, .pots::before, .cards::before, .grownups::before, .plans::before, .faq::before, .foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: -15px; height: 16px;
  background: inherit; -webkit-mask: var(--deckle) repeat-x left bottom / 240px 16px; mask: var(--deckle) repeat-x left bottom / 240px 16px;
  pointer-events: none;
}

/* ---------- 1. The plate ---------- */
.plate {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: min(820px, calc(100svh - var(--bar-h)));
  background: var(--ultramarine); color: var(--chalk);
  display: grid; align-items: center;
  padding: var(--s8) max(16px, calc((100% - var(--wrap)) / 2)) var(--s9);
}
.plate-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; max-width: none; }
.plate-copy { max-width: 640px; }
.plate h1 { font-size: clamp(2.7rem, 5.9vw, 5.1rem); line-height: .98; letter-spacing: -.02em; }
.plate h1 span { display: block; }
.lede { margin-top: var(--s5); font-size: clamp(1.08rem, 1.5vw, 1.25rem); max-width: 50ch; line-height: 1.6; }
.plate-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.plate-note { margin-top: var(--s4); font-size: .95rem; color: #dfe4f7; max-width: 46ch; }

/* The signature moment: pieces land on the plate like paper settling, from where they already are */
.p { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .plate-art .p { animation: settle 1.3s var(--ease) both; }
  .p1 { animation-delay: .05s; } .p2 { animation-delay: .2s; } .p3 { animation-delay: .32s; } .p4 { animation-delay: .45s; }
  .p5 { animation-delay: .55s; } .p6 { animation-delay: .62s; } .p7 { animation-delay: .5s; } .p8 { animation-delay: .38s; }
  .p9 { animation-delay: .7s; } .p10 { animation-delay: .76s; } .p11 { animation-delay: .1s; } .p12 { animation-delay: .25s; }
}
@keyframes settle { from { translate: 0 -26px; rotate: -7deg; } 60% { translate: 0 3px; rotate: 1deg; } to { translate: 0 0; rotate: 0deg; } }

/* ---------- 2. The table ---------- */
.table { background: var(--kraft); padding: var(--s8) 0 var(--s8); }
.table-head { display: grid; grid-template-columns: auto 1fr; gap: var(--s4) var(--s7); align-items: end; margin-bottom: var(--s6); }
.table-head p { max-width: 64ch; color: var(--ink-soft); }

.tablet {
  background: var(--ink); border-radius: 44px; padding: 26px;
  box-shadow: 0 6px 14px rgb(29 27 34 / .25), 0 30px 60px -20px rgb(29 27 34 / .45);
  position: relative;
}
.tablet::after { /* camera dot */
  content: ""; position: absolute; top: 10px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: #3a3644;
}
.tablet-screen {
  background: var(--chalk); border-radius: 22px; padding: var(--s4);
  display: grid; gap: var(--s4);
  grid-template-columns: 104px minmax(0, 1fr) 196px;
  grid-template-areas: "drawer stage tray" "tools tools tools";
}
.rail-label { font: 800 1.1rem/1 var(--display); margin-bottom: var(--s3); }

/* Sheets drawer */
.drawer { grid-area: drawer; }
.sheets { display: grid; gap: 8px; }
.sheet {
  position: relative; display: flex; align-items: flex-end; height: 58px; padding: 4px 8px;
  border: 0; border-radius: 6px; cursor: pointer; font: 700 .72rem/1.1 var(--body);
  background-color: var(--c); background-size: cover; color: var(--t);
  box-shadow: 0 2px 3px rgb(29 27 34 / .18);
  transition: transform .25s var(--ease), box-shadow .25s;
  clip-path: polygon(0 3%, 12% 0, 30% 2%, 52% 0, 75% 3%, 100% 0, 99% 30%, 100% 62%, 98% 100%, 70% 97%, 44% 100%, 20% 98%, 0 100%, 2% 55%);
}
.sheet span { background: var(--chalk); color: var(--ink); padding: 2px 6px; border-radius: 4px; }
.sheet[aria-checked="true"] { transform: translateX(8px) rotate(-2deg); }
.sheet[aria-checked="true"]::after {
  content: ""; position: absolute; right: 6px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--chalk); border: 3px solid var(--ink);
}
.sheet:focus-visible { clip-path: none; }

/* Stage */
.stage { grid-area: stage; min-width: 0; display: grid; gap: var(--s3); align-content: start; }
.board-wrap { position: relative; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 2px rgb(29 27 34 / .14); }
#board { width: 100%; height: auto; aspect-ratio: 3 / 2; touch-action: none; cursor: grab; background: var(--chalk); }
#board:focus-visible { outline-offset: -3px; box-shadow: none; }
.tablet[data-mode="cut"] #board { cursor: crosshair; }
.board-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  pointer-events: none; color: var(--ink-soft); text-align: center; font-weight: 700;
}
.board-empty svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 5 5; }
.board-empty[hidden] { display: none; }
.board-nojs { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; background: var(--chalk); }

.prompt {
  display: flex; align-items: center; gap: var(--s3); justify-content: space-between;
  background: var(--lemon); padding: 8px 8px 8px 16px; border-radius: 8px; font-weight: 700;
  rotate: -.6deg;
}
.prompt[hidden] { display: none; }
.prompt-x { border: 0; background: var(--chalk); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }

.mode-switch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.mode-switch button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--chalk); color: var(--ink);
  font: 700 1rem/1 var(--display); cursor: pointer;
}
.mode-switch button[aria-checked="true"] { background: var(--ink); color: var(--chalk); }
.ground-pick { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.ground-pick select, .field select {
  font: 700 .95rem var(--body); color: var(--ink); background: var(--chalk);
  border: 2.5px solid var(--ink); border-radius: 12px; min-height: 44px; padding: 6px 36px 6px 12px;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1b22' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

/* Shapes tray */
.tray { grid-area: tray; }
.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape {
  aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: #f3ead6; cursor: grab;
  display: grid; place-items: center; padding: 8px; touch-action: none; color: var(--ink);
  transition: transform .25s var(--ease), background-color .2s;
}
.shape svg { width: 100%; height: 100%; overflow: visible; }
.shape svg use { fill: var(--c, var(--vermilion)); }
.shape:hover { transform: rotate(-5deg) scale(1.06); background: #ebdfc4; }
.shape:active { cursor: grabbing; }
.shape-cut { grid-column: span 3; aspect-ratio: auto; min-height: 48px; display: flex; gap: 8px; font: 700 1rem/1 var(--display); border: 2px dashed var(--ink); background: transparent; }
.shape-cut svg { width: 22px; height: 22px; }
.ghost {
  position: fixed; left: 0; top: 0; width: 84px; height: 84px; pointer-events: none; z-index: 60;
  translate: -50% -50%; filter: drop-shadow(0 6px 8px rgb(29 27 34 / .3)); rotate: -6deg;
}
.ghost use { fill: var(--c); }

/* Tools */
.tools { grid-area: tools; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); border-top: 2px dashed rgb(29 27 34 / .2); padding-top: var(--s4); }
.tool-group { display: flex; flex-wrap: wrap; gap: 6px; }
.tools button {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 64px; min-height: 58px; padding: 6px 8px;
  border: 0; border-radius: 14px; background: #f1e7d2; color: var(--ink);
  font: 700 .8rem/1 var(--body); cursor: pointer; transition: background-color .2s, transform .2s var(--ease);
}
.tools button:hover:not(:disabled) { background: var(--lemon); transform: translateY(-2px); }
.tools button:disabled { color: #8a8291; cursor: not-allowed; background: #f6efdf; }
.tools .pin-btn { background: var(--rose); min-width: 96px; }
.tools .pin-btn:disabled { background: #f6efdf; }
.status { color: #e9e4f0; font-weight: 700; font-size: .95rem; text-align: center; padding: 14px 8px 0; min-height: 2.6em; }

/* Clear confirmation note */
.note-confirm {
  position: fixed; z-index: 40; left: 50%; bottom: 24px; translate: -50% 0;
  width: min(420px, calc(100% - 32px)); background: var(--lemon); color: var(--ink);
  padding: var(--s5); border-radius: 6px; box-shadow: var(--shadow); rotate: -1deg;
  clip-path: polygon(0 2%, 20% 0, 48% 2%, 80% 0, 100% 3%, 99% 50%, 100% 97%, 70% 100%, 35% 98%, 0 100%, 1% 50%);
}
.note-confirm[hidden] { display: none; }
.note-title { font: 800 1.5rem/1.1 var(--display); margin-bottom: 6px; }
.note-actions { display: flex; gap: var(--s2); margin-top: var(--s4); flex-wrap: wrap; }

/* ---------- 3. Pin wall ---------- */
.wall { background: var(--lemon); padding: var(--s8) 0; }
.wall-head { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s4) var(--s7); align-items: end; margin-bottom: var(--s6); }
.wall-head p { max-width: 56ch; }
.wall-count { font: 700 1.05rem var(--display); background: var(--ink); color: var(--lemon); padding: 8px 14px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pins { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s6) var(--s5); }
.pin { position: relative; background: var(--chalk); padding: 10px 10px 12px; box-shadow: var(--shadow); rotate: var(--tilt, -1.5deg); transition: rotate .3s var(--ease); }
.pin:nth-child(2n) { --tilt: 1.8deg; } .pin:nth-child(3n) { --tilt: -.6deg; }
.pin:hover { rotate: 0deg; }
.pin::before { /* the push pin */
  content: ""; position: absolute; top: -9px; left: 50%; margin-left: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--pinc, var(--vermilion)); box-shadow: 0 3px 4px rgb(29 27 34 / .35), inset -3px -3px 0 rgb(0 0 0 / .15);
}
.pin:nth-child(3n+2) { --pinc: var(--ultramarine); } .pin:nth-child(3n) { --pinc: var(--emerald); }
.pin img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.pin-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.pin-meta b { display: block; font: 700 1.05rem/1.15 var(--display); color: var(--ink); margin-bottom: 2px; }
.pin-actions { display: flex; gap: 4px; }
.pin-actions button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--chalk); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.pin-actions button:hover { background: var(--lemon); }
.pin-actions .ico { width: 18px; height: 18px; }
.pin.is-new { animation: pin-in .6s var(--ease); }
@keyframes pin-in { from { translate: 0 -18px; rotate: 6deg; } }
@media (prefers-reduced-motion: reduce) { .pin.is-new { animation: none; } }
.wall-empty { border: 3px dashed var(--ink); border-radius: 18px; padding: var(--s6); text-align: center; font-weight: 700; }
.wall-empty[hidden] { display: none; }
.wall-full { margin-top: var(--s5); background: var(--ink); color: var(--chalk); padding: 12px 18px; border-radius: 12px; font-weight: 700; display: inline-block; }

/* ---------- 4. Pots ---------- */
.pots { background: var(--chalk); padding: var(--s8) 0; }
.pots-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s7); align-items: center; }
.pots-copy p { margin-top: var(--s4); max-width: 60ch; color: var(--ink-soft); }
.pots-copy p:first-of-type { margin-top: var(--s5); }
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); row-gap: var(--s6); }
.shelf li { display: grid; grid-template-rows: var(--pot-row, 160px) auto 1fr; gap: 4px; align-content: start; padding: 0 8px 14px; border-bottom: 10px solid var(--ink); font-size: .88rem; line-height: 1.35; color: var(--ink-soft); }
.shelf b { font: 800 1.25rem/1 var(--display); color: var(--ink); margin-top: 8px; }
.pot { /* a jar of gouache: lid, glass, paint */
  position: relative; align-self: end; width: 74%; aspect-ratio: 1 / 1.05; border-radius: 14px 14px 18px 18px;
  background: linear-gradient(to top, var(--pot) 0 72%, #e9e2d3 72%); border: 3px solid var(--ink);
}
.shelf li:nth-child(2n) .pot { aspect-ratio: 1 / 1.25; }
.shelf li:nth-child(3n) .pot { aspect-ratio: 1 / .9; }
.pot::before { content: ""; position: absolute; left: -8%; right: -8%; top: -16px; height: 16px; background: var(--ink); border-radius: 6px 6px 2px 2px; }
.pot::after { content: ""; position: absolute; left: 14%; top: 34%; width: 12%; height: 40%; border-radius: 999px; background: rgb(255 255 255 / .4); }

/* ---------- 5. Cutting cards ---------- */
.cards { background: var(--emerald); color: var(--chalk); padding: var(--s8) 0 var(--s9); }
.cards-head { margin-bottom: var(--s7); }
.cards-head p { max-width: 62ch; margin-top: var(--s4); font-size: 1.1rem; }
.card-row { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s5); }
.ccard {
  padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); align-items: flex-start;
  box-shadow: 0 4px 8px rgb(0 0 0 / .18), 0 18px 30px -14px rgb(0 0 0 / .35);
}
.ccard p:not(.ccard-age) { flex: 1; }
.ccard .btn { margin-top: var(--s2); min-height: 44px; font-size: 1.02rem; padding: 8px 18px; }
.ccard-age { font: 700 .82rem/1 var(--body); padding: 6px 10px; border-radius: 999px; background: rgb(255 255 255 / .55); color: var(--ink); }
.ccard-1 { grid-column: span 3; background: var(--cerulean); color: var(--ink); rotate: -1.2deg; border-radius: 60px 14px 60px 14px; }
.ccard-2 { grid-column: span 3; background: var(--ink); color: var(--chalk); rotate: 1deg; border-radius: 8px; translate: 0 26px; }
.ccard-2 .ccard-age { background: var(--lemon); }
.ccard-3 { grid-column: span 2; background: var(--lemon); color: var(--ink); rotate: .8deg; border-radius: 40% 40% 14px 14px / 18% 18% 14px 14px; padding-top: var(--s7); }
.ccard-4 { grid-column: span 2; background: var(--ultramarine); color: var(--chalk); rotate: -1.6deg; border-radius: 14px; translate: 0 18px; }
.ccard-4 .ccard-age { background: var(--chalk); }
.ccard-5 { grid-column: span 2; background: var(--rose); color: var(--ink); rotate: 1.4deg; border-radius: 14px 70px 14px 14px; }

/* ---------- 6. Grown-ups ---------- */
.grownups { background: var(--rose); padding: var(--s8) 0; }
.grown-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: var(--s7); align-items: start; }
.grown-copy p { margin-top: var(--s4); max-width: 46ch; }
.grown-small { font-size: .95rem; }
.rules {
  margin: 0; padding: var(--s6) var(--s6) var(--s6) calc(var(--s6) + 30px); background: var(--chalk);
  box-shadow: var(--shadow); rotate: .3deg; counter-reset: rule; list-style: none; display: grid; gap: var(--s4);
  clip-path: polygon(0 1%, 25% 0, 60% 1%, 100% 0, 99.5% 40%, 100% 99%, 60% 100%, 30% 99.4%, 0 100%, .5% 50%);
}
.rules li { counter-increment: rule; position: relative; color: var(--ink-soft); max-width: 66ch; }
.rules li::before {
  content: counter(rule); position: absolute; left: -38px; top: -2px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--chalk); font: 700 .9rem/1 var(--display);
}
.rules b { color: var(--ink); display: block; font-size: 1.05rem; }

/* ---------- 7. Plans ---------- */
.plans { background: var(--cerulean); padding: var(--s8) 0; }
.plans-head { display: grid; grid-template-columns: auto 1fr; gap: var(--s4) var(--s7); align-items: end; margin-bottom: var(--s6); }
.plans-head p { max-width: 58ch; }
.plan-tabs { display: inline-flex; gap: 6px; padding: 6px; background: var(--ink); border-radius: 999px; margin-bottom: var(--s5); }
.plan-tabs button { min-height: 46px; padding: 8px 22px; border: 0; border-radius: 999px; background: transparent; color: var(--chalk); font: 700 1.1rem/1 var(--display); cursor: pointer; }
.plan-tabs button[aria-selected="true"] { background: var(--lemon); color: var(--ink); }
.plan-panel[hidden] { display: none; }
.plan-sheet {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: var(--chalk); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow);
}
.plan-terms { background: var(--ultramarine); color: var(--chalk); padding: var(--s6); }
.school .plan-terms { background: var(--emerald); }
.plan-terms h3 { font-size: 2.2rem; }
.billing { display: inline-flex; margin-top: var(--s4); border: 2.5px solid var(--chalk); border-radius: 999px; padding: 3px; }
.billing label { position: relative; padding: 8px 16px; border-radius: 999px; font-weight: 700; cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.billing input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.billing label:has(input:checked) { background: var(--chalk); color: var(--ink); }
.billing label:has(input:focus-visible) { outline: 3px solid var(--lemon); outline-offset: 2px; }
.price { margin-top: var(--s5); font: 800 3.2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.price span + span { font: 700 1.1rem var(--body); margin-left: -4px; }
.price-note { margin-top: var(--s2); font-size: .95rem; max-width: 40ch; }
.plan-list { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s3); }
.plan-list li { display: flex; gap: 10px; align-items: flex-start; }
.plan-list .ico { color: var(--lemon); margin-top: 2px; }

.join { padding: var(--s6); position: relative; }
.form-body { display: grid; gap: var(--s4); }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.field label, .field legend { font-weight: 700; padding: 0; display: flex; align-items: center; gap: 8px; }
.field input:not([type="checkbox"]) {
  font: 600 1rem var(--body); color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; min-height: 48px; padding: 8px 14px; width: 100%;
}
.field input::placeholder { color: #6b6474; }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--ultramarine); outline-offset: 2px; box-shadow: none; }
.field [aria-invalid="true"] { border-color: #b3261e !important; background: #fff4f1 !important; }
.err { color: #a3221a; font-weight: 700; font-size: .9rem; min-height: 0; }
.err:empty { display: none; }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step { width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--chalk); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.step:hover:not(:disabled) { background: var(--lemon); }
.step:disabled { opacity: .45; cursor: not-allowed; }
.stepper output { padding-top: .18em; font: 800 1.7rem/1 var(--display); min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.step-note { font-size: .92rem; color: var(--ink-soft); }
.sum { font-size: .98rem; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.field .chip { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 2.5px solid var(--ink); border-radius: 999px; font-weight: 700; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.field .chip:has(input:checked) { background: var(--emerald); color: var(--chalk); border-color: var(--emerald); }
.chip:has(input:focus-visible) { outline: 3px solid var(--ultramarine); outline-offset: 2px; }
.gate label .ico { width: 18px; height: 18px; }
.gate input { max-width: 160px; }
.tick { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.tick input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.privacy-line { font-size: .9rem; color: var(--ink-soft); background: #f2ead9; padding: 10px 14px; border-radius: 10px; }
.submit { justify-self: start; min-height: 52px; position: relative; }
.spinner { display: none; width: 20px; height: 20px; border: 3px solid rgb(251 245 232 / .35); border-top-color: var(--chalk); border-radius: 50%; }
.join.is-loading .spinner { display: block; animation: spin .8s linear infinite; }
.join.is-loading .submit { pointer-events: none; opacity: .85; }
@keyframes spin { to { rotate: 1turn; } }
.form-error { background: #fde3dc; color: #8a1c14; border: 2px solid #b3261e; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.form-error[hidden] { display: none; }
.form-done { display: grid; gap: var(--s3); justify-items: start; align-content: center; min-height: 100%; }
.form-body[hidden], .form-done[hidden] { display: none; }
.form-done:focus, .form-done:focus-visible { outline: none; box-shadow: none; }
.done-star { width: 80px; height: 80px; overflow: visible; }
.done-text { max-width: 48ch; color: var(--ink-soft); }

/* ---------- 8. FAQ ---------- */
.faq { background: var(--ink); color: var(--chalk); padding: var(--s8) 0; }
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--s7); align-items: start; }
.qs { display: grid; gap: 10px; }
.qs details { background: #2c2933; border-radius: 14px; }
.qs summary { list-style: none; cursor: pointer; padding: 16px 52px 16px 20px; font: 700 1.25rem/1.25 var(--display); position: relative; min-height: 44px; }
.qs summary::-webkit-details-marker { display: none; }
.qs summary::after { content: ""; position: absolute; right: 20px; top: 50%; width: 14px; height: 14px; margin-top: -9px; border-right: 3px solid var(--lemon); border-bottom: 3px solid var(--lemon); rotate: 45deg; transition: rotate .3s var(--ease); }
.qs details[open] summary::after { rotate: 225deg; margin-top: -3px; }
.qs details p { padding: 0 20px 18px; color: #dcd6e3; max-width: 64ch; }
.qs summary:focus-visible { box-shadow: 0 0 0 4px var(--lemon); outline: none; }

/* ---------- Footer ---------- */
.foot { background: var(--ultramarine); color: var(--chalk); padding: var(--s7) 0 var(--s5); }
.foot-grid { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr 1fr; gap: var(--s5); }
.foot-name { font: 800 2.2rem/1 var(--display); margin-bottom: 8px; }
.foot-h { font: 700 1.05rem var(--display); margin-bottom: 6px; color: var(--lemon); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.foot a { display: inline-block; padding: 3px 0; }
.foot-legal { margin-top: var(--s6); padding-top: var(--s4); border-top: 2px solid rgb(251 245 232 / .25); font-size: .85rem; color: #dfe4f7; }

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
  .tablet-screen { grid-template-columns: 92px minmax(0, 1fr); grid-template-areas: "drawer stage" "tray tray" "tools tools"; }
  .shapes { grid-template-columns: repeat(7, 1fr); }
  .shape-cut { grid-column: span 7; }
  .bar nav a { padding: 10px 8px; }
  .card-row { grid-template-columns: repeat(2, 1fr); }
  .ccard-1, .ccard-2, .ccard-3, .ccard-4, .ccard-5 { grid-column: span 1; translate: none; }
  .ccard-5 { grid-column: span 2; }
}
@media (max-width: 960px) {
  .bar nav { display: none; }
  .bar-cta { margin-left: auto; }
  .plate-art { opacity: .55; }
  .table-head, .wall-head, .cards-head, .plans-head { grid-template-columns: 1fr; }
  .wall-count { justify-self: start; }
  .pots-grid, .grown-grid, .faq-grid, .plan-sheet { grid-template-columns: 1fr; }
  .pins { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  /* tablet widths: shorter sheets so the drawer ends level with the stage instead of running past it */
  .sheets { gap: 6px; }
  .sheet { height: 47px; }
}
@media (max-width: 680px) {
  :root { --s8: 56px; --s9: 80px; }
  .tablet { border-radius: 26px; padding: 12px; }
  .tablet::after { display: none; }
  .tablet-screen { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "drawer" "tray" "tools"; padding: 10px; border-radius: 16px; }
  .sheets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet { height: 50px; padding: 3px 4px; font-size: .68rem; }
  .sheet span { padding: 2px 4px; }
  .bar-cta .long { display: none; }
  .mode-switch button { padding: 8px 12px; font-size: .95rem; }
  .sheet[aria-checked="true"] { transform: translateY(-4px) rotate(-2deg); }
  .shapes { grid-template-columns: repeat(4, 1fr); }
  .shape-cut { grid-column: span 4; }
  .ground-pick { margin-left: 0; }
  .tools { justify-content: center; }
  .tool-group { justify-content: center; }
  .tools button { min-width: 60px; }
  .pins { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s4); }
  .pin-meta { flex-direction: column; align-items: stretch; }
  .shelf { grid-template-columns: repeat(2, 1fr); }
  .pot { width: 52%; }
  .shelf { --pot-row: 128px; }
  .card-row { grid-template-columns: 1fr; }
  .ccard-5 { grid-column: span 1; }
  .field-row { grid-template-columns: 1fr; }
  .plan-terms, .join { padding: var(--s5); }
  .rules { padding: var(--s5) var(--s4) var(--s5) calc(var(--s4) + 34px); }
  .foot-grid { grid-template-columns: 1fr; }
  .plate { padding-bottom: 260px; align-items: start; }
  .plate-art { opacity: 1; top: auto; height: 300px; }
  .bar-cta { padding: 8px 14px; font-size: .95rem; }
}
@media (max-width: 400px) {
  .brand span { font-size: 1.45rem; }
  .bar { gap: 10px; }
}
