/* Ladder Specific Styles */
.ladder-nav-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0;
}
.ladder-tab {
  background: linear-gradient(180deg, #172438 0%, #0e1724 100%);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.4rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}
.ladder-tab:hover {
  background: var(--panel-elevated);
  color: var(--ink);
  border-color: var(--holo);
}
.ladder-tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--button-ink);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.5rem;
  margin: 1rem 0 2.5rem;
  min-height: 180px;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
}
.podium-place .card {
  width: 100%;
  text-align: center;
  padding: 1.25rem 0.5rem;
  background: linear-gradient(180deg, #182538 0%, #0d1421 100%);
}
.podium-place[data-rank="1"] { order: 2; transform: scale(1.15); z-index: 2; margin-bottom: 1rem; }
.podium-place[data-rank="2"] { order: 1; }
.podium-place[data-rank="3"] { order: 3; }
.podium-rank {
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.ladder-table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.ladder-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
  text-align: left;
}
.ladder-table th, .ladder-table td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ladder-table th {
  background: linear-gradient(180deg, #18283e 0%, #111b2b 100%);
  color: var(--holo);
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--holo);
}
.ladder-table tbody tr:hover td {
  background: rgba(0, 229, 255, 0.04);
}
.ladder-table td.numeric {
  font-family: ui-monospace, Consolas, monospace;
}

.div-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid var(--line);
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
  letter-spacing: .08em;
  font-family: 'Rajdhani', ui-monospace, monospace;
}
.div-unranked { color: var(--muted); border-color: var(--line); background: rgba(17, 26, 42, 0.6); }
.div-bronze { color: #cd7f32; border-color: #cd7f32; background: rgba(205, 127, 50, 0.1); }
.div-silver { color: #c0c0c0; border-color: #c0c0c0; background: rgba(192, 192, 192, 0.1); }
.div-gold { color: #ffd700; border-color: #ffd700; background: rgba(255, 215, 0, 0.1); box-shadow: 0 0 8px rgba(255,215,0,0.25); }
.div-platinum { color: #e5e4e2; border-color: #e5e4e2; background: rgba(229, 228, 226, 0.1); box-shadow: 0 0 10px rgba(229,228,226,0.3); }
.div-diamond { color: #00e5ff; border-color: #00e5ff; background: rgba(0, 229, 255, 0.1); box-shadow: 0 0 12px rgba(0,229,255,0.4); }
.div-master { color: #ff69b4; border-color: #ff69b4; background: rgba(255, 105, 180, 0.1); box-shadow: 0 0 14px rgba(255,105,180,0.45); }
.div-grandmaster { color: #ff4500; border-color: #ff4500; background: rgba(255, 69, 0, 0.1); box-shadow: 0 0 16px rgba(255,69,0,0.5); }

.streak-up { color: var(--laser-green); font-weight: bold; }
.streak-down { color: var(--laser-red); }

.ladder-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.ladder-search {
  padding: 0.55rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-size: 1rem;
  width: 100%;
  max-width: 250px;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}
.ladder-search:focus {
  outline: none;
  border-color: var(--holo);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 10px var(--holo-glow);
}
.ladder-find {
  display: flex;
  gap: 0.5rem;
}

.profile-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.bracket-container {
  display: flex;
  gap: 3rem;
  overflow-x: auto;
  padding: 1.5rem 0 2.5rem;
  background: rgba(9, 14, 24, 0.5);
  border: 1px solid var(--line);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 1.5rem;
  min-width: 220px;
  position: relative;
}
.bracket-round:first-child { padding-left: 1.5rem; }
.bracket-round:last-child { padding-right: 1.5rem; }
.bracket-match {
  background: linear-gradient(180deg, #131c2b 0%, #0d1421 100%);
  border: 1px solid var(--line);
  padding: 0.5rem;
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease;
}
.bracket-match:hover {
  border-color: var(--line-highlight);
}
.bracket-player {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-size: 1.05rem;
}
.bracket-player + .bracket-player {
  border-top: 1px solid var(--line);
}
.bracket-player.winner {
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

.loading-skeleton {
  animation: hud-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  background: var(--grid);
  border: 1px dashed var(--line-highlight);
}

@media (max-width: 38rem) {
  .podium { align-items: stretch; flex-direction: column; }
  .podium-place { width: 100%; order: unset !important; transform: none !important; margin-bottom: 0 !important; }
  .ladder-toolbar { flex-direction: column; align-items: stretch; }
  .ladder-search { max-width: 100%; }
}

/* Stable layout: the content area keeps its height while views load, so the footer does not jump */
#ladder-content { min-height: 26rem; }
.ladder-skeleton { height: 14rem; width: 100%; }
.ladder-small-button { padding: 0.4rem 1rem; font-size: 1rem; }
.ladder-toolbar-top { justify-content: space-between; }
.ladder-tab { min-width: 5.5rem; }
@media (prefers-reduced-motion: reduce) { .loading-skeleton { animation: none; } }
