:root {
  --ink: #16131f;
  --muted: #6c6578;
  --paper: #fffdf8;
  --line: #ebe5f2;
  --hot: #ff315d;
  --sun: #ffd43b;
  --aqua: #00bcd4;
  --lime: #8bd63f;
  --violet: #6c3df4;
  --shadow: 0 18px 44px rgba(28, 20, 45, .14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 49, 93, .12), rgba(0, 188, 212, .12), rgba(139, 214, 63, .12)),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 44px);
  color: white;
  background: linear-gradient(110deg, #ff315d 0%, #ff8a00 34%, #00bcd4 68%, #6c3df4 100%);
  border-bottom: 8px solid var(--sun);
}

.topbar h1,
.results-head h2,
.diploma-detail h2,
.empty-state h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: .95;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.event-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.event-stats span,
.chips span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(8px);
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 36px;
}

.filters {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  padding: 12px;
  margin-bottom: 18px;
  background: rgba(255, 253, 248, .92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

label {
  display: grid;
  gap: 5px;
}

label span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
button,
.action-button {
  min-height: 43px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

input,
select {
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

button,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  background: var(--sun);
  cursor: pointer;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 18px;
  align-items: start;
}

.results-panel,
.diploma-panel {
  min-width: 0;
}

.results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
}

.results-head .eyebrow,
.diploma-meta .eyebrow,
.empty-state .eyebrow {
  color: var(--hot);
}

.results-list {
  display: grid;
  gap: 10px;
}

.result-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--aqua);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 18px rgba(28, 20, 45, .08);
  cursor: pointer;
}

.result-card:nth-child(4n + 1) {
  border-left-color: var(--hot);
}

.result-card:nth-child(4n + 2) {
  border-left-color: var(--lime);
}

.result-card:nth-child(4n + 3) {
  border-left-color: var(--violet);
}

.result-card.active {
  outline: 3px solid var(--sun);
}

.bib {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
}

.bib strong {
  font-size: 1.35rem;
}

.runner h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.2;
}

.runner p,
.metrics span,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.metrics span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f5f1fb;
  font-size: .82rem;
  font-weight: 750;
}

.status {
  min-width: 112px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #063b22;
  font-size: .82rem;
  font-weight: 900;
  text-align: center;
  background: #d8ff71;
}

.status.missing {
  color: #6f1730;
  background: #ffd6df;
}

.diploma-panel {
  position: sticky;
  top: 95px;
}

.diploma-detail,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 32px;
}

.diploma-meta {
  padding: 18px 18px 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips span {
  color: var(--ink);
  border-color: var(--line);
  background: #f7fbff;
}

.actions {
  padding: 0 18px 14px;
}

.action-button.primary {
  width: 100%;
  color: white;
  border-color: var(--hot);
  background: var(--hot);
}

.diploma-viewer {
  padding: 0 18px 18px;
}

.diploma-viewer img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.no-diploma {
  padding: 22px;
  border: 2px dashed #ffc1d0;
  border-radius: 8px;
  color: #6f1730;
  background: #fff1f5;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .filters,
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }

  .search-field,
  .content-grid,
  #clearFilters {
    grid-column: 1 / -1;
  }

  .diploma-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-stats {
    justify-content: flex-start;
  }

  .filters {
    position: static;
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .results-head,
  .result-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .results-head {
    display: grid;
  }

  .bib {
    grid-auto-flow: column;
    justify-content: start;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
  }

  .status {
    width: 100%;
  }

}
