.rank-breakdown-card {
  padding: 0.75rem;
}

.rank-breakdown-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto minmax(220px, 1fr);
  align-items: end;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.rank-lookup-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.rank-lookup-field input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-1, #fff);
  color: var(--text-1, #1f2937);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.rank-lookup-field input:focus {
  border-color: var(--primary, #1e40af);
  box-shadow: 0 0 0 2px rgb(var(--ring-rgb, 59 130 246) / 0.25);
}

#rating-lookup-go {
  white-space: nowrap;
  align-self: end;
}

#rating-lookup-result {
  min-height: 1.2em;
  font-size: 0.82rem;
  align-self: end;
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-overall-progress-wrap {
  margin-bottom: 0.65rem;
}

.rank-overall-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
  margin-bottom: 0.3rem;
}

.rank-overall-progress-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2, #f3f4f6);
  overflow: hidden;
}

.rank-overall-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--success));
  transition: width 0.25s ease;
}

.rank-breakdown-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
}

.rank-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.rank-breakdown-table th,
.rank-breakdown-table td {
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: var(--text-1, #1f2937);
}

.rank-breakdown-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2, #f3f4f6);
  color: var(--muted, #6b7280);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.rank-breakdown-table tbody tr:hover {
  background: var(--surface-2, #f3f4f6);
}

.rank-breakdown-table tbody tr:last-child td {
  border-bottom: none;
}

.rank-breakdown-table .rank-col {
  font-weight: 700;
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  white-space: nowrap;
}

.rank-breakdown-table .number-col {
  text-align: right;
}

.rank-breakdown-table th.number-col {
  text-align: right;
}

.rank-breakdown-table .icon-col {
  width: 88px;
}

.rank-badge-icon {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 0.66rem;
  font-weight: 700;
  background-repeat: no-repeat;
  background-origin: content-box;
  box-sizing: border-box;
}

.rank-breakdown-table tbody tr.is-active {
  background: rgb(var(--primary-rgb) / 0.12);
  outline: 1px solid rgb(var(--primary-rgb) / 0.35);
  outline-offset: -1px;
}

@media (max-width: 700px) {
  .rank-breakdown-card {
    padding: 0.5rem;
  }

  .rank-breakdown-toolbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'input button'
      'result result';
    align-items: center;
  }

  .rank-lookup-field {
    grid-area: input;
  }

  #rating-lookup-go {
    grid-area: button;
  }

  #rating-lookup-result {
    grid-area: result;
    justify-self: start;
    text-align: left;
  }

  .rank-breakdown-table th,
  .rank-breakdown-table td {
    padding: 0.4rem 0.5rem;
  }

  .rank-badge-icon {
    width: 48px;
    height: 48px;
    border-radius: 5px;
  }
}
