* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: #ececec;
  color: #28292b;
  font: .875rem/1.45 Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
a, button { touch-action: manipulation; }
a:focus-visible, button:focus-visible { outline: 3px solid #215ded; outline-offset: 2px; }

.archive-detail { width: min(calc(100% - 20px), 770px); margin: 12px auto 24px; }
.archive-heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  margin: 0 0 10px;
  padding: 4px 8px;
  background: #087c0e;
  color: #fff;
  border-radius: 4px;
}
.archive-heading h1 { margin: 0; font-size: clamp(.9375rem, 3vw, 1.125rem); line-height: 1.2; text-align: center; }
.archive-back { display: inline-flex; align-items: center; min-height: 44px; justify-self: start; padding: 7px 5px; color: inherit; text-decoration: none; white-space: nowrap; font-size: .75rem; }

.archive-sheet { padding: 10px; border-radius: 14px; background: #dcdcdc; box-shadow: 0 6px 24px #0002; }
.archive-groups, .archive-years, .archive-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.archive-groups { margin-bottom: 7px; }
.archive-groups a, .archive-years a, .archive-years button, .archive-pages a, .archive-pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7b7b7;
  border-radius: 7px;
  background: #f6f6f6;
  color: #292929;
  min-height: 34px;
  padding: 4px 9px;
  text-decoration: none;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 700;
}
.archive-groups a { flex: 1 1 auto; }
.archive-groups [aria-current] { background: #087c0e; border-color: #087c0e; color: #fff; }
.archive-filters { background: #ececc3; border: 1px solid #c8c8bd; padding: 6px; margin-bottom: 6px; }
.filter-line { display: grid; grid-template-columns: 3.125rem minmax(0,1fr); align-items: center; gap: 6px; }
.filter-line + .filter-line { margin-top: 6px; }
.filter-label { color: #ba1e17; font-size: .8125rem; font-weight: 700; }
.filter-chips { display: grid; grid-template-columns: repeat(auto-fill,minmax(2.75rem,1fr)); gap: 6px; }
.filter-chips button {
  min-width: 0;
  padding: 1px;
  min-height: 30px;
  border: 1px solid #b9b9a7;
  border-radius: 6px;
  background: #f4f4dd;
  color: #1d1d1b;
  font-size: .75rem;
  font-weight: 700;
}
.filter-chips [aria-pressed="true"] { background: #f7a600; border-color: #a96700; color: #281700; }
.archive-years { margin: 0 0 6px; }
.archive-years a, .archive-years button { flex: 1 1 auto; min-height: 30px; padding-inline: 5px; border: 2px solid #fff; background: #f7a600; color: #281700; border-radius: 10px; }
.archive-years [aria-current] { background: #f1f1f1; color: #252525; border-color: #f1f1f1; }

.history-row { margin: 0 0 6px; border: 1px solid #cfcfcf; background: #efefef; }
.history-row h2 { margin: 0; padding: 4px 6px; color: #444; font-size: .8125rem; line-height: 1.25; }
.history-row time { font-weight: 600; }
.sourceissue, .archive-credit a { color: #155689; text-underline-offset: 2px; }
.history-results {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr)) 1.75rem minmax(0,1fr);
  gap: 4px;
  align-items: start;
  border-top: 1px solid #d5d5d5;
  padding: 3px 3px 2px;
}
.history-ball { min-width: 0; text-align: center; }
.history-ball .ball {
  --wave: #626971;
  display: grid;
  place-items: center;
  min-height: 1.75rem;
  color: #fff;
  background: var(--wave);
  border-radius: 2px;
  font-size: .8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.history-ball .red { --wave: #d31c1c; }
.history-ball .blue { --wave: #1d31df; }
.history-ball .green { --wave: #007b13; }
.history-ball.is-dim .ball { background: #e0e2e4; background: color-mix(in srgb, var(--wave) 18%, #fff); color: #51565c; }
.history-meta { display: block; min-height: 17px; margin-top: 2px; font-size: .75rem; font-weight: 600; color: #4d4d4d; white-space: nowrap; }
.history-ball.is-dim .history-meta { color: #666; }
.history-special { color: #555; text-align: center; font-weight: 700; line-height: 1.75rem; }
.archive-message { margin: 0; padding: 18px 8px; background: #efefef; color: #555; text-align: center; }
.archive-pages { justify-content: center; margin: 10px 0 0; }
.archive-pages [aria-current] { background: #4a4d51; border-color: #4a4d51; color: #fff; }
.archive-pages .page-gap { border-color: transparent; background: transparent; padding-inline: 1px; }
.archive-credit { margin: 8px 0 0; font-size: .75rem; color: #4d4d4d; line-height: 1.55; }

@media (max-width: 620px) {
  .archive-sheet { padding: 8px; }
  .filter-line { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .filter-chips { grid-template-columns: repeat(auto-fit,minmax(2.75rem,1fr)); gap: 5px; }
  .filter-chips[data-filter="pos"] { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .filter-chips button, .archive-groups a, .archive-years a, .archive-years button { min-height: 36px; }
  .archive-years { gap: 4px; }
  .archive-years a, .archive-years button { padding-inline: 2px; font-size: .75rem; }
  .history-results { grid-template-columns: repeat(6,minmax(0,1fr)) 1.125rem minmax(0,1fr); gap: 3px; }
  .history-ball .ball { min-height: 2rem; font-size: .875rem; }
  .history-meta { font-size: .75rem; }
  .history-special { line-height: 2rem; }
}

/* Keep touch controls usable without reducing the draw or filter text. */
@media (pointer: coarse), (max-width: 620px) {
  .archive-groups a, .archive-years a, .archive-years button, .archive-pages a,
  .filter-chips button { min-height: 44px; min-width: 44px; }
}
@media (max-width: 23em) {
  .archive-detail { width: calc(100% - 12px); }
  .archive-sheet { padding: 6px; }
  .archive-years { display: grid; grid-template-columns: repeat(auto-fit,minmax(2.8rem,1fr)); gap: 3px; }
}
@media (max-width: 19em) {
  .archive-heading { grid-template-columns: minmax(0,1fr) auto; }
  .archive-heading h1 { grid-column: 1 / -1; grid-row: 2; margin-bottom: 4px; }
  .archive-brand-mark { grid-column: 2; grid-row: 1; }
  .filter-chips[data-filter="pos"] { grid-template-columns: repeat(auto-fit,minmax(2.75rem,1fr)); }
  .history-results { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
