@font-face { font-family: "Albert Sans"; src: url("/assets/albert-sans.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fira Code"; src: url("/assets/fira-code.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #08090a; --surface: #0f1011; --raised: #161718; --border: #23252a;
  --ink: #f7f8f8; --muted: #8a8f98; --accent: #02b8cc; --on-accent: #08090a;
  --error: #eb5757; --ok: #27a644; --fill: rgba(2, 184, 204, .16);
  --sans: "Albert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ffffff; --surface: #f4f5f6; --raised: #ffffff; --border: #e0e2e6;
    --ink: #08090a; --muted: #62666d; --accent: #007a89; --on-accent: #ffffff;
    --error: #c62828; --ok: #1a7f37; --fill: rgba(0, 122, 137, .12);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --surface: #f4f5f6; --raised: #ffffff; --border: #e0e2e6;
  --ink: #08090a; --muted: #62666d; --accent: #007a89; --on-accent: #ffffff;
  --error: #c62828; --ok: #1a7f37; --fill: rgba(0, 122, 137, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--sans); }
code, pre, .mono, textarea { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
code { font-size: 13px; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.wrap { max-width: 1376px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 32px; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 6px; z-index: 20; }
.skip:focus { left: 16px; }

/* header */
.top { border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.wordmark { font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.wordmark svg { display: block; }
.errstr { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.errstr.fixed .code-num { text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.theme { background: none; border: 0; box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); border-radius: 6px; font: inherit; font-size: 13px; padding: 4px 8px; cursor: pointer; }
.theme:hover { color: var(--ink); }
@media (max-width: 620px) { .errstr { order: 3; flex-basis: 100%; } }

/* hero */
.hero { padding: 32px 0 24px; }
.hero h1 { font-size: 32px; max-width: 22ch; }
.hero .lede { color: var(--muted); margin-top: 8px; max-width: 64ch; }
@media (min-width: 900px) { .hero { padding: 48px 0 24px; } .hero h1 { font-size: 48px; letter-spacing: -.02em; } .hero .lede { font-size: 20px; line-height: 1.4; } }
.page .hero h1 { font-size: 32px; max-width: 28ch; }

/* tool */
.tool { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .tool { grid-template-columns: minmax(0, 1fr) minmax(0, .95fr) minmax(0, 1.15fr); align-items: start; } }
.pane { background: var(--surface); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); min-width: 0; display: flex; flex-direction: column; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 48px; }
.pane-head > span { white-space: nowrap; }
.tool .pane-head h2, .pane-head label { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.pane-body { padding: 16px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.editor { position: relative; display: flex; height: 300px; border-radius: 0; }
@media (min-width: 1100px) { .editor { height: 420px; } }
.editor.over { box-shadow: inset 0 0 0 2px var(--accent); }
.gutter { flex: 0 0 40px; overflow: hidden; padding: 12px 0; text-align: right; color: var(--muted); font: 400 13px/20px var(--mono); border-right: 1px solid var(--border); user-select: none; }
.gutter div { padding-right: 8px; height: 20px; opacity: .6; }
.gutter div.bad { color: var(--error); opacity: 1; }
.gutter div.bad::before { content: "\203A"; margin-right: 2px; }
.editor textarea { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; color: var(--ink); font-size: 13px; line-height: 20px; padding: 12px; white-space: pre; overflow: auto; tab-size: 2; }
.editor textarea::placeholder { color: var(--muted); opacity: .75; }
.editor textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.status { padding: 8px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); min-height: 37px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--error); }
.problems { list-style: none; margin: 0; padding: 0 16px 12px; font-size: 13px; color: var(--muted); }
.problems li { padding: 2px 0; }
.problems li.err { color: var(--error); }
.problems .ln { font-family: var(--mono); margin-right: 8px; }

/* rows */
.rows { padding: 8px 16px 16px; }
@media (min-width: 1100px) { .rows { max-height: 560px; overflow: auto; } }
.empty { color: var(--muted); font-size: 13px; padding: 24px 0; }
.row { padding: 16px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.row-head { min-width: 0; }
.row-head code { font-size: 13px; color: var(--ink); min-width: 0; max-width: 100%; overflow-wrap: break-word; }
.tag { font-size: 13px; line-height: 18px; color: var(--muted); border-radius: 9999px; box-shadow: inset 0 0 0 1px var(--border); padding: 0 8px; white-space: nowrap; }
.tag.paid { color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); background: var(--bg); padding: 2px; gap: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; font-size: 13px; font-weight: 500; padding: 6px 4px; border-radius: 4px; color: var(--muted); cursor: pointer; min-height: 32px; }
.seg label:hover { color: var(--ink); }
.seg input:checked + label { background: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-sum { font-size: 13px; color: var(--muted); margin: 8px 0; }
.owner { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.owner input { font: 400 13px var(--mono); background: var(--bg); color: var(--ink); border: 0; box-shadow: inset 0 0 0 1px var(--border); border-radius: 6px; padding: 6px 8px; width: 160px; }
.owner input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--error); }
.matrix { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 13px; margin-top: 8px; }
.matrix th { font-weight: 400; color: var(--muted); text-align: left; padding: 2px 4px; }
.matrix thead th { font-family: var(--mono); font-size: 13px; text-align: center; padding: 2px 0; }
.matrix thead th:first-child { width: 116px; }
.matrix tbody th { font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix td { height: 22px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--border); text-align: center; color: transparent; font-size: 13px; line-height: 22px; }
.matrix td.on { background: var(--accent); box-shadow: none; color: var(--on-accent); }
.warns { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.warns li { overflow-wrap: break-word; min-width: 0; padding: 4px 0 4px 12px; border-left: 2px solid var(--border); margin-top: 4px; }
.warns li.block { color: var(--error); border-left-color: var(--error); }
.payrow { margin: 4px 0 8px; padding: 16px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--accent); background: var(--fill); }
.payrow p { font-size: 13px; }
.payrow strong { font-weight: 600; }
.payrow .btn { margin-top: 12px; width: 100%; }
.payrow .fine { color: var(--muted); margin-top: 8px; }
.opts { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.opts input { accent-color: var(--accent); margin-top: 3px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 13px/1 var(--sans); border: 0; border-radius: 6px; padding: 10px 12px; min-height: 36px; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--border); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* output */
.tabs { display: flex; gap: 2px; min-width: 0; }
.tabs button { font: 500 13px var(--sans); color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); background: var(--raised); box-shadow: inset 0 0 0 1px var(--border); }
.code { font: 400 13px/20px var(--mono); overflow: auto; padding: 12px 0; height: 352px; } /* 12px + 17 whole lines: no half line at the bottom edge */
@media (min-width: 1100px) { .code { height: 452px; } } /* 12px + 22 whole lines */
.code .l { display: flex; white-space: pre; min-width: max-content; padding-right: 16px; }
.code .l::before { content: "+"; flex: 0 0 32px; text-align: center; color: var(--accent); user-select: none; }
.code .l.c { color: var(--muted); }
.code .l.b::before { content: ""; }
.code .l.hl { background: var(--fill); }
.code.prose { padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.code .hole { color: var(--muted); padding: 24px 16px; font-family: var(--sans); font-size: 13px; line-height: 1.55; white-space: normal; }
.code .hole .btn { margin-top: 12px; }
.out-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.out-foot select { font: 400 13px var(--sans); background: var(--bg); color: var(--ink); border: 0; box-shadow: inset 0 0 0 1px var(--border); border-radius: 6px; padding: 8px; min-height: 36px; }
.out-foot .grow { flex: 1; }
/* The note is a row of the pane footer, under the scrolling code area, never on top of it. */
.locknote { font-size: 13px; line-height: 20px; color: var(--muted); padding: 12px 16px; border-top: 1px solid var(--border); }
.locknote[hidden] { display: none; }
@media (max-width: 1099px) {
  .out-foot { position: sticky; bottom: 0; background: var(--surface); border-radius: 0 0 12px 12px; box-shadow: inset 0 0 0 1px var(--border); z-index: 5; }
  .out-foot .copy { flex: 1; }
}
.trust { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* content */
.below { padding: 48px 0 0; display: grid; gap: 48px; grid-template-columns: minmax(0, 1fr); }
.below > * { min-width: 0; }
.prose code, .three code, details code { overflow-wrap: anywhere; }
.below h2 { font-size: 24px; margin-bottom: 12px; }
.below h3 { font-size: 15px; margin: 24px 0 8px; }
.prose { max-width: 72ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.three { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.three li { padding-left: 16px; border-left: 2px solid var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
pre.sql { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); border-radius: 12px; padding: 16px; overflow: auto; font-size: 13px; line-height: 20px; margin: 0 0 12px; max-width: 100%; }
.tablewrap { overflow-x: auto; margin: 0 0 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data thead th { color: var(--muted); font-weight: 500; background: var(--surface); }
table.data th, table.data td { overflow-wrap: break-word; }
table.data code { overflow-wrap: anywhere; }
table.data tr:last-child td { border-bottom: 0; }
/* Narrow screens: each row becomes a card, the column name sits above its value. Nothing scrolls sideways. */
@media (max-width: 719px) {
  .tablewrap { overflow-x: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.data tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { border-bottom: 0; padding: 4px 12px; overflow-wrap: anywhere; }
  table.data td::before { content: attr(data-label); display: block; color: var(--muted); font-weight: 500; }
}
.cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); list-style: none; padding: 0; margin: 0; }
.cards a { display: block; padding: 12px 16px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); color: var(--ink); text-decoration: none; font-size: 13px; height: 100%; }
.cards a:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.cards a span { display: block; color: var(--muted); margin-top: 2px; }
.price { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 720px; }
.price > div { padding: 16px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); }
.price .amt { font-size: 24px; font-weight: 600; margin: 4px 0 8px; }
.price ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
details { border-bottom: 1px solid var(--border); padding: 12px 0; max-width: 72ch; }
summary { cursor: pointer; font-weight: 500; }
details p { margin-top: 8px; color: var(--muted); }
.fb { max-width: 480px; display: grid; gap: 8px; }
.fb textarea { font: 400 15px/1.4 var(--sans); background: var(--surface); color: var(--ink); border: 0; box-shadow: inset 0 0 0 1px var(--border); border-radius: 6px; padding: 8px 12px; min-height: 72px; resize: vertical; }
.fb .btn { justify-self: start; }
.foot { margin-top: 64px; border-top: 1px solid var(--border); padding: 24px 0 96px; color: var(--muted); font-size: 13px; }
.foot nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.foot a { color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); padding-top: 24px; }
.crumbs a { color: var(--muted); }
.page .hero { padding-top: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .matrix td, .seg label, .btn, .cards a { transition: background-color .12s ease, color .12s ease, box-shadow .12s ease; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
