:root {
  --bg-base: #0a0d13;
  --bg-surface: #121824;
  --bg-elevated: #171f2f;
  --text-primary: #f5f7ff;
  --text-muted: #98a4bc;
  --accent: #ff385c;
  --accent-soft: rgba(255, 56, 92, 0.15);
  --line: rgba(255, 255, 255, 0.08);
  --gold: #f1c550;
  --silver: #c7d2de;
  --bronze: #cd8a58;
  --medal-face-gold: radial-gradient(circle at 24% 22%, #fff8d3 8%, #f0cc66 45%, #a9791f 100%);
  --medal-face-silver: radial-gradient(circle at 24% 22%, #ffffff 8%, #d6dce5 45%, #7d8ea1 100%);
  --medal-face-bronze: radial-gradient(circle at 24% 22%, #ffeddc 8%, #d79a66 45%, #7f4928 100%);
  --medal-edge-gold: linear-gradient(180deg, #d6a741, #7c5515);
  --medal-edge-silver: linear-gradient(180deg, #c8d0db, #68788c);
  --medal-edge-bronze: linear-gradient(180deg, #c58352, #643a21);
  --medal-texture-gold: none;
  --medal-texture-silver: none;
  --medal-texture-bronze: none;
  --medal-clock-delay: 0s;
  --medal-depth: 7px;
  --medal-mark-color: rgba(22, 24, 30, 0.64);
  --season-glow-a: rgba(76, 174, 255, 0.26);
  --season-glow-b: rgba(123, 209, 255, 0.22);
  --season-accent: rgba(220, 236, 255, 0.15);
  --ok: #49d6a5;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --glow: 0 14px 40px rgba(255, 56, 92, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 10% -15%, var(--season-glow-a), transparent 45%),
    radial-gradient(circle at 90% 20%, var(--season-glow-b), transparent 45%),
    var(--bg-base);
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
}

body[data-season='summer'] {
  --season-glow-a: rgba(255, 128, 84, 0.26);
  --season-glow-b: rgba(255, 209, 106, 0.2);
  --season-accent: rgba(255, 188, 128, 0.16);
}

body[data-season='winter'] {
  --season-glow-a: rgba(76, 174, 255, 0.26);
  --season-glow-b: rgba(123, 209, 255, 0.22);
  --season-accent: rgba(220, 236, 255, 0.15);
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  animation: drift 16s ease-in-out infinite;
}

.orb-a {
  width: 340px;
  height: 340px;
  left: -80px;
  top: 120px;
  background: radial-gradient(circle, var(--season-glow-a), transparent 68%);
}

.orb-b {
  width: 300px;
  height: 300px;
  right: 20px;
  top: 260px;
  animation-delay: -5s;
  background: radial-gradient(circle, var(--season-glow-b), transparent 70%);
}

.orb-c {
  width: 170px;
  height: 170px;
  left: 50%;
  bottom: -140px;
  animation-delay: -9s;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 74%);
  opacity: 0.34;
}

.sun-glow {
  position: absolute;
  top: -130px;
  right: -120px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, rgba(255, 224, 148, 0.28), rgba(255, 180, 96, 0.14) 36%, rgba(255, 160, 92, 0.02) 66%, transparent 100%);
  box-shadow: 0 0 22px rgba(255, 185, 102, 0.15), 0 0 52px rgba(255, 192, 115, 0.12);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.28s ease;
  animation: sunShimmer 8.5s ease-in-out infinite;
}

.snowfield {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.28s ease;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -10%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(237, 246, 255, 0.88);
  box-shadow: 0 0 8px rgba(214, 236, 255, 0.44);
  animation: snowfall linear infinite;
}

.snowflake:nth-child(1) { left: 4%; animation-duration: 10s; animation-delay: -1s; }
.snowflake:nth-child(2) { left: 12%; animation-duration: 12s; animation-delay: -5s; width: 5px; height: 5px; }
.snowflake:nth-child(3) { left: 20%; animation-duration: 11s; animation-delay: -2s; }
.snowflake:nth-child(4) { left: 28%; animation-duration: 9.6s; animation-delay: -6s; width: 7px; height: 7px; }
.snowflake:nth-child(5) { left: 36%; animation-duration: 13s; animation-delay: -3s; width: 4px; height: 4px; }
.snowflake:nth-child(6) { left: 44%; animation-duration: 10.7s; animation-delay: -4s; }
.snowflake:nth-child(7) { left: 52%; animation-duration: 12.5s; animation-delay: -8s; width: 5px; height: 5px; }
.snowflake:nth-child(8) { left: 60%; animation-duration: 9.8s; animation-delay: -7s; width: 7px; height: 7px; }
.snowflake:nth-child(9) { left: 68%; animation-duration: 11.8s; animation-delay: -2.8s; }
.snowflake:nth-child(10) { left: 76%; animation-duration: 12.2s; animation-delay: -4.5s; width: 4px; height: 4px; }
.snowflake:nth-child(11) { left: 86%; animation-duration: 10.5s; animation-delay: -6.3s; }
.snowflake:nth-child(12) { left: 94%; animation-duration: 13.3s; animation-delay: -2.2s; width: 5px; height: 5px; }

body[data-season='summer'] .sun-glow {
  opacity: 0.62;
}

body[data-season='winter'] .snowfield {
  opacity: 1;
}

body[data-season='winter'] .sun-glow {
  opacity: 0.18;
}

@keyframes drift {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(30px) translateX(12px);
  }
}

@keyframes sunShimmer {
  0%, 100% {
    transform: scale(0.95) translate3d(0, 0, 0);
    filter: saturate(1);
  }
  50% {
    transform: scale(1) translate3d(-6px, 5px, 0);
    filter: saturate(1.06);
  }
}

@keyframes snowfall {
  0% {
    transform: translate3d(0, -12vh, 0);
    opacity: 0;
  }
  12% {
    opacity: 0.92;
  }
  100% {
    transform: translate3d(18px, 110vh, 0);
    opacity: 0.1;
  }
}

.topbar {
  padding: 30px 36px 14px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

h1 {
  margin: 6px 0 6px;
  font-family: 'Sora', sans-serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1;
}

.source-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.status-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(73, 214, 165, 0.55);
  background: rgba(73, 214, 165, 0.12);
  color: #8ff3cf;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.live-badge.stale {
  border-color: rgba(255, 176, 121, 0.55);
  background: rgba(255, 176, 121, 0.12);
  color: #ffd6b2;
}

.live-detail {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  max-width: min(940px, 100%);
}

.control-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-width: 180px;
  flex: 1 1 210px;
  backdrop-filter: blur(6px);
}

.season-block.active-season {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.season-block.inactive-season {
  opacity: 0.82;
}

.season-block.inactive-season select:disabled {
  cursor: pointer;
  opacity: 0.88;
}

.control-block span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
button {
  font-family: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px;
}

.segmented {
  display: inline-flex;
  width: 100%;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.seg-btn.active {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.scope-btn.active {
  border-color: rgba(112, 182, 255, 0.58);
  background: rgba(112, 182, 255, 0.2);
}

.action-block {
  min-width: 240px;
}

.actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.layout {
  padding: 10px 36px 36px;
  display: grid;
  gap: 18px;
}

.panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.panel-header h2 {
  margin: 0;
  font-family: 'Sora', sans-serif;
}

.trend-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trend-topn-select {
  width: auto;
  min-width: 68px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.1;
  background: rgba(17, 27, 42, 0.88);
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.table-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.standings-query {
  display: grid;
  gap: 8px;
}

.standings-hint {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(186, 204, 234, 0.88);
  letter-spacing: 0.01em;
}

.standings-query-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inline-select {
  width: auto;
  min-width: 160px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  background: rgba(17, 27, 42, 0.88);
}

.sort-indicator-row th {
  padding: 0 10px 14px;
  border-bottom: 0;
  transform: none;
  overflow: visible;
}

thead tr:nth-child(2) th {
  padding-top: 8px;
}

.table-sort-indicator {
  display: grid;
  width: 100%;
  justify-items: center;
  align-items: center;
  gap: 5px;
  position: relative;
  min-height: 42px;
  margin-top: -12px;
}

.table-sort-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.table-sort-pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ebf2ff;
  background: rgba(144, 171, 210, 0.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.table-sort-pill.sort-gold {
  background: rgba(241, 197, 80, 0.23);
  border-color: rgba(241, 197, 80, 0.55);
  color: #ffe8a8;
}

.table-sort-pill.sort-silver {
  background: rgba(199, 210, 222, 0.22);
  border-color: rgba(199, 210, 222, 0.5);
  color: #eef5ff;
}

.table-sort-pill.sort-bronze {
  background: rgba(205, 138, 88, 0.24);
  border-color: rgba(205, 138, 88, 0.55);
  color: #ffe5cf;
}

.table-sort-pill.sort-total {
  background: rgba(112, 182, 255, 0.2);
  border-color: rgba(112, 182, 255, 0.55);
  color: #d4ebff;
}

.sort-trace {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -38px;
  height: 44px;
  pointer-events: none;
}

.trace-v1,
.trace-h,
.trace-v2 {
  position: absolute;
  background: rgba(188, 212, 244, 0.68);
  border-radius: 999px;
}

.trace-v1 {
  width: 2px;
  height: 16px;
  left: calc(var(--trace-source-x, 0px) - 1px);
  top: 0;
}

.trace-h {
  height: 2px;
  width: var(--trace-width, 0px);
  left: var(--trace-left, 0px);
  top: 16px;
}

.trace-v2 {
  width: 2px;
  height: 24px;
  left: calc(var(--trace-target-x, 0px) - 1px);
  top: 16px;
}

.table-rank-mode {
  min-width: 270px;
}

.table-rank-mode > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaders-inline {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.leaders-inline-header {
  margin-bottom: 8px;
}

.leaders-inline-header h3 {
  margin: 0;
  font-size: 1.02rem;
  font-family: 'Sora', sans-serif;
}

.leaders-inline-header p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.leaders-scroll {
  margin-top: 8px;
}

.leaders-table {
  min-width: 760px;
}

.leaders-table thead th {
  padding-top: 8px;
  padding-bottom: 8px;
}

.leader-standings-row td {
  padding-top: 16px;
  padding-bottom: 16px;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.035);
  vertical-align: middle;
}

.leader-standings-row td:first-child {
  text-align: center;
}

.leader-standings-row .country-cell {
  gap: 12px;
}

.leader-standings-row .country-cell > span {
  font-size: 1.2rem;
  font-weight: 600;
}

.leader-country-name {
  font-size: 1.2rem;
  font-weight: 600;
}

.leader-rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leader-rank-medal .medal-sm {
  width: 50px;
  height: 50px;
}

.leader-rank-medal .medal-sm .medal-count {
  font-size: 0.94rem;
}

.podium-rank {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.02rem;
}

.podium-rank.rank-1 {
  background: radial-gradient(circle at 35% 30%, #fff7d8, var(--gold));
  color: #3f2e00;
}

.podium-rank.rank-2 {
  background: radial-gradient(circle at 35% 30%, #fff, var(--silver));
  color: #26313d;
}

.podium-rank.rank-3 {
  background: radial-gradient(circle at 35% 30%, #fde5cf, var(--bronze));
  color: #43230f;
}

.country-name {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.podium-flag {
  width: 66px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.32);
}

.podium-block {
  margin-top: auto;
  width: 100%;
  border-radius: 10px;
  transform: rotateX(55deg) translateZ(0);
  transform-origin: bottom;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 10px 20px rgba(255, 255, 255, 0.08), 0 10px 20px rgba(0, 0, 0, 0.32);
}

.block-1 {
  height: 120px;
  background: linear-gradient(180deg, rgba(241, 197, 80, 0.7), rgba(241, 197, 80, 0.2));
}

.block-2 {
  height: 92px;
  background: linear-gradient(180deg, rgba(199, 210, 222, 0.65), rgba(199, 210, 222, 0.15));
}

.block-3 {
  height: 72px;
  background: linear-gradient(180deg, rgba(205, 138, 88, 0.65), rgba(205, 138, 88, 0.16));
}

.medal-cluster {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.medal-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.medal-stat-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.medal {
  --medal-face: var(--medal-face-gold);
  --medal-edge: var(--medal-edge-gold);
  --medal-texture: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--medal-edge);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.34), 0 10px 16px rgba(0, 0, 0, 0.3);
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.medal.medal-animate {
  animation: medalTilt 4.6s ease-in-out infinite;
  animation-delay: var(--medal-clock-delay);
  will-change: transform;
}

.medal::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background-image: var(--medal-texture), var(--medal-face);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.32),
    inset 0 -5px 8px rgba(0, 0, 0, 0.33),
    inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.medal.has-texture::before {
  inset: 1px;
  border: 0;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -2px 4px rgba(0, 0, 0, 0.26);
}

.medal::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.38), transparent 62%);
  pointer-events: none;
}

.medal.medal-animate::after {
  animation: medalSparkle 3.4s ease-in-out infinite;
}

.medal-gold {
  --medal-face: var(--medal-face-gold);
  --medal-edge: var(--medal-edge-gold);
  --medal-texture: var(--medal-texture-gold);
  color: #4a3300;
}

.medal-silver {
  --medal-face: var(--medal-face-silver);
  --medal-edge: var(--medal-edge-silver);
  --medal-texture: var(--medal-texture-silver);
  color: #22303a;
}

.medal-bronze {
  --medal-face: var(--medal-face-bronze);
  --medal-edge: var(--medal-edge-bronze);
  --medal-texture: var(--medal-texture-bronze);
  color: #3b2114;
}

.medal-count {
  position: relative;
  z-index: 3;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.36);
  mix-blend-mode: multiply;
}

.medal.has-texture .medal-count {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.64);
  color: #f3f8ff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  mix-blend-mode: normal;
  text-shadow: none;
}

.medal-mark {
  position: relative;
  z-index: 3;
  margin-top: 2px;
  font-size: 0.46rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--medal-mark-color);
  opacity: 0.88;
}

.podium-medal {
  width: 92px;
  height: 92px;
}

.podium-medal .medal-count {
  font-size: 1.08rem;
}

.podium-medal .medal-mark {
  font-size: 0.56rem;
}

.medal-sm {
  width: 44px;
  height: 44px;
}

.medal-sm .medal-count {
  font-size: 0.76rem;
}

.medal-sm .medal-mark {
  font-size: 0.38rem;
  margin-top: 2px;
}

@keyframes medalTilt {
  0% {
    transform: rotateX(4deg) rotateY(-12deg) rotateZ(-4deg);
  }
  50% {
    transform: rotateX(-3deg) rotateY(12deg) rotateZ(4deg);
  }
  100% {
    transform: rotateX(4deg) rotateY(-12deg) rotateZ(-4deg);
  }
}

@keyframes medalSparkle {
  0%, 100% {
    opacity: 0.24;
  }
  42% {
    opacity: 0.72;
  }
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  margin-top: 0;
  padding-top: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.col-rank {
  width: 78px;
}

.col-country {
  width: 42%;
}

.col-medal {
  width: 13%;
}

.col-total {
  width: 13%;
}

.col-head {
  display: grid;
  width: 100%;
  grid-auto-flow: row;
  justify-items: center;
  align-content: center;
  align-items: center;
  gap: 4px;
  min-height: 62px;
}

.col-head.total-head {
  min-height: 62px;
  display: grid;
  grid-auto-flow: row;
  gap: 4px;
}

.th-medal-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.th-medal-icon.gold {
  background: radial-gradient(circle at 35% 30%, #fff6cf, #d6a83a);
}

.th-medal-icon.silver {
  background: radial-gradient(circle at 35% 30%, #ffffff, #a9b8cc);
}

.th-medal-icon.bronze {
  background: radial-gradient(circle at 35% 30%, #ffe6d5, #b76f44);
}

.th-medal-cluster {
  position: relative;
  width: 30px;
  height: 20px;
  display: inline-block;
}

.th-medal-cluster .th-medal-icon {
  position: absolute;
  width: 12px;
  height: 12px;
}

.th-medal-cluster .th-medal-icon.gold {
  left: 0;
  top: 5px;
  z-index: 3;
}

.th-medal-cluster .th-medal-icon.silver {
  left: 9px;
  top: 1px;
  z-index: 2;
}

.th-medal-cluster .th-medal-icon.bronze {
  left: 18px;
  top: 6px;
  z-index: 1;
}

thead th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

thead tr:last-child th:nth-child(n + 3) {
  text-align: center;
}

.sortable-head {
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.sortable-head:hover {
  color: #dbe7ff;
}

.sortable-head:focus-visible {
  outline: 2px solid rgba(158, 195, 255, 0.7);
  outline-offset: -2px;
}

.sortable-head.active-sort {
  color: #f2f6ff;
}

.sort-caret {
  font-size: 0.72rem;
  line-height: 1;
  color: #cde0ff;
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity 0.16s ease;
}

.sortable-head.active-sort .sort-caret {
  opacity: 1;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.medal-cell,
.total-cell {
  text-align: center;
}

.medal-number,
.total-cell strong {
  display: inline-block;
  min-width: 2ch;
  font-size: 1.36rem;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.standings-loading-row td {
  padding: 12px 10px;
}

.standings-loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
}

.standings-loading-card strong {
  display: block;
  font-size: 0.9rem;
  color: #edf4ff;
}

.standings-loading-card p {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.standings-loader {
  width: 20px;
  height: 20px;
  border-width: 2px;
  flex-shrink: 0;
}

tr.standings-row-click {
  cursor: pointer;
}

tr.standings-row-click:focus-visible {
  outline: 2px solid rgba(158, 195, 255, 0.7);
  outline-offset: -2px;
}

.country-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rank-cell {
  text-align: center;
}

.flag {
  width: 34px;
  height: 24px;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.country-open-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.trend-card {
  display: grid;
  gap: 12px;
}

.trend-actions {
  display: flex;
  justify-content: flex-end;
}

.chart-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(16, 25, 40, 0.2), rgba(10, 16, 27, 0.12));
  backdrop-filter: blur(6px);
  position: relative;
}

#trendCanvas {
  width: 100%;
  min-height: 340px;
  display: block;
}

.trend-loading {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(12, 18, 29, 0.74);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}

.trend-loading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.trend-loading .loader {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.83rem;
  color: var(--text-muted);
  transition: opacity 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.legend-item.active {
  color: #f2f6ff;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.legend-item.muted {
  opacity: 0.36;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-flag {
  width: 14px;
  height: 10px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, 0.62);
  opacity: 0;
  transition: opacity 0.24s ease;
  z-index: 11;
}

.drawer-scrim.open {
  opacity: 1;
}

.country-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(560px, 92vw);
  height: 100vh;
  background: linear-gradient(180deg, #131a2a, #0f151f);
  border-right: 1px solid var(--line);
  padding: 18px;
  transform: translateX(-104%);
  transition: transform 0.28s ease;
  z-index: 12;
  overflow-y: auto;
  box-shadow: 20px 0 40px rgba(0, 0, 0, 0.42);
}

.country-drawer.open {
  transform: translateX(0);
}

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

.drawer-header h3 {
  margin: 8px 0 4px;
  font-size: 1.5rem;
  font-family: 'Sora', sans-serif;
}

.drawer-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.close-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-counts {
  margin: 14px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.drawer-tools {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.segmented-small .seg-btn {
  padding: 8px 10px;
  font-size: 0.8rem;
}

.drawer-tools-label {
  display: inline-block;
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

#drawerSortToggle .seg-btn {
  min-width: 98px;
}

.drawer-map-panel {
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.drawer-map-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.drawer-map-header h4 {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dce6fa;
}

.drawer-map-meta {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.drawer-map-shell {
  position: relative;
}

.drawer-map {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(140deg, rgba(14, 22, 36, 0.92), rgba(9, 13, 20, 0.96));
}

.drawer-map-empty {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
  background: linear-gradient(140deg, rgba(12, 19, 31, 0.76), rgba(8, 13, 21, 0.82));
  pointer-events: none;
}

.drawer-map .leaflet-control-container .leaflet-control {
  background: rgba(15, 22, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.drawer-map .leaflet-control-zoom a {
  color: #d7e4ff;
  background: rgba(16, 24, 36, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.drawer-map .leaflet-control-attribution {
  color: rgba(212, 223, 245, 0.72);
  background: rgba(10, 15, 24, 0.72);
  font-size: 10px;
}

.drawer-map .leaflet-control-attribution a {
  color: rgba(206, 219, 248, 0.86);
}

.drawer-map-popup .leaflet-popup-content-wrapper {
  background: rgba(11, 17, 28, 0.95);
  color: #eaf2ff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
}

.drawer-map-popup .leaflet-popup-content {
  margin: 8px 9px;
}

.drawer-map-popup .leaflet-popup-tip {
  background: rgba(11, 17, 28, 0.95);
}

.drawer-map-popup-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  min-width: 190px;
  align-items: center;
}

.drawer-map-popup-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.drawer-map-popup-fallback {
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(255, 56, 92, 0.35), rgba(73, 214, 165, 0.35));
}

.drawer-map-popup-body p {
  margin: 0;
  line-height: 1.25;
}

.drawer-map-popup-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f0f5ff;
}

.drawer-map-popup-meta {
  margin-top: 1px;
  font-size: 0.73rem;
  color: #b9c8e4;
}

.drawer-map-popup-medal {
  margin-top: 3px;
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffd894;
}

.count-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

button.count-pill {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

button.count-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

button.count-pill.active {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.medal-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.medal-filter-btn .medal {
  margin-right: 1px;
}

.medal-filter-total {
  font-weight: 600;
}

.medal-filter-total strong {
  margin-left: 4px;
}

.medalist-grid {
  display: grid;
  gap: 10px;
}

.drawer-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.drawer-loading strong {
  display: block;
  font-size: 0.9rem;
  color: #edf4ff;
}

.drawer-loading p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.drawer-loader {
  width: 18px;
  height: 18px;
  border-width: 2px;
  flex-shrink: 0;
}

.medalist-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 11px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.medalist-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
}

.medalist-card:focus-visible {
  outline: 2px solid rgba(158, 195, 255, 0.74);
  outline-offset: 1px;
}

.medalist-photo-wrap {
  width: 72px;
  height: 72px;
  position: relative;
}

.athlete-open-btn {
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: none;
}

.athlete-photo,
.photo-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.photo-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(255, 56, 92, 0.4), rgba(73, 214, 165, 0.45));
}

.medalist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.medalist-head h4 {
  margin: 0;
  font-size: 1rem;
}

.medalist-country-flag-overlay {
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 30px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 18, 26, 0.8);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.meta-line {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.medalist-country-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.medalist-country-flag-inline {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.medalist-bio {
  margin: 6px 0 0;
  color: #d4dced;
  font-size: 0.83rem;
  line-height: 1.4;
}

.medalist-history {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #dce5f8;
}

.hidden {
  display: none !important;
}

.athlete-modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.72);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 33;
}

.athlete-modal-scrim.open {
  opacity: 1;
}

.athlete-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(900px, 94vw);
  height: auto;
  max-height: 90vh;
  transform: translate(-50%, -48%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #141d2d, #0e141f);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.52);
  z-index: 34;
  transition: opacity 0.2s ease, transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.athlete-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.athlete-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 0;
}

.athlete-modal-body {
  padding: 12px 16px 16px;
  overflow: auto;
  max-height: calc(90vh - 60px);
  flex: 1;
  min-height: 0;
}

.athlete-profile {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.athlete-photo-panel {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.athlete-photo-lg {
  width: 260px;
  height: 300px;
  object-fit: contain;
  object-position: center center;
  margin-inline: auto;
  display: block;
  background: rgba(5, 10, 18, 0.86);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.athlete-summary h3 {
  margin: 0 0 8px;
  font-family: 'Sora', sans-serif;
}

.athlete-summary p {
  margin: 0 0 10px;
  color: #d6deef;
  line-height: 1.5;
  min-height: 0;
}

.athlete-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.athlete-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
  color: #abd0ff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
}

.athlete-meta-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(200px, 0.9fr) minmax(260px, 1.1fr);
  align-items: start;
  gap: 10px;
}

.athlete-meta-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  align-self: start;
  height: auto;
}

.athlete-meta-card h4 {
  margin: 0 0 7px;
  font-size: 0.86rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.athlete-meta-card p {
  margin: 0;
  color: #d8e1f4;
  font-size: 0.9rem;
  line-height: 1.45;
}

.athlete-hometown-line {
  margin-top: 6px !important;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.medal-totals-card {
  display: grid;
  align-content: start;
  gap: 6px;
}

.athlete-medal-summary-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px;
}

.athlete-medal-summary-row + .athlete-medal-summary-row {
  margin-top: 2px;
}

.athlete-medal-row-label {
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.athlete-medal-line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 5px;
}

.athlete-medal-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 16px;
}

.athlete-medal-row.gold {
  color: #ffe7a0;
}

.athlete-medal-row.silver {
  color: #edf5ff;
}

.athlete-medal-row.bronze {
  color: #ffd9bf;
}

.athlete-mini-stack {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 42px;
}

.athlete-mini-row-count {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.athlete-mini-overflow {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.athlete-mini-token {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.athlete-mini-disc {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.athlete-mini-disc.gold {
  background: radial-gradient(circle at 24% 22%, #fff5c7 8%, #e6c067 50%, #9a6d1d 100%);
}

.athlete-mini-disc.silver {
  background: radial-gradient(circle at 24% 22%, #ffffff 8%, #d4dde8 50%, #70839a 100%);
}

.athlete-mini-disc.bronze {
  background: radial-gradient(circle at 24% 22%, #ffe9d8 8%, #d29361 50%, #774525 100%);
}

.athlete-mini-token.gold {
  color: #ffe7a0;
  border-color: rgba(241, 197, 80, 0.45);
  background: rgba(241, 197, 80, 0.14);
}

.athlete-mini-token.silver {
  color: #edf5ff;
  border-color: rgba(199, 210, 222, 0.44);
  background: rgba(199, 210, 222, 0.16);
}

.athlete-mini-token.bronze {
  color: #ffd9bf;
  border-color: rgba(205, 138, 88, 0.45);
  background: rgba(205, 138, 88, 0.14);
}

.athlete-mini-token.total {
  display: inline-flex;
  justify-content: flex-start;
  color: #d1e6ff;
  border-color: rgba(112, 182, 255, 0.44);
  background: rgba(112, 182, 255, 0.14);
}

.athlete-mini-token.total strong {
  font-size: 0.92em;
}

.medalist-totals {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.athlete-medal-summaries {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.athlete-medal-summaries .athlete-medal-summary-row,
.medalist-totals .athlete-medal-summary-row {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.athlete-medal-summaries .athlete-medal-row-label,
.medalist-totals .athlete-medal-row-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.athlete-medal-summaries .athlete-medal-line,
.medalist-totals .athlete-medal-line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 6px;
}

.medalist-totals .athlete-medal-summary-row {
  gap: 5px;
}

.medalist-totals .athlete-medal-row-label {
  font-size: 0.68rem;
}

.medalist-totals .athlete-mini-token {
  font-size: 0.71rem;
  padding: 2px 7px;
}

.medalist-totals .athlete-mini-disc {
  width: 9px;
  height: 9px;
}

.medalist-totals .athlete-mini-stack {
  min-width: 34px;
  gap: 3px;
}

.medalist-totals .athlete-mini-row-count {
  font-size: 0.72rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  z-index: 30;
  gap: 10px;
}

.loader {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

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

@media (max-width: 980px) {
  .layout {
    padding: 8px 16px 22px;
  }

  .topbar {
    padding: 20px 16px 8px;
  }

  .controls {
    width: 100%;
    max-width: none;
  }

  .control-block {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .podium-flag {
    width: 56px;
    height: 38px;
  }

  .leader-standings-row td {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.98rem;
  }

  .leader-standings-row .country-cell > span {
    font-size: 1.06rem;
  }

  .country-drawer {
    width: 100vw;
  }

  .drawer-tools {
    grid-template-columns: 1fr;
  }

  .drawer-map {
    height: 210px;
  }

  .table-rank-mode {
    width: 100%;
    min-width: 0;
  }

  .sort-indicator-row th {
    padding: 0 8px 12px;
  }

  .table-sort-label {
    font-size: 0.63rem;
  }

  .table-sort-pill {
    min-height: 24px;
    font-size: 0.76rem;
    padding: 3px 10px;
  }

  .sort-trace {
    bottom: -34px;
    height: 38px;
  }

  .trace-v1 {
    height: 14px;
  }

  .trace-h {
    top: 14px;
  }

  .trace-v2 {
    top: 14px;
    height: 22px;
  }

  table {
    min-width: 700px;
  }

  .standings-query-line {
    row-gap: 6px;
  }

  .athlete-profile {
    grid-template-columns: 1fr;
  }

  .athlete-modal {
    height: auto;
    max-height: 92vh;
  }

  .athlete-modal-body {
    min-height: 0;
    max-height: calc(92vh - 60px);
  }

  .athlete-photo-lg {
    width: 100%;
    max-width: 320px;
    height: 300px;
    aspect-ratio: auto;
  }

  .athlete-meta-grid {
    grid-template-columns: 1fr;
  }

  .athlete-medal-summaries {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .control-block {
    flex: 1 1 100%;
  }

  .standings-query-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-select {
    width: 100%;
  }

  .sort-indicator-row th {
    padding: 0 8px 10px;
  }

  .table-sort-indicator {
    min-height: 38px;
    gap: 4px;
    margin-top: -8px;
  }

  .table-sort-pill {
    font-size: 0.72rem;
    padding: 3px 9px;
  }

  .table-sort-label {
    font-size: 0.58rem;
  }

  .sort-trace {
    bottom: -30px;
    height: 34px;
  }

  .trace-v1 {
    height: 12px;
  }

  .trace-h {
    top: 12px;
  }

  .trace-v2 {
    top: 12px;
    height: 20px;
  }

  table {
    min-width: 620px;
  }

  thead th {
    font-size: 0.74rem;
    padding: 8px 8px;
  }

  .col-head {
    min-height: 56px;
    gap: 3px;
  }

  .th-medal-icon {
    width: 16px;
    height: 16px;
  }

  .medal-number,
  .total-cell strong {
    font-size: 1.18rem;
  }

  .medalist-card {
    grid-template-columns: 64px 1fr;
    gap: 9px;
    padding: 9px;
  }

  .drawer-map {
    height: 190px;
  }

  .medalist-photo-wrap {
    width: 62px;
    height: 62px;
  }

  .athlete-photo,
  .photo-fallback {
    width: 62px;
    height: 62px;
  }

  .medalist-country-flag-overlay {
    width: 26px;
    height: 18px;
  }

  .medalist-totals .athlete-medal-summary-row {
    gap: 5px;
  }

  .medalist-totals,
  .athlete-medal-summaries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .medalist-totals .athlete-medal-line,
  .athlete-medal-summaries .athlete-medal-line {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    row-gap: 5px;
  }
}
