:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #161a22;
  --muted: #5b6474;
  --accent: #6a3fe0;
  --accent-text: #ffffff;
  --focus: #6a3fe055;
  --brand-a: #0891b2;

  --crit-bg: #fde7ec; --crit-fg: #a3123a;
  --high-bg: #fdeee2; --high-fg: #b03e00;
  --med-bg:  #fdf5d9; --med-fg:  #8a6300;
  --low-bg:  #e3f3ea; --low-fg:  #1d6b3e;
  --none-bg: #eceef2; --none-fg: #4c5565;
  --kev-bg:  #2a0a12; --kev-fg:  #ffd9e1;

  --radius: 10px;
  --shadow: 0 1px 2px #10182808, 0 2px 8px #1018280d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d121d; --surface: #141b2a; --surface-2: #1a2336; --border: #27324a;
    --text: #e8ebf1; --muted: #9aa4b6; --accent: #0ae0f8; --accent-text: #06121c; --focus: #0ae0f855; --brand-a: #0ae0f8;
    --crit-bg: #3d1020; --crit-fg: #ff9db5;
    --high-bg: #3d2110; --high-fg: #ffb27f;
    --med-bg:  #3a2f0c; --med-fg:  #f5d26b;
    --low-bg:  #0f3222; --low-fg:  #8fe0b0;
    --none-bg: #232a37; --none-fg: #aab3c3;
    --kev-bg:  #ff9db5; --kev-fg:  #2a0a12;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d121d; --surface: #141b2a; --surface-2: #1a2336; --border: #27324a;
  --text: #e8ebf1; --muted: #9aa4b6; --accent: #0ae0f8; --accent-text: #06121c; --focus: #0ae0f855; --brand-a: #0ae0f8;
  --crit-bg: #3d1020; --crit-fg: #ff9db5;
  --high-bg: #3d2110; --high-fg: #ffb27f;
  --med-bg:  #3a2f0c; --med-fg:  #f5d26b;
  --low-bg:  #0f3222; --low-fg:  #8fe0b0;
  --none-bg: #232a37; --none-fg: #aab3c3;
  --kev-bg:  #ff9db5; --kev-fg:  #2a0a12;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { height: 56px; display: flex; align-items: center; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.brand img { display: block; width: 34px; height: 34px; border-radius: 8px; }
.wordmark { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.wm-a { color: var(--brand-a); }

.hero { padding: 40px 0 20px; }
.hero h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--muted); max-width: 62ch; }

/* ---------- search form ---------- */
.search {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1fr 0.8fr auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-size: 13px; font-weight: 600; }
.opt { font-weight: 400; color: var(--muted); }
input, select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); background: var(--surface); }
.btn-primary {
  height: 42px; padding: 0 20px;
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  font: inherit; font-weight: 600;
  color: var(--accent-text); background: var(--accent);
  border: 0; border-radius: 8px; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }

/* ---------- combobox ---------- */
.combo { position: relative; }
.options {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none;
  max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px #10182826;
}
.options li {
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px;
  white-space: nowrap; overflow: hidden;
}
.options li span:first-child { overflow: hidden; text-overflow: ellipsis; }
.options li .meta { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.options li[aria-selected="true"], .options li:hover { background: var(--surface-2); }
.options li mark { background: none; color: var(--accent); font-weight: 650; }
.options .empty { color: var(--muted); cursor: default; }

/* ---------- results ---------- */
#results { margin: 28px 0 48px; }
.summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: 14px; }
.summary h2 { font-size: 18px; margin: 0; font-weight: 600; }
.summary .sub { color: var(--muted); font-size: 13px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 74px 1fr; gap: 14px;
}
.score {
  border-radius: 8px; text-align: center; padding: 8px 4px; align-self: start;
  background: var(--none-bg); color: var(--none-fg);
}
.score b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.sev-CRITICAL { background: var(--crit-bg); color: var(--crit-fg); }
.sev-HIGH { background: var(--high-bg); color: var(--high-fg); }
.sev-MEDIUM { background: var(--med-bg); color: var(--med-fg); }
.sev-LOW { background: var(--low-bg); color: var(--low-fg); }

.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.cve-id { font-weight: 650; font-size: 16px; text-decoration: none; font-variant-numeric: tabular-nums; }
.cve-id:hover { text-decoration: underline; }
.date { color: var(--muted); font-size: 13px; }
.kev { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--kev-bg); color: var(--kev-fg); cursor: help; }
.desc { margin: 6px 0 0; overflow-wrap: anywhere; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; margin-top: 2px; }
.affected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 12.5px; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; overflow-wrap: anywhere; text-align: left;
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--accent); }
.chip .v { color: var(--muted); }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 20px; }
.pager button {
  height: 36px; padding: 0 14px; font: inherit; font-size: 14px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
}
.pager button:disabled { opacity: .45; cursor: default; }
.pager span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.notice { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); }
.notice h2 { color: var(--text); font-size: 17px; margin: 0 0 6px; }
.notice.error { border-style: solid; border-color: var(--crit-fg); }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.site-footer p { margin: 16px 0; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .search { grid-template-columns: 1fr 1fr; }
  .btn-primary { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .hero { padding-top: 28px; }
  .search { grid-template-columns: 1fr; padding: 14px; }
  .card { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .score { display: inline-flex; gap: 8px; align-items: baseline; padding: 4px 10px; justify-self: start; }
  .score b { font-size: 16px; }
}
