:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #fcfcfb;
  --border: #e3e1db;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7d7b75;
  --accent: #2a78d6;
  --series-human: #2a78d6;
  --series-ai: #eb6834;
  --good: #008300;
  --warn: #b37400;
  --bad: #c9302c;
  --grid: #ecebe6;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --border: #2e2e2c;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #3987e5;
    --series-human: #3987e5;
    --series-ai: #d95926;
    --good: #3fae3f;
    --warn: #e0a326;
    --bad: #e66767;
    --grid: #262624;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --border: #2e2e2c; --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
  --accent: #3987e5; --series-human: #3987e5; --series-ai: #d95926; --good: #3fae3f; --warn: #e0a326; --bad: #e66767; --grid: #262624;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

.top { max-width: 1040px; margin: 0 auto; padding: 32px 16px 8px; }
.brand { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; color: var(--text); }
.brand span { color: var(--series-ai); }
.tag { margin: 2px 0 0; color: var(--text-2); }

.search { display: flex; gap: 8px; margin-top: 20px; }
.search input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search button {
  padding: 0 20px; font-size: 16px; font-weight: 600; border: 0; border-radius: var(--radius);
  background: var(--text); color: var(--bg); cursor: pointer;
}
.search button:disabled { opacity: 0.5; cursor: wait; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 24px; }

#status { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--bad); color: var(--bad); background: var(--surface); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card .sub { color: var(--text-2); font-size: 13px; margin: 0 0 14px; }
h2 { font-size: 16px; }

.hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.hero .num { font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero .num small { font-size: 22px; color: var(--muted); font-weight: 600; }
.hero .grade { font-size: 20px; font-weight: 700; }
.hero .repo { font-size: 18px; font-weight: 600; word-break: break-word; }
.hero .meta { color: var(--text-2); font-size: 13px; }
.meter { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin: 10px 0 6px; max-width: 420px; }
.meter > div { height: 100%; border-radius: 4px; background: var(--series-ai); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-2); font-size: 13px; }
.stat .n { color: var(--muted); font-size: 12px; margin-top: 2px; }

.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.rules li:first-child { border-top: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.pass { color: var(--good); } .badge.warn { color: var(--warn); } .badge.fail { color: var(--bad); }
.rules .t { font-weight: 600; }
.rules .d { color: var(--text-2); font-size: 13px; }
.verdict { font-weight: 700; margin: 0 0 8px; }

.chart-wrap { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 8px;
  border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; z-index: 2;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; border-top: 0; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .emails { color: var(--muted); font-size: 12px; word-break: break-all; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); margin: 1px 2px 1px 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.bars .row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 48px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bars .track { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--series-ai); border-radius: 4px; }
.bars .pts { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

details summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.recent { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.recent a { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--text); font-size: 13px; }
footer { max-width: 1040px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 8px; }
  .hero .num { font-size: 56px; }
  .grid2 { grid-template-columns: 1fr; }
  .rules li { grid-template-columns: 1fr; gap: 2px; }
  .bars .row { grid-template-columns: minmax(0, 1fr) 80px 40px; }
}

[hidden] { display: none !important; }
.card, .grid2 > * { min-width: 0; }
.pill, code { overflow-wrap: anywhere; }

/* browser version additions */
.hint a { color: var(--text-2); }
.panel { margin-bottom: 16px; }
.fields { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 10px 0 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
select, .token input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
.token { max-width: 420px; }
.token input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.panel .sub { margin: 8px 0 10px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
button.secondary {
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
button.secondary:hover { border-color: var(--text-2); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-text { flex: 1; min-width: 0; }
.progress { height: 4px; background: var(--grid); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.notes { margin: 12px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.notes li { margin: 2px 0; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .progress > div { transition: none; } }

#trending-wrap { margin-bottom: 24px; }
.trending-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.trending-head h2 { font-size: 16px; margin: 0; }
#trending-wrap > .sub { color: var(--text-2); font-size: 13px; margin: 4px 0 12px; }
.tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.tabs button { border: 0; background: none; color: var(--text-2); font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.trending { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.trending[aria-busy="true"] { opacity: 0.5; }
.tr { display: flex; flex-direction: column; gap: 6px; height: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.tr:hover, .tr:focus-visible { border-color: var(--accent); }
.tr-name { font-weight: 600; overflow-wrap: anywhere; }
.tr-owner { font-weight: 400; color: var(--text-2); }
.tr-desc { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; }
.tr-meta .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 5px; vertical-align: -1px; }
.tr-gain { color: var(--good); }
