:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #171b21;
  --muted: #5c6774;
  --line: #e1e6ec;
  --line-strong: #cbd3dc;
  --accent: #2f62e8;
  --accent-soft: #e8eefe;
  --good: #147a45;
  --good-bg: #e3f5ea;
  --warn: #8a5a00;
  --warn-bg: #fdf1cf;
  --bad: #b42318;
  --bad-bg: #fde7e4;
  --muted-bg: #edf0f4;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 4%);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --panel: #161b22;
    --panel-soft: #1b2129;
    --text: #e7ecf2;
    --muted: #9aa6b2;
    --line: #262d36;
    --line-strong: #38414c;
    --accent: #6f97ff;
    --accent-soft: #1b2a47;
    --good: #5ad391;
    --good-bg: #12291d;
    --warn: #f2c14e;
    --warn-bg: #2c2412;
    --bad: #ff8a80;
    --bad-bg: #2e1715;
    --muted-bg: #1f252d;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
}

.wrap {
  width: min(1160px, 100% - 40px);
  margin-inline: auto;
}

code, .mono { font-family: var(--mono); font-size: .92em; }

h1, h2, h3 { line-height: 1.25; margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header */

.site-header { padding: 28px 0 20px; }

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; gap: 14px; align-items: flex-start; }

.brand-mark {
  font-size: 30px;
  line-height: 1;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.brand h1 { font-size: clamp(22px, 3vw, 30px); letter-spacing: -.02em; }

.sub { margin: 4px 0 0; color: var(--muted); }

.repo-link {
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}
.repo-link:hover { color: var(--text); text-decoration: none; border-color: var(--line-strong); }

/* Cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Upload */

.uploader { margin-bottom: 22px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  padding: 34px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone.dragover { transform: scale(.995); }

.dropzone p { margin: 4px 0; }
.dz-icon { font-size: 26px; color: var(--accent); line-height: 1; }

.fake-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }

.paste { margin-top: 16px; }
.paste summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0;
  width: fit-content;
}
.paste summary:hover { color: var(--text); }

textarea {
  width: 100%;
  min-height: 160px;
  margin-top: 10px;
  padding: 12px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.paste-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* Buttons */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--panel-soft); border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); background: var(--accent); border-color: var(--accent); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--panel-soft); border-color: var(--line); }

.linkish {
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Error */

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid var(--bad);
  border-color: color-mix(in srgb, var(--bad) 25%, transparent);
  border-radius: 9px;
  font-size: 14px;
}

/* Summary */

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.stat.good .stat-value { color: var(--good); }
.stat.warn .stat-value { color: var(--warn); }
.stat.bad .stat-value { color: var(--bad); }

/* Progress */

.progress-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--muted-bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .2s ease;
}
.progress-row.done .progress-bar { background: var(--good); }

.scan-status { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Toolbar */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

input[type="search"], select {
  font: inherit;
  font-size: 14px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
}
input[type="search"] { width: min(300px, 100%); }
input[type="search"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Table */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100dvh - 150px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-track { background: var(--panel-soft); }

table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

thead th:first-child,
tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
}
thead th:first-child { z-index: 3; background: var(--panel-soft); }
tbody tr:hover td:first-child { background: var(--panel-soft); }

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-soft); }

.pod-cell { display: flex; flex-direction: column; gap: 3px; }
.pod-name { font-family: var(--mono); font-weight: 600; }
.pod-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }

.tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
}
.tag.direct {
  color: var(--accent);
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.muted { color: var(--muted); background: var(--muted-bg); }
.badge.pending { color: var(--muted); background: var(--muted-bg); }

td.version, td.tag-cell { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
td.notes { color: var(--muted); min-width: 420px; max-width: 620px; }
td.repo { max-width: 240px; overflow-wrap: anywhere; }
.spi-link {
  display: inline-block;
  font-size: 13px;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-soft);
  white-space: nowrap;
}
.spi-link:hover { border-color: var(--accent); text-decoration: none; }
.notes-text {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* Explain */

.explain { margin-top: 22px; }
.explain h2 { font-size: 16px; margin-bottom: 10px; }
.explain ol { margin: 0 0 10px; padding-left: 20px; color: var(--muted); }
.explain li { margin: 4px 0; }
.explain code { color: var(--text); }

/* Footer */

.site-footer { padding: 20px 0 40px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0; }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
  z-index: 10;
  animation: toast-in .18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 620px) {
  .header-inner { flex-direction: column; gap: 10px; }
  .card { padding: 16px; }
  .dropzone { padding: 26px 14px; }
  .toolbar .spacer { display: none; }
  input[type="search"] { width: 100%; }
}

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