/* Kerf styles. Contrast ratios in comments are WCAG, computed against --card unless noted. */
:root {
  --paper: #f6f3ee;
  --card: #fffdf9;
  --ink: #1d2b24;
  --ink-2: #4a5a52;            /* 6.60 on paper */
  --ink-3: #5f6e66;            /* 5.29 on card, 4.85 on paper */
  --line: #e4ded4;
  --line-2: #d6cfc3;
  --field-line: #858f89;       /* input borders: 3.29 on card, 3.02 on paper */
  --accent: #0c7a53;           /* 5.27 on card, 4.65 on accent-soft, white on it 5.35 */
  --accent-hover: #0a6646;     /* white on it 7.00 */
  --accent-ink: #ffffff;
  --accent-soft: #e2f3ec;
  --accent-deep: #0a5f41;      /* 6.70 on accent-soft */
  --warn: #9a4a07;             /* 5.65 on warn-soft, 6.16 on card */
  --warn-soft: #fdf2e2;
  --bad: #b42318;              /* 6.47 */
  --mat: #3f8f78;
  --mat-deep: #2d6b59;         /* white on it 6.25 */
  --on-mat: #ffffff;
  --mat-line: rgba(255, 255, 255, 0.16);
  --mat-line-strong: rgba(255, 255, 255, 0.34);
  --scrim: rgba(12, 18, 15, 0.45);
  --radius: 14px;
  --shadow: 0 1px 0 rgba(29, 43, 36, 0.04), 0 8px 24px -12px rgba(29, 43, 36, 0.18);
  --sheet-shadow: 0 -12px 30px -12px rgba(0, 0, 0, 0.4);
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Header height (content box) plus the notch inset. Everything sticky offsets by --top-total. */
  --top-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --top-total: calc(var(--top-h) + var(--safe-t));
  --tap: 44px;
  color-scheme: light;
}
/* Dark: ink-3 6.44 on card / 7.07 on paper, accent 6.95 on card, accent-ink on accent 7.25, warn 6.75 on warn-soft. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131a17; --card: #1a231f; --ink: #eef2ef; --ink-2: #b7c3bc; --ink-3: #9aa79f;
    --line: #2a3530; --line-2: #36433d; --field-line: #6b7a72; --accent: #34c08c; --accent-hover: #5fd3a6;
    --accent-ink: #062218; --accent-soft: #173a2d; --accent-deep: #8fe3c0;
    --warn: #f0a650; --warn-soft: #3a2a14; --bad: #ff7b6e; --mat: #2c6e5c; --mat-deep: #1f5243;
    --mat-line: rgba(255, 255, 255, 0.1); --mat-line-strong: rgba(255, 255, 255, 0.24); --scrim: rgba(0, 0, 0, 0.55);
    --shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131a17; --card: #1a231f; --ink: #eef2ef; --ink-2: #b7c3bc; --ink-3: #9aa79f;
  --line: #2a3530; --line-2: #36433d; --field-line: #6b7a72; --accent: #34c08c; --accent-hover: #5fd3a6;
  --accent-ink: #062218; --accent-soft: #173a2d; --accent-deep: #8fe3c0;
  --warn: #f0a650; --warn-soft: #3a2a14; --bad: #ff7b6e; --mat: #2c6e5c; --mat-deep: #1f5243;
  --mat-line: rgba(255, 255, 255, 0.1); --mat-line-strong: rgba(255, 255, 255, 0.24); --scrim: rgba(0, 0, 0, 0.55);
  --shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-total) + 8px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
/* iOS zooms into any field under 16 px. */
input, select, textarea { font-size: max(16px, 1em); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Headings get focus on route change for screen readers; no ring for that. */
h1[tabindex="-1"]:focus { outline: none; }
/* On the green mat the accent ring disappears (1.38:1); white is 3.88 on --mat, 6.25 on --mat-deep. */
.mat :focus-visible, .thumb:focus-visible, .ed-preview :focus-visible, .shelf .thumb:focus-visible { outline-color: var(--on-mat); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: var(--top-total); padding: calc(10px + var(--safe-t)) max(24px, var(--safe-r)) 9px max(24px, var(--safe-l)); background: color-mix(in oklab, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; min-height: var(--tap); font: 800 24px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.04em; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink-2); text-decoration: none; padding: 0 14px; border-radius: 999px; font-weight: 550; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a.on, .nav a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .acct { min-width: 0; max-width: 16em; }
.who .acct span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 13px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.pro { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); background: var(--accent-soft); font-weight: 650; }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s; }
.btn:hover { background: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { min-height: 52px; padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn.block { display: flex; width: 100%; }
.btn.icon { width: var(--tap); padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); background: var(--card); border: 1px solid var(--field-line); border-radius: 10px; padding: 9px 12px; }
textarea.input { resize: vertical; min-height: 64px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.help { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.3em; margin: 8px 0 0; }

/* ---------- home ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 max(24px, var(--safe-r)) 0 max(24px, var(--safe-l)); }
.hero { padding: 56px 0 28px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(36px, 5.4vw, 64px); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: var(--ink-2); max-width: 34em; margin: 18px 0 24px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-mat { aspect-ratio: 4/3; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; color: var(--ink-3); font-size: 13px; }
.trust b { color: var(--ink-2); font-weight: 600; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 36px 0 14px; }
.section-h h2 { font-size: 26px; }
.section-h p { color: var(--ink-3); margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.tool-card .thumb { aspect-ratio: 16/10; background: var(--mat); position: relative; }
.tool-card .thumb svg { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); }
.tool-card .meta { padding: 12px 14px 14px; }
.tool-card h3 { font-size: 17px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { font: 600 11px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); border: 1px solid var(--line); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.tool-card p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.why { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 8px 0 12px; }
.why div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.why h3 { font-size: 17px; margin-bottom: 6px; }
.why p { margin: 0; color: var(--ink-2); font-size: 14px; }
table.compare { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.compare th, .compare td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.compare th { font-family: var(--display); font-size: 15px; background: var(--paper); }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }
.compare .yes { color: var(--accent); font-weight: 700; }
.compare .no { color: var(--ink-3); }
.compare tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* ---------- editor (today's markup: .editor > .panel + .stage) ---------- */
.editor { display: grid; grid-template-columns: 360px 1fr; min-height: calc(100vh - var(--top-total)); }
.panel { border-right: 1px solid var(--line); background: var(--card); padding: 18px 18px 120px; overflow-y: auto; overscroll-behavior: contain; max-height: calc(100vh - var(--top-total)); position: sticky; top: var(--top-total); }
.panel h1 { font-size: 24px; }
.panel .sub { color: var(--ink-2); font-size: 13.5px; margin: 6px 0 14px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; font-weight: 550; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on, .chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); box-shadow: inset 0 0 0 1px var(--accent); }
.field { margin-bottom: 14px; }
.field.hide { display: none; }
.field .row { display: flex; align-items: center; gap: 10px; }
.field input[type="range"] { flex: 1; min-height: var(--tap); accent-color: var(--accent); }
.field output { font: 13px var(--mono); color: var(--ink-2); min-width: 4.5em; text-align: right; }
.field input[type="color"] { width: var(--tap); height: var(--tap); border: 1px solid var(--field-line); border-radius: 8px; padding: 2px; background: var(--card); cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 550; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.fontpick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 236px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.fontpick button, .fontpick [role="option"] { min-height: 52px; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 8px 6px; cursor: pointer; font-size: 19px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontpick .on, .fontpick [aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.fontpick small { display: block; font: 11px var(--body); color: var(--ink-3); margin-top: 2px; }

.stage { display: flex; flex-direction: column; min-width: 0; }
.stagebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: var(--top-total); z-index: 5; }
.size { font: 600 14px var(--mono); }
.fit { font-size: 12.5px; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.fit.warn { background: var(--warn-soft); color: var(--warn); }
.stagebar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.matwrap { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.mat { position: relative; background: var(--mat); border-radius: 16px; padding: 28px 18px 18px 30px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); min-height: 360px; display: flex; align-items: center; justify-content: center; }
.mat svg.preview { width: 100%; height: auto; max-height: 64vh; display: block; overflow: visible; }
.mat .busy { position: absolute; top: 10px; right: 14px; color: var(--on-mat); background: var(--mat-deep); padding: 2px 8px; border-radius: 999px; font-size: 12px; opacity: 0; transition: opacity .2s; }
.mat.rendering .busy { opacity: 1; }
.notice { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.layers { display: flex; flex-wrap: wrap; gap: 8px; }
.layer { display: flex; align-items: center; gap: 8px; min-height: 36px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 6px 12px; border-radius: 10px; font-size: 13px; cursor: pointer; user-select: none; }
.layer .sw { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.layer.off, .layer[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }
.tips { color: var(--ink-3); font-size: 13px; }
.tips b { color: var(--ink-2); }

/* ---------- phone-first editor shell (.editor.ed-shell) ----------
   Markup: .ed-shell > .ed-head, .ed-preview, .ed-tabs > .ed-tab, .ed-panel (> .ed-dock as a direct child), .ed-main.
   JS sets --vvh / --vvt on :root from visualViewport and toggles .typing on .ed-shell while a text field has focus. */
.ed-shell { grid-template-columns: 380px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "head preview" "tabs preview" "panel preview" "main preview"; height: calc(100vh - var(--top-total)); height: calc(100dvh - var(--top-total)); min-height: 540px; }
.ed-shell::before { content: ""; grid-column: 1; grid-row: 1 / -1; background: var(--card); border-right: 1px solid var(--line); }
.ed-head { grid-area: head; display: flex; align-items: center; gap: 4px; padding: 8px 10px 4px; min-width: 0; }
.ed-head h1 { flex: 1; min-width: 0; font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-head .btn.icon { width: 48px; min-height: 48px; font-size: 20px; }
.ed-preview { grid-area: preview; position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 20px; }
.ed-preview .mat { flex: 1; min-height: 0; }
.ed-preview .mat svg.preview { height: 100%; max-height: none; }
.ed-preview[data-zoom] .mat { touch-action: none; overflow: hidden; }
.ed-chips { position: absolute; left: 30px; bottom: 30px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.ed-chips span { font: 600 12px/1.4 var(--mono); color: var(--on-mat); background: var(--mat-deep); padding: 3px 8px; border-radius: 6px; }
.ed-chips .warn { color: var(--warn); background: var(--warn-soft); }
.ed-fix { position: absolute; left: 30px; top: 30px; min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 650; font-size: 13px; cursor: pointer; }
.ed-zoom { position: absolute; right: 30px; top: 30px; width: var(--tap); height: var(--tap); display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.ed-status { position: absolute; right: 30px; bottom: 30px; font-size: 12px; color: var(--on-mat); background: var(--mat-deep); padding: 3px 10px; border-radius: 999px; }
.ed-tabs { grid-area: tabs; display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ed-tabs::-webkit-scrollbar { display: none; }
.ed-tab { flex: 1 0 auto; min-width: 64px; min-height: 48px; padding: 0 10px; border: 0; background: none; color: var(--ink-2); font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap; }
.ed-tab:hover { color: var(--ink); }
.ed-tab[aria-selected="true"], .ed-tab.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.ed-tab:focus-visible { outline-offset: -3px; }
.ed-panel { grid-area: panel; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.ed-panel > h2 { font-size: 15px; margin: 4px 0 10px; }
.ed-main { grid-area: main; display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.ed-main .btn.primary { width: 100%; min-height: 52px; font-size: 16px; border-radius: 12px; }
.ed-note { font-size: 13px; color: var(--ink-3); text-align: center; margin: 0; }
/* Typing dock: the same field, restyled above the keyboard in .typing. */
.ed-dock { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ed-dock .ed-row { display: flex; align-items: center; gap: 8px; }
.ed-dock .input { flex: 1; min-width: 0; min-height: 48px; font-size: 18px; font-weight: 600; }
.ed-done { display: none; min-height: var(--tap); padding: 0 8px; border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; }
.ed-hint { font-size: 13px; color: var(--warn); margin: 0; }
/* Style strip: tap a tile to choose, scrolling never chooses. */
.ed-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.ed-strip::-webkit-scrollbar { display: none; }
.ed-style { flex: none; scroll-snap-align: start; min-height: var(--tap); max-width: 150px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 18px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ed-tile { flex: none; scroll-snap-align: start; width: 112px; height: 88px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; overflow: hidden; text-align: center; }
.ed-tile .ed-sample { font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tile small { font: 11px/1.2 var(--body); color: var(--ink-3); }
.ed-tile.missing small { color: var(--warn); }
.ed-tile.loading .ed-sample { color: transparent; border-radius: 6px; background: linear-gradient(90deg, var(--line) 0 30%, var(--paper) 50%, var(--line) 70%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }
.ed-style.on, .ed-style[aria-checked="true"], .ed-tile.on, .ed-tile[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
/* Size stepper. */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .btn { width: var(--tap); padding: 0; font-size: 20px; }
.stepper b { font: 700 17px var(--mono); }
.stepper small { margin-left: auto; color: var(--ink-2); font-size: 13px; }
.fitline { font-size: 13px; font-weight: 650; color: var(--accent-deep); margin: 6px 0 0; }
.fitline.warn { color: var(--warn); }

/* ---------- sheets (bottom sheet on phones, centred card on wide screens) ----------
   Use a <div class="sheet-backdrop"> + <div class="sheet" role="dialog" aria-modal="true">, or <dialog class="sheet">.
   It sits on the visible viewport so the keyboard never covers it (uses --vvh/--vvt when set). */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: var(--scrim); animation: fade-in .2s ease-out; }
.sheet { position: fixed; left: 0; right: 0; bottom: max(0px, calc(100% - var(--vvh, 100%) - var(--vvt, 0px))); z-index: 61; max-height: calc(var(--vvh, 100dvh) * 0.88); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 10px max(16px, var(--safe-r)) max(16px, calc(var(--safe-b) + 12px)) max(16px, var(--safe-l)); border: 0; border-radius: 20px 20px 0 0; background: var(--card); color: var(--ink); box-shadow: var(--sheet-shadow); animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; flex: none; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 4px; }
dialog.sheet { width: 100%; max-width: none; top: auto; }
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(12, 18, 15, 0.45); background: var(--scrim); }
.sheet h2 { font-size: 21px; }
.sheet p { margin: 0; color: var(--ink-2); }
.sheet .btn.primary { min-height: 52px; font-size: 16px; }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head > div { min-width: 0; }
.sheet-head small { display: block; color: var(--ink-2); font-size: 13px; }
.sheet-thumb { flex: none; width: 64px; height: 48px; border-radius: 9px; background: var(--mat-deep); display: grid; place-items: center; overflow: hidden; padding: 4px; }
.sheet-thumb svg { width: 100%; height: 100%; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-actions .row2, .row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.row2 .btn { white-space: normal; text-align: center; line-height: 1.2; }
.sheet-close { position: absolute; top: 6px; right: 6px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; bottom: max(24px, calc(100% - var(--vvh, 100%) - var(--vvt, 0px) + 12px)); width: min(480px, calc(100vw - 32px)); translate: -50% 0; border-radius: 18px; padding: 22px 24px 24px; max-height: calc(100vh - 48px); }
  .sheet::before { display: none; }
  dialog.sheet { width: min(480px, calc(100vw - 32px)); }
}

/* ---------- save step ---------- */
.save-steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: flex; flex-direction: column; gap: 10px; }
.save-steps li { counter-increment: st; position: relative; min-height: 24px; padding-left: 34px; color: var(--ink-2); font-size: 14px; }
.save-steps li::before { content: counter(st); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line-2); display: grid; place-items: center; font: 700 12px var(--mono); color: var(--ink); }
.save-steps b { color: var(--ink); }
.save-steps code, .save-steps .fn { font: 600 13px var(--mono); color: var(--ink); background: var(--paper); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.save-steps li.extra::before { content: "!"; background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; color: var(--accent-deep); min-height: 1.4em; margin: 0; }
.status-line.warn { color: var(--warn); }
/* In-app browser (Instagram, Facebook, TikTok): no save button, an exit card instead. */
.inapp-exit { display: flex; flex-direction: column; gap: 12px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 18px 16px; box-shadow: var(--shadow); }
.inapp-exit h2 { font-size: 20px; }
.inapp-exit p { margin: 0; color: var(--ink-2); }
.inapp-exit .menu-line { font-size: 14px; color: var(--ink-2); background: var(--paper); border-radius: 10px; padding: 10px 12px; }
.inapp-exit .menu-line b { color: var(--ink); }
.inapp-exit .btn { width: 100%; }

/* ---------- cut check: one line, details on request ---------- */
.cut-issue { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px; font-size: 14px; }
.cut-issue::before { content: "!"; content: "!" / ""; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--warn); color: var(--card); font: 800 13px/20px var(--body); text-align: center; }
.cut-issue > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cut-issue b { color: var(--ink); }
.cut-issue .btn { align-self: flex-start; }
.cut-issue.ok { background: var(--accent-soft); }
.cut-issue.ok::before { content: "\2713"; content: "\2713" / ""; background: var(--accent); color: var(--accent-ink); }
.cut-issue.bad { background: color-mix(in oklab, var(--bad) 12%, var(--card)); }
.cut-issue.bad::before { background: var(--bad); }
.cut-issue details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); min-height: var(--tap); display: flex; align-items: center; }
.cut-list { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.cut-list li { position: relative; padding-left: 20px; }
.cut-list li::before { content: "\2713"; content: "\2713" / ""; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.cut-list li.warn::before { content: "!"; content: "!" / ""; color: var(--warn); }

/* ---------- member home ---------- */
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.home-card { display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.home-card h2, .home-card h3 { font-size: 18px; }
.home-card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.home-card .row { display: flex; flex-wrap: wrap; gap: 8px; }
.home-card .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.home-card.kit { background: color-mix(in oklab, var(--accent-soft) 60%, var(--card)); border-color: color-mix(in oklab, var(--accent) 30%, var(--line)); }
.home-card.soon { background: var(--warn-soft); border-color: transparent; }
.home-card .eyebrow { font: 600 12px/1.4 var(--body); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.home-card.kit .eyebrow { color: var(--accent-deep); }
/* Shelf: a sideways row of designs (Make again, Christmas). */
.shelf { list-style: none; margin: 0; padding: 2px 2px 8px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 44%); gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.shelf > * { scroll-snap-align: start; min-width: 0; }
.shelf a, .shelf button { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; font-size: 14px; font-weight: 600; }
.shelf .thumb { position: relative; aspect-ratio: 4/3; border-radius: 10px; background: var(--mat); overflow: hidden; }
.shelf .thumb svg { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
.shelf small { display: block; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
@media (min-width: 700px) { .shelf { grid-auto-columns: 180px; } }

/* ---------- #/check phone test page ---------- */
.check-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check-file:last-child { border-bottom: 0; }
.check-file .k { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font: 700 15px var(--mono); }
.check-file b { display: block; }
.check-file small { display: block; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.check-file .result { grid-column: 2 / -1; font-size: 13px; color: var(--ink-2); }
.check-file .result.ok { color: var(--accent-deep); font-weight: 650; }
.check-file .result.bad { color: var(--bad); font-weight: 650; }

/* ---------- pages ---------- */
.page { max-width: 960px; margin: 0 auto; padding: 40px max(24px, var(--safe-r)) 60px max(24px, var(--safe-l)); }
.page.narrow { max-width: 440px; }
.page h1 { font-size: 34px; margin-bottom: 10px; }
.page .lead { color: var(--ink-2); margin: 0 0 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.card h2 { font-size: 20px; margin-bottom: 12px; }
.stack > * + * { margin-top: 12px; }
.codebox { font: 700 28px/1 var(--mono); letter-spacing: .4em; text-align: center; padding: 14px 10px 14px 18px; }
/* Text-styled button: invisible padding takes the hit area to 44 px without moving the text. */
.linkish { display: inline-block; background: none; border: 0; padding: 12px 4px; margin: -12px -4px; color: var(--accent); cursor: pointer; font-weight: 550; text-decoration: underline; text-underline-offset: 2px; }
.muted { color: var(--ink-3); font-size: 13.5px; }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan { position: relative; }
.plan.feature { border: 2px solid var(--accent); }
.plan .price { font: 800 40px/1 var(--display); margin: 8px 0 2px; }
.plan .price small { font: 500 15px var(--body); color: var(--ink-3); }
.plan ul { list-style: none; padding: 0; margin: 16px 0 20px; }
.plan li { padding: 5px 0 5px 26px; position: relative; }
.plan li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 12px; height: 7px; border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }
.ribbon { position: absolute; top: -12px; right: 16px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; background: var(--card); margin-bottom: 18px; }
.seg button { min-height: 38px; border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button.on, .seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.faq p { color: var(--ink-2); margin: 0 0 12px; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lib .item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.lib .item .thumb { aspect-ratio: 4/3; background: var(--mat); position: relative; cursor: pointer; }
.lib .item .thumb svg { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
.lib .item .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.lib .item .meta .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib .item .row { display: flex; gap: 6px; }
.lib .item .row .btn { flex: 1 1 auto; min-width: 0; white-space: normal; text-align: center; line-height: 1.2; padding-left: 10px; padding-right: 10px; }
.lib .item .row .more { flex: none; width: var(--tap); padding: 0; font-size: 18px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }

#toast { position: fixed; left: 50%; bottom: max(24px, calc(var(--safe-b) + 16px)); transform: translate(-50%, 20px); display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-weight: 550; opacity: 0; transition: .2s; pointer-events: none; z-index: 70; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.show:has(button) { pointer-events: auto; }
#toast button { min-height: var(--tap); margin: -10px -6px -10px 0; padding: 0 6px; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#toast button:focus-visible { outline-color: var(--paper); }
dialog#modal { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
dialog#modal::backdrop { background: rgba(20, 28, 24, .45); }
#modal-body { padding: 24px; }
#modal-body h2 { font-size: 22px; margin-bottom: 8px; }
#modal-body p { color: var(--ink-2); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.foot { border-top: 1px solid var(--line); padding: 22px max(24px, var(--safe-r)) max(28px, calc(var(--safe-b) + 16px)) max(24px, var(--safe-l)); color: var(--ink-3); font-size: 13px; text-align: center; }
.foot p { margin: 4px auto; max-width: 720px; }
.foot .fine { font-size: 12px; }

/* Touch screens: every control 44 px tall. */
@media (pointer: coarse) {
  .btn.sm, .chip, .layer { min-height: var(--tap); }
  .seg button { min-height: 40px; }
}

@media (max-width: 899px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .why { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 18px; order: 2; }
  .stage { order: 1; }
  .stagebar { position: static; }
  .plans { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  :root { --top-h: 104px; }
  .top { padding: calc(6px + var(--safe-t)) max(16px, var(--safe-r)) 5px max(16px, var(--safe-l)); column-gap: 10px; row-gap: 4px; flex-wrap: wrap; align-content: center; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .wrap, .page { padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r)); }
  .matwrap { padding: 12px 16px; }
  .mat { padding: 22px 10px 10px 22px; min-height: 240px; }
  .stagebar { padding: 10px 16px; }
  .stagebar .actions { margin-left: 0; width: 100%; }
  .stagebar .actions .btn { flex: 1; }
  .pill.usage { display: none; }
  .who .acct { max-width: 11em; }
  .check-file { grid-template-columns: auto minmax(0, 1fr); }
  .check-file > .btn { grid-column: 1 / -1; width: 100%; }
}

/* Phone editor: one fixed screen sized to the visible viewport. The page never scrolls; the panel does. */
@media (max-width: 899px) {
  body.in-editor > .top, body.in-editor > .foot, body:has(.ed-shell) > .top, body:has(.ed-shell) > .foot { display: none; }
  body.in-editor #toast, body:has(.ed-shell) #toast { bottom: calc(var(--safe-b) + 100px); }
  .ed-shell { position: fixed; inset: 0; top: 0; z-index: 30; height: var(--vvh, 100dvh); min-height: 0; transform: translateY(var(--vvt, 0px)); background: var(--paper); grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(180px, 1fr) auto auto auto; grid-template-areas: "head" "preview" "tabs" "panel" "main"; padding: var(--safe-t) var(--safe-r) 0 var(--safe-l); }
  .ed-shell::before { display: none; }
  .ed-head { min-height: 48px; padding: 0 4px; }
  .ed-head h1 { font-size: 18px; text-align: center; }
  .ed-preview { padding: 0 12px 10px; }
  .ed-preview .mat { padding: 20px 8px 8px 20px; border-radius: 14px; }
  .ed-preview[data-zoom] { touch-action: none; }
  .ed-chips { left: 20px; bottom: 18px; }
  .ed-fix { left: 20px; top: 8px; }
  .ed-zoom { right: 20px; top: 8px; }
  .ed-status { right: 20px; bottom: 18px; }
  .ed-tabs { background: var(--card); border-top: 1px solid var(--line); padding: 0 4px; }
  .ed-panel { max-height: calc(var(--vvh, 100dvh) * 0.38); background: var(--card); padding: 14px 16px; }
  .ed-main { background: var(--card); padding: 10px 16px max(12px, var(--safe-b)); }

  /* Typing: preview fills the space, the field and style strip dock above the keyboard. */
  .ed-shell.typing { grid-template-rows: 0 minmax(0, 1fr) 0 auto 0; }
  .ed-shell.typing .ed-head, .ed-shell.typing .ed-tabs, .ed-shell.typing .ed-main { display: none; }
  .ed-shell.typing .ed-preview { padding-top: 10px; }
  .ed-shell.typing .ed-panel { max-height: none; overflow: visible; padding: 0; border-top: 1px solid var(--line); }
  .ed-shell.typing .ed-panel > :not(.ed-dock) { display: none; }
  .ed-shell.typing .ed-dock { margin: 0; padding: 8px 12px 8px; gap: 6px; }
  .ed-shell.typing .ed-dock .lbl, .ed-shell.typing .ed-dock .help { display: none; }
  .ed-shell.typing .ed-done { display: inline-flex; align-items: center; }
  .ed-shell:not(.typing) .ed-dock .ed-strip.dock-only { display: none; }
}
/* Phone on its side: preview left, controls right. */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  .ed-shell:not(.typing) { grid-template-columns: minmax(0, 1fr) minmax(300px, 44%); grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "preview head" "preview tabs" "preview panel" "preview main"; }
  .ed-shell:not(.typing) .ed-preview { padding: 10px 12px; }
  .ed-shell:not(.typing) .ed-panel { max-height: none; }
}
/* Big text or browser zoom on a narrow phone: stack and let the page scroll, so nothing is cut off. */
@media (max-width: 599px) and (max-height: 419px) {
  .ed-shell:not(.typing) { position: static; height: auto; transform: none; grid-template-rows: auto 260px auto auto auto; }
  .ed-shell:not(.typing) .ed-panel { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .tool-card:hover, .btn:active { transform: none; }
}
@media (forced-colors: active) {
  .ed-tab[aria-selected="true"], .ed-tab.on { text-decoration: underline; text-underline-offset: 6px; }
  .chip.on, .chip[aria-pressed="true"], .chip[aria-checked="true"], .ed-style.on, .ed-style[aria-checked="true"], .ed-tile.on, .ed-tile[aria-checked="true"], .fontpick .on, .fontpick [aria-selected="true"] { outline: 2px solid Highlight; }
}
