/* ==========================================================================
   jumphost.ch — visual SSH command builder
   ========================================================================== */

:root {
  --bg:            #0a0e13;
  --bg-grad:       radial-gradient(1200px 620px at 78% -12%, rgba(56,189,248,.13), transparent 62%),
                   radial-gradient(900px 520px at 6% 0%, rgba(52,211,153,.07), transparent 58%);
  --surface:       #10161e;
  --surface-2:     #151d27;
  --surface-3:     #1b2531;
  --border:        #22303f;
  --border-soft:   #1a242f;
  --text:          #e4ecf4;
  --text-dim:      #9aabbf;
  --muted:         #6f8298;
  --accent:        #38bdf8;
  --accent-ink:    #03212f;
  --accent-soft:   rgba(56,189,248,.12);
  --green:         #34d399;
  --amber:         #fbbf24;
  --red:           #f87171;
  --violet:        #a78bfa;
  --shadow:        0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.55);
  --radius:        14px;
  --radius-sm:     9px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="light"] {
  --bg:            #f4f7fa;
  --bg-grad:       radial-gradient(1100px 560px at 80% -14%, rgba(14,165,233,.10), transparent 60%),
                   radial-gradient(800px 480px at 4% 0%, rgba(16,185,129,.07), transparent 58%);
  --surface:       #ffffff;
  --surface-2:     #f7f9fc;
  --surface-3:     #eef2f7;
  --border:        #d7e0ea;
  --border-soft:   #e5ebf2;
  --text:          #10202f;
  --text-dim:      #47607a;
  --muted:         #6b7f95;
  --accent:        #0284c7;
  --accent-ink:    #ffffff;
  --accent-soft:   rgba(2,132,199,.10);
  --green:         #059669;
  --amber:         #b45309;
  --red:           #dc2626;
  --violet:        #7c3aed;
  --shadow:        0 1px 2px rgba(16,32,47,.06), 0 10px 28px -14px rgba(16,32,47,.22);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .89em; }
em { font-style: normal; }
hr.sep { border: 0; border-top: 1px solid var(--border-soft); margin: 18px 0; }

.wrap { width: min(1440px, 100% - 40px); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 12px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* data-when toggles the hidden attribute, and .field/.check/.grid all set a
   display of their own — an author rule, which beats the browser's default for
   [hidden] no matter how specific that default looks. Without this the
   conditional fields are simply always on screen. */
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark rect { fill: var(--accent-soft); }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-dot { color: var(--muted); font-weight: 500; }
.header-nav { display: flex; align-items: center; gap: 8px; }

.icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 13.5px; font-weight: 550;
  padding: 8px 13px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
/* One look for every unavailable button on the page. */
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { filter: none; }
.btn:disabled:active { transform: none; }
.btn-ghost { color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }
.btn-soft:hover { background: var(--surface-3); color: var(--text); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn code { background: rgba(127,127,127,.16); padding: 1px 4px; border-radius: 4px; }

/* ---------- hero ---------- */
.hero { padding: 46px 0 26px; }
/* On a wide screen the headline and the lede sit side by side so the copy uses
   the whole measure of the page instead of hugging the left edge. Each keeps a
   sane line length of its own — spreading one paragraph across 1440px would be
   the other kind of unreadable. */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 12px 56px;
  align-items: end;
}
.hero h1 { grid-column: 1; font-size: clamp(28px, 3.6vw, 46px); max-width: 22ch; }
.lede { grid-column: 2; max-width: 68ch; color: var(--text-dim); font-size: 15.5px; padding-bottom: 3px; }
.lede code { background: var(--surface-2); border: 1px solid var(--border-soft); padding: 1px 5px; border-radius: 5px; }
.privacy {
  grid-column: 1 / -1; justify-self: start;
  margin-top: 8px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 26%, transparent);
  padding: 7px 13px; border-radius: 999px;
}

/* ---------- presets ---------- */
.presets { padding: 14px 0 6px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hint code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

.preset-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 232px; gap: 10px;
  overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.preset {
  scroll-snap-align: start; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 14px; color: var(--text); font: inherit;
  transition: border-color .15s ease, transform .12s ease, background .15s ease;
  display: flex; flex-direction: column; gap: 5px;
}
.preset:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--surface-2); }
.preset-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 3px; }
.preset-ico .icon { width: 15px; height: 15px; }
.preset b { font-size: 13.5px; font-weight: 600; }
.preset span { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- layout ---------- */
.builder-wrap { padding-bottom: 60px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 620px); gap: 22px; align-items: start; }
.form-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.out-col { min-width: 0; }
.out-sticky { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card[open] { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; cursor: pointer; list-style: none; user-select: none;
  transition: background .14s ease;
}
.card-head::-webkit-details-marker { display: none; }
.card-head:hover { background: var(--surface-2); }
.card-head::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; flex: none;
  border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted);
  transform: rotate(45deg) translate(-2px,-2px); transition: transform .18s ease;
}
.card[open] > .card-head::after { transform: rotate(-135deg) translate(-2px,-2px); }
.card-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 620; font-size: 14.5px; }
.step {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700;
  font-family: var(--mono);
}
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-body {
  padding: 16px 16px 18px; border-top: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 14px;
}

/* ---------- form ---------- */
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.req { color: var(--accent); }
.tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border-soft); padding: 1px 5px; border-radius: 5px;
}

input[type="text"], input:not([type]), input[type="file"], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; min-width: 0;
  transition: border-color .14s ease, background .14s ease;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
input:disabled:hover, select:disabled:hover { border-color: var(--border); }
input:focus, select:focus { border-color: var(--accent); background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input.mono, .mono { font-family: var(--mono); }
select {
  appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% + 1px), calc(100% - 11px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; gap: 10px; cursor: pointer; align-items: flex-start; }
.check input[type="checkbox"] {
  appearance: none; width: 17px; height: 17px; flex: none; margin-top: 2px;
  border: 1.5px solid var(--border); border-radius: 5px; background: var(--surface-2);
  cursor: pointer; position: relative; transition: background .14s, border-color .14s;
}
.check input:hover { border-color: var(--accent); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(43deg);
}
/* Title and its flag chip share the first line; the explanation drops below. */
.check > span { font-size: 13px; min-width: 0; }
.check b { font-weight: 600; color: var(--text); margin-right: 6px; }
.check em { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.check em.warn { color: var(--amber); }
.check em strong { color: var(--text-dim); font-weight: 650; }

.note {
  margin-top: 14px; padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.55; border: 1px solid;
}
.note code { background: rgba(127,127,127,.16); padding: 1px 5px; border-radius: 4px; }
.note code.block { display: block; margin: 7px 0; padding: 8px 10px; }
.note-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text-dim); }
.note-info b { color: var(--accent); }
.note-warn { background: color-mix(in srgb, var(--amber) 11%, transparent); border-color: color-mix(in srgb, var(--amber) 32%, transparent); color: var(--text-dim); }
.note-warn b { color: var(--amber); }
/* The margin above is for notes sitting in prose on the legal page; inside a
   card the body's gap already does that job. */
.card-body > .note { margin-top: 0; }

/* ---------- dynamic rows ---------- */
.rows { display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.rows:empty { display: none; }
.row {
  display: grid; gap: 8px; align-items: end;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 11px;
}
.row-head { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; }
.row-badge {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent);
}
.row-badge.b-remote { background: color-mix(in srgb, var(--violet) 15%, transparent); color: var(--violet); }
.row-badge.b-dynamic { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.row-badge.b-hop { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.row-label { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.row-tools { display: flex; gap: 3px; margin-left: auto; }
.icon-btn {
  width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border-radius: 6px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; transition: all .14s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.icon-btn:disabled { opacity: .25; cursor: not-allowed; }
.row .field > label { font-size: 11.5px; }
.row-grid-4 { grid-template-columns: 1.4fr .8fr .8fr; }
.row-grid-fwd { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row-grid-2 { grid-template-columns: 1fr 1.4fr; }
.row-full { grid-template-columns: 1fr; }
.row-inline { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.row-inline input { flex: 1; }
.row-inline .row-tools { margin-left: 0; }
.row-arrow { display: grid; place-items: center; color: var(--muted); padding-bottom: 9px; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2);
}
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel-body { padding: 14px; }
.pill {
  margin-left: auto; font-size: 11.5px; font-family: var(--mono);
  background: var(--surface-3); border: 1px solid var(--border-soft);
  color: var(--text-dim); padding: 2px 9px; border-radius: 999px;
}

/* ---------- topology diagram ---------- */
.topology {
  display: flex; align-items: stretch; gap: 0; padding: 20px 14px 16px;
  overflow-x: auto; scrollbar-width: thin;
}
.node {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 108px; flex: none; text-align: center;
}
.node-box {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center;
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  position: relative; transition: all .2s ease;
}
.node-box .icon { width: 22px; height: 22px; stroke-width: 1.5; }
.node.n-local .node-box { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.node.n-jump .node-box { border-color: color-mix(in srgb, var(--amber) 55%, transparent); color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.node.n-target .node-box { border-color: var(--green); color: var(--green); background: color-mix(in srgb, var(--green) 11%, transparent); }
.node-name { font-size: 12.5px; font-weight: 600; max-width: 128px; overflow-wrap: anywhere; line-height: 1.3; }
.node-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; max-width: 128px; }
.node-role { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.link { flex: 1 1 46px; min-width: 46px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 26px; }
.link-line { width: 100%; height: 2px; background: linear-gradient(90deg, var(--border) 0 6px, transparent 6px 11px) repeat-x; background-size: 11px 2px; position: relative; }
.link-line::after {
  content: ""; position: absolute; right: -1px; top: -3px;
  border-left: 7px solid var(--accent); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.link-label { font-size: 10px; color: var(--muted); margin-top: 7px; font-family: var(--mono); white-space: nowrap; }
.link.encrypted .link-line { background: linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 11px) repeat-x; background-size: 11px 2px; opacity: .75; }

.tunnels { border-top: 1px solid var(--border-soft); padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.tunnels:empty { display: none; }
.tunnel {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12px; font-family: var(--mono);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.tunnel .t-kind {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; font-family: var(--sans);
}
.t-local   { background: var(--accent-soft); color: var(--accent); }
.t-remote  { background: color-mix(in srgb, var(--violet) 15%, transparent); color: var(--violet); }
.t-dynamic { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.tunnel .t-ep { color: var(--text); overflow-wrap: anywhere; }
.tunnel .t-arrow { color: var(--muted); }
.tunnel .t-note { font-family: var(--sans); font-size: 11.5px; color: var(--muted); width: 100%; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 13px; font-weight: 550; padding: 6px 12px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer; transition: all .14s ease;
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.is-active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.tabpane { display: none; }
.tabpane.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- code ---------- */
.code-block { position: relative; }
.code {
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 15px; margin: 0;
  overflow-x: auto; white-space: pre; color: var(--text);
  max-height: 340px; overflow-y: auto; scrollbar-width: thin;
  padding-right: 46px;                 /* clears the copy button */
}
/* Named for what it does, not "wrap": that is the page's layout container,
   and sharing the name put width: min(1440px, 100% - 40px) on every code
   block, shrinking it inside its own box and stranding the copy button. */
.code.is-wrapped { white-space: pre-wrap; overflow-wrap: anywhere; }
.code .c-bin  { color: var(--green); font-weight: 600; }
.code .c-flag { color: var(--accent); }
.code .c-val  { color: var(--text); }
.code .c-host { color: var(--amber); font-weight: 600; }
.code .c-str  { color: var(--violet); }
.code .c-cmt  { color: var(--muted); font-style: italic; }
.code .c-key  { color: var(--accent); }
/* Icon only: the clipboard glyph says it, and a square button leaves the code
   far more room than the word did. The name lives in title/aria-label. */
.btn-copy {
  position: absolute; top: 9px; right: 9px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.btn-copy.ok { border-color: var(--green); color: var(--green); }

/* ---------- validation ---------- */
.validation { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.validation:empty { display: none; }
.vmsg {
  display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.5;
  padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid;
}
.vmsg .icon { margin-top: 1px; }
.vmsg code { background: rgba(127,127,127,.16); padding: 1px 4px; border-radius: 4px; }
.v-error { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.v-warn  { background: color-mix(in srgb, var(--amber) 10%, transparent); border-color: color-mix(in srgb, var(--amber) 28%, transparent); color: var(--amber); }
.v-info  { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--accent); }
.v-ok    { background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 28%, transparent); color: var(--green); }

/* ---------- explain ---------- */
.explain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.explain li {
  display: grid; grid-template-columns: minmax(120px, 32%) 1fr; gap: 14px;
  padding: 9px 10px; border-radius: 8px; align-items: baseline;
}
.explain li:nth-child(odd) { background: var(--surface-2); }
.explain .e-tok { font-family: var(--mono); font-size: 12.5px; color: var(--accent); overflow-wrap: anywhere; }
.explain .e-tok.is-host { color: var(--amber); }
.explain .e-tok.is-bin { color: var(--green); }
.explain .e-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.explain .e-desc code { background: var(--surface-3); padding: 1px 4px; border-radius: 4px; }

/* ---------- toolkit ---------- */
.toolkit { display: flex; flex-direction: column; gap: 16px; }
.tk-item h3 { font-size: 13px; font-weight: 620; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; }
.tk-item > p { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
.tk-item .code { max-height: 220px; font-size: 12.5px; }

/* ---------- profiles ---------- */
.profile-bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.profile-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.profile-list:empty { display: none; }
.profile-list li {
  display: flex; align-items: center; gap: 0; padding: 0;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  transition: background .14s ease, border-color .14s ease;
}
.profile-list li:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
/* The row that matches the name in the field: the one the builder is on. */
.profile-list li.is-active { background: var(--accent-soft); border-color: var(--accent); }
.profile-list li.is-active .p-name { color: var(--accent); }

/* The whole row loads the profile; it is a button wearing the row's clothes.
   The row's padding lives here rather than on the <li>, so every pixel up to
   the delete button is a real click target and nobody has to aim. */
.p-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; margin: 0; padding: 9px 8px 9px 11px;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.profile-list .icon-btn { margin-right: 7px; }
.profile-list .p-name { font-size: 13px; font-weight: 550; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.profile-list .p-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.empty-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* ---------- storage / vault bar ---------- */
.storage-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px; margin-bottom: 12px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
/* The label asks for a real width rather than flex: 1, which let it shrink to
   a few characters so the row never wrapped — the buttons then sat on top of
   the text instead of moving below it. Once it cannot fit alongside them, the
   whole line wraps. */
.storage-bar .storage-state {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
  flex: 1 1 15rem; min-width: 0;
}
.storage-bar .storage-label { min-width: 0; }
.storage-bar .storage-state .icon { flex: none; }
.storage-bar .hint { flex-basis: 100%; }
.storage-bar.mode-open { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: color-mix(in srgb, var(--green) 9%, transparent); }
.storage-bar.mode-open .storage-state .icon { color: var(--green); }
.storage-bar.mode-locked { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.storage-bar.mode-locked .storage-state .icon { color: var(--accent); }
.storage-bar.mode-plain .storage-state .icon { color: var(--muted); }

/* ---------- withheld output ---------- */
.c-blocked { color: var(--red); font-style: italic; }

/* ---------- dialog ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text);
  width: min(760px, calc(100vw - 32px)); max-height: 84vh; overflow: hidden;
  box-shadow: 0 24px 70px -20px rgba(0,0,0,.7);
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(3,7,12,.68); backdrop-filter: blur(3px); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface); flex: none;
}
.dialog-head h2 { font-size: 16px; }
.dialog-body { padding: 18px; overflow-y: auto; flex: 1; min-height: 0; }
.dialog-sm { width: min(520px, calc(100vw - 32px)); }
/* A question that failed says so where it was asked, rather than closing and
   leaving a toast to explain in the corner. */
.ask-error {
  flex: none; margin: 0; padding: 0 18px 14px;
  font-size: 12.5px; line-height: 1.5; color: var(--red);
  display: flex; align-items: flex-start; gap: 7px;
}
.ask-error::before { content: "\26A0"; font-size: 13px; line-height: 1.35; }
.ask-error[hidden] { display: none; }

.dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px; flex: none;
  padding: 13px 18px; border-top: 1px solid var(--border-soft); background: var(--surface-2);
}

/* A real field so password managers file the passphrase under a stable name,
   kept off screen. Not display:none — managers skip those — and qualified past
   the input rules above, which would otherwise give it a full-width box sitting
   invisibly over the field below it. */
#ask-body input.vault-user {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; pointer-events: none;
}

/* questions asked before something irreversible or attacker-supplied happens */
.ask-lede { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin-bottom: 14px; }
.ask-lede b { color: var(--text); font-weight: 620; }
#ask-body .field { margin-bottom: 12px; }
#ask-body .field > label { font-size: 12.5px; }
#ask-body .check { margin-top: 10px; }
.ask-danger, .ask-warn {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 11px 12px; font-size: 12.5px; line-height: 1.55; color: var(--text-dim);
  margin-bottom: 12px;
}
.ask-danger { background: color-mix(in srgb, var(--red) 11%, transparent); border-color: color-mix(in srgb, var(--red) 34%, transparent); }
.ask-danger > b { color: var(--red); display: block; margin-bottom: 7px; }
.ask-warn { background: color-mix(in srgb, var(--amber) 11%, transparent); border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.ask-warn > b { color: var(--amber); }
.ask-danger em, .ask-warn em { font-style: normal; color: var(--muted); }
.ask-danger ul, .ask-warn ul, .ask-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ask-danger li, .ask-warn li, .ask-list li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ask-danger code, .ask-warn code {
  font-size: 12px; color: var(--text); background: rgba(127,127,127,.16);
  padding: 3px 6px; border-radius: 4px; overflow-wrap: anywhere;
}
.ask-list { margin-top: 10px; }
.ask-list li { flex-direction: row; align-items: baseline; gap: 8px; font-size: 12.5px; }
.ask-list em { font-family: var(--mono); font-size: 11px; color: var(--muted); font-style: normal; }
.cs-group { margin-bottom: 22px; }
.cs-group:last-child { margin-bottom: 0; }
.cs-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.cs-list { display: flex; flex-direction: column; gap: 4px; }
.cs-row { display: grid; grid-template-columns: minmax(150px, 40%) 1fr; gap: 14px; padding: 7px 9px; border-radius: 7px; align-items: baseline; }
.cs-row:nth-child(odd) { background: var(--surface-2); }
.cs-row code { color: var(--accent); font-size: 12.5px; overflow-wrap: anywhere; }
.cs-row span { font-size: 12.5px; color: var(--text-dim); }

/* ---------- no scripting ---------- */
.noscript-note {
  max-width: 70ch; margin: 18px auto; padding: 13px 16px;
  background: color-mix(in srgb, var(--amber) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent);
  border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.55; color: var(--text-dim);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--surface-3); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 550;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); padding: 26px 0 40px; margin-top: 20px; }
.footer-inner { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.footer-contact { margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.contact-link {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--accent); text-decoration: none; font-weight: 550;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  padding: 5px 12px; border-radius: 999px;
  transition: background .14s ease, border-color .14s ease;
}
.contact-link:hover, .contact-link:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.contact-link.revealed #contact-label,
.contact-link.revealed [data-contact-label] { font-family: var(--mono); font-size: 12px; }

.footer-links {
  margin-top: 10px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.footer-inner a:not(.contact-link) { color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.footer-inner a:not(.contact-link):hover,
.footer-inner a:not(.contact-link):focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
.sep-dot { color: var(--muted); }

/* ---------- prose pages (legal.html) ---------- */
.doc { max-width: 860px; padding: 34px 0 20px; }
/* Prose links only — .btn / .contact-link bring their own colours, and this rule
   would otherwise out-specify them (0,1,1 beats 0,1,0). */
.doc a:not(.btn):not(.contact-link) {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.doc a:not(.btn):not(.contact-link):hover,
.doc a:not(.btn):not(.contact-link):focus-visible { border-bottom-color: var(--accent); }

.doc-title { font-size: clamp(25px, 3.4vw, 34px); }
.doc-meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.doc-toc {
  margin-top: 22px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  font-size: 13px;
}
.doc-toc b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.doc-toc ol { margin: 8px 0 0; padding-left: 20px; color: var(--text-dim); }
.doc-toc li { margin: 3px 0; }

.doc section { margin-top: 34px; scroll-margin-top: 78px; }
.doc h2 {
  font-size: 19px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border-soft);
}
.doc h3 { margin-top: 20px; font-size: 14.5px; color: var(--text-dim); }
.doc section p { margin-top: 12px; color: var(--text-dim); max-width: 78ch; }
.doc section p b, .doc-list b { color: var(--text); font-weight: 650; }
.doc code { background: var(--surface-2); border: 1px solid var(--border-soft); padding: 1px 5px; border-radius: 5px; }

.doc-list { margin: 12px 0 0; padding-left: 20px; color: var(--text-dim); max-width: 78ch; }
.doc-list li { margin: 7px 0; }
.doc-list li::marker { color: var(--muted); }

.doc .note { max-width: 78ch; font-size: 13px; }
.doc-contact { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-contact + .hint { margin-top: 9px; max-width: 78ch; }
.doc-back { margin: 40px 0 10px; }

/* ---------- 404 ---------- */
.nf { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.nf-code { font-family: var(--mono); font-size: 64px; color: var(--accent); line-height: 1; }
.nf p { margin: 14px 0 22px; color: var(--text-dim); }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .builder { grid-template-columns: minmax(0,1fr); }
  .out-sticky { position: static; }
  .out-col { order: -1; }
}
@media (max-width: 900px) {
  /* Too narrow for two readable columns: back to one, with the lede under the
     headline where it started. */
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero h1, .lede, .privacy { grid-column: 1; }
  .hero h1 { max-width: 20ch; }
  .lede { margin-top: 14px; max-width: 74ch; padding-bottom: 0; }
  .privacy { margin-top: 16px; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .hero { padding: 30px 0 18px; }
  .cols-3, .cols-2 { grid-template-columns: minmax(0,1fr); }
  .span-2 { grid-column: auto; }
  .row-grid-4, .row-grid-fwd, .row-grid-2 { grid-template-columns: minmax(0,1fr); }
  .explain li, .cs-row { grid-template-columns: minmax(0,1fr); gap: 3px; }
  .code { padding-right: 42px; }
  .btn-copy { top: 7px; right: 7px; }
  .brand-text { font-size: 15px; }
  .preset-rail { grid-auto-columns: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .presets, .hero, .profiles-panel, .site-footer, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}
