/* The gallery's one stylesheet. Tokens first; components below in the order pages use them. */
:root {
  --bg: #f6f5f2; --panel: #fff; --sunk: #efede8; --ink: #1c1b19; --mute: #6b665e; --faint: #9a948a; --line: #e2ded6; --line-strong: #cfc9bf;
  --accent: #2f5bd3; --accent-ink: #fff; --accent-soft: #e8eefc; --ok: #1f7a4d; --ok-soft: #e3f3ea; --warn: #9a6400; --warn-soft: #fbf0d9;
  --err: #c2362f; --err-soft: #fbe7e5; --live: #2f5bd3; --shadow: 0 1px 2px #0000000d, 0 4px 16px #0000000a; --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312; --panel: #1c1c1a; --sunk: #232321; --ink: #ecebe7; --mute: #a39e94; --faint: #78736b; --line: #2f2e2b; --line-strong: #44423d;
    --accent: #8aa8ff; --accent-ink: #0f1830; --accent-soft: #1d2640; --ok: #6fd39c; --ok-soft: #16271e; --warn: #f0c26a; --warn-soft: #2b2416;
    --err: #ff8a80; --err-soft: #2e1a19; --live: #8aa8ff; --shadow: 0 1px 2px #0006, 0 4px 16px #0004; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* the top bar */
header.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.top-in { max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
header nav { display: flex; gap: 4px; }
header nav a { color: var(--mute); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 500; }
header nav a:hover { color: var(--ink); background: var(--sunk); }
header nav a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
.pill { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; text-decoration: none; }
.pill.live { background: var(--accent-soft); color: var(--live); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot, .spinner { animation: none !important; } }

main { max-width: 1440px; margin: 0 auto; padding: 28px 20px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--mute); margin-top: 6px; }
.crumb { display: inline-block; color: var(--mute); text-decoration: none; font-size: 14px; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }
.section { margin-top: 40px; }
.section > h2 { margin-bottom: 4px; }
.section > .sub { color: var(--mute); margin-bottom: 16px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.sep::before { content: "·"; margin: 0 6px; color: var(--faint); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--mute); }
.btn.quiet:hover { color: var(--ink); background: var(--sunk); }
.btn.danger { color: var(--err); }
.btn.sm { padding: 7px 10px; font-size: 13px; border-radius: 7px; }
.btn.lg { padding: 13px 20px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--mute); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

/* cards and panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.notice { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); margin-bottom: 20px; }
.notice.ok { background: var(--ok-soft); }
.notice.warn { background: var(--warn-soft); }
.notice.err { background: var(--err-soft); }
.empty { padding: 40px 20px; text-align: center; color: var(--mute); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* forms */
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
label.field .hint, .hint { font-weight: 400; color: var(--mute); font-size: 13px; }
input[type="text"], input:not([type]), textarea, select { font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.segmented { display: inline-flex; background: var(--sunk); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button, .segmented a { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--mute); cursor: pointer; text-decoration: none; }
.segmented [aria-pressed="true"], .segmented [aria-current="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.errors { background: var(--err-soft); color: var(--err); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.errors ul { margin: 0; padding-left: 18px; }

/* the rounds list */
.round-row { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.round-row:first-of-type { border-top: 0; padding-top: 0; }
.round-row .info h2 a { color: var(--ink); text-decoration: none; }
.round-row .info h2 a:hover { color: var(--accent); }
.round-row .info p { color: var(--mute); margin-top: 6px; font-size: 14px; text-wrap: pretty; }
.round-row .info .btn-row { margin-top: 12px; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.strip figure { margin: 0; }
.strip a { display: block; text-decoration: none; color: inherit; }
.strip img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); display: block; background: var(--sunk); }
.strip figcaption { font-size: 13px; color: var(--mute); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 800px) { .round-row { grid-template-columns: 1fr; gap: 12px; } }

/* design cards */
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 24px; }
.design { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; scroll-margin-top: 72px; }
.design:target { box-shadow: 0 0 0 3px var(--accent); }
.design .shot { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--sunk); overflow: hidden; border-bottom: 1px solid var(--line); }
.design .shot > img.desk { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 0.25s; }
.design .shot:hover > img.desk { transform: scale(1.015); }
.design .shot > img.phone { position: absolute; right: 12px; bottom: 12px; width: 21%; aspect-ratio: 390 / 844; object-fit: cover; object-position: top; border-radius: 10px; border: 3px solid #1c1b19; box-shadow: 0 6px 20px #0005; background: #fff; }
.design .body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
.design .title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.design .meta { color: var(--mute); font-size: 13px; }
.design .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.design .state { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; padding: 20px; color: var(--mute); }
.design .state strong { color: var(--ink); font-size: 15px; }
.design.failed .state strong { color: var(--err); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); margin: 0 auto 4px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the next-round box on a round page */
.next { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.next .cta { display: grid; gap: 12px; }
@media (max-width: 900px) { .next { grid-template-columns: 1fr; } }
.saving { font-size: 12px; color: var(--faint); min-height: 18px; }

/* the builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.builder aside { position: sticky; top: 76px; display: grid; gap: 16px; }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } .builder aside { position: static; } }
.slots { display: grid; gap: 12px; }
.slot { display: grid; grid-template-columns: 34px 132px minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.slot .num { width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); color: var(--mute); display: grid; place-content: center; font-weight: 700; font-size: 13px; }
.slot .pic { width: 132px; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: repeating-linear-gradient(135deg, var(--sunk) 0 10px, transparent 10px 20px), var(--bg); border: 1px solid var(--line); display: grid; place-content: center; color: var(--faint); font-size: 12px; text-align: center; }
.slot .pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.slot .main { display: grid; gap: 10px; min-width: 0; }
.slot .main .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.slot .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.slot .opts label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--mute); }
.slot .resolved { font-size: 12px; color: var(--mute); }
.slot textarea { min-height: 56px; }
@media (max-width: 640px) { .slot { grid-template-columns: 28px minmax(0, 1fr) auto; } .slot .pic { display: none; } }
.catalog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 32px 0 12px; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pick { text-align: left; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.15s, box-shadow 0.15s; }
.pick:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.pick[disabled] { opacity: 0.5; cursor: not-allowed; }
.pick .pic { aspect-ratio: 16 / 9; background: repeating-linear-gradient(135deg, var(--sunk) 0 12px, transparent 12px 24px), var(--bg); display: grid; place-content: center; color: var(--faint); font-size: 12px; overflow: hidden; }
.pick .pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pick .txt { padding: 10px 12px 12px; display: grid; gap: 4px; }
.pick .txt .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pick .txt p { font-size: 13px; color: var(--mute); }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0 16px; font-size: 14px; }
.summary dt { color: var(--mute); }
.summary dd { margin: 0; text-align: right; font-weight: 600; }
.why { font-size: 13px; color: var(--warn); }

/* designers */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 20px; }
.dcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.dcard .pics { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 16 / 9; background: var(--sunk); }
.dcard .pics a:first-child { grid-row: span 2; }
.dcard .pics img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.dcard .pics.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.dcard .pics.n2 { grid-template-rows: 1fr; }
.dcard .pics.n1 a:first-child, .dcard .pics.n2 a:first-child { grid-row: auto; }
.dcard .pics.none { grid-template-columns: 1fr; grid-template-rows: 1fr; place-items: center; color: var(--faint); font-size: 13px;
  background: repeating-linear-gradient(135deg, var(--sunk) 0 12px, transparent 12px 24px), var(--bg); }
.dcard .body { padding: 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.dcard .voice { font-size: 13px; color: var(--mute); font-style: italic; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dcard .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--mute); }
.form { display: grid; gap: 18px; max-width: 760px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 400; }
.radio-row label { display: flex; gap: 6px; align-items: center; }

/* the round page */
.tip { font-size: 13px; color: var(--mute); margin: -8px 0 16px; }
kbd { font: 600 11px var(--mono); background: var(--panel); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.qdot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; display: inline-block; }

/* compare */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare .col { display: grid; gap: 8px; align-content: start; }
.compare .col header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.compare .viewport { height: calc(100vh - 230px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); }
.compare .viewport img { width: 100%; display: block; }
.compare.phone .viewport img { width: 390px; margin: 0 auto; }

/* the image library (unchanged in spirit from the first gallery) */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.lib .panel { padding: 16px; display: grid; gap: 10px; align-content: start; }
.lib .panel.active { box-shadow: 0 0 0 3px var(--accent); }
pre.prompt { white-space: pre-wrap; font: 12.5px/1.45 var(--mono); background: var(--sunk); border-radius: 6px; padding: 10px; max-height: 9em; overflow: auto; margin: 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { margin: 0; width: 150px; }
.thumbs img { width: 150px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumbs figcaption { font-size: 12px; color: var(--mute); display: flex; justify-content: space-between; gap: 6px; }
.thumbs figcaption button { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; cursor: pointer; }
.upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.upload input[type="text"] { flex: 1; min-width: 160px; width: auto; }
nav.groups { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }

/* sites */
.site-card { position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
.site-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.site-card .cover { position: absolute; inset: 0; z-index: 1; border-radius: 12px; }
.site-card .body h2 { font-size: 18px; }
.site-card .foot .btn { pointer-events: none; }
.site-card .pics .state { display: grid; justify-items: center; gap: 8px; color: var(--mute); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; overflow-x: auto; }
.tabs a { color: var(--mute); text-decoration: none; font-weight: 600; font-size: 14px; padding: 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-size: 12px; font-weight: 600; color: var(--faint); background: var(--sunk); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.setup-run { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; margin-bottom: 24px; }
.setup-run .spinner { margin: 2px 0 0; }
.setup-run p { margin-top: 6px; }
.ready { margin-bottom: 24px; display: grid; gap: 16px; border-color: var(--ok); }
.ready-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.ready-head p { margin-top: 6px; max-width: 70ch; }
details.notes-md { border-top: 1px solid var(--line); padding-top: 12px; }
details.notes-md summary { cursor: pointer; font-weight: 600; }
.prose { font-size: 14px; line-height: 1.55; display: grid; gap: 8px; }
.prose h2, .prose h3, .prose h4 { font-size: 15px; margin-top: 8px; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.prose code, .facts-panel code { font: 12.5px var(--mono); background: var(--sunk); border-radius: 4px; padding: 0 4px; }
.prose a { word-break: break-word; }
blockquote { margin: 6px 0 10px; padding: 8px 12px; border-left: 3px solid var(--line-strong); color: var(--mute); font-size: 14px; white-space: pre-wrap; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.split { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 1fr); gap: 24px; align-items: start; }
.split .form { max-width: none; }
.explain ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; color: var(--mute); }
.explain ol strong { color: var(--ink); }
label.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; cursor: pointer; }
label.choice input { margin-top: 3px; }
.biz { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.biz-side { display: grid; gap: 16px; }
.biz-side .form { gap: 14px; }
.facts-panel { display: grid; gap: 12px; }
.facts-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.facts-head .hint { margin-top: 4px; max-width: 90ch; }
#facts { font: 12.5px/1.55 var(--mono); min-height: 70vh; tab-size: 2; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.assets figure { margin: 0; min-width: 0; }
.assets .pic { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line); overflow: hidden;
  background: repeating-conic-gradient(var(--sunk) 0 25%, var(--panel) 0 50%) 0 0 / 16px 16px; color: var(--faint); font-size: 12px; font-weight: 600; text-decoration: none; }
.assets img { width: 100%; height: 100%; object-fit: contain; display: block; }
.assets figcaption { font-size: 11.5px; color: var(--mute); display: flex; justify-content: space-between; gap: 4px; margin-top: 4px; }
.assets figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.assets figcaption button { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; cursor: pointer; flex: none; }
@media (max-width: 1100px) { .biz, .split { grid-template-columns: 1fr; } #facts { min-height: 50vh; } }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; transition: 0.2s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); color: #fff; }
@media (max-width: 600px) { main { padding: 20px 16px 80px; } .top-in { padding: 0 16px; gap: 12px; } header nav a { padding: 6px 7px; } .pill { display: none; } }

/* the public copy (bin/export.ts) */
.ro-bar { background: var(--sunk); color: var(--mute); font-size: 13px; text-align: center; padding: 6px 16px; }
