.athlete-page {
  min-width: 320px;
}

.athlete-shell {
  max-width: 1080px;
}

.athlete-page-main {
  display: grid;
  gap: 8px;
}

.athlete-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
}

.athlete-back-link,
.athlete-toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 750;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.athlete-back-link > span:first-child {
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.athlete-page-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.athlete-toolbar-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.athlete-back-link:hover,
.athlete-back-link:focus-visible,
.athlete-toolbar-button:hover,
.athlete-toolbar-button:focus-visible {
  border-color: rgba(255, 214, 10, 0.36);
  color: var(--text);
  background: rgba(255, 214, 10, 0.07);
  outline: none;
}

.athlete-profile-page {
  overflow: visible;
  min-height: min(660px, calc(100dvh - 190px));
}

.athlete-page-content {
  padding: 12px;
}

.athlete-page-content[aria-busy="true"] {
  cursor: progress;
}

.athlete-profile-layout,
.athlete-ssr-preview {
  display: grid;
  gap: 9px;
}

.athlete-page-identity {
  min-width: 0;
  padding: 2px 1px 5px;
}

.athlete-page-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.athlete-page-flag,
.athlete-page-name-row > .flag {
  display: block;
  width: 29px;
  height: 18px;
  flex: 0 0 29px;
  margin: 0;
  object-fit: cover;
}

.athlete-page-name-copy {
  min-width: 0;
}

.athlete-page-eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.athlete-page-name-copy h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  font-size: clamp(1.35rem, 7vw, 1.8rem);
  letter-spacing: -0.025em;
  line-height: 1;
  text-transform: uppercase;
}

.athlete-page-name-copy > p:last-child {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-elite-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 7px;
  padding: 0 6px;
  border: 1px solid rgba(255, 214, 10, 0.3);
  border-radius: 999px;
  color: var(--accent);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.5rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  vertical-align: 3px;
}

.athlete-page-score-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 0.82fr));
  gap: 1px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.athlete-page-score {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 72px;
  padding: 9px;
  background: #151514;
}

.athlete-page-score:first-child {
  border-radius: 11px 0 0 11px;
}

.athlete-page-score:last-child {
  border-radius: 0 11px 11px 0;
}

.athlete-page-score > span,
.athlete-mini-card > span,
.athlete-profile-card > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.065em;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.athlete-page-score strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-page-score-primary {
  background: linear-gradient(135deg, rgba(255, 214, 10, 0.11), #151514 72%);
}

.athlete-page-score-primary strong {
  color: var(--accent);
  font-size: 1.72rem;
  letter-spacing: -0.04em;
}

.athlete-page-score small {
  display: block;
  min-height: 1em;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.5rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-score-trigger {
  display: grid;
  align-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.athlete-score-trigger:focus-visible {
  border-radius: 7px;
  box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.5);
  outline: none;
}

.athlete-score-trigger-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-2);
  font-size: 0.5rem;
  font-weight: 750;
}

.athlete-score-trigger-label b {
  color: var(--accent);
  font-size: 0.72rem;
}

.athlete-score-detail {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: -1px;
  width: min(310px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid rgba(255, 214, 10, 0.32);
  border-radius: 12px;
  color: var(--text);
  background: rgba(13, 13, 12, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.58);
}

.athlete-score-detail[hidden] {
  display: none;
}

.athlete-score-detail-title {
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.athlete-score-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  font-size: 0.72rem;
}

.athlete-score-detail-grid span {
  color: var(--muted);
}

.athlete-score-detail-grid strong {
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  text-align: right;
}

.athlete-score-formula {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.athlete-score-formula strong {
  color: var(--text);
}

.athlete-page-penalty {
  color: var(--accent) !important;
}

.athlete-page-stat-grid,
.athlete-page-best-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.athlete-page-best-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.athlete-mini-card,
.athlete-profile-card {
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.athlete-mini-card strong,
.athlete-profile-card strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-page-submeta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 0.62rem;
  line-height: 1.3;
}

.athlete-page-submeta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-results-section {
  margin-top: 3px;
}

.athlete-results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 6px;
}

.athlete-results-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.athlete-results-head span {
  color: var(--muted-2);
  font-size: 0.58rem;
  text-align: right;
}

.athlete-race-list {
  display: grid;
  gap: 5px;
}

.athlete-race-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
}

.athlete-race-card.is-selected {
  border-color: rgba(255, 214, 10, 0.25);
  background: linear-gradient(135deg, rgba(255, 214, 10, 0.07), rgba(255, 255, 255, 0.018));
}

.athlete-race-card.is-open {
  border-color: rgba(255, 214, 10, 0.38);
}

.athlete-race-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  width: 100%;
  min-height: 55px;
  padding: 8px 9px;
  border: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.athlete-race-toggle:hover,
.athlete-race-toggle:focus-visible,
.athlete-race-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.athlete-race-title {
  min-width: 0;
}

.athlete-race-event-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.athlete-race-event-name strong {
  min-width: 0;
}

.athlete-race-flag {
  width: 22px;
  height: 14px;
  flex: 0 0 22px;
  object-fit: cover;
}

.athlete-race-title strong {
  display: block;
  overflow: hidden;
  font-size: 0.73rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-race-title small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.57rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-race-badge {
  display: inline-flex;
  align-items: center;
  min-height: 15px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: 99px;
  color: #0d0d0d;
  font-size: 0.45rem;
  font-weight: 900;
  background: var(--accent);
  vertical-align: 1px;
}

.athlete-race-score {
  min-width: 58px;
  text-align: right;
}

.athlete-race-score strong {
  display: block;
  color: var(--accent);
  font-size: 0.76rem;
  line-height: 1.15;
}

.athlete-race-score small {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 0.55rem;
}

.athlete-race-toggle-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.athlete-race-detail-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 800;
}

.athlete-race-detail-label b {
  font-size: 0.82rem;
  line-height: 1;
}

.athlete-race-calculation {
  padding: 9px;
  border-top: 1px solid var(--line);
  background: rgba(255, 214, 10, 0.025);
}

.athlete-race-calculation[hidden] {
  display: none;
}

.athlete-race-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding-bottom: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.63rem;
  line-height: 1.4;
}

.athlete-race-formula strong {
  color: var(--accent);
  font-size: 0.72rem;
}

.athlete-race-calculation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.athlete-race-calculation-grid > div {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.13);
}

.athlete-race-calculation-grid span {
  display: block;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.athlete-race-calculation-grid strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-profile-empty,
.athlete-profile-error {
  display: grid;
  justify-items: start;
  gap: 10px;
  min-height: 300px;
  align-content: center;
  padding: 20px;
}

.athlete-profile-error h1 {
  margin: 0;
  font-family: "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  text-transform: uppercase;
}

.athlete-profile-error p,
.athlete-profile-empty p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.athlete-profile-error .button {
  min-height: 40px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.athlete-page-loading-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 9px;
  color: var(--muted-2);
  font-size: 0.64rem;
}

.athlete-page-loading-line i {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: athlete-spin 700ms linear infinite;
}

@keyframes athlete-spin {
  to { transform: rotate(360deg); }
}

.athlete-page-toast {
  position: fixed;
  z-index: 120;
  right: 14px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: min(300px, calc(100vw - 28px));
  padding: 10px 13px;
  border: 1px solid rgba(255, 214, 10, 0.32);
  border-radius: 11px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(15, 15, 14, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.5);
}

.athlete-page-toast[hidden] {
  display: none;
}

.athlete-footer {
  margin-bottom: 0;
}

@media (min-width: 560px) {
  .athlete-page-content {
    padding: 16px;
  }

  .athlete-profile-layout,
  .athlete-ssr-preview {
    gap: 11px;
  }

  .athlete-page-name-copy h1 {
    font-size: 2rem;
  }

  .athlete-page-score {
    min-height: 84px;
    padding: 12px;
  }

  .athlete-page-score-primary strong {
    font-size: 2rem;
  }

  .athlete-page-score strong {
    font-size: 1.08rem;
  }

  .athlete-page-score-primary strong {
    font-size: 2rem;
  }

  .athlete-mini-card,
  .athlete-profile-card {
    min-height: 62px;
    padding: 10px;
  }

  .athlete-mini-card strong,
  .athlete-profile-card strong {
    font-size: 0.84rem;
  }

  .athlete-race-toggle {
    grid-template-columns: minmax(0, 1fr) 90px 90px;
    align-items: center;
    min-height: 62px;
    padding: 10px 12px;
  }

  .athlete-race-title strong {
    font-size: 0.8rem;
  }

  .athlete-race-score {
    min-width: 0;
  }

  .athlete-race-toggle-footer {
    grid-column: auto;
    justify-content: flex-end;
    padding: 0;
    border: 0;
  }

  .athlete-race-toggle-footer > span:first-child {
    color: var(--text);
    font-size: 0.74rem;
  }

  .athlete-race-calculation {
    padding: 12px;
  }
}

@media (min-width: 761px) {
  .athlete-page-main {
    gap: 10px;
  }

  .athlete-page-toolbar {
    min-height: 48px;
  }

  .athlete-profile-page {
    min-height: 680px;
  }

  .athlete-page-content {
    padding: 20px;
  }

  .athlete-page-name-row {
    gap: 12px;
  }

  .athlete-page-flag,
  .athlete-page-name-row > .flag {
    width: 34px;
    height: 21px;
    flex-basis: 34px;
  }

  .athlete-page-name-copy h1 {
    font-size: 2.25rem;
  }

  .athlete-page-name-copy > p:last-child {
    font-size: 0.76rem;
  }

  .athlete-page-score-grid {
    grid-template-columns: minmax(210px, 1.2fr) repeat(2, minmax(150px, 0.8fr));
    border-radius: 15px;
  }

  .athlete-page-score {
    min-height: 96px;
    padding: 14px 16px;
  }

  .athlete-page-score:first-child {
    border-radius: 14px 0 0 14px;
  }

  .athlete-page-score:last-child {
    border-radius: 0 14px 14px 0;
  }

  .athlete-page-score > span,
  .athlete-mini-card > span,
  .athlete-profile-card > span {
    font-size: 0.62rem;
  }

  .athlete-page-score-primary strong {
    font-size: 2.45rem;
  }

  .athlete-page-score strong {
    font-size: 1.22rem;
  }

  .athlete-page-score-primary strong {
    font-size: 2.45rem;
  }

  .athlete-page-stat-grid,
  .athlete-page-best-grid {
    gap: 8px;
  }

  .athlete-mini-card,
  .athlete-profile-card {
    min-height: 68px;
    padding: 11px 12px;
    border-radius: 12px;
  }

  .athlete-page-submeta {
    font-size: 0.7rem;
  }

  .athlete-results-head {
    min-height: 35px;
    margin-bottom: 8px;
  }

  .athlete-results-head h2 {
    font-size: 0.82rem;
  }

  .athlete-race-list {
    gap: 7px;
  }

  .athlete-race-card {
    border-radius: 13px;
  }

  .athlete-race-toggle {
    min-height: 68px;
    padding: 11px 14px;
  }

  .athlete-race-title strong {
    font-size: 0.88rem;
  }

  .athlete-race-title small,
  .athlete-race-score small,
  .athlete-race-toggle-footer {
    font-size: 0.64rem;
  }

  .athlete-race-score strong {
    font-size: 0.88rem;
  }

  .athlete-race-calculation-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
  }

  .athlete-race-calculation-grid > div {
    padding: 8px;
  }

  .athlete-race-calculation-grid span {
    font-size: 0.52rem;
  }

  .athlete-race-calculation-grid strong {
    font-size: 0.7rem;
  }

  .athlete-page-toast {
    bottom: 22px;
  }
}

@media (max-width: 760px) {
  .athlete-page .topbar {
    margin-bottom: 0;
  }

  .athlete-page-main {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .athlete-page-toolbar {
    position: sticky;
    z-index: 30;
    top: 0;
    padding: 5px 0;
    background: rgba(13, 13, 13, 0.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .athlete-share-button span {
    display: none;
  }

  .athlete-share-button {
    width: 38px;
    padding: 0;
  }

  .athlete-footer {
    margin-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .athlete-page-content {
    padding: 10px 9px;
  }

  .athlete-page-score {
    padding: 8px 7px;
  }

  .athlete-page-score > span,
  .athlete-mini-card > span,
  .athlete-profile-card > span {
    letter-spacing: 0.04em;
  }

  .athlete-page-score-primary strong {
    font-size: 1.58rem;
  }

  .athlete-page-stat-grid,
  .athlete-page-best-grid {
    gap: 4px;
  }

  .athlete-mini-card,
  .athlete-profile-card {
    padding: 7px 6px;
  }

  .athlete-race-calculation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .athlete-page-loading-line i {
    animation-duration: 1.8s;
  }
}
