:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --ink: #1d1b18;
  --muted: #5f5a52;
  --line: #ddd6c8;
  --accent: #0f6e5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --warn-bg: #fff4d6;
  --warn-line: #e3b341;
  --error: #b42318;
  --radius: 18px;
  --shadow: 0 1px 0 #0000000a, 0 8px 24px -12px #3a2f1a33;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #151412; --paper: #1f1d1a; --ink: #f2efe8; --muted: #b0a99d; --line: #3a3630;
    --accent: #5fd0b6; --accent-ink: #0c1a16; --accent-soft: #1c3631;
    --warn-bg: #3a2f12; --warn-line: #a07a1f; --error: #ff8a7a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

.top { max-width: 1180px; margin: 0 auto; padding: 20px 16px 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand img { align-self: center; }
.tagline { margin: 0; color: var(--muted); }

.layout { max-width: 1180px; margin: 0 auto; padding: 12px 16px 32px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.narrow { max-width: 860px; margin: 0 auto; padding: 12px 16px 40px; display: grid; gap: 20px; }
.narrow > div { display: grid; gap: 20px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel section + section { margin-top: 28px; padding-top: 24px; border-top: 1px dashed var(--line); }
h1 { font-size: 1.5rem; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin: 0 0 16px; letter-spacing: -0.01em; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 0.85rem; }

fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; margin-bottom: 14px; min-width: 0; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-weight: 400;
}
textarea { min-height: 90px; resize: vertical; }
input[type="color"] { width: 100%; height: 44px; padding: 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
input[type="file"] { font-weight: 400; font-size: 0.9rem; max-width: 100%; }
input[type="range"] { width: 100%; margin: 0 0 16px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.check, .radio { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input, .radio input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.radio input:disabled + span { opacity: 0.45; }
.hint { color: var(--muted); font-size: 0.86rem; margin: -6px 0 14px; font-weight: 400; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.type { position: relative; margin: 0; padding: 10px 12px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; text-align: center; font-weight: 600; display: block; background: var(--bg); }
.type input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.type:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.links { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; align-items: center; }
@media (max-width: 520px) { .link-row { grid-template-columns: 1fr auto; } .link-row input[type="url"] { grid-column: 1; grid-row: 2; } .link-row .btn { grid-row: 1 / span 2; grid-column: 2; } }
.logo-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.logo-row label { flex: 1; }
.logo-row .btn { margin-bottom: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn.wide { width: 100%; margin-bottom: 12px; }

.created { margin-top: 16px; overflow-wrap: anywhere; }
.warn { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-radius: 12px; padding: 12px 14px; }
.warn p { margin: 0 0 8px; }
.manage-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.error { color: var(--error); font-weight: 600; min-height: 1.5em; margin: 8px 0 0; }

.preview { position: sticky; top: 16px; }
@media (max-width: 860px) { .preview { position: static; } }
.canvas { aspect-ratio: 1 / 1.15; display: grid; place-items: center; padding: 16px; margin-bottom: 14px; border-radius: 14px;
  background: repeating-conic-gradient(#0000000d 0 25%, transparent 0 50%) 0 0 / 20px 20px, var(--bg); }
.canvas svg { width: 100%; height: 100%; max-height: 100%; }
.canvas .empty { color: var(--muted); text-align: center; margin: 0; }

.big { font-size: 2.4rem; font-weight: 800; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
figure { margin: 0; }
figcaption { font-weight: 700; margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
td:last-child { position: relative; width: 45%; padding-left: 8px; font-variant-numeric: tabular-nums; }
.bar { position: absolute; left: 0; top: 5px; bottom: 5px; background: var(--accent-soft); border-radius: 4px; z-index: 0; }
td:last-child { isolation: isolate; }
.bar + span { position: relative; }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 0.86rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: 0.2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Landing pages */
.crumbs { max-width: 1180px; margin: 0 auto; padding: 4px 16px 0; font-size: 0.86rem; color: var(--muted); }
.crumbs a { color: inherit; }
.hero { max-width: 1180px; margin: 0 auto; padding: 8px 16px 4px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 6px; letter-spacing: -0.03em; }
.hero p { margin: 0; max-width: 62ch; color: var(--muted); }
.below { max-width: 1180px; margin: 0 auto; padding: 0 16px 32px; display: grid; gap: 20px; }
.article { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 40px); max-width: 820px; }
.article section + section { margin-top: 28px; }
.article h2 { display: block; font-size: 1.35rem; margin: 0 0 10px; }
.article p, .article li { max-width: 70ch; }
.article ol, .article ul { padding-left: 1.3em; }
.article li + li { margin-top: 6px; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; min-height: 24px; }
.faq details p { margin: 8px 0 0; }
.types-nav { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.types-nav h2 { display: block; font-size: 1.15rem; }
.types-nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.types-nav a, .types-nav span { display: block; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; min-height: 44px; }
.types-nav a:hover { border-color: var(--accent); }
.types-nav span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
