:root {
  --bg: #111317;
  --screen: #101216;
  --text: #ffffff;
  --muted: rgba(255,255,255,0.68);
  --line: rgba(255,255,255,0.12);
  --line-soft: rgba(255,255,255,0.08);
  --yellow: #efe66f;
  --yellow-2: #f5d84d;
  --card: rgba(255,255,255,0.055);
  --card-strong: rgba(255,255,255,0.075);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 18%, rgba(239, 230, 109, 0.018), transparent 22%),
    radial-gradient(circle at 100% 82%, rgba(239, 230, 109, 0.014), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.012), rgba(255,255,255,0.006)),
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.018) 0 16px,
      transparent 16px 32px
    ),
    var(--screen);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.ranking-page,
.subpage-layout {
  min-height: 100vh;
}

.ranking-screen,
.subpage-screen {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 20px 28px;
  position: relative;
  min-width: 0;
}

.ranking-screen--full { min-height: 100vh; }

.ranking-header,
.subpage-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.left-tools { justify-content: flex-start; }
.right-tools { justify-content: flex-end; }

.tool-btn {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.tool-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.05); }
.tool-btn svg { width: 24px; height: 24px; }
.tool-btn--large { width: 54px; height: 54px; }
.tool-btn--large svg { width: 26px; height: 26px; }
.tool-btn--accent { color: var(--yellow); }

.filter-trigger-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.floating-select {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: 210px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(14,16,20,0.96);
  color: #fff;
  outline: none;
  box-shadow: 0 18px 40px rgba(0,0,0,0.36);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 8;
}

.filter-trigger-wrap.open .floating-select,
.floating-select:focus {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.brand--ranking,
.subpage-brand {
  text-align: center;
  padding-top: 2px;
  min-width: 0;
}

.brand-title-stack {
  line-height: .92;
  font-weight: 900;
  letter-spacing: -0.05em;
  font-family: "Archivo Black", Inter, ui-sans-serif, system-ui, sans-serif;
}
.brand-line { display: block; font-size: clamp(28px, 3.7vw, 56px); }
.brand-line-top { color: #fff; }
.brand-line-bottom { color: var(--yellow-2); }
.brand-line-bottom--dark {
  color: #0f1218;
  -webkit-text-stroke: 1.5px rgba(255,255,255,0.18);
  text-shadow: 0 4px 18px rgba(0,0,0,0.62), 0 0 0.5px rgba(255,255,255,0.18);
}
.brand-subtitle,
.subpage-kicker {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.66);
}

.subpage-title {
  margin-top: 8px;
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.ranking-stage {
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

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

.ranking-list--flat .athlete-row {
  position: relative;
  border-radius: 22px;
  overflow: visible;
  background: var(--card);
  border: 1px solid var(--line-soft);
}

.athlete-row.top-1,
.athlete-row.top-2,
.athlete-row.top-3 {
  background: var(--card-strong);
}
.athlete-row.top-1 {
  background:
    linear-gradient(90deg, rgba(245, 216, 77, 0.16), rgba(245, 216, 77, 0.03) 42%, rgba(255,255,255,0.055) 100%);
}
.athlete-row.top-2 {
  background:
    linear-gradient(90deg, rgba(210, 217, 232, 0.16), rgba(210, 217, 232, 0.03) 42%, rgba(255,255,255,0.055) 100%);
}
.athlete-row.top-3 {
  background:
    linear-gradient(90deg, rgba(198, 138, 90, 0.16), rgba(198, 138, 90, 0.03) 42%, rgba(255,255,255,0.055) 100%);
}

.athlete-button {
  appearance: none;
  width: 100%;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.rank-badge { display: none; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.96);
  box-shadow: 0 8px 22px rgba(0,0,0,0.25);
  margin-left: 0;
}

.athlete-main {
  min-width: 0;
  display: flex;
  align-items: center;
}

.athlete-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}
.athlete-name-row > * { min-width: 0; }
.athlete-name { flex: 1 1 auto; min-width: 0; }
.place-tag { flex: 0 0 auto; }
.athlete-name {
  font-size: clamp(16px, 1.5vw, 24px);
  font-weight: 600;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
}
.place-tag--1 {
  color: #f5d84d;
  background: rgba(245, 216, 77, 0.12);
  border-color: rgba(245, 216, 77, 0.22);
}
.place-tag--2 {
  color: #d7deea;
  background: rgba(215, 222, 234, 0.12);
  border-color: rgba(215, 222, 234, 0.20);
}
.place-tag--3 {
  color: #d49a6b;
  background: rgba(212, 154, 107, 0.12);
  border-color: rgba(212, 154, 107, 0.20);
}

.athlete-subtitle {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.athlete-subtitle--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.athlete-subtitle-left,
.athlete-subtitle-right {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.athlete-subtitle-right {
  flex: 0 0 auto;
  text-align: right;
}

.athlete-subtitle-left {
  flex: 1 1 auto;
}

.athlete-score {
  min-width: 0;
  max-width: 100%;
  padding-right: 2px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
}
.athlete-score--centered {
  gap: 0;
}
.score-meta {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}

.score-value {
  font-size: clamp(16px, 1.65vw, 24px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
  max-width: 100%;
}
.score-number { color: #fff; }
.score-unit { color: var(--yellow-2); }

.athlete-details {
  padding: 0 14px 16px 14px;
}
.hidden { display: none; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 12px 14px;
}
.detail-item--meta {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.14);
}
.detail-label {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-value {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.detail-points {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: rgba(255,255,255,0.72);
}

.empty-state {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  text-align: center;
}
.empty-state--dark {
  background: rgba(255,255,255,0.04);
}

.ranking-footer {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
}

.subpage-card {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 18px;
}
.section-label {
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 8px; min-width: 0; }
.field-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.input, .textarea {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(12,14,17,0.76);
  color: #fff;
  outline: none;
}
.input::placeholder { color: rgba(255,255,255,0.34); }
.field--pair-left { grid-column: 1; }
.field--pair-right { grid-column: 2; }
.textarea {
  min-height: 220px;
  resize: vertical;
}
.input:focus, .textarea:focus {
  border-color: rgba(239, 230, 109, 0.45);
  box-shadow: 0 0 0 4px rgba(239, 230, 109, 0.08);
}
.btn {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--yellow-2);
  color: #0f1114;
  font-weight: 800;
  cursor: pointer;
}
.copy-wrap { display: grid; gap: 12px; }

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  position: relative;
  z-index: 1;
  margin-top: 16px;
}
.rules-grid h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.rules-grid p,
.rules-grid li {
  color: rgba(255,255,255,0.84);
  line-height: 1.6;
  font-size: 14px;
}
.rules-grid ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 820px) {
  .ranking-screen,
  .subpage-screen {
    padding-inline: 14px;
  }

  .ranking-header,
  .subpage-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
  }

  .header-side,
  .subpage-header > :first-child,
  .subpage-header > :last-child {
    justify-content: flex-start;
  }

  .right-tools,
  .subpage-header > :last-child {
    justify-content: flex-end;
  }

  .brand--ranking,
  .subpage-brand {
    order: 0;
  }

  .athlete-button {
    grid-template-columns: 54px minmax(0, 1fr) fit-content(96px);
    gap: 10px;
    padding: 12px 12px;
  }

  .detail-grid,
  .rules-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.form-grid--labels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .form-grid.form-grid--labels .full {
    grid-column: 1 / -1;
  }

  .field-label {
    font-size: 10px;
    letter-spacing: .12em;
  }

  .input, .textarea {
    padding: 11px 12px;
  }
}

@media (max-width: 560px) {
  .tool-btn,
  .tool-btn--large {
    width: 44px;
    height: 44px;
  }
  .tool-btn svg,
  .tool-btn--large svg {
    width: 22px;
    height: 22px;
  }
  .ranking-header,
  .subpage-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }
  .header-side {
    gap: 6px;
  }
  .brand-line { font-size: clamp(28px, 10vw, 42px); }
  .brand-subtitle,
  .subpage-kicker {
    margin-top: 8px;
    font-size: 10px;
    letter-spacing: .18em;
  }
  .athlete-name {
    font-size: 15px;
    white-space: nowrap;
  }
  .score-value {
    font-size: 17px;
  }
  .athlete-button {
    grid-template-columns: 44px minmax(0, 1fr) fit-content(82px);
    gap: 8px;
    padding: 11px 10px;
  }
  .avatar {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }
  .place-tag {
    min-width: 30px;
    height: 18px;
    padding: 0 6px;
    font-size: 9px;
  }
  .athlete-details {
    padding: 0 11px 13px;
  }
}


@media (max-width: 560px) {
  .ranking-screen,
  .subpage-screen {
    width: min(100%, 100vw);
    margin-inline: auto;
    padding-inline: 10px;
  }

  .header-side {
    gap: 4px;
  }

  .tool-btn,
  .tool-btn--large {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    flex: 0 0 auto;
  }

  .floating-select {
    left: 0;
    right: auto;
    width: min(210px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .athlete-row {
    max-width: 100%;
  }

  .athlete-name-row {
    gap: 6px;
  }

  .athlete-score {
    padding-right: 0;
  }

  .score-value {
    font-size: 15px;
  }


  .form-grid.form-grid--labels {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .input, .textarea {
    min-width: 0;
  }
}
