/* Pikkola CIDR: ink on paper, one green accent, and a bit strip that is always
   readable whatever the theme. Weights stay at 400, 500, 600 and 700. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/tools/cidr/fonts/inter.woff2) format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/tools/cidr/fonts/jetbrains-mono.woff2) format("woff2");
}

:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
  --r: 14px;
  --r-sm: 8px;
}
html[lang="ko"] {
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  word-break: keep-all;
}
html[lang="ja"] {
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  word-break: normal;
}
html[lang="ja"] h1,
html[lang="ja"] h2,
html[lang="ja"] h3,
html[lang="ja"] p,
html[lang="ja"] li,
html[lang="ja"] summary { line-break: strict; overflow-wrap: break-word; word-break: auto-phrase; }
html[lang="ja"] .hero h1 { max-width: 15ch; font-size: clamp(1.95rem, 3.9vw, 3.1rem); }

html[data-theme="light"] {
  --bg: #f2f0e8;
  --bg-2: #e9e6dc;
  --surface: #fdfcf7;
  --surface-2: #f6f4ec;
  --ink: #15181a;
  --ink-2: #444a4d;
  --ink-3: #767c7e;
  --line: #dedacd;
  --line-2: #c6c1b2;
  --accent: #1f6a5b;
  --accent-ink: #f7fbf8;
  --accent-soft: #d9e8e1;
  --hot: #b6432e;
  --hot-soft: #f4ded6;
  --bit-on: #1f6a5b;
  --bit-off: #d3cec0;
  --bit-net: #dbe9e3;
  --bit-host: #efece2;
  --paper: #ffffff;
  --shadow: 0 24px 60px -32px rgba(22, 30, 26, 0.38);
  --shadow-sm: 0 10px 24px -18px rgba(22, 30, 26, 0.42);
  --header: rgba(242, 240, 232, 0.86);
}
html[data-theme="dark"] {
  --bg: #101314;
  --bg-2: #171b1c;
  --surface: #1a1f20;
  --surface-2: #202627;
  --ink: #eef1ec;
  --ink-2: #c0c8c4;
  --ink-3: #8e9793;
  --line: #2b3233;
  --line-2: #3d4647;
  --accent: #6cc0aa;
  --accent-ink: #0d1714;
  --accent-soft: #21332e;
  --hot: #e08169;
  --hot-soft: #3a241f;
  --bit-on: #6cc0aa;
  --bit-off: #2c3435;
  --bit-net: #1d2f2b;
  --bit-host: #232a2b;
  --paper: #fbfaf6;
  --shadow: 0 28px 70px -30px rgba(0, 0, 0, 0.8);
  --shadow-sm: 0 12px 28px -18px rgba(0, 0, 0, 0.8);
  --header: rgba(16, 19, 20, 0.86);
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 460px at 88% -8%, rgba(31, 106, 91, 0.10), transparent 70%),
    radial-gradient(560px 380px at 2% 6%, rgba(31, 106, 91, 0.05), transparent 72%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 40;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 26px; height: 66px; }
.brand { display: inline-flex; align-items: baseline; gap: 7px; text-decoration: none; font-weight: 600; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); align-self: center; }
.brand-name { font-size: 17px; }
.brand-tool {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 8px;
}
.site-nav { display: flex; gap: 20px; margin-left: auto; font-size: 14px; }
.site-nav a { text-decoration: none; color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.header-tools { display: flex; align-items: center; gap: 10px; }
.lang-field { position: relative; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.lang-globe { width: 16px; height: 16px; margin-left: 6px; pointer-events: none; position: absolute; left: 0; }
.lang-field select {
  appearance: none; background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); font-size: 12.5px; padding: 6px 10px 6px 26px; cursor: pointer;
}
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="light"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: none; }

/* ---------- hero ---------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 46px; align-items: center;
  padding-top: 72px; padding-bottom: 60px;
}
.eyebrow {
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2.1rem, 4.3vw, 3.4rem); line-height: 1.03; letter-spacing: -0.035em; max-width: 16ch; }
.hero-lede { margin-top: 22px; font-size: 17px; color: var(--ink-2); max-width: 54ch; }
.facts { display: flex; gap: 34px; margin: 34px 0 0; padding: 0; flex-wrap: wrap; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--ink); }
.facts dd { margin: 0; font-size: 12px; color: var(--ink-3); letter-spacing: 0.02em; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 340px; padding-bottom: 30px; }
.art-block {
  width: min(430px, 100%); padding: 22px 22px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow); transform: rotate(-0.8deg);
}
.art-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.art-head .art-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--ink-3); text-transform: uppercase; }
.art-cidr { font-family: var(--mono); font-size: 19px; color: var(--ink); letter-spacing: -0.02em; }
.art-rows { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 12px 0 14px; font-size: 11px; }
.art-rows dt { color: var(--ink-3); font-family: var(--mono); letter-spacing: 0.02em; }
.art-rows dd { margin: 0; font-family: var(--mono); color: var(--ink-2); text-align: right; }
.art-bits { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.art-bits i {
  font-style: normal; font-family: var(--mono); font-size: 9px; text-align: center;
  line-height: 17px; height: 17px; border-radius: 2px; color: var(--bit-on); background: var(--bit-net);
}
.art-bits i.one { background: var(--bit-on); color: var(--accent-ink); }
.art-bits i.host { color: var(--ink-3); background: var(--bit-host); }
.art-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.art-foot span { font-size: 10px; letter-spacing: 0.06em; color: var(--ink-3); font-family: var(--mono); }
.art-caption {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
  white-space: nowrap;
}

/* ---------- sections ---------- */

.section { padding: 62px 0; border-top: 1px solid var(--line); }
.section[id] { scroll-margin-top: 84px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 30px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.5rem, 2.7vw, 2.05rem); }
.section-lede { max-width: 46ch; color: var(--ink-2); font-size: 15.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-label { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 12px; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; margin-top: 10px; }

/* ---------- calculator ---------- */

.deck { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.deck > * { min-width: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 24px 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(520px 280px at 60% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.panel > * { position: relative; z-index: 1; }

.seg { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  background: transparent; border: 0; border-radius: 999px; padding: 6px 14px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-family: var(--mono);
}
.seg button.is-on { background: var(--ink); color: var(--bg); }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.field { display: block; margin-top: 20px; }
.field-label { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.value-input {
  width: 100%; padding: 12px 0 10px;
  font-family: var(--mono); font-size: 26px; letter-spacing: 0.01em; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--line-2); border-radius: 0;
}
.value-input::placeholder { color: var(--ink-3); font-size: 15px; letter-spacing: 0; }
.value-input:focus { outline: none; border-bottom-color: var(--accent); }
.mask-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.mask-row .field { margin-top: 16px; }
.mask-row .value-input { font-size: 18px; }

.status { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); min-height: 20px; }
.status.is-ok { color: var(--accent); }
.status.is-bad { color: var(--hot); }

.prefix-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.prefix-row .range-field { flex: 1; }
.prefix-out {
  font-family: var(--mono); font-size: 13px; color: var(--ink); white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

.bits { margin-top: 18px; }
.bits-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.bits-head b { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.bits-legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-3); }
.bits-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bits-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.bits-legend .lg-net { background: var(--bit-on); }
.bits-legend .lg-host { background: var(--bit-off); }
.bit-groups { display: flex; flex-direction: column; gap: 9px; }
.bit-row { display: flex; gap: 12px; }
.bit-group { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bit-group span {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bit-cells { display: flex; gap: 1px; }
.bit-cells i {
  flex: 1; min-width: 0; height: 22px; border-radius: 2px; display: grid; place-items: center;
  font-style: normal; font-family: var(--mono); font-size: 11px;
  background: var(--bit-host); color: var(--ink-3); border: 1px solid transparent;
}
.bit-cells i.net { background: var(--bit-net); color: var(--ink-2); }
.bit-cells i.one { background: #b9b3a2; color: #fdfcf7; font-weight: 700; }
.bit-cells i.net.one { background: var(--bit-on); color: var(--accent-ink); }
html[data-theme="dark"] .bit-cells i.one { background: #4a5254; color: #eef1ec; }
html[data-theme="dark"] .bit-cells i.net.one { background: var(--bit-on); color: #0d1714; }
html[lang="ja"] .bit-group span { letter-spacing: 0; }

.readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 20px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.readout div { background: var(--surface); padding: 11px 13px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.readout dt, .readout .r-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.readout dd, .readout .r-value { margin: 0; font-family: var(--mono); font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.readout div.wide { grid-column: span 2; }
.readout div small { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

.actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 15px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  min-width: 140px; height: 44px; font-weight: 600;
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--accent-ink); }
.btn.small { height: 34px; font-size: 12px; padding: 0 12px; }
.btn.tiny { height: 28px; font-size: 11px; padding: 0 9px; border-radius: 7px; }

.side { display: flex; flex-direction: column; gap: 14px; }
.range-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-3); }
.range-field + .range-field { margin-top: 14px; }
.range-field .range-top { display: flex; justify-content: space-between; align-items: baseline; }
.range-field output { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.range-field input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer;
}
.range-field input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--line-2); }
.range-field input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-2); }
.range-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2);
}
.range-field input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface);
}

.scope-list { display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }
.scope-tag {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 12.5px; color: var(--ink-2); padding: 6px 9px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid transparent;
}
.scope-tag b { font-weight: 500; }
.scope-tag .mono { font-size: 10.5px; color: var(--ink-3); }
.scope-tag.is-on { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); color: var(--ink); }
.scope-tag.is-on .mono { color: var(--accent); }
.scope-tag.is-edge { border-color: var(--line-2); border-style: dashed; }
.scope-verdict { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.scope-verdict b { color: var(--accent); font-weight: 600; }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.presets button {
  text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; cursor: pointer; font-size: 12px; color: var(--ink-2); line-height: 1.35;
}
.presets button:hover { border-color: var(--accent); color: var(--ink); }
.presets button b { display: block; font-size: 11.5px; color: var(--ink); font-weight: 600; }
.presets button span { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* ---------- snippet ---------- */

.snip-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.snip-tabs button {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2); padding: 4px 10px; cursor: pointer;
}
.snip-tabs button.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.snip-body {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 13px; position: relative;
}
.snip-body pre {
  margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink);
  white-space: pre-wrap; word-break: break-word; max-height: 190px; overflow: auto;
}
.snip-copy { position: absolute; top: 6px; right: 6px; }
.snip-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; }
.allow-row { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-3); }
.allow-row select {
  appearance: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink); font-family: var(--mono); font-size: 11.5px; padding: 5px 7px; cursor: pointer;
}

/* ---------- splitter ---------- */

.split-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.split-grid > * { min-width: 0; }
.split-input .value-input { font-size: 18px; }
.quick-split { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.quick-split button {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); padding: 5px 11px; cursor: pointer;
}
.quick-split button:hover { border-color: var(--accent); color: var(--ink); }
.quick-split button.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.table-head b { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.table-head .mono { font-size: 11px; color: var(--ink-3); }
.split-scroll { max-height: 460px; max-width: 100%; overflow: auto; border-top: 1px solid var(--line); }
table.subnets { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.subnets th, table.subnets td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.subnets thead th {
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600;
}
table.subnets td { font-family: var(--mono); color: var(--ink-2); }
table.subnets td:first-child { color: var(--ink-3); width: 44px; }
table.subnets td.cidr { color: var(--ink); }
table.subnets tbody tr:hover { background: var(--surface-2); }
.split-note { margin-top: 10px; font-size: 12px; color: var(--ink-3); min-height: 18px; }
.split-note.is-bad { color: var(--hot); }

/* ---------- compare ---------- */

.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compare-grid .field { margin-top: 0; }
.compare-grid .value-input { font-size: 17px; }
.verdict {
  margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
}
.verdict .v-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 13px;
}
.verdict.is-apart .v-mark { background: var(--surface); color: var(--ink-3); border: 1px solid var(--line-2); }
.verdict.is-overlap .v-mark { background: var(--hot-soft); color: var(--hot); }
.verdict h3 { font-size: 14px; }
.verdict p { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.verdict code { font-family: var(--mono); font-size: 0.94em; }

/* ---------- rules ---------- */

.rule-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rule-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.rule-card .rule-num { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; }
.rule-card h3 { margin-top: 8px; font-size: 16px; }
.rule-card p { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }

.format-table { margin-top: 22px; overflow-x: auto; }
.format-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.format-table caption { text-align: left; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 10px; }
.format-table th, .format-table td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); }
.format-table thead th { border-top: 0; border-bottom: 1px solid var(--line-2); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.format-table td { font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }
.format-table td:first-child { color: var(--ink); }
.format-table tbody tr:hover { background: var(--surface-2); }

/* ---------- faq ---------- */

.faq-section { padding-top: 54px; }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 18px 30px 18px 0; font-size: 15.5px; font-weight: 500;
  list-style: none; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 16px; color: var(--ink-3);
}
.faq details[open] summary::after { content: "−"; color: var(--accent); }
.faq details p { padding: 0 0 20px; color: var(--ink-2); font-size: 14.5px; max-width: 78ch; }

/* ---------- related ---------- */

.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rel-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.rel-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.rel-kicker { font-size: 10px; letter-spacing: 0.1em; color: var(--accent); }
.rel-card h3 { font-size: 16px; }
.rel-card p { font-size: 13px; color: var(--ink-3); }
.rel-open { margin-top: auto; font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.rel-open::after { content: "→"; font-family: var(--mono); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 40px; padding: 40px 0 46px; position: relative; z-index: 1; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 30px; align-items: start; }
.footer-brand .brand-name { font-weight: 600; font-size: 16px; }
.footer-brand .brand-tool { margin-left: 8px; }
.footer-tagline { margin-top: 10px; font-size: 13px; color: var(--ink-3); max-width: 46ch; }
.footer-note { margin-top: 10px; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.footer-links { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { font-size: 12px; color: var(--ink-3); }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 999px; font-size: 13.5px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; z-index: 120;
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- plain pages ---------- */

.doc { max-width: 780px; padding: 56px 0 70px; }
.doc h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); }
.doc .updated { margin-top: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--ink-3); text-transform: uppercase; }
.doc-lede { margin-top: 20px; font-size: 17px; color: var(--ink-2); }
.doc h2 { margin-top: 36px; font-size: 1.22rem; }
.doc h3 { margin-top: 24px; font-size: 1.02rem; }
.doc p, .doc li { font-size: 15px; color: var(--ink-2); }
.doc p { margin-top: 12px; }
.doc ul { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.doc a { color: var(--accent); text-underline-offset: 3px; }
.doc code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.doc .doc-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

.notfound { padding: 96px 0 110px; max-width: 620px; }
.notfound h1 { font-size: clamp(2rem, 4vw, 2.9rem); }
.notfound p { margin-top: 16px; color: var(--ink-2); }
.notfound .btn { margin-top: 26px; text-decoration: none; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 52px; padding-bottom: 48px; }
  .hero-art { min-height: 280px; order: -1; }
  .deck { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side .card:last-child { grid-column: 1 / -1; }
  .split-grid { grid-template-columns: 1fr; }
  .rule-cards { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  .footer-links { flex-direction: row; flex-wrap: wrap; gap: 16px; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .site-nav { display: none; }
  .header-inner { height: 60px; }
  .header-tools { margin-left: auto; }
  .section { padding: 44px 0; }
  .section-head { gap: 12px; margin-bottom: 22px; }
  .section-lede { font-size: 14.5px; }
  .hero h1 { max-width: none; }
  .facts { gap: 24px; }
  .panel { padding: 18px 15px 20px; }
  .value-input { font-size: 19px; }
  .mask-row { grid-template-columns: 1fr; gap: 0; }
  .readout { grid-template-columns: 1fr 1fr; }
  .readout div.wide { grid-column: span 2; }
  .side { grid-template-columns: 1fr; }
  .presets { grid-template-columns: 1fr; }
  .bit-row { gap: 8px; }
  .compare-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .doc { padding: 36px 0 54px; }
  .art-block { transform: none; }
}
@media (max-width: 460px) {
  .seg button { padding: 6px 10px; font-size: 11.5px; }
  .actions .btn.primary { flex: 1 1 100%; }
  .format-table th, .format-table td { padding: 8px 8px; font-size: 12px; }
  .bit-cells i { font-size: 9px; height: 18px; }
  .art-bits i { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- spacing helpers used by the markup ---------- */

.card-snip { margin-top: 18px; }
.label-flush { margin-bottom: 0; }
.field-first { margin-top: 0; }
.range-close { margin-top: 6px; }
.label-gap { margin-top: 16px; }
