/* The leaderboard's share of dreamteamhub.ca's stylesheet (DreamTeamHub/css/styles.css):
   colours, header, sign-in menu, leaderboard table and tooltips. Keep in step with it. */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #1c1e26;
  --muted: #5e6272;
  --accent: #4f5bd5;
  --card-fallback: linear-gradient(135deg, #4f5bd5, #2a2f6b);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.12), 0 12px 28px rgba(0, 0, 0, 0.12);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121319;
    --surface: #1c1e27;
    --text: #eceef4;
    --muted: #a2a6b6;
    --accent: #8b95ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.site-header {
  position: relative;
  text-align: center;
  padding: 56px 16px 32px;
}

/* ---------- Site nav (top left) ---------- */

.site-nav {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
}

/* ---------- Account (sign-in, top right) ---------- */

.account {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  text-align: left;
}

/* Pill buttons in the header corners: "Leaderboard" / "Games" on the left, the account on the right. */
.pill-link,
.account__signin,
.account__name {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.pill-link:hover,
.account__signin:hover,
.account__name:hover,
.account__name[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.5), var(--shadow);
}

.pill-link:focus-visible,
.account__signin:focus-visible,
.account__name:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.account__name::after {
  content: " \25BE";
  color: var(--muted);
}

.account__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.account__panel[hidden] {
  display: none;
}

.account__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.account__current {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* The menu's two actions: View profile (green, like the site's other buttons) and Sign out (red). */
.account__profile,
.account__signout {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.account__profile {
  background: #84cc16;
  color: #1c1e26;
}

.account__signout {
  background: #dc2626;
  color: #fff;
}

.account__profile:hover,
.account__signout:hover {
  filter: brightness(1.1);
}

.account__profile:focus-visible,
.account__signout:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.account__logout {
  margin: 8px 0 0;
}

/* Small screens: keep the button clear of the centered title. */
@media (max-width: 520px) {
  .site-header {
    padding-top: 64px;
  }
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer a {
  color: inherit;
}

/* ---------- Leaderboard ---------- */

.leaderboard__tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.leaderboard__tab {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.leaderboard__tab[aria-selected="true"] {
  background: #84cc16;
  color: #1c1e26;
}

.leaderboard__tab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.leaderboard__panel {
  max-width: 720px;
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.leaderboard__table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard__table th,
.leaderboard__table td {
  padding: 12px 16px;
  text-align: left;
}

.leaderboard__table th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--bg);
}

.leaderboard__table tbody tr + tr td {
  border-top: 1px solid var(--bg);
}

.leaderboard__table .rank {
  width: 3em;
  color: var(--muted);
}

.leaderboard__table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Top three stand out. */
.leaderboard__table tbody tr:nth-child(-n + 3) td {
  font-weight: 600;
}

.leaderboard__empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 520px) {
  .leaderboard__table th,
  .leaderboard__table td {
    padding: 10px 8px;
  }
}

/* Hover (or tap/focus) text, e.g. the account number on a name or W / L on a ratio. */
.tip {
  position: relative;
  border-bottom: 1px dotted var(--muted);
  cursor: help;
}

.tip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Names on the leaderboard link to profiles: same look as other tips, plus a hover colour. */
a.tip {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

a.tip:hover {
  color: var(--accent);
  border-bottom-style: solid;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 5;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tip:hover::after,
.tip:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Numbers sit at the right edge: keep their tips on screen. */
.num .tip::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.num .tip:hover::after,
.num .tip:focus::after {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
