:root {
  --bg: #0f1115;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --surface: #161a22;
  --surface-alt: #1f242f;
  --accent: #38bdf8;
  --border: #27303f;
  --key-default: #d3d3d3;
  --key-wrong-spot: #ffd700;
  --key-correct: #2ecc71;
  --key-absent: #6c757d;
}

* {

  :root {
    --bg: #0f1115;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --surface: #161a22;
    --surface-alt: #1f242f;
    --accent: #38bdf8;
    --border: #27303f;
    --key-default: #d3d3d3;
    --key-wrong-spot: #ffd700;
    --key-correct: #2ecc71;
    --key-absent: #6c757d;
  }

  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    font-family: "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .site-header,
  .site-footer {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .site-footer {
    border-bottom: none;
    border-top: 1px solid var(--border);
    margin-top: auto;
  }

  .site-header .inner,
  .site-footer .inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .site-header nav a {
    color: var(--fg);
    text-decoration: none;
    margin-left: 16px;
    font-weight: 600;
  }

  .site-header nav a:hover,
  .site-header nav a:focus {
    color: var(--accent);
  }

  .brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
  }

  .site-content {
    max-width: 960px;
    width: 100%;
    margin: 24px auto;
    padding: 0 20px 60px;
  }

  .game-list {
    display: grid;
    gap: 20px;
  }

  .game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    gap: 12px;
  }

  .game-card .actions {
    display: flex;
    gap: 12px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: var(--accent);
    color: #0f172a;
    font-weight: 600;
    border-radius: 999px;
    text-decoration: none;
  }

  .btn.secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
  }

  .leaderboard {
    display: grid;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
  }

  .leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
  }

  .leaderboard .ranges button {
    margin-right: 12px;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--fg);
    cursor: pointer;
  }

  .leaderboard .ranges button[aria-selected="true"] {
    background: var(--accent);
    color: #0f172a;
  }

  .leaderboard table {
    width: 100%;
    border-collapse: collapse;
  }

  .leaderboard th,
  .leaderboard td {
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
  }

  /* Generic window styling to match game UIs */
  .window {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 12px;
  }

  .admin {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: grid;
    gap: 24px;
  }

  .admin form button {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
  }

  @media (max-width: 640px) {
    .site-header .inner,
    .site-footer .inner {
      flex-direction: column;
      gap: 8px;
    }
    .game-card .actions {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  /* Main navigation and user controls */
  .main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .main-nav a {
    color: var(--fg);
    text-decoration: none;
    font-weight: 600;
  }

  .main-nav a:hover,
  .main-nav a:focus {
    color: var(--accent);
  }

  .nav-user {
    font-size: 0.95rem;
    color: var(--muted);
  }

  .nav-logout {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    margin-left: 16px;
  }

  .nav-logout button {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
  }

  .nav-logout button:hover {
    background: rgba(56, 189, 248, 0.2);
  }

  .nav-signup {
    margin-left: 16px;
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
  }

  .nav-signup:hover {
    background: transparent;
  }

