/* ColorContrastLab — OPYEB. Self-contained: no external fonts, images or CDN. */

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

:root {
  --bg: #f2f3f6;
  --bg2: #e9ebf0;
  --panel: #ffffff;
  --panel2: #f7f8fa;
  --ink: #0f1216;
  --ink2: #232932;
  --muted: #5b636f;
  --line: #d8dbe2;
  --line2: #c1c6d1;
  --accent: #1d3fd8;
  --accent-ink: #12298f;
  --accent-soft: #e7ebff;
  --ok: #0a6b3d;
  --ok-soft: #e1f5ea;
  --bad: #ad2118;
  --bad-soft: #fce7e4;
  --warn: #845200;
  --warn-soft: #fbf0d9;
  --shadow: 0 1px 0 rgba(15, 18, 22, .04), 0 22px 46px -34px rgba(15, 18, 22, .55);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Liberation Sans", "Noto Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR",
          "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans TC",
          "Microsoft JhengHei", "WenQuanYi Zen Hei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 16px;
  --radius-sm: 10px;
}

html[data-theme="dark"] {
  --bg: #0b0d11;
  --bg2: #0f1319;
  --panel: #12161c;
  --panel2: #171c24;
  --ink: #eef1f6;
  --ink2: #d4d9e2;
  --muted: #9ba4b2;
  --line: #242a34;
  --line2: #343c49;
  --accent: #93aaff;
  --accent-ink: #b9c7ff;
  --accent-soft: #161f36;
  --ok: #63d69f;
  --ok-soft: #0f2a1e;
  --bad: #ff9f96;
  --bad-soft: #2d1513;
  --warn: #e6bd72;
  --warn-soft: #2a2113;
  --shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 26px 54px -34px rgba(0, 0, 0, .95);
}

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

section[id], #studio, #export { scroll-margin-top: 78px; }
@media (max-width: 640px) { section[id], #studio, #export { scroll-margin-top: 92px; } }

html[lang="ko"] body { word-break: keep-all; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  letter-spacing: -0.003em;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }

h1, h2, h3, h4 { line-height: 1.16; letter-spacing: -0.02em; font-weight: 700; margin: 0; }
h1 { font-size: clamp(1.62rem, 3.6vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .85em; }

.wrap { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: max(16px, 4vw); }

.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;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--panel); color: var(--ink); padding: 10px 16px;
  border-radius: 0 0 8px 0; border: 1px solid var(--line);
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

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

.site-head {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, var(--panel));
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(8px);
}
.head-inner {
  display: flex; align-items: center; gap: 8px;
  min-height: 62px; padding-block: 8px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px; min-width: 0; margin-right: auto;
  text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -0.02em;
}
.brand .mark { display: inline-flex; color: var(--accent); flex: none; }
.brand-name { font-size: 1.04rem; white-space: nowrap; }
.brand-name b { color: var(--accent); }
.brand-sub {
  font-size: .58rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
  border-left: 1px solid var(--line2); padding-left: 9px; margin-left: 1px;
  font-weight: 700; white-space: nowrap; font-family: var(--mono);
}
.langs { display: flex; gap: 1px; }
.langs a {
  display: inline-block; padding: 5px 7px; border-radius: 7px;
  font-size: .76rem; font-weight: 600; color: var(--muted); text-decoration: none;
  white-space: nowrap;
}
.langs a:hover { background: var(--panel2); color: var(--ink); }
.langs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }

.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--line2); background: var(--panel2); }
.icon-btn .i-sun { display: none; }
html[data-theme="dark"] .icon-btn .i-sun { display: block; }
html[data-theme="dark"] .icon-btn .i-moon { display: none; }

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

.hero { padding-block: clamp(30px, 5vw, 54px) 20px; }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent-ink); margin: 0 0 12px; font-weight: 600;
}
.hero h1 { max-width: 26ch; margin-bottom: 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(1rem, 1.4vw, 1.08rem); color: var(--ink2); max-width: 68ch; margin-bottom: 18px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0 0 18px; }
.chip {
  font-size: .76rem; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line2); color: var(--ink2); background: var(--panel);
}
.basis-strip {
  display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel2); font-size: .82rem; color: var(--muted);
}
.basis-strip span { display: inline-flex; gap: 6px; align-items: baseline; }
.basis-strip b { color: var(--ink); font-family: var(--mono); font-size: .76rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; }

/* -------------------------------- presets --------------------------------- */

.presets {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-block: 6px 22px;
}
.presets-label { font-size: .76rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.preset {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--ink2); font: inherit; font-size: .78rem; cursor: pointer;
}
.preset:hover { border-color: var(--line2); background: var(--panel2); }
.preset-sw { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0,0,0,.12); }
.preset-sw i { width: 13px; height: 18px; display: block; }

/* ---------------------------------- cards --------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.2vw, 22px);
  min-width: 0;
}

.studio { padding-bottom: 6px; }
.studio-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 16px; align-items: stretch;
}

/* -------------------------------- pair card ------------------------------- */

.pair-block { padding-bottom: 12px; }
.pair-block + .pair-block { border-top: 1px dashed var(--line); padding-top: 14px; }
.pair-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.swatch {
  position: relative; width: 46px; height: 46px; border-radius: 11px; flex: none;
  border: 1px solid var(--line2); overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d7d7d7 25%, transparent 25%, transparent 75%, #d7d7d7 75%),
    linear-gradient(45deg, #d7d7d7 25%, transparent 25%, transparent 75%, #d7d7d7 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.swatch i { position: absolute; inset: 0; background: var(--sw, #000); opacity: var(--sw-a, 1); }
.swatch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.pair-id { min-width: 0; flex: 1; }
.pair-lbl {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 2px; font-weight: 600;
}
.pair-hex { font-family: var(--mono); font-size: 1.02rem; font-weight: 600; margin: 0; color: var(--ink); }
.color-native {
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line2); border-radius: 9px;
  background: var(--panel2); cursor: pointer; flex: none;
  box-shadow: inset 0 0 0 2px var(--panel), 0 1px 2px rgba(0,0,0,.12);
}
.color-native::-webkit-color-swatch-wrapper { padding: 3px; }
.color-native::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-native::-moz-color-swatch { border: none; border-radius: 6px; }

.pair-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.35fr); gap: 8px; }
.pfield { min-width: 0; display: block; }
.pfield > span {
  display: block; font-family: var(--mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px; font-weight: 600;
}
.pfield input {
  width: 100%; min-width: 0; font-family: var(--mono); font-size: .8rem;
  padding: 7px 8px; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--panel2); color: var(--ink);
}
.pfield input:focus { background: var(--panel); }
.pfield input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }

.alpha-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.alpha-row label {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.alpha-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); height: 26px; }
.alpha-val { font-family: var(--mono); font-size: .78rem; color: var(--ink); min-width: 3.2em; text-align: right; }

.swap-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin: 4px 0 0; padding: 7px;
  border: 1px dashed var(--line2); border-radius: 9px; background: var(--panel2);
  color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.swap-btn:hover { color: var(--ink); border-color: var(--accent); }

/* ------------------------------ result card ------------------------------- */

.result-card { display: flex; flex-direction: column; gap: 12px; }
.ratio-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ratio {
  font-family: var(--mono); font-size: clamp(2.6rem, 7vw, 3.6rem); font-weight: 700;
  line-height: 1; letter-spacing: -0.04em; margin: 0; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ratio-colon { font-size: .55em; color: var(--muted); font-weight: 600; }
.verdict { font-size: .86rem; font-weight: 700; padding: 4px 9px; border-radius: 7px; margin: 0; }
.lvl-aaa { color: var(--ok); background: var(--ok-soft); }
.lvl-aa { color: var(--ok); background: var(--ok-soft); }
.lvl-large { color: var(--warn); background: var(--warn-soft); }
.lvl-fail { color: var(--bad); background: var(--bad-soft); }
.verdict.lvl-aaa, .verdict.lvl-aa { color: var(--ink); }
.verdict::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; margin-right: 6px; vertical-align: 1px; }

.lum-line {
  display: flex; flex-direction: column; gap: 1px;
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
}
.lum-line b { color: var(--ink2); font-weight: 600; }

.badges { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.badge {
  display: flex; align-items: center; gap: 9px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel2);
}
.badge.is-pass { border-color: color-mix(in srgb, var(--ok) 32%, var(--line)); background: var(--ok-soft); }
.badge.is-fail { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); background: var(--bad-soft); }
.badge-mark {
  width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: .72rem; font-weight: 700; flex: none;
}
.badge.is-pass .badge-mark { background: var(--ok); color: var(--panel); }
.badge.is-fail .badge-mark { background: var(--bad); color: var(--panel); }
.badge-body { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex: 1; min-width: 0; }
.badge-label { font-size: .81rem; font-weight: 600; color: var(--ink); }
.badge-need { font-family: var(--mono); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.badge.is-pass .badge-need { color: var(--ok); }
.badge.is-fail .badge-need { color: var(--bad); }

.preview {
  border-radius: 12px; border: 1px solid var(--line2); padding: 14px;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.pv-normal { font-size: 16px; line-height: 1.5; margin: 0; }
.pv-large { font-size: 24px; line-height: 1.3; font-weight: 700; margin: 0; }
.pv-ui {
  align-self: flex-start; font-size: .82rem; font-weight: 700; padding: 6px 14px;
  border: 2px solid currentColor; border-radius: 8px; background: transparent;
}

.fix-row { display: flex; flex-wrap: wrap; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-size: .84rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { background: var(--panel2); border-color: var(--accent); color: var(--ink); }
.btn.small { padding: 6px 10px; font-size: .78rem; }
.fix-row .btn { flex: 1 1 auto; min-width: 0; }
html[data-theme="dark"] .btn { color: #0b0d11; }
html[data-theme="dark"] .btn:hover { color: #0b0d11; }
html[data-theme="dark"] .btn.ghost { color: var(--ink); }
.fix-note { font-size: .78rem; color: var(--muted); margin: 0; min-height: 1.4em; }
.fix-note:not(:empty) { color: var(--ink2); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

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

.sec { padding-block: clamp(30px, 4.4vw, 52px) 0; }
.sec-head { max-width: 70ch; margin-bottom: 20px; }
.sec-eyebrow {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent-ink); margin: 0 0 7px; font-weight: 600;
}
.sec-head h2 { margin-bottom: 8px; }
.sec-sub { color: var(--muted); margin: 0; font-size: .94rem; max-width: 72ch; }
.hint { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }

/* ------------------------------- simulation ------------------------------- */

.vision-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
}
.vision-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--panel); min-width: 0; display: flex; flex-direction: column;
}
.vision-swatch {
  padding: 14px 12px; display: flex; flex-direction: column; gap: 6px;
  border-bottom: 1px solid var(--line); min-height: 104px; justify-content: center;
}
.vision-sample { font-size: 1.9rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.vision-ratio { font-family: var(--mono); font-size: .82rem; font-weight: 600; }
.vision-meta { padding: 9px 11px 11px; }
.vision-meta h3 { font-size: .83rem; margin-bottom: 2px; }
.vision-meta p { font-size: .7rem; color: var(--muted); margin: 0; line-height: 1.4; }
.vision-status {
  margin: 6px 0 0 !important; display: inline-block; font-family: var(--mono);
  font-size: .64rem !important; font-weight: 600; padding: 2px 6px; border-radius: 5px;
}

/* -------------------------------- palette -------------------------------- */

.palette-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.panel-title h3 { font-size: .95rem; }
.panel-title .count { font-family: var(--mono); font-size: .7rem; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 7px; min-width: 24px; text-align: center; }

.saved-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.saved-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); min-width: 0;
}
.saved-chip {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; flex: none; border: 1px solid var(--line2);
}
.saved-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.saved-body b { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-hex { font-family: var(--mono); font-size: .66rem; color: var(--muted); }
.saved-ratio { font-family: var(--mono); font-size: .76rem; font-weight: 700; padding: 2px 5px; border-radius: 5px; white-space: nowrap; }
.saved-tags { font-family: var(--mono); font-size: .6rem; color: var(--muted); white-space: nowrap; }
.saved-actions { display: flex; gap: 3px; flex: none; }
.mini {
  font: inherit; font-size: .7rem; font-weight: 600; padding: 4px 7px; border-radius: 6px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--ink2); cursor: pointer;
}
.mini:hover { border-color: var(--accent); color: var(--ink); }
.mini.quiet { color: var(--muted); border-color: transparent; background: transparent; }
.mini.quiet:hover { color: var(--bad); border-color: var(--line2); }

.pair-name-row { display: flex; gap: 6px; margin-top: 12px; }
.pair-name-row input {
  flex: 1; min-width: 0; font: inherit; font-size: .82rem; padding: 7px 9px;
  border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); color: var(--ink);
}

.palette-chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.palette-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 5px 4px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel2);
}
.palette-chip .dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line2); flex: none; }
.palette-chip code { font-family: var(--mono); font-size: .7rem; color: var(--ink2); }

.matrix-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; }
.matrix { border-collapse: collapse; width: 100%; font-size: .72rem; }
.matrix th, .matrix td { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix thead th { background: var(--panel2); font-weight: 600; vertical-align: bottom; }
.mx-corner { width: 88px; }
.mx-head code, .mx-row code { display: block; font-family: var(--mono); font-size: .62rem; color: var(--muted); margin-top: 3px; }
.mx-sw { display: inline-block; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line2); }
.mx-row { position: sticky; left: 0; background: var(--panel); z-index: 1; text-align: left; min-width: 88px; }
.mx-row .mx-sw { margin-right: 5px; vertical-align: middle; }
.mx-row code { display: inline; }
.mx-cell { font-family: var(--mono); min-width: 62px; }
.mx-cell b { display: block; font-weight: 700; }
.mx-cell span { display: block; font-size: .58rem; color: var(--muted); }
.mx-cell.lvl-aaa b, .mx-cell.lvl-aa b { color: var(--ok); }
.mx-cell.lvl-large b { color: var(--warn); }
.mx-cell.lvl-fail b { color: var(--bad); }

/* -------------------------------- export --------------------------------- */

.export-card { padding: 0; overflow: hidden; }
.tabs {
  display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line);
  background: var(--panel2); flex-wrap: wrap;
}
.tab {
  font: inherit; font-size: .8rem; font-weight: 600; padding: 8px 12px;
  border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0;
  background: transparent; color: var(--muted); cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--panel); color: var(--ink); border-color: var(--line);
}
.export-code {
  margin: 0; padding: 16px 18px; background: var(--panel);
  font-family: var(--mono); font-size: .78rem; line-height: 1.6; color: var(--ink2);
  overflow: auto; max-height: 420px; white-space: pre; tab-size: 2;
  scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
}
.export-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel2);
}
.export-status { font-size: .78rem; color: var(--ok); font-weight: 600; }
.export-code::-webkit-scrollbar { width: 10px; height: 10px; }
.export-code::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
.export-code::-webkit-scrollbar-track { background: transparent; }

/* -------------------------------- explainer ------------------------------ */

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.step {
  border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--panel); padding: 14px; min-width: 0;
}
.step-no { font-family: var(--mono); font-size: .68rem; font-weight: 700; color: var(--accent-ink); letter-spacing: .1em; }
.step h3 { margin: 4px 0 6px; font-size: .92rem; }
.step p { margin: 0; font-size: .82rem; color: var(--muted); }

.prose { max-width: 74ch; }
.prose p { color: var(--ink2); }
.prose code, .formula code, .prose .mono {
  font-family: var(--mono); font-size: .86em; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink);
}

.formula {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
  padding: 16px 16px 14px; margin-top: 16px; overflow-x: auto;
}
.formula-line {
  font-family: var(--mono); font-size: .82rem; line-height: 1.9; color: var(--ink2);
  white-space: normal; overflow-wrap: anywhere;
}
.formula-line b { color: var(--accent-ink); }
.formula-legend { display: grid; gap: 6px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.formula-legend div { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: 8px; }
.formula-legend b { font-family: var(--mono); color: var(--ink); font-weight: 600; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: .85rem; min-width: 520px; }
.table-wrap caption { text-align: left; padding: 11px 14px 0; font-size: .78rem; color: var(--muted); }
.table-wrap th, .table-wrap td { padding: 9px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table-wrap thead th { background: var(--panel2); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap .num { font-family: var(--mono); white-space: nowrap; text-align: right; }
.table-wrap code { font-family: var(--mono); font-size: .8rem; }
.table-wrap .is-pass { color: var(--ok); font-weight: 600; }
.table-wrap .is-fail { color: var(--bad); font-weight: 600; }
.table-wrap .is-warn { color: var(--warn); font-weight: 600; }
.tbl-note { font-size: .76rem; color: var(--muted); margin: 8px 0 0; }

.vision-explain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.vision-explain article {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; background: var(--panel);
}
.vision-explain h3 { font-size: .88rem; margin-bottom: 4px; }
.vision-explain p { font-size: .82rem; color: var(--muted); margin: 0; }

.export-docs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.export-docs article { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--panel); }
.export-docs h3 { font-size: .88rem; margin-bottom: 5px; }
.export-docs p { font-size: .81rem; color: var(--muted); margin: 0; }
.export-docs pre {
  margin: 8px 0 0; padding: 9px 10px; border-radius: 7px; background: var(--panel2);
  border: 1px solid var(--line); font-family: var(--mono); font-size: .71rem; overflow-x: auto;
  color: var(--ink2);
}

.faq { display: grid; gap: 8px; max-width: 82ch; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 12px 15px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.faq summary::marker { color: var(--accent); }
.faq details[open] summary { margin-bottom: 8px; }
.faq details p { margin: 0; font-size: .86rem; color: var(--ink2); }

.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.limit { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 14px; }
.limit h3 { font-size: .87rem; margin-bottom: 5px; }
.limit p { font-size: .81rem; color: var(--muted); margin: 0; }
.basis-box {
  margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel2); padding: 14px 16px;
}
.basis-box h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.basis-box ul { margin: 0; padding-left: 18px; font-size: .82rem; color: var(--ink2); display: grid; gap: 4px; }
.basis-box b { font-family: var(--mono); font-size: .76rem; font-weight: 600; }

.note-warn {
  font-size: .8rem; color: var(--warn); background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, var(--line));
  border-radius: 8px; padding: 8px 10px; margin: 10px 0 0;
}

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

.site-foot { margin-top: clamp(40px, 6vw, 70px); border-top: 1px solid var(--line); background: var(--panel2); }
.foot-grid { display: flex; justify-content: space-between; gap: 22px; padding-block: 26px 18px; flex-wrap: wrap; }
.foot-brand { font-weight: 700; font-size: 1rem; margin: 0 0 4px; }
.foot-brand .opyeb {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; color: var(--accent-ink);
  border: 1px solid var(--line2); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  vertical-align: 2px;
}
.foot-note { font-size: .8rem; color: var(--muted); margin: 0 0 6px; max-width: 46ch; }
.operated { font-size: .76rem; color: var(--muted); margin: 0; font-family: var(--mono); letter-spacing: .04em; }
.foot-right { font-size: .82rem; }
.foot-links { margin-bottom: 6px; }
.foot-langs { color: var(--muted); font-size: .78rem; }
.foot-langs span { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; margin-right: 4px; }
.foot-legal {
  font-size: .72rem; color: var(--muted); border-top: 1px solid var(--line);
  padding-block: 12px 22px; margin: 0;
}

/* -------------------------------- policies ------------------------------- */

.page-wrap { max-width: 78ch; padding-block: clamp(28px, 5vw, 46px); }
.page-wrap h1 { margin-bottom: 6px; }
.updated { font-family: var(--mono); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.page-wrap h2 { font-size: 1.05rem; margin: 26px 0 8px; }
.page-wrap p, .page-wrap li { color: var(--ink2); font-size: .92rem; }
.page-wrap ul { padding-left: 20px; }
.contact-card { margin-top: 26px; }
.back { display: inline-block; margin-top: 22px; font-size: .84rem; }

.not-found { text-align: left; padding-block: 60px; }
.nf-code { font-family: var(--mono); font-size: 3rem; font-weight: 700; color: var(--accent); margin: 0; line-height: 1; }
.nf-langs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }
.nf-langs li a { font-size: .9rem; }

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

@media (max-width: 1040px) {
  .vision-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .limits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .studio-grid, .palette-grid { grid-template-columns: minmax(0, 1fr); }
  .vision-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-sub { display: none; }
}

@media (max-width: 640px) {
  .langs {
    order: 3; width: 100%; justify-content: flex-start; gap: 2px;
    border-top: 1px solid var(--line); padding-top: 5px; margin-top: 1px;
    overflow-x: auto;
  }
  .brand-name { font-size: .96rem; }
  .head-inner { row-gap: 0; padding-block: 7px 5px; min-height: 0; }
}

@media (max-width: 620px) {
  body { font-size: 15.5px; }
  .wrap { padding-inline: 14px; }
  .hero { padding-block: 24px 14px; }
  .hero h1 { max-width: none; }
  .basis-strip { gap: 6px 16px; }
  .pair-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pair-fields .pfield:nth-child(3) { grid-column: 1 / -1; }
  .vision-grid { grid-template-columns: minmax(0, 1fr); }
  .vision-swatch { min-height: 82px; flex-direction: row; align-items: center; justify-content: space-between; }
  .vision-sample { font-size: 1.5rem; }
  .steps, .limits, .export-docs, .vision-explain { grid-template-columns: minmax(0, 1fr); }
  .ratio { font-size: 2.9rem; }
  .badge-body { flex-wrap: wrap; }
  .tabs { padding: 8px 8px 0; }
  .tab { padding: 7px 9px; font-size: .76rem; }
  .export-code { font-size: .71rem; padding: 12px; }
  .saved-item { flex-wrap: wrap; }
  .saved-body { flex: 1 1 50%; }
  .saved-tags { order: 4; }
  .saved-actions { order: 5; margin-left: auto; }
  .matrix { font-size: .68rem; }
  .mx-cell { min-width: 54px; }
  .foot-grid { flex-direction: column; gap: 14px; }
  .langs a { padding: 5px 6px; font-size: .72rem; }
}

@media (max-width: 380px) {
  .brand-name { font-size: .95rem; }
  .pair-head { gap: 8px; }
  .swatch { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
