:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202124;
  background: #f7f7f8;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --surface: #fff;
  --muted: #707078;
  --line: #e7e7eb;
  --accent: #303138;
  --success: #438060;
  --danger: #a44d4d;
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1240px; margin: auto; padding: 40px 40px 24px; }
h1, h2, h3, p { margin: 0; }
h1 { margin: 10px 0; font-size: 30px; line-height: 1.25; font-weight: 650; letter-spacing: -1px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.3px; }
h3 { margin: 24px 0 10px; font-size: 13px; font-weight: 600; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: 1.8px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.subtitle { color: var(--muted); font-size: 12px; line-height: 1.6; }
.connection { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.5; }
#connection { display: inline-flex; align-items: center; gap: 7px; color: #45464c; font-size: 11px; font-weight: 500; }
#connection::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
#connection.offline { color: var(--danger); }
#connection.offline::before { background: var(--danger); }

.run-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.run-select, .run-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.run-select { flex: 0 1 370px; }
.run-select label, .filter label { flex-shrink: 0; color: var(--muted); font-size: 11px; white-space: nowrap; }
select, button { border: 1px solid #dedee3; border-radius: 7px; background: var(--surface); color: inherit; font: inherit; }
select { min-width: 0; max-width: 100%; padding: 8px 28px 8px 11px; font-size: 12px; line-height: 1.4; }
#run-select { width: 100%; }
button { cursor: pointer; padding: 8px 12px; }
button:hover, select:hover { border-color: #b8b8c0; }
button:hover { background: #f5f5f7; }
button:focus-visible, select:focus-visible, summary:focus-visible, pre:focus-visible { outline: 2px solid #55565e; outline-offset: 3px; }
.run-meta { flex: 1; justify-content: flex-end; color: var(--muted); font-size: 10px; }
#source { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.badge { flex-shrink: 0; padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: #62626b; background: #f7f7f8; font-size: 10px; white-space: nowrap; }
.notice { margin-top: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; background: #f2f2f4; color: #5e5e66; font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.incident, #fetch-warning { border-color: #eadcdc; background: #fbf7f7; color: #8f4b4b; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 32px; }
.stats > div { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.stats strong { display: block; color: #25262c; font-size: clamp(20px, 2vw, 27px); line-height: 1.4; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#elapsed, #budget { font-size: clamp(18px, 1.65vw, 23px); letter-spacing: -.5px; }
.stats small { display: block; margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading > span, .section-heading p, .method { color: var(--muted); font-size: 11px; }
.section-heading p { margin-top: 7px; line-height: 1.6; }
.method { margin: 9px 0 18px; line-height: 1.8; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { min-width: 0; padding: 21px 20px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chart-heading h3 { margin: 0; color: #62626c; font-size: 12px; font-weight: 500; }
.chart-heading strong { font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
.chart-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-card svg text { fill: #7c7c86; font-family: inherit; font-size: 10px; }
.chart-card .empty { display: grid; place-items: center; height: 178px; }

.samples-section { margin-top: 32px; }
.filter { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 15px 20px; border-bottom: 1px solid #ededf0; }
th { color: var(--muted); background: #fafafb; font-size: 10px; font-weight: 500; }
tbody tr:hover { background: #fafafb; }
tr:last-child td { border-bottom: 0; }
.sample-link { display: block; max-width: 380px; overflow: hidden; padding: 2px 0; border: 0; border-radius: 2px; background: none; color: #33343c; text-align: left; text-overflow: ellipsis; font-weight: 500; }
.sample-link:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.result-good { color: #4e4f57; }
.result-bad { color: var(--danger); }
.empty { padding: 26px 12px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }

.events { margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.events summary { padding: 16px 0; color: #64646d; cursor: pointer; }
.events summary::marker { color: #9797a0; font-size: 10px; }
.events summary span { margin-left: 8px; font-size: 10px; font-variant-numeric: tabular-nums; }
.events ol { margin: 0 0 12px; padding: 0; list-style: none; }
.events li { display: flex; gap: 20px; padding: 8px 0; line-height: 1.7; }
.events time { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.events li span { overflow-wrap: anywhere; }
#warning-panel { margin-top: 14px; border: 0; }
#warning-panel summary { padding: 4px 0; font-size: 11px; }
#warning-panel .notice { margin-top: 8px; }
footer { display: flex; justify-content: space-between; gap: 14px; padding-top: 20px; color: #7b7b84; font-size: 10px; line-height: 1.7; }

dialog { width: min(900px, calc(100% - 32px)); max-height: 88vh; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: #25262c; box-shadow: 0 20px 80px #0000001a; }
dialog::backdrop { background: #17171b66; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-heading > div { min-width: 0; }
.dialog-heading h2 { margin-top: 8px; overflow-wrap: anywhere; }
.dialog-heading button { flex-shrink: 0; font-size: 12px; }
#detail-status { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
pre { overflow: auto; max-height: 42vh; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #f8f8fa; font: 12px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; tab-size: 4; }
[hidden] { display: none !important; }

@media (max-width: 980px) {
  main { padding-right: 28px; padding-left: 28px; }
  .run-select { flex-basis: 320px; }
  .stats > div { padding: 17px 15px; }
  .stats strong { font-size: 22px; }
  #elapsed, #budget { font-size: 18px; }
}

@media (max-width: 760px) {
  main { padding: 28px 20px 22px; }
  .masthead { align-items: flex-start; gap: 16px; }
  h1 { font-size: 26px; }
  .connection { max-width: 150px; text-align: right; }
  .run-bar { align-items: stretch; flex-direction: column; gap: 12px; padding: 14px; }
  .run-select { flex-basis: auto; width: 100%; }
  .run-meta { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
  .stats > div { padding: 16px; }
  .stats strong { font-size: 23px; }
  #elapsed, #budget { font-size: 19px; }
  .charts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .chart-card { padding: 18px 16px 8px; }
  .section-heading { align-items: flex-start; }
  .events li { flex-direction: column; gap: 3px; }
  footer { flex-direction: column; gap: 5px; }
  dialog { padding: 20px; }
}

@media (max-width: 430px) {
  main { padding: 24px 16px 20px; }
  .masthead { flex-wrap: wrap; margin-bottom: 20px; gap: 14px; }
  .connection { max-width: none; width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 12px; text-align: left; }
  .connection > :last-child { display: none; }
  .stats > div { padding: 15px 13px; }
  .stat-label { margin-bottom: 12px; }
  #elapsed, #budget { font-size: 18px; }
  .filter { gap: 6px; }
  .filter label { display: none; }
  .section-heading > span { font-size: 10px; }
}

@media (prefers-reduced-motion: no-preference) {
  button, select, tbody tr { transition: background .15s, border-color .15s; }
}
