/* Kilobyte Press: instrument-panel look, cool neutrals, one cobalt accent.
   Layout: split hero (promise + example result ticket), tool panel, two-column reference content, link-rich footer. */
:root {
  --bg: #eef1f4; --panel: #ffffff; --ink: #141820; --muted: #5b6472; --line: #d6dce4;
  --accent: #2f45ff; --accent-ink: #ffffff; --accent-soft: #e3e7ff;
  --good: #11804a; --good-soft: #dcf3e6; --bad: #b4321f; --bad-soft: #fbe3de;
  --check-a: #e4e8ee; --check-b: #f6f8fa; --grid: rgba(47, 69, 255, .07);
  --shadow: 0 1px 2px rgba(20,24,32,.06), 0 6px 20px rgba(20,24,32,.06);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --panel: #171b23; --ink: #e8ecf2; --muted: #98a2b3; --line: #2a303c;
    --accent: #7d8cff; --accent-ink: #0d1020; --accent-soft: #232a52;
    --good: #4fd18b; --good-soft: #143224; --bad: #ff8a75; --bad-soft: #3a1c16;
    --check-a: #1c212a; --check-b: #242a35; --grid: rgba(125, 140, 255, .08);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--f-body); }
a { color: var(--accent); }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.container { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.site-head { border-bottom: 1px solid var(--line); background: var(--panel); }
.site-head .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.logo { font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logo::before { content: "KB"; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 12px; letter-spacing: 0; }
.logo span { color: var(--accent); }
.site-head nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-head nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-head nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding-block: 34px 22px; }
.hero h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 4.6vw, 46px); line-height: 1.06; letter-spacing: -0.025em; margin: 0 0 12px; text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; font-size: 16.5px; }
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: center; }
@media (max-width: 860px) { .hero-split { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }

/* Example-result ticket: the product's promise, shown as a receipt. */
.ticket { margin: 0; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 10px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 14px 14px; }
.t-row { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.t-row.out { background: var(--panel); border-color: var(--accent); }
.t-k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.t-file { font-family: var(--f-mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-v { font-family: var(--f-mono); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.t-row:not(.out) .t-v { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; font-size: 16px; }
.t-arrow { justify-self: center; color: var(--accent); font-size: 20px; line-height: 1; }
.t-ok { font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 8px; background: var(--good-soft); color: var(--good); }
@media (max-width: 560px) { .ticket { display: none; } } /* keep the tool above the fold on phones */
.ticket figcaption { position: absolute; top: -10px; right: 16px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 2px 8px; border-radius: 99px; }

/* ---------- tool ---------- */
.tool { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .tool { grid-template-columns: minmax(0, 1fr); } .tool .work { order: -1; } .drop { min-height: 0 !important; padding-block: 24px !important; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.req { padding: 18px; display: grid; gap: 14px; }
.req h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; font-weight: 600; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.dash { padding-bottom: 10px; color: var(--muted); }
.fld { display: grid; gap: 5px; min-width: 0; }
.fld label, .fld .lbl { font-size: 12.5px; font-weight: 600; }
.fld input, .fld select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font-family: var(--f-mono); }
.fld input:focus, .fld select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.fld select { font-family: var(--f-body); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 4px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.icon-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; cursor: pointer; line-height: 1.2; }
.icon-btn:hover { border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
#pxNote { margin-top: -6px; color: var(--accent); }

.work { display: grid; gap: 14px; align-content: start; }
.drop { border: 2px dashed var(--line); border-radius: 14px; background: var(--panel); padding: 32px 20px; min-height: 360px; display: grid; gap: 10px; justify-items: center; align-content: center; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 52px; height: 52px; color: var(--accent); }
.drop strong { font-family: var(--f-display); font-size: 22px; letter-spacing: -0.01em; }
.drop p { margin: 0 0 6px; color: var(--muted); }
.drop.loaded { min-height: 0; padding: 12px 14px; grid-template-columns: minmax(0, 1fr) auto; justify-items: start; text-align: left; align-items: center; border-style: solid; }
.drop.loaded .drop-big { display: none; }
.drop.loaded .btn.big { padding: 9px 16px; font-size: 14px; }
.steps { list-style: none; display: flex; gap: 8px 22px; flex-wrap: wrap; justify-content: center; padding: 0; margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.steps li { display: inline-flex; align-items: center; gap: 7px; }
.steps b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
#srcInfo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.big { padding: 13px 24px; font-size: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; justify-self: start; }

.editor { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 640px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.pane { padding: 14px; display: grid; gap: 10px; align-content: start; }
.pane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pane-head b { font-size: 13px; }
.checker { background-color: var(--check-b); background-image: linear-gradient(45deg, var(--check-a) 25%, transparent 25%, transparent 75%, var(--check-a) 75%), linear-gradient(45deg, var(--check-a) 25%, transparent 25%, transparent 75%, var(--check-a) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; border-radius: 10px; }
#pvBox { display: grid; place-items: center; padding: 10px; min-height: 200px; }
#pv { display: block; max-width: 100%; box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(0,0,0,.12); touch-action: none; }
#pv.pannable { cursor: grab; }
#pv.pannable:active { cursor: grabbing; }
.crop-tools { display: flex; gap: 10px; align-items: center; }
.crop-tools input[type=range], .adj-row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.adjust { border-top: 1px solid var(--line); padding-top: 10px; }
.adjust summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.adjust[open] summary { margin-bottom: 10px; color: var(--ink); }
.adjust > :not(summary) + :not(summary) { margin-top: 8px; }
.adj-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 13px; }
.adj-row output { text-align: right; font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.check input { accent-color: var(--accent); }
.out-img { display: grid; place-items: center; padding: 10px; min-height: 120px; }
.out-img img { max-height: 260px; box-shadow: 0 0 0 1px var(--line); }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.big-size { font-family: var(--f-mono); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.status { font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 8px; }
.status.ok { background: var(--good-soft); color: var(--good); }
.status.ok::before { content: "\2713\00a0"; }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.busy { background: var(--accent-soft); color: var(--accent); }

/* ---------- content ---------- */
.content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 56px; margin-top: 56px; align-items: start; }
@media (max-width: 860px) { .content { grid-template-columns: minmax(0, 1fr); } }
.prose { max-width: 70ch; min-width: 0; }
.prose h2 { font-family: var(--f-display); font-size: 24px; letter-spacing: -0.01em; margin: 0 0 10px; text-wrap: balance; }
.prose h3 { font-size: 16px; margin: 18px 0 4px; }
.prose ol, .prose ul { padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.spec { border-collapse: collapse; font-size: 14px; margin-top: 8px; width: 100%; }
.spec td { border-bottom: 1px solid var(--line); padding: 7px 14px 7px 0; }
.spec td:first-child { color: var(--muted); width: 40%; }
details.faq, .prose details { border-top: 1px solid var(--line); padding-block: 11px; }
.prose details summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.prose details summary::-webkit-details-marker { display: none; }
.prose details summary::after { content: "+"; color: var(--accent); font-weight: 600; font-size: 18px; line-height: 1.2; }
.prose details[open] summary::after { content: "\2212"; }
.prose details p { margin: 6px 0 0; color: var(--muted); }

.article { max-width: 70ch; }
.article h2 { margin-top: 28px; }
.crumbs { font-size: 13px; color: var(--muted); padding-top: 18px; }
.crumbs a { color: var(--muted); }
.guide-list { display: grid; gap: 10px; }
.guide-card { display: grid; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.guide-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.guide-card b { font-family: var(--f-display); font-size: 17px; }
.guide-card span { color: var(--muted); font-size: 13.5px; }

.related { margin-top: 56px; }
.related h2 { font-family: var(--f-display); font-size: 24px; margin: 0 0 4px; }
.related h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 2px; padding: 12px 14px; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile b { font-weight: 600; }
.tile span { font-size: 12.5px; color: var(--muted); font-family: var(--f-mono); }

.ad-slot { margin-top: 28px; min-height: 100px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 64px; padding-block: 36px 28px; background: var(--panel); font-size: 13.5px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
.foot-about p { color: var(--muted); margin: 8px 0 0; max-width: 34ch; }
.site-foot h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-foot ul a { color: var(--ink); text-decoration: none; }
.site-foot ul a:hover { color: var(--accent); }
.foot-legal { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 16px; color: var(--muted); }
.foot-legal a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
