:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #17231d;
  background: #f3f6f3;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 0;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: url("assets/images/banner.png") center / cover no-repeat;
  content: "";
  opacity: 0.1;
  pointer-events: none;
}

.page {
  width: min(100% - 2rem, 820px);
  margin: 0 auto;
  padding: 4rem 0 2rem;
}

.page-header {
  margin-bottom: 3rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: #276344;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.4rem, 7vw, 4rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.status,
footer {
  color: #56645c;
}

.feedback-button {
  padding: 0.6rem 0.85rem;
  border: 0;
  border-radius: 0.5rem;
  background: #17613c;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
}

.feedback-button:hover {
  background: #0c4227;
}

.feedback-button:focus-visible {
  outline: 3px solid #e0a52e;
  outline-offset: 2px;
}

.source-status {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #dce5de;
  border-radius: 0.75rem;
  background: #fff;
}

.source-status h2 {
  margin-bottom: 0.6rem;
  font-size: 1rem;
}

.source-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 0.75rem;
}

.filter-groups {
  display: grid;
  gap: 0.55rem;
  width: min(100%, 460px);
  margin: -1rem auto 2rem;
}

.date-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.2rem;
  width: 100%;
  padding: 0.2rem;
  border: 1px solid #dce5de;
  border-radius: 0.7rem;
  background: #f3f6f3;
}

.date-filter-button {
  min-width: 0;
  padding: 0.55rem 0.35rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: #34443a;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.date-filter-button[aria-pressed="true"] {
  background: #17613c;
  color: #fff;
  box-shadow: 0 1px 3px rgba(23, 97, 60, 0.25);
}

.date-filter-button:focus-visible {
  outline: 3px solid #344d82;
  outline-offset: 2px;
}

.duplicate-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--duplicate-border, #eadca6);
  border-radius: 999px;
  background: var(--duplicate-background, #fff8dc);
  color: var(--duplicate-foreground, #66520a);
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}

.duplicate-badge--color-1 {
  --duplicate-border: #aec6f5;
  --duplicate-background: #e8f0fe;
  --duplicate-foreground: #234b8a;
}

.duplicate-badge--color-2 {
  --duplicate-border: #abd5b5;
  --duplicate-background: #e7f5ea;
  --duplicate-foreground: #245c32;
}

.duplicate-badge--color-3 {
  --duplicate-border: #d2b8ea;
  --duplicate-background: #f2eafb;
  --duplicate-foreground: #573779;
}

.duplicate-badge--color-4 {
  --duplicate-border: #f0c08e;
  --duplicate-background: #fff0e2;
  --duplicate-foreground: #75430f;
}

.duplicate-badge--color-5 {
  --duplicate-border: #a4d6d1;
  --duplicate-background: #e3f4f2;
  --duplicate-foreground: #155b57;
}

.duplicate-badge--color-6 {
  --duplicate-border: #e8b3c5;
  --duplicate-background: #fce9f0;
  --duplicate-foreground: #7b2c4a;
}

.debug-banner {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid #e0a52e;
  border-radius: 0.5rem;
  background: #fff8dc;
  color: #66520a;
  font-size: 0.85rem;
  font-weight: 650;
}

.debug-banner[hidden] {
  display: none;
}

.source-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.75rem;
  align-items: stretch;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  box-shadow: 0 2px 6px rgba(24, 38, 67, 0.08);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.source-card:hover,
.source-card:focus-within {
  border-color: rgba(52, 77, 130, 0.6);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(52, 77, 130, 0.22),
    0 8px 18px rgba(31, 48, 86, 0.16),
    0 0 12px rgba(52, 77, 130, 0.14);
}

.source-card--fresh {
  border-color: rgba(36, 132, 72, 0.2);
  background: rgba(54, 166, 91, 0.09);
}

.source-card--stale {
  border-color: rgba(181, 133, 18, 0.22);
  background: rgba(235, 190, 62, 0.12);
}

.source-card--failed {
  border-color: rgba(174, 53, 53, 0.2);
  background: rgba(205, 72, 72, 0.09);
}

.source-card--unknown {
  border-color: rgba(73, 91, 79, 0.12);
  background: rgba(73, 91, 79, 0.05);
}

.source-card-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.source-card-details {
  min-width: 0;
}

.source-card-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
}

.source-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.source-toggle-button {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid #dce5de;
  border-radius: 0.5rem;
  background: #fff;
  color: #34443a;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.source-toggle-button:hover {
  border-color: #9dac9f;
}

.source-toggle-button:focus-visible,
.source-link-button:focus-visible {
  outline: 3px solid #344d82;
  outline-offset: 2px;
}

.source-toggle-track {
  position: relative;
  width: 1.65rem;
  height: 0.95rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #aab4ad;
  transition: background-color 180ms ease;
}

.source-toggle-track::before {
  position: absolute;
  top: 0.115rem;
  left: 0.115rem;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 180ms ease;
}

.source-toggle-button[aria-pressed="true"] .source-toggle-track {
  background: #17613c;
}

.source-toggle-button[aria-pressed="true"] .source-toggle-track::before {
  transform: translateX(0.7rem);
}

.source-link-button {
  display: flex;
  flex: 1 1 0;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid #17613c;
  border-radius: 0.5rem;
  background: #17613c;
  color: #fff;
  box-shadow: 0 1px 3px rgba(23, 97, 60, 0.25);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.source-visibility-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.source-eye-open,
.source-eye-closed {
  display: none;
}

.source-toggle-button[aria-pressed="true"] .source-eye-open,
.source-toggle-button[aria-pressed="false"] .source-eye-closed {
  display: initial;
}

.source-link-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.source-link-button:hover {
  border-color: #0c4227;
  background: #0c4227;
  color: #fff;
}

.source-name {
  margin: 0;
  font-size: 0.95rem;
}

.source-state,
.source-time {
  margin: 0.55rem 0 0;
  color: #56645c;
  font-size: 0.82rem;
  line-height: 1.4;
}

.source-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.source-cell {
  min-width: 0;
}

.event-source-links {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.event-source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid #b7d9c0;
  border-radius: 0.45rem;
  background: #e8f4eb;
  color: #174f32;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.event-source-link:hover {
  border-color: #83b995;
  background: #d8ecde;
  color: #103f27;
}

.event-source-link .source-icon {
  width: 20px;
  height: 20px;
}

.competition-date-cell {
  font-variant-numeric: tabular-nums;
}

.competition-type-cell {
  color: #344d40;
  font-size: 0.88rem;
  font-weight: 600;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid #dce5de;
  border-radius: 0.75rem;
  background: #fff;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 1rem 1.1rem;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th:first-child {
  width: 13%;
}

th:nth-child(2) {
  width: 27%;
}

th:nth-child(3) {
  width: 17%;
}

th:nth-child(4) {
  width: 20%;
}

th:nth-child(5) {
  width: 23%;
}

th {
  color: #56645c;
  background: #f8faf8;
  font-size: 0.8rem;
  font-weight: 650;
}

td {
  border-top: 1px solid #e8eee9;
}

a {
  color: #17613c;
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: #0c4227;
}

.event-source-link:focus-visible {
  outline: 3px solid #e0a52e;
  outline-offset: 2px;
}

.status {
  margin-bottom: 1rem;
}

.status:empty {
  display: none;
}

footer {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .source-card {
    transition: none;
  }
}

@media (max-width: 600px) {
  .page {
    width: calc(100% - 1rem);
    padding-top: 2.5rem;
  }

  .source-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .source-card {
    grid-template-columns: minmax(0, 1fr) 5.5rem;
  }

  .date-filters {
    width: 100%;
  }

  .date-filter-button {
    padding-inline: 0.2rem;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  table,
  tbody {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  tbody tr {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
    border: 1px solid #dce5de;
    border-radius: 0.75rem;
    background: #fff;
  }

  tbody td {
    display: grid;
    grid-template-columns: minmax(5rem, 0.32fr) minmax(0, 1fr);
    gap: 0.6rem;
    width: 100%;
    min-width: 0;
    padding: 0.75rem;
    border-top: 1px solid #e8eee9;
  }

  tbody td::before {
    color: #56645c;
    font-size: 0.78rem;
    font-weight: 650;
    content: attr(data-label);
  }

  tbody td:first-child {
    border-top: 0;
  }

  .competition-date-cell {
    width: auto;
    white-space: normal;
  }

  .event-source-links,
  .event-source-link {
    min-width: 0;
    max-width: 100%;
  }

  .duplicate-badge {
    white-space: normal;
  }
}
