:root {
  --bg: #fff; --fg: #111; --muted: #666; --line: #e5e5e5; --soft: #f6f6f6;
  --accent: #111; --on-accent: #fff; --good: #0a7d3c; --avg: #b06a00; --poor: #c62828;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e0e; --fg: #f2f2f2; --muted: #9a9a9a; --line: #2a2a2a; --soft: #181818; --accent: #f2f2f2; --on-accent: #111; --good: #3ecf7a; --avg: #f0a83a; --poor: #ff6b6b; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
code, pre, output { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; font-size: 16px; }
.top nav { display: flex; gap: 18px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--muted); padding: 15px 0; }
.top nav a:hover, .top nav a[aria-current] { color: var(--fg); }
.top nav a[aria-current] { box-shadow: inset 0 -2px var(--fg); }

.hero { padding: 48px 0 28px; }
.hero.tight { padding: 32px 0 20px; }
.hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
.hero.tight h1 { font-size: 24px; }
.hero p { margin-top: 8px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; transition: border-color .15s; }
.card:hover { border-color: var(--fg); }
.card h2, .card h3 { font-size: 15px; margin: 8px 0 2px; }
.h.group { margin: 28px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.h.group:first-of-type { margin-top: 0; }
.card p { color: var(--muted); font-size: 13px; line-height: 1.4; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.panel { border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 220px; min-width: 0; }
input[type=text], select { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; }
textarea { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
textarea + textarea, .row + textarea, textarea + .row { margin-top: 8px; }
input.narrow { width: 80px; flex: none; } input.mid { width: 190px; flex: 0 1 190px; }
input[type=text]:focus, select:focus, textarea:focus { outline: 2px solid var(--fg); outline-offset: -1px; }
input[type=range] { width: 100%; accent-color: var(--accent); display: block; margin-top: 6px; }
input[type=checkbox] { accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: default; }

.pw-out { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pw-out output { font-size: 20px; word-break: break-all; flex: 1 1 260px; }
.pw-actions { display: flex; gap: 8px; }
.meter { height: 4px; background: var(--soft); border-radius: 2px; margin: 14px 0 6px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--good); transition: width .2s, background .2s; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.panel > .row { margin-top: 14px; }
.panel > form.row, .panel > .row.first { margin-top: 0; }
.panel > .row.first + textarea { margin-top: 8px; }
.status:empty { display: none; }
.status { margin-top: 10px; }
.big { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-top: 14px; }
.big:empty { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two textarea { margin: 0; }
.kv { margin-top: 10px; }
.kv th { width: 180px; font-weight: 500; }
.diff { white-space: pre-wrap; word-break: break-word; max-height: 480px; overflow-y: auto; margin-top: 12px; }
.diff .add { color: var(--good); } .diff .del { color: var(--poor); }
.diff span { display: block; }
.more { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 18px; font-size: 13px; }
.more a { color: var(--muted); }
.more a:hover { color: var(--fg); }

.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; border: 1.5px dashed var(--line); border-radius: 8px; cursor: pointer; text-align: center; }
.drop:hover, .drop.over { border-color: var(--fg); }
.drop svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
#cv-status:empty, #ps-status:empty, #k-status:empty { display: none; }
#cv-status, #ps-status, #k-status { margin-top: 12px; }
.kblock { margin-top: 14px; }
.kblock .khead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.kblock .khead button { height: 26px; padding: 0 10px; font-size: 12px; }
.kblock pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow-y: auto; }
#cv-download { margin-top: 12px; }

.api { margin: 20px 0 0; border-top: 1px solid var(--line); padding-top: 14px; }
.api summary { cursor: pointer; font-size: 14px; color: var(--muted); }
pre { background: var(--soft); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13px; margin: 10px 0; }
.h { font-size: 16px; margin: 24px 0 4px; }
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
td.num, th.num { text-align: right; padding-right: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* page speed report */
#ps-report { margin-top: 20px; }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.score { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.score b { display: block; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score span { font-size: 13px; color: var(--muted); }
.good { color: var(--good); } .avg { color: var(--avg); } .poor { color: var(--poor); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.metric { padding: 10px 0; border-bottom: 1px solid var(--line); }
.metric b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.metric span { font-size: 13px; color: var(--muted); }
.shot { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.shot img { height: 150px; border: 1px solid var(--line); border-radius: 6px; flex: none; }
.finding { border-bottom: 1px solid var(--line); }
.finding summary { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; cursor: pointer; list-style: none; font-size: 14px; }
.finding summary::-webkit-details-marker { display: none; }
.finding summary::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; transform: translateY(-1px); }
.finding summary .t { color: var(--fg); flex: 1; }
.finding summary .v { color: var(--muted); font-size: 13px; white-space: nowrap; }
.finding .body { padding: 0 0 12px 18px; font-size: 13px; color: var(--muted); }
.finding .body ul { margin: 8px 0 0; padding: 0; list-style: none; }
.finding .body li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.finding .body li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.finding .body li span:last-child { white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0 6px; }
.tabs button { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.tabs button[aria-selected=true] { border-color: var(--fg); color: var(--fg); }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 56px; padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .two { grid-template-columns: 1fr; }
  .scores, .metrics { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: 24px; }
  .top .wrap { gap: 16px; }
}

/* web tools */
#web-out { margin-top: 16px; }
#web-out .big { margin-top: 0; }
.issues { list-style: none; margin: 12px 0 4px; padding: 0; font-size: 14px; }
.issues li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.issues li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; transform: translateY(-1px); }
.issues li.error::before { background: var(--poor); } .issues li.warning::before { background: var(--avg); } .issues li.ok::before { background: var(--good); }
.kv td, .table td { word-break: break-word; }
.kv .kv { margin: 0; } .kv .kv th { width: 130px; } .kv .kv tr:last-child > * { border-bottom: 0; }
.lines > div { padding: 1px 0; }
.capture { display: block; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }

.ad { margin: 28px auto 0; text-align: center; max-width: 100%; overflow: hidden; }
.ad:empty { display: none; }
