:root {
  color-scheme: light;
  --sky-top: #5ec3e0;
  --sky-bottom: #cdeee2;
  --sand: #f6e3b4;
  --sand-dark: #e8cf94;
  --bg: var(--sand);
  --card: #fffdf7;
  --text: #1f2d3a;
  --muted: #6b7a86;
  --accent: #ff6b4a;
  --accent-hover: #f2532f;
  --ocean: #0d7f8c;
  --ocean-hover: #0a6670;
  --error: #d64545;
  --success: #0d8a4f;
  --border: #e6d9ae;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--sand);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 30%, var(--sand) 58%, var(--sand) 100%)
    fixed;
  position: relative;
  overflow-x: hidden;
}

@media (max-width: 480px) {
  body {
    padding: 14px;
  }
}

/* Sun */
body::before {
  content: "";
  position: fixed;
  top: 6%;
  right: 10%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7d6, #ffd873 60%, #ffc94d 100%);
  box-shadow: 0 0 60px 10px rgba(255, 210, 100, 0.55);
  z-index: 0;
  pointer-events: none;
}

/* Waves along the bottom of the viewport */
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  z-index: 0;
  pointer-events: none;
  background-repeat: repeat-x;
  background-position: bottom;
  background-size: 700px 140px;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='140' viewBox='0 0 700 140'%3E%3Cpath d='M0 90 Q 87.5 60 175 90 T 350 90 T 525 90 T 700 90 V140 H0 Z' fill='%230d7f8c' fill-opacity='0.28'/%3E%3Cpath d='M0 110 Q 87.5 85 175 110 T 350 110 T 525 110 T 700 110 V140 H0 Z' fill='%230d7f8c' fill-opacity='0.4'/%3E%3C/svg%3E");
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.brand-row {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-row.brand-row-wide {
  max-width: 640px;
}

.brand-row .brand {
  margin-bottom: 0;
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  flex: none;
}

.lang-switch button {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.lang-switch button:hover {
  background: transparent;
  color: var(--ocean);
  box-shadow: none;
}

.lang-switch button.active {
  background: var(--ocean);
  color: #fff;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ocean);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-header {
  width: 100%;
  max-width: 880px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ocean);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.notif-bell-wrap {
  position: relative;
  flex: none;
}

.notif-bell {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffefb;
  box-shadow: none;
  font-size: 1.05rem;
  cursor: pointer;
}

.notif-bell:hover {
  border-color: var(--ocean);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 420px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 30px -10px rgba(20, 60, 70, 0.28), 0 2px 8px rgba(20, 60, 70, 0.08);
  z-index: 20;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.92rem;
}

.notif-dropdown-header button {
  width: auto;
}

.notif-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
}

.notif-item:last-child {
  margin-bottom: 0;
}

.notif-item:hover {
  background: var(--sand);
}

.notif-item.unread {
  background: #eaf7f4;
}

.notif-item-text {
  font-size: 0.86rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.notif-item-time {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.nav-toggle {
  display: none;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffefb;
  box-shadow: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.nav-toggle:hover {
  border-color: var(--ocean);
}

.nav-collapse {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ocean);
}

/* Below this width the nav collapses behind a hamburger toggle instead of
   wrapping onto extra lines — six links plus the language switch has no
   good "wrap" layout once the header itself gets this narrow. */
@media (max-width: 700px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-collapse {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .nav-collapse.open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 2px;
  }

  .nav-links a {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: var(--sand);
  }

  .lang-switch {
    align-self: center;
    margin-top: 8px;
  }
}

.hero {
  width: 100%;
  max-width: 640px;
  text-align: center;
  padding: 4px 0 32px;
}

.hero h1 {
  font-size: 2rem;
  margin: 0 0 16px;
  color: var(--text);
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-link {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fffefb;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-link:hover {
  border-color: var(--ocean);
  color: var(--ocean);
}

.btn-primary-link {
  background: linear-gradient(135deg, var(--accent), #ff8a5c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(255, 107, 74, 0.6);
}

.btn-primary-link:hover {
  background: linear-gradient(135deg, var(--accent-hover), #ff7a4d);
  color: #fff;
}

.how-it-works {
  width: 100%;
  max-width: 720px;
  text-align: center;
  padding: 0 0 32px;
}

.how-it-works h2 {
  font-size: 1.4rem;
  margin: 0 0 8px;
  color: var(--text);
}

.how-intro {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  text-align: left;
}

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
}

.step-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff8a5c);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.step h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
  color: var(--text);
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

.leagues-section {
  width: 100%;
  max-width: 720px;
  text-align: center;
  padding: 0 0 32px;
}

.leagues-section h2 {
  font-size: 1.4rem;
  margin: 0 0 8px;
  color: var(--text);
}

.leagues-section .steps {
  margin-bottom: 24px;
}

.about-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.about-tab {
  width: auto;
  margin: 0;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.about-tab:hover {
  background: transparent;
  color: var(--ocean);
  box-shadow: none;
}

.about-tab.active {
  background: var(--ocean);
  color: #fff;
}

.markdown-body {
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}

.markdown-body h1 {
  font-size: 1.3rem;
  margin: 0 0 12px;
}

.markdown-body h2 {
  font-size: 1.1rem;
  margin: 28px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.markdown-body h3 {
  font-size: 0.98rem;
  margin: 20px 0 8px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body code {
  background: var(--sand);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}

.markdown-body a {
  color: var(--ocean);
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 12px 30px -10px rgba(20, 60, 70, 0.28), 0 2px 8px rgba(20, 60, 70, 0.08);
  overflow: hidden;
}

/* A thin ocean-to-coral band along the top of every card — the app pages
   sit inside a wide white card that otherwise covers most of the sun/wave
   background from the body, so this keeps the beach palette present even
   on the busiest data pages. */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--ocean), var(--accent));
}

.card-wide {
  max-width: 880px;
}

@media (max-width: 480px) {
  .card {
    padding: 20px;
    border-radius: 16px;
  }
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  color: var(--text);
}

h1 .emoji {
  margin-right: 6px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 0.9rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 16px;
  background: #fffefb;
  color: var(--text);
  font-family: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--ocean);
  outline-offset: 1px;
}

button {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff8a5c);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px rgba(255, 107, 74, 0.6);
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: linear-gradient(135deg, var(--accent-hover), #ff7a4d);
  box-shadow: 0 8px 20px -6px rgba(255, 107, 74, 0.7);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.message {
  margin-top: 16px;
  font-size: 0.88rem;
  min-height: 1.2em;
}

.message.error {
  color: var(--error);
}

.message.success {
  color: var(--success);
}

.footer-link {
  margin-top: 20px;
  font-size: 0.88rem;
  text-align: center;
  color: var(--muted);
}

.footer-link a {
  color: var(--ocean);
  font-weight: 600;
  text-decoration: none;
}

.footer-link a:hover {
  text-decoration: underline;
}

.profile-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 20px;
}

.provider-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-provider {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.btn-provider:hover {
  border-color: var(--ocean);
  background: #f4fbfa;
}

.btn-provider:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.provider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  flex: none;
}

.btn-google .provider-icon {
  background: #fce8e6;
  color: #c5221f;
}

.btn-facebook .provider-icon {
  background: #e7ecff;
  color: #1877f2;
}

.btn-email .provider-icon {
  background: #e4f3ef;
  color: var(--ocean);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 480px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

.field-hint {
  display: inline;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}

/* Starting-level hints under the select — one line each, and `hidden`
   must win over .field-hint's display: inline. */
.level-hint {
  display: block;
  margin: 6px 0 0;
}

.level-hint[hidden] {
  display: none;
}

.advanced-options {
  margin-bottom: 18px;
}

.advanced-options summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.advanced-options[open] summary {
  margin-bottom: 14px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--ocean);
}

.checkbox-row span {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.checkbox-row .field-hint {
  display: block;
  font-weight: 400;
  margin-top: 2px;
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.photo-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--sand-dark);
  background: #eaeeec;
  flex: none;
}

.btn-secondary {
  display: inline-block;
  width: auto;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: #fffefb;
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary:hover {
  border-color: var(--ocean);
  color: var(--ocean);
}

.profile-stats {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 0.9rem;
}

.profile-stats dt {
  color: var(--muted);
  font-weight: 500;
}

.profile-stats dd {
  margin: 0;
  font-weight: 600;
}

.profile-stats .unset {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.player-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-bottom: 4px;
}

.player-filters > input,
.player-filters > select {
  flex: 1 1 140px;
  min-width: 0;
}

.player-filters > input#player-search {
  flex: 2 1 200px;
}

.player-filters > input[type="number"] {
  flex-basis: 110px;
}

@media (max-width: 480px) {
  .player-filters > input,
  .player-filters > select {
    flex: 1 1 100%;
  }
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--ocean);
}

.league-filter-label {
  display: flex;
  align-items: center;
  flex: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.player-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
  margin: 0 0 12px;
}

.player-status.error {
  color: var(--error);
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffefb;
}

.btn-invite {
  flex: none;
}

.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #eaeeec;
  border: 2px solid var(--sand-dark);
  flex: none;
}

.player-info {
  min-width: 0;
  flex: 1;
}

.player-name {
  font-weight: 700;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-name .you-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.player-meta {
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.player-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: none;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e4f3ef;
  color: var(--ocean);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.rating-badge {
  flex: none;
  min-width: 44px;
  padding: 4px 10px;
  border-radius: 10px;
  background: #fff4da;
  color: #a3720a;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.rank-badge {
  flex: none;
}

.rank-badge.rank-BRONZE {
  background: #f0dfc8;
  color: #8a5a2b;
}

.rank-badge.rank-SILVER {
  background: #e6e9ea;
  color: #6b7278;
}

.rank-badge.rank-GOLD {
  background: #fff0c2;
  color: #a3790a;
}

.rank-badge.rank-PLATINUM {
  background: #dff5f2;
  color: #128a7a;
}

.rank-badge.rank-DIAMOND {
  background: #e6ecfd;
  color: #3f51b5;
}

/* Season banner (home + Rankings): the current season and its dates, or
   the next season's start — hidden when neither exists. */
.season-banner {
  margin: 8px 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #e4f3ef;
  color: var(--ocean);
  font-weight: 600;
  font-size: 0.9rem;
}

.season-banner[hidden] {
  display: none;
}

/* The season select joins the Rankings filter row as if its label/select
   were direct children. */
.season-filter {
  display: contents;
}

.season-filter[hidden] {
  display: none;
}

/* "Placement n/5" — shown instead of a rank badge (and instead of a points
   change) during a player's or pair's first five ranked matches. */
.placement-badge {
  flex: none;
  background: #eef0f2;
  color: var(--muted);
  border: 1px dashed #c3c9ce;
}

/* One-line reason under/next to a points change ("Beating a stronger pair
   earns more"). */
.change-reason {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

/* The ⓘ next to every leaderboard heading. The popover is positioned
   against the whole panel (not the tiny summary), so it always spans the
   panel's width and can't overflow off the right edge on a phone. */
.leaderboard-panel {
  position: relative;
}

.leaderboard-panel > h2 {
  display: inline-block;
}

.ranking-info {
  display: inline-block;
  margin-left: 6px;
  vertical-align: 2px;
}

.ranking-info > summary {
  list-style: none;
  cursor: pointer;
  color: var(--ocean);
  font-size: 1rem;
  line-height: 1;
}

.ranking-info > summary::-webkit-details-marker {
  display: none;
}

.ranking-info-pop {
  position: absolute;
  left: 0;
  right: 0;
  top: 2.2em;
  z-index: 20;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(31, 45, 58, 0.15);
  font-size: 0.85rem;
  color: var(--text);
}

.ranking-info-pop p {
  margin: 0 0 8px;
}

.ranking-info-pop p:last-child {
  margin-bottom: 0;
}

/* "Details" on player/pair pages: the hidden skill rating + certainty. */
.rating-details {
  margin: 12px 0;
  font-size: 0.9rem;
}

.rating-details > summary {
  cursor: pointer;
  color: var(--ocean);
  font-weight: 600;
}

.rating-details .profile-stats {
  margin-top: 8px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.pager span {
  font-size: 0.85rem;
  color: var(--muted);
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.leaderboard-grid.single-column {
  grid-template-columns: 1fr;
}

@media (max-width: 700px) {
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}

.leaderboard-panel h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
  color: var(--text);
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
}

.leaderboard-row .rank {
  flex: none;
  width: 26px;
  font-weight: 800;
  color: var(--muted);
  font-size: 0.85rem;
}

.leaderboard-row .name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-plain,
a.leaderboard-row-link {
  color: inherit;
  text-decoration: none;
}

.link-plain:hover {
  color: var(--ocean);
  text-decoration: underline;
}

/* The flex row itself lives on an inner <div>, not the <a> — some
   browsers don't handle display:flex reliably on an anchor element
   (which defaults to inline), collapsing every field onto its own
   line; a <div> (block by default) is the reliable target, same as
   every other flex row in this app (.pair-row, .match-row, etc.). */
a.leaderboard-row-link {
  display: block;
}

a.leaderboard-row-link:hover .leaderboard-row {
  border-color: var(--ocean);
}

a.leaderboard-row-link:hover .name {
  color: var(--ocean);
}

.player-detail-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.player-detail-heading {
  min-width: 0;
  flex: 1;
}

.player-detail-heading h1 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.pairs-section {
  margin-bottom: 28px;
}

.pairs-section h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
  color: var(--text);
}

.pairs-subsection {
  margin-bottom: 20px;
}

.pairs-subsection h3 {
  font-size: 0.92rem;
  margin: 0 0 8px;
  color: var(--text);
}

.pair-avatars {
  display: flex;
  flex: none;
}

.pair-avatars .player-avatar:not(:first-child) {
  margin-left: -16px;
}

.pair-row-looking {
  flex: none;
}

.pair-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
  margin-bottom: 8px;
}

.pair-row-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.pair-row-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

a.pair-row-name {
  color: inherit;
  text-decoration: none;
}

a.pair-row-name:hover {
  color: var(--ocean);
  text-decoration: underline;
}

.pair-rating-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.pair-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 600px) {
  .pair-players {
    grid-template-columns: 1fr;
  }
}

.pair-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Grid items default to min-width: auto, which refuses to shrink below
     its content's intrinsic width (avatar + name + badges on one line) —
     on the half-width column this grid item sits in, that overflows and
     makes the name/badges overlap instead of wrapping. */
  min-width: 0;
}

.pair-player-stats {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
}

.match-row-info {
  min-width: 0;
  flex: 1;
}

.edit-match-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.match-row-opponent {
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.match-row-meta {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge-win {
  background: #e1f6ea;
  color: var(--success);
}

.badge-loss {
  background: #fbe6e6;
  color: var(--error);
}

.badge-pending {
  background: #fff4da;
  color: #a3720a;
}

.badge-hot {
  background: #ffe8d6;
  color: #c2410c;
}

.rating-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rating-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffefb;
  font-size: 0.85rem;
}

.rating-history-delta {
  font-weight: 600;
}

.rating-history-delta.positive {
  color: var(--success);
}

.rating-history-delta.negative {
  color: var(--error);
}

.badge-disputed {
  background: #fbe6e6;
  color: var(--error);
}

.badge-deletion {
  background: #e4f3ef;
  color: var(--ocean);
}

.set-score-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.set-score-inputs input {
  width: 64px;
  flex: none;
}

.match-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

.match-vs {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 4px;
}

.match-side-winner {
  color: var(--success);
  font-weight: 700;
}
