:root {
  --paper: #fbf5ea; --paper-2: #f4ead8; --ink: #23203a; --muted: #6b6478; --rule: #e6d9c2;
  --tomato: #e4572e; --tomato-dk: #c2421d; --gold: #f4b942; --teal: #2c7a7b; --white: #fffdf8;
  --display: "Fraunces", Georgia, serif; --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--body); }
a { color: var(--tomato-dk); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header / footer */
.top { border-bottom: 1px solid var(--rule); background: var(--paper); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 600 19px/1 var(--display); letter-spacing: -.01em; }
.mark b { color: var(--tomato); font-weight: 800; }
.logo { width: 30px; height: 30px; flex: none; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; padding: 6px 12px; border-radius: 99px; }
.top nav a:hover, .top nav a[aria-current] { background: var(--paper-2); }
.foot { margin-top: 72px; border-top: 1px solid var(--rule); background: var(--paper-2); font-size: 15px; color: var(--muted); }
.foot-in { padding: 28px 0 40px; }
.foot b { color: var(--ink); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-links a { color: var(--ink); }

/* hero */
.hero { padding: 44px 0 20px; text-align: center; }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tomato-dk); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
h1 { font-size: clamp(36px, 6vw, 64px); margin: 0 auto 14px; max-width: 16ch; }
.lead { font-size: clamp(17px, 2.1vw, 20px); color: var(--muted); max-width: 62ch; margin: 0 auto; }
.intro { padding: 44px 0 8px; }
.intro h1 { margin-left: 0; }
.intro .lead { margin-left: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 2px solid var(--ink); background: var(--white); color: var(--ink); font: 700 15px/1.2 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--paper-2); color: var(--ink); }
.btn.primary { background: var(--tomato); border-color: var(--tomato); color: #fff; box-shadow: 0 3px 0 var(--tomato-dk); }
.btn.primary:hover { background: var(--tomato-dk); border-color: var(--tomato-dk); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; border-width: 1.5px; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--tomato-dk); font: 600 14px/1.3 var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--ink); }

/* maker layout */
.maker { padding: 16px 0 8px; }
.maker-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.preview { position: sticky; top: 16px; }
.maker.is-shared .maker-grid { grid-template-columns: minmax(0, 620px); justify-content: center; }
.maker.is-shared .preview { position: static; }
.shared-bar { background: var(--ink); color: var(--paper); border-radius: 16px; padding: 18px 20px; margin-bottom: 22px; text-align: center; }
.shared-bar p { margin: 0 0 12px; }
.shared-bar .row { display: flex; gap: 10px 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.shared-bar .btn:not(.primary) { background: transparent; color: var(--paper); border-color: var(--paper); }
.shared-bar .link { color: var(--gold); }
.status { margin: 14px 0 12px; text-align: center; font-weight: 600; min-height: 1.6em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hint { text-align: center; font-size: 14px; color: var(--muted); margin: 10px 0 0; overflow-wrap: anywhere; }

/* the card: sizes in design units (1080 = full card width) */
.card { container-type: inline-size; border-radius: 18px; background: var(--bg) center / 100% 100% no-repeat; color: var(--ink);
  box-shadow: 0 1px 0 rgba(35, 32, 58, .08), 0 18px 40px -18px rgba(35, 32, 58, .35); overflow: hidden; }
.card > * { --u: calc(100cqw / 1080); }
.card-head { padding-top: calc(70 * var(--u)); text-align: center; }
.card-eyebrow { margin: 0; height: calc(48 * var(--u)); line-height: calc(48 * var(--u)); font: 700 calc(30 * var(--u)) / calc(48 * var(--u)) var(--body);
  letter-spacing: calc(4 * var(--u)); text-transform: uppercase; color: var(--free); }
.card-title { margin: 0; height: calc(102 * var(--u)); font: 800 calc(var(--fs, 86) * var(--u)) / calc(102 * var(--u)) var(--display); color: var(--ink);
  letter-spacing: 0; white-space: nowrap; }
.card-sub { margin: 0; height: calc(54 * var(--u)); font: 600 calc(var(--fs, 36) * var(--u)) / calc(54 * var(--u)) var(--body); color: var(--sub); white-space: nowrap; }
.grid-wrap { position: relative; width: calc(928 * var(--u)); height: calc(928 * var(--u)); margin: calc(38 * var(--u)) auto 0; }
.grid { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); grid-auto-rows: 1fr; gap: calc(13 * var(--u)); width: 100%; height: 100%; }
.cell { position: relative; display: grid; place-items: center; padding: 0; margin: 0; min-width: 0; border: calc(3 * var(--u)) solid var(--line);
  border-radius: calc(16 * var(--u)); background: var(--cell); color: var(--ink); font: inherit; cursor: pointer; overflow: hidden; }
.cell span { position: relative; z-index: 2; white-space: pre; text-align: center; font: 600 calc(var(--fs) * var(--u)) / 1.16 var(--body); }
.cell.free { background: var(--free); border-color: var(--free); color: var(--free-ink); cursor: default; }
.cell.free span { font-family: var(--display); font-weight: 800; }
.cell.done::before { content: ""; position: absolute; width: 80%; aspect-ratio: 1; border-radius: 50%; background: var(--dot); }
.cell.empty { border-style: dashed; }
.cell.empty::after { content: "+"; font: 400 calc(60 * var(--u)) / 1 var(--body); color: var(--sub); opacity: .6; }
.cell:not(.free):not(:disabled):hover { box-shadow: inset 0 0 0 calc(3 * var(--u)) var(--line); }
.cell:disabled { cursor: default; color: var(--ink); opacity: 1; }
.lines { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lines line { stroke: var(--mark); stroke-linecap: round; opacity: .6; }
.card-foot { margin: calc(32 * var(--u)) 0 0; padding-bottom: calc(50 * var(--u)); height: calc(94 * var(--u)); text-align: center;
  font: 600 calc(26 * var(--u)) / calc(44 * var(--u)) var(--body); color: var(--sub); }
.card.celebrate .grid-wrap { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.03) rotate(-.6deg); } 70% { transform: scale(.995); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .card.celebrate .grid-wrap { animation: none; } }

/* editor */
.editor { background: var(--white); border: 1px solid var(--rule); border-radius: 18px; padding: 22px; }
.field { margin-bottom: 20px; }
.field label, .label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
.field input:not([type]), .field input[type=text] { width: 100%; }
input { font: 400 16px/1.3 var(--body); color: var(--ink); background: var(--paper); border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
input:focus { border-color: var(--ink); outline: none; background: #fff; }
.check { display: flex !important; align-items: center; gap: 8px; margin-top: 10px; font-weight: 400 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--tomato); }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 9px 18px; font: 700 15px var(--body); color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-checked=true] { background: var(--ink); color: var(--paper); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: 2px solid var(--rule);
  background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); }
.swatches button[aria-checked=true] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.field-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.tools { display: flex; gap: 12px; }
.squares { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: sq; display: grid; gap: 6px; max-height: 470px; overflow: auto; padding-right: 4px; }
.squares li { counter-increment: sq; display: flex; align-items: center; gap: 8px; }
.squares li::before { content: counter(sq); width: 24px; flex: none; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.squares input { flex: 1; min-width: 0; padding: 8px 10px; }
.squares li.free input { background: var(--paper-2); font-weight: 700; }
.squares li.free::after { content: "free"; font-size: 12px; color: var(--muted); }
.squares li.done input { text-decoration: line-through; text-decoration-color: var(--tomato); }
.ideas-box { border-top: 1px solid var(--rule); padding-top: 18px; margin-bottom: 0; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cats button { border: 1.5px solid var(--rule); background: var(--paper); border-radius: 99px; padding: 6px 12px; font: 600 13px var(--body); color: var(--ink); cursor: pointer; }
.cats button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1.5px solid var(--ink); background: var(--white); border-radius: 10px; padding: 6px 10px; font: 500 14px/1.25 var(--body); color: var(--ink); cursor: pointer; text-align: left; }
.chip:hover { background: var(--paper-2); }
.chip[aria-pressed=true] { background: var(--tomato); border-color: var(--tomato); color: #fff; }
.chip[aria-pressed=true]::before { content: "✓ "; }

/* articles */
.prose { max-width: 760px; }
.prose h2 { font-size: clamp(26px, 3.4vw, 34px); margin: 52px 0 12px; }
.prose h3 { font-size: 22px; margin: 32px 0 8px; }
.steps { padding-left: 1.2em; }
.steps li { margin-bottom: 10px; }
.steps li::marker { font-weight: 800; color: var(--tomato); }
.faq { border-top: 1px solid var(--rule); padding: 14px 0; }
.faq:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 700; font-size: 18px; }
.faq p { margin: 10px 0 0; color: #3d3a52; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 26px 0 8px; }
.toc a { text-decoration: none; color: var(--ink); background: var(--white); border: 1.5px solid var(--rule); border-radius: 99px; padding: 5px 12px; font-size: 14px; font-weight: 600; }
.toc a:hover { border-color: var(--ink); }
.idea-list { columns: 2; column-gap: 32px; padding-left: 1.6em; margin: 0; }
.idea-list li { break-inside: avoid; margin-bottom: 4px; }
.idea-list li::marker { color: var(--muted); font-size: 14px; }
.use { margin: 14px 0 0; }
.callout { background: var(--white); border: 1px solid var(--rule); border-left: 5px solid var(--tomato); border-radius: 12px; padding: 16px 20px; margin: 28px 0; }
.callout p { margin: 0; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin: 24px 0; }
.tpl { background: var(--white); border: 1px solid var(--rule); border-radius: 14px; padding: 14px; text-align: center; }
.tpl img { width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.tpl h3 { font-size: 18px; margin: 12px 0 4px; }
.tpl p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.tpl .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
code { background: var(--paper-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

@media (max-width: 880px) {
  .maker-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .preview { position: static; }
  .squares { max-height: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero { padding-top: 28px; }
  .editor { padding: 16px; }
  .idea-list { columns: 1; }
  .actions .btn { flex: 1 1 45%; }
  .top-in { padding: 8px 0; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .top, .foot, .hero, .prose, .editor, .actions, .status, .hint, .shared-bar, .skip { display: none !important; }
  .maker, .maker-grid { padding: 0; display: block; }
  .preview { position: static; }
  .card { width: 170mm; margin: 0 auto; box-shadow: none; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
}
