:root {
  --race-bg: #f4f0e8;
  --race-ink: #18212f;
  --race-muted: #667085;
  --race-line: #ded6c8;
  --race-card: #fffaf1;
  --race-card-strong: #ffffff;
  --race-accent: #e85d35;
  --race-accent-dark: #b93d1d;
  --race-blue: #1f6f8b;
  --race-green: #198754;
  --race-danger: #c2410c;
  --race-shadow: 0 18px 45px rgba(41, 35, 27, 0.13);
}

.racematic-public-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(232, 93, 53, 0.18), transparent 34rem),
    linear-gradient(135deg, #f6efe2 0%, #edf4f7 100%);
  color: var(--race-ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.racematic-results-shell {
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px;
  color: var(--race-ink);
}

.racematic-public-shell {
  padding: 28px;
}

.racematic-results-toolbar,
.racematic-panel,
.racematic-table-wrap,
.racematic-loading,
.racematic-error {
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid var(--race-line);
  border-radius: 22px;
  box-shadow: var(--race-shadow);
}

.racematic-results-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin-bottom: 18px;
}

.racematic-kicker {
  margin: 0 0 6px;
  color: var(--race-accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.racematic-results-toolbar h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

.racematic-results-toolbar p {
  margin: 10px 0 0;
  color: var(--race-muted);
}

.racematic-select-label,
.racematic-filter label {
  display: grid;
  gap: 7px;
  color: var(--race-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.racematic-select-label select,
.racematic-filter select,
.racematic-filter input {
  min-width: 220px;
  border: 1px solid var(--race-line);
  border-radius: 14px;
  padding: 11px 13px;
  background: #fff;
  color: var(--race-ink);
  outline: none;
}

.racematic-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.racematic-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff3df;
  color: #7c3b12;
  border: 1px solid #f3c98d;
  margin-bottom: 16px;
}

.racematic-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.racematic-card {
  background: var(--race-card-strong);
  border: 1px solid var(--race-line);
  border-radius: 18px;
  padding: 14px;
}

.racematic-card strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.racematic-card span {
  display: block;
  margin-top: 7px;
  color: var(--race-muted);
  font-size: 0.82rem;
}

.racematic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.racematic-tab {
  border: 1px solid var(--race-line);
  border-radius: 999px;
  background: #fff;
  color: var(--race-ink);
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
}

.racematic-tab:hover,
.racematic-tab.is-active {
  background: var(--race-accent);
  border-color: var(--race-accent);
  color: #fff;
  transform: translateY(-1px);
}

.racematic-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.racematic-filter-reset {
  border: 1px solid var(--race-line);
  border-radius: 14px;
  background: #fff;
  padding: 11px 13px;
  cursor: pointer;
  color: var(--race-muted);
}

.racematic-layout-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.racematic-layout-switch button {
  border: 1px solid var(--race-line);
  border-radius: 999px;
  background: #fff;
  color: var(--race-ink);
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}

.racematic-layout-switch button.is-active {
  background: #2c3948;
  border-color: #2c3948;
  color: #fff;
}

.racematic-table-wrap {
  overflow: auto;
}

.racematic-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  background: #fff;
}

.racematic-table th,
.racematic-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #efe8dc;
  text-align: left;
  vertical-align: top;
}

.racematic-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2c3948;
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.racematic-table tbody tr:hover {
  background: #fff7ea;
}

.racematic-position {
  width: 54px;
  color: var(--race-muted);
  font-weight: 800;
}

.racematic-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf4f7;
  color: var(--race-blue);
  font-weight: 900;
}

.racematic-time {
  color: var(--race-green);
  font-weight: 900;
  white-space: nowrap;
}

.racematic-status {
  color: var(--race-danger);
  font-weight: 900;
  text-transform: uppercase;
}

.racematic-muted {
  color: var(--race-muted);
  font-size: 0.88rem;
}

.racematic-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.racematic-lap-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.racematic-loading,
.racematic-error {
  padding: 28px;
  text-align: center;
  color: var(--race-muted);
}

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

.racematic-protocol-wrap {
  background: transparent;
}

.racematic-protocol-page {
  background: #fff;
  border: 1px solid #d9d9d9;
  box-shadow: 0 18px 45px rgba(31, 41, 55, 0.12);
  color: #111827;
  font-family: "Times New Roman", Georgia, serif;
  margin: 0 auto 28px;
  max-width: 1180px;
  padding: 28px;
}

.racematic-protocol-header {
  align-items: flex-start;
  border-bottom: 2px solid #111827;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
}

.racematic-protocol-kicker {
  color: #6b7280;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.racematic-protocol-header h2 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.1;
  margin: 5px 0 8px;
}

.racematic-protocol-header p {
  color: #4b5563;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  margin: 0;
}

.racematic-protocol-stamp {
  border: 2px solid #198754;
  color: #198754;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: 900;
  padding: 9px 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.racematic-protocol-stamp.has-warnings {
  border-color: var(--race-danger);
  color: var(--race-danger);
}

.racematic-protocol-section {
  margin: 0 0 26px;
  page-break-inside: avoid;
}

.racematic-protocol-section-title {
  align-items: baseline;
  border-bottom: 1px solid #111827;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 6px;
}

.racematic-protocol-section-title h3 {
  font-size: 1.1rem;
  margin: 0 0 5px;
}

.racematic-protocol-section-title span,
.racematic-protocol-section p {
  color: #6b7280;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.racematic-protocol-section p {
  margin: 0 0 8px;
}

.racematic-protocol-table {
  font-family: "Times New Roman", Georgia, serif;
  font-size: 0.86rem;
  min-width: 0;
}

.racematic-protocol-table th {
  background: #f3f4f6;
  color: #111827;
  font-size: 0.72rem;
  position: static;
}

.racematic-protocol-table th,
.racematic-protocol-table td {
  border: 1px solid #d1d5db;
  padding: 6px 7px;
}

.racematic-protocol-table tbody tr:hover {
  background: #fff;
}

.racematic-embed-body {
  background: #fff;
  color: #212529;
  margin: 0;
  min-height: 0;
  overflow-x: auto;
  padding: 0;
}

.racematic-embed-app {
  margin: 0;
  margin-left: auto;
  margin-right: auto;
  max-width: 1400px;
  padding: 0;
  width: 100%;
}

.racematic-embed-body .racematic-protocol-wrap,
.racematic-embed-body .racematic-table-wrap {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  overflow-x: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.racematic-embed-body .racematic-loading,
.racematic-embed-body .racematic-loading-embed {
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: transparent;
  min-height: 4px;
  padding: 0;
  position: relative;
  text-align: left;
}

.racematic-embed-body .racematic-loading-embed::before {
  background: #343a40;
  content: "";
  display: block;
  height: 3px;
  width: 92px;
}

.racematic-embed-skeleton {
  background: #fff;
  margin: 0;
  padding: 0;
  width: 100%;
}

.racematic-embed-skeleton-title {
  background: #f8f9fa;
  border-bottom: 2px solid #666;
  height: 42px;
  position: relative;
}

.racematic-embed-skeleton-title::before {
  background: #d7dce1;
  content: "";
  display: block;
  height: 16px;
  left: 12px;
  position: absolute;
  top: 13px;
  width: 240px;
}

.racematic-embed-skeleton-table {
  display: grid;
  gap: 0;
  min-width: 980px;
}

.racematic-embed-skeleton-table span {
  background:
    linear-gradient(90deg, transparent 0, transparent 2%, rgba(52, 58, 64, 0.08) 2%, rgba(52, 58, 64, 0.08) 20%, transparent 20%, transparent 22%, rgba(52, 58, 64, 0.08) 22%, rgba(52, 58, 64, 0.08) 48%, transparent 48%, transparent 50%, rgba(52, 58, 64, 0.08) 50%, rgba(52, 58, 64, 0.08) 72%, transparent 72%),
    #fff;
  border-bottom: 1px solid #dee2e6;
  display: block;
  height: 31px;
  opacity: calc(1 - (var(--i) * 0.06));
}

.racematic-embed-skeleton-table span:first-child {
  background: #343a40;
  height: 34px;
  opacity: 1;
}

.racematic-embed-body .racematic-protocol-page {
  border: 0;
  box-shadow: none;
  font-family: Arial, "Helvetica Neue", sans-serif;
  margin: 0;
  max-width: none;
  padding: 0;
  width: 100%;
}

.racematic-embed-body .racematic-protocol-section {
  margin: 0 0 18px;
  overflow-x: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.racematic-embed-body .racematic-protocol-section-title {
  background: #f8f9fa;
  border-bottom: 2px solid #666;
  margin: 0;
  padding: 10px 12px;
}

.racematic-embed-body .racematic-protocol-section-title h3 {
  color: #2c3e50;
  font-size: 18px;
  margin: 0;
}

.racematic-embed-body .racematic-protocol-section-title span,
.racematic-embed-body .racematic-protocol-section p {
  display: none;
}

.racematic-embed-body .racematic-protocol-table {
  border-collapse: collapse;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 12px;
  min-width: 1120px;
  width: 100%;
}

.racematic-embed-body .racematic-protocol-table th {
  background: #343a40;
  border: 1px solid #495057;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 6px;
  position: sticky;
  text-align: center;
  top: 0;
  z-index: 2;
}

.racematic-embed-body .racematic-protocol-table td {
  border: 1px solid #dee2e6;
  padding: 6px 5px;
  text-align: center;
  vertical-align: middle;
}

.racematic-embed-body .racematic-protocol-table td:nth-child(3) {
  min-width: 190px;
  text-align: left;
}

.racematic-embed-body .racematic-protocol-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.racematic-embed-body .racematic-protocol-table tbody tr:hover {
  background: #e3f2fd;
}

.racematic-embed-body .racematic-pill {
  background: transparent;
  border-radius: 0;
  color: inherit;
  display: inline;
  font-size: inherit;
  font-weight: 600;
  padding: 0;
}

.racematic-embed-body .racematic-number {
  background: transparent;
  color: inherit;
  min-width: 0;
  padding: 0;
}

.racematic-embed-body .racematic-position {
  color: inherit;
  width: auto;
}

.racematic-embed-body .racematic-time {
  color: #198754;
}

@media (max-width: 900px) {
  .racematic-results-shell,
  .racematic-public-shell {
    padding: 14px;
  }

  .racematic-embed-app {
    max-width: none;
  }

  .racematic-results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .racematic-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .racematic-select-label select,
  .racematic-filter select,
  .racematic-filter input {
    min-width: 0;
    width: 100%;
  }

  .racematic-protocol-page {
    padding: 14px;
  }

  .racematic-protocol-header {
    display: block;
  }

  .racematic-protocol-table {
    font-size: 0.78rem;
  }

  .racematic-embed-body .racematic-protocol-table {
    font-size: 11px;
    min-width: 980px;
  }

  .racematic-embed-body .racematic-protocol-section-title h3 {
    font-size: 15px;
  }
}

@media print {
  .racematic-public-body {
    background: #fff;
  }

  .racematic-results-shell {
    max-width: none;
    padding: 0;
  }

  .racematic-results-toolbar,
  .racematic-panel {
    display: none;
  }

  .racematic-protocol-page {
    border: 0;
    box-shadow: none;
    max-width: none;
    padding: 0;
  }
}
