/* Bundled locally so the builder never depends on a font CDN.
   Graduate, Great Vibes and Barlow — SIL Open Font License 1.1 (see fonts/LICENSE.txt). */
@font-face { font-family: "Graduate"; src: url("fonts/graduate-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Great Vibes"; src: url("fonts/great-vibes-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/barlow-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #f3f3f1;
  --panel: #fbfbfa;
  --ink: #16181d;
  --muted: #5f6672;
  --line: #d8dade;
  --line-soft: #e8e9ec;
  --accent: #8d6a16;
  --stage: radial-gradient(circle at 50% 40%, #f5f5f4 0%, #d9dbdd 72%);
  --warn: #8a3220;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171c; --panel: #1c1f25; --ink: #eceef1; --muted: #9aa2ae;
    --line: #333841; --line-soft: #272b33; --accent: #d7b05a;
    --stage: radial-gradient(circle at 50% 40%, #3b404a 0%, #16181d 74%);
    --warn: #e0876a;
  }
}
:root[data-theme="dark"] {
  --paper: #15171c; --panel: #1c1f25; --ink: #eceef1; --muted: #9aa2ae;
  --line: #333841; --line-soft: #272b33; --accent: #d7b05a;
  --stage: radial-gradient(circle at 50% 40%, #3b404a 0%, #16181d 74%);
  --warn: #e0876a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.45;
}
.app { display: grid; grid-template-columns: 1fr 420px; height: 100dvh; }

/* ---------------------------------------------------------------- stage */
.stage { position: relative; background: var(--stage); min-height: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--muted); padding: 24px; }
.loading small { display: block; margin-top: 8px; max-width: 32ch; }
.stage-views { position: absolute; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.stage-views button {
  font: inherit; font-size: 14px; padding: 7px 13px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
.stage-views button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.stage-hint { position: absolute; right: 16px; bottom: 20px; margin: 0; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- panel */
.panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.panel-head { padding: 22px 22px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel); z-index: 5; }
.panel-head h1 { font-family: "Graduate", Georgia, serif; font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.meta { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 14px; }
.meta strong { font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- steps */
.step { border-bottom: 1px solid var(--line-soft); scroll-margin-top: 92px; }
.step-head {
  width: 100%; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 15px 22px; background: none; border: 0; cursor: pointer; text-align: left;
  font: inherit; color: var(--ink);
}
.step-head:hover { background: rgba(125, 125, 125, .06); }
.step-n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.step.open .step-n { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.step-title { font-weight: 600; }
.step.open .step-title { font-family: "Graduate", Georgia, serif; font-weight: 400; }
.step-state { color: var(--muted); font-size: 13px; max-width: 13ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-body { padding: 2px 22px 26px; }

.lede { color: var(--muted); margin: 0 0 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.note { color: var(--warn); font-size: 13.5px; margin: 10px 0 0; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 20px 0; }
h3 { font-family: "Graduate", Georgia, serif; font-weight: 400; font-size: 16px; margin: 20px 0 10px; }

.field { margin: 0 0 16px; }
.field > label { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.count { font-variant-numeric: tabular-nums; }
.count.full { color: var(--warn); }

.txt {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.txt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select.txt { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.file { width: 100%; font: inherit; font-size: 13.5px; color: var(--muted); }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid rgba(0,0,0,.25); box-shadow: inset 0 -3px 6px rgba(0,0,0,.18); }
.sw[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 3px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  font: inherit; font-size: 14px; padding: 8px 13px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
}
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.seg-btn:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

.size-grid, .year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 16px; }
.size-btn {
  font: inherit; display: grid; gap: 2px; padding: 10px 6px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink); text-align: center;
}
.size-btn strong { font-size: 16px; }
.size-btn span { font-size: 11.5px; color: var(--muted); }
.size-btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.size-btn[aria-pressed="true"] span { color: var(--panel); opacity: .75; }

.rules { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--muted); }
.rules td { padding: 5px 0; border-top: 1px solid var(--line-soft); }
.rules td:last-child { text-align: right; }

.logo-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 4px; }
.logo-btn { padding: 4px; border-radius: 7px; cursor: pointer; border: 1px solid var(--line); background: transparent; }
.logo-btn canvas { display: block; width: 100%; height: auto; }
.logo-btn[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.letter-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.letter { font: inherit; font-family: "Graduate", Georgia, serif; padding: 7px 0; border-radius: 6px;
  cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.letter[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 7px 5px 11px;
  border-radius: 999px; border: 1px solid var(--line); font-size: 14px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 17px;
  line-height: 1; padding: 0 2px; }

.add, .next, .cart {
  width: 100%; font: inherit; font-weight: 600; padding: 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); margin-top: 6px;
}
.add:disabled { opacity: .45; cursor: not-allowed; border-style: dashed; }
.next { margin-top: 20px; background: var(--ink); color: var(--panel); }
.cart { margin-top: 18px; background: var(--ink); color: var(--panel); font-size: 16px; padding: 14px; }
.link-btn { font: inherit; font-size: 13.5px; background: none; border: 0; color: var(--muted);
  text-decoration: underline; cursor: pointer; padding: 8px 0; }

.patchbox { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.patchhead { display: grid; grid-template-columns: 56px 1fr auto; gap: 11px; align-items: center; margin-bottom: 12px; }
.patchhead canvas { width: 56px; height: 56px; }
.patchhead strong { display: block; }
.patchhead .hint { margin: 0; }

.summary { display: grid; grid-template-columns: 11em 1fr; gap: 5px 14px; margin: 0 0 8px; font-size: 14px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }

.price { width: 100%; border-collapse: collapse; font-size: 14px; }
.price td { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.price .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price .total td { font-weight: 700; border-top: 2px solid var(--line); }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--panel); padding: 12px 18px; border-radius: 9px;
  font-size: 14.5px; opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  max-width: min(90vw, 44ch); z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46dvh 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .stage-hint { display: none; }
  .stage-views { left: 12px; bottom: 12px; }
  .step-head, .panel-head { padding-left: 16px; padding-right: 16px; }
  .step-body { padding-left: 16px; padding-right: 16px; }
  .summary { grid-template-columns: 9em 1fr; }
}
