:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5d6977;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #9f1239;
  --success-bg: #ecfdf5;
  --success-line: #a7f3d0;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(245, 247, 249, 0) 290px),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.lookup-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 36px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.logo {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.5rem;
}

.search-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.search-form button {
  grid-column: 1 / -1;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.status {
  min-height: 28px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 700;
}

.status.error {
  color: var(--danger);
}

.summary {
  margin-top: 16px;
  border: 1px solid var(--success-line);
  border-radius: 8px;
  background: var(--success-bg);
  padding: 18px;
}

.registration-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.registration {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.registration-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.registration-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.place-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 900;
  white-space: nowrap;
}

.place-badge {
  background: var(--accent);
  color: #ffffff;
}

.status-badge {
  background: rgba(93, 105, 119, 0.12);
  color: var(--muted);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.meta-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.meta-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.meta-value {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.certificate-button {
  margin-top: 16px;
}

.empty {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
}

.public-results {
  margin-top: 38px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.event-select-label {
  width: min(420px, 100%);
}

.ranking-distance {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
}

.ranking-distance-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: rgba(15, 118, 110, 0.08);
  border-bottom: 1px solid var(--line);
}

.ranking-distance-head span {
  color: var(--muted);
  font-weight: 900;
}

.ranking-group {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.ranking-group:last-child {
  border-bottom: 0;
}

.ranking-group h4 {
  margin-bottom: 12px;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ranking-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.ranking-column-head {
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}

.ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(217, 224, 231, 0.72);
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.ranking-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ranking-main strong,
.ranking-main span,
.ranking-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-main span,
.ranking-main small {
  color: var(--muted);
  font-weight: 700;
}

.ranking-time {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.ranking-empty {
  padding: 12px;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 900px) {
  .search-form,
  .meta-grid,
  .ranking-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .registration-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .lookup-panel {
    padding: 18px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .logo {
    width: 58px;
    height: 58px;
  }

  .ranking-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .ranking-time {
    grid-column: 2;
  }
}
