:root {
  --red: #cc2c2c;
  --border: #e5e5e5;
  font-family: "Lantinghei SC", "Microsoft Yahei", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #333;
  background: #edfcf6;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
input[type="checkbox"] { margin: 0; accent-color: var(--red); }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible,
.chart-scroll:focus-visible, summary:focus-visible {
  outline: 2px solid #8c1f1f;
  outline-offset: 2px;
}

.page {
  max-width: 800px;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
}

.page-head {
  display: grid;
  place-items: center;
  height: 45px;
  color: #fff;
  background: var(--red);
}

.page-head h1 { margin: 0; font-size: 18px; font-weight: 600; }

.controls { padding: 10px; border-bottom: 1px solid var(--border); }
.scope-controls, .display-controls, .display-options { display: flex; align-items: center; }
.scope-controls { flex-wrap: wrap; gap: 8px 16px; }
.scope-controls label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.scope-controls select, #retry {
  min-height: 32px;
  padding: 3px 8px;
  border: 1px solid #ccc;
  border-radius: 2px;
  color: #333;
  background: #fff;
}

.display-controls { flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.display-options { flex-wrap: wrap; gap: 4px 14px; }
.display-options label { display: flex; gap: 5px; align-items: center; min-height: 28px; }
.display-options label:has(:disabled) { color: #6d6969; }
.dimensions { display: flex; }
.dimensions button {
  min-width: 58px;
  min-height: 32px;
  padding: 3px 10px;
  border: 1px solid #ccc;
  color: #333;
  background: #fff;
}
.dimensions button + button { margin-left: -1px; }
.dimensions button[aria-pressed="true"] {
  position: relative;
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}
.dimensions button:focus-visible { position: relative; z-index: 1; }

.status, .load-error, .chart-note { margin: 0; padding: 8px 10px; }
.load-error { color: #8c1f1f; }
.load-error p { margin: 0 0 6px; }
.scope-summary {
  margin: 0;
  padding: 5px 10px;
  color: #555;
  background: #eee;
  font-variant-numeric: tabular-nums;
}

.chart-scroll {
  max-height: min(65vh, 650px);
  overflow: auto;
  border-bottom: 1px solid var(--border);
}
.chart-scroll:focus-visible { outline-offset: -2px; }
.chart-content {
  --period-width: 135px;
  --column-width: 33px;
  position: relative;
  isolation: isolate;
  width: max(100%, calc(var(--period-width) + var(--column-width) * var(--column-count)));
}
.chart-content:not([data-dimension="number"]) { --column-width: 38px; }

#trend-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

#trend-table th, #trend-table td {
  height: 34px;
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
#trend-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 30px;
  color: #424242;
  background: #f7f7f7;
  font-size: 12px;
}
#trend-table .period-heading, #trend-table .period-cell {
  position: sticky;
  left: 0;
  width: var(--period-width);
  box-shadow: 2px 0 3px #00000012;
}
#trend-table .period-heading { z-index: 5; }
#trend-table .period-cell { z-index: 3; background: #fff; font-size: 12px; font-weight: 400; }
#trend-table tbody tr:nth-child(even) { background: #fafafa; }
#trend-table tr:nth-child(even) .period-cell { background: #fafafa; }
#trend-table tr.segment-start > * { border-top: 2px dashed #b77474; }
.period-cell strong { color: #b72323; }
.period-cell time { margin-left: 6px; color: #595959; }

.omission { color: #696565; font-size: 11px; }
.hide-omissions .omission { visibility: hidden; }
.hit {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #e8e8e8 center / contain no-repeat;
  color: #252525;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.hit.ball-red, .hit.ball-blue, .hit.ball-green { background-color: #fff; }
.hit.ball-red { background-image: url("/static/2/images/ball-red.png"); }
.hit.ball-blue { background-image: url("/static/2/images/ball-blue.png"); }
.hit.ball-green { background-image: url("/static/2/images/ball-green.png"); }
button.hit { padding: 0; border: 1px solid #8d8d8d; }
button.hit[aria-expanded="true"] { outline: 2px solid #8c1f1f; outline-offset: 1px; }
.hit-count {
  position: absolute;
  top: -3px;
  right: -4px;
  display: grid;
  place-items: center;
  min-width: 13px;
  min-height: 13px;
  border-radius: 50%;
  background: #555;
  color: #fff;
  font-size: 9px;
}
.hit-detail { margin: 0; }
.hit-detail:not(:empty) { padding: 5px 10px; border-bottom: 1px solid var(--border); background: #fff6f5; }
.trend-lines { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.trend-lines path { fill: none; stroke: #cc2c2c; stroke-opacity: .65; stroke-width: 1.6; }
.chart-note { color: #5e5e5e; font-size: 12px; }
.data-issues { padding: 8px 10px; border-top: 1px solid var(--border); color: #794624; }
.data-issues summary { cursor: pointer; }
.data-issues ul { margin: 6px 0 0; padding-left: 1.45em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 520px) {
  .scope-controls label { flex: 1 0 calc(50% - 8px); }
  .scope-controls select { flex: 1; min-width: 0; }
  .display-controls { gap: 6px 14px; }
  .chart-content { --period-width: 91px; }
  .period-cell time { display: block; margin-left: 0; font-size: 11px; }
}
