:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1b1a17;
  --muted: #5d5a52;
  --line: #dcd8cf;
  --accent: #5b3df5;
  --accent-ink: #ffffff;
  --accent-soft: #ebe6ff;
  --ok: #157a4a;
  --ok-soft: #e1f3e9;
  --warn: #9a5b00;
  --warn-soft: #fdf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe4e2;
  --wave: #5b3df5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 12, .06), 0 8px 24px rgba(20, 18, 12, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #19191d;
    --surface-2: #222228;
    --text: #ecebe8;
    --muted: #a3a19b;
    --line: #2f2f37;
    --accent: #9d8bff;
    --accent-ink: #120d2e;
    --accent-soft: #2a2450;
    --ok: #5fd69b;
    --ok-soft: #173326;
    --warn: #f2b45a;
    --warn-soft: #3a2a12;
    --bad: #ff8a80;
    --bad-soft: #3c1a18;
    --wave: #b1a3ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg, canvas { max-width: 100%; }
code, kbd {
  font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2);
  padding: .1em .35em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 4px 16px; flex-wrap: wrap; margin-left: auto; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* hero */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; }
.hero p.lede { font-size: 1.12rem; color: var(--muted); max-width: 46rem; margin: 0 0 8px; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 20px 0 0; }
.crumbs a { color: var(--muted); }

/* converter */
.converter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 24px 0 8px;
}
.drop {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 36px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { font-size: 1.15rem; }
.drop .hint { color: var(--muted); font-size: .95rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  min-height: 42px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 16px; }
.toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.toolbar select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.toolbar .spacer { flex: 1; }
.privacy { font-size: .88rem; color: var(--muted); margin: 12px 0 0; }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .95rem; }

.results { display: grid; gap: 14px; margin-top: 18px; }
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
  min-width: 0;
}
.card-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.card-title { flex: 1; min-width: 12rem; }
.card-title h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.card-title .meta { color: var(--muted); font-size: .9rem; margin-top: 2px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: .78rem; font-weight: 600; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status { font-size: .9rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.error { color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; margin-top: 10px; font-size: .95rem; }

.oscs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.osc { background: var(--surface-2); border-radius: 10px; padding: 10px; min-width: 0; }
.osc .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.osc .label { font-weight: 600; font-size: .92rem; }
.osc .table { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.osc canvas { display: block; width: 100%; height: 64px; margin-top: 6px; }
.badge { font-size: .74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.badge.embedded, .badge.library, .badge.builtin, .badge.recreated, .badge.generated { background: var(--ok-soft); color: var(--ok); }
.badge.approximated { background: var(--accent-soft); color: var(--accent); }
.badge.placeholder { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.missing { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .95rem; }
.missing ul { margin: 6px 0; padding-left: 20px; }
.missing .btn { margin-top: 6px; min-height: 36px; padding: 6px 12px; }

details.notes { margin-top: 12px; }
details.notes summary { cursor: pointer; color: var(--muted); font-size: .95rem; }
details.notes ul { margin: 8px 0 0; padding-left: 20px; font-size: .92rem; }
details.notes li { margin: 3px 0; }
details.notes .kind { font-weight: 700; text-transform: capitalize; }

/* content */
main section { padding: 28px 0; border-top: 1px solid var(--line); }
main section:first-of-type { border-top: 0; }
main h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); letter-spacing: -.01em; line-height: 1.25; margin: 0 0 12px; }
main h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.prose { max-width: 46rem; }
.prose p, .prose li { color: var(--text); }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.panel h3 { margin-top: 0; }
.panel ul { padding-left: 20px; margin: 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--surface); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }
.related { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 0; list-style: none; }
.related a { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--text); }
.related a:hover { border-color: var(--accent); }
.related strong { display: block; color: var(--accent); }
.related span { color: var(--muted); font-size: .92rem; }

.site-footer { border-top: 1px solid var(--line); margin-top: 32px; padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.site-footer a { color: var(--muted); }
