/* ── Game lobby ─────────────────────────────────────────────────────────
 * Multi-game landing page. No top bar / wallet / balance. Just four game
 * cards (each: clickable title, live "active games" pill, compact top-5
 * leaderboard) plus a spectate link and the shared site footer.
 *
 * Generic page-level styles (body bg, .x1-toast, .site-footer, .hidden,
 * etc.) come from styles.css. */

.lobby-main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.lobby-header {
  text-align: center;
}
.lobby-title {
  font-size: 44px;
  font-weight: 300;
  letter-spacing: 10px;
  text-transform: uppercase;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #00d4ff, #7b2ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lobby-tagline {
  font-size: 14px;
  letter-spacing: 2.5px;
  color: #6ab7d4;
  font-variant-caps: all-small-caps;
  margin: 0;
}

/* ── Game grid ──────────────────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 760px) {
  .games-grid { grid-template-columns: 1fr; }
}

/* The whole tile is the link — using an <a> as the card lets clicks anywhere
   (including the leaderboard) navigate to the game, keyboard-tab works
   naturally, and Cmd/Ctrl+click opens in a new tab without extra JS. */
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 18, 38, 0.78);
  border: 1px solid rgba(106, 183, 212, 0.2);
  border-radius: 14px;
  padding: 22px 22px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  border-color: rgba(106, 183, 212, 0.45);
}
.game-card:focus-visible {
  outline: 2px solid #6ab7d4;
  outline-offset: 3px;
}

/* Header row: title block on the left, decorative mini-board thumbnail on the right */
.game-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.game-card-headline {
  flex: 1 1 auto;
  min-width: 0;
}
.game-card-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 3px;
  margin: 0;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: text-shadow 0.2s;
}
.game-card-name::after {
  content: "→";
  font-size: 18px;
  opacity: 0.5;
  transition: transform 0.2s, opacity 0.2s;
}
.game-card:hover .game-card-name::after {
  transform: translateX(4px);
  opacity: 1;
}

/* Per-game accent colour applied to title text + glow on hover */
.game-card-name.tictactoe { color: #00d4ff; }
.game-card-name.reversi   { color: #00ff88; }
.game-card-name.connect4  { color: #ffaa44; }
.game-card-name.seabattle { color: #6cd6dc; }

.game-card:hover .game-card-name.tictactoe { text-shadow: 0 0 14px rgba(0, 212, 255, 0.55); }
.game-card:hover .game-card-name.reversi   { text-shadow: 0 0 14px rgba(0, 255, 136, 0.55); }
.game-card:hover .game-card-name.connect4  { text-shadow: 0 0 14px rgba(255, 170, 68, 0.55); }
.game-card:hover .game-card-name.seabattle { text-shadow: 0 0 14px rgba(108, 214, 220, 0.55); }

.game-card-tagline {
  font-size: 12px;
  color: #8aa3b0;
  letter-spacing: 1px;
  margin: 4px 0 0;
}

/* ── Mini-board thumbnail (top-right of each card) ─────────────────────
   Pixel sizes are picked per game type so each thumbnail comes out roughly
   the same physical size while still showing the correct grid shape. */
.lobby-thumb {
  flex: 0 0 auto;
  display: grid;
  border-radius: 6px;
  padding: 4px;
  background: rgba(8, 24, 40, 0.8);
  border: 1px solid rgba(106, 183, 212, 0.18);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, border-color 0.2s;
}
.game-card:hover .lobby-thumb { transform: translateY(-1px) scale(1.04); }

.lobby-thumb .lthumb-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
}

/* — Tic-Tac-Toe thumb: 3×3 with X/O — */
.thumb-tictactoe {
  grid-template-columns: repeat(3, 18px);
  grid-template-rows:    repeat(3, 18px);
  gap: 2px;
}
.thumb-tictactoe .lthumb-cell.x { color: #ff4466; text-shadow: 0 0 4px rgba(255, 68, 102, 0.6); }
.thumb-tictactoe .lthumb-cell.o { color: #44aaff; text-shadow: 0 0 4px rgba(68, 170, 255, 0.6); }
.thumb-tictactoe .lthumb-cell.x,
.thumb-tictactoe .lthumb-cell.o { background: rgba(255, 255, 255, 0.07); }

/* — Reversi thumb: 8×8 dots — */
.thumb-reversi {
  grid-template-columns: repeat(8, 7px);
  grid-template-rows:    repeat(8, 7px);
  gap: 1px;
  background: rgba(10, 30, 18, 0.85);
}
.thumb-reversi .lthumb-cell { font-size: 0; background: rgba(255, 255, 255, 0.05); border-radius: 50%; }
.thumb-reversi .lthumb-cell.x { background: #ff4466; box-shadow: 0 0 3px rgba(255, 68, 102, 0.55); }
.thumb-reversi .lthumb-cell.o { background: #44aaff; box-shadow: 0 0 3px rgba(68, 170, 255, 0.55); }

/* — Connect 4 thumb: 7×6 dots stacked at the bottom — */
.thumb-connect4 {
  grid-template-columns: repeat(7, 8px);
  grid-template-rows:    repeat(6, 8px);
  gap: 1px;
  background: linear-gradient(160deg, rgba(15, 35, 80, 0.85), rgba(20, 50, 110, 0.6));
}
.thumb-connect4 .lthumb-cell { font-size: 0; background: rgba(0, 0, 0, 0.35); border-radius: 50%; }
.thumb-connect4 .lthumb-cell.x { background: #ff4466; box-shadow: 0 0 3px rgba(255, 68, 102, 0.55); }
.thumb-connect4 .lthumb-cell.o { background: #44aaff; box-shadow: 0 0 3px rgba(68, 170, 255, 0.55); }

/* — Sea Battle thumb: 10×10 with a few ship cells + pegs — */
.thumb-seabattle {
  grid-template-columns: repeat(10, 6px);
  grid-template-rows:    repeat(10, 6px);
  gap: 1px;
  background: rgba(20, 50, 90, 0.85);
}
.thumb-seabattle .lthumb-cell { font-size: 0; background: rgba(108, 180, 220, 0.08); border-radius: 1px; }
.thumb-seabattle .lthumb-cell.ship    { background: #6cd6dc; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35); }
.thumb-seabattle .lthumb-cell.peg-hit  { background: #ff4466; border-radius: 50%; }
.thumb-seabattle .lthumb-cell.peg-miss { background: #d0d8e0; border-radius: 50%; }

/* Live active-games pill */
.active-games-pill {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #888;
}
.active-games-pill.has-active {
  border-color: rgba(0, 255, 136, 0.4);
  background: rgba(0, 255, 136, 0.1);
  color: #6ee68a;
  /* tiny pulse so it feels live */
  animation: lobbyPulse 1.8s ease-in-out infinite alternate;
}
@keyframes lobbyPulse {
  0%   { box-shadow: 0 0 0 rgba(0, 255, 136, 0); }
  100% { box-shadow: 0 0 12px rgba(0, 255, 136, 0.35); }
}

/* ── Per-card leaderboard ───────────────────────────────────────────── */
.game-card-lb {
  margin-top: 2px;
}
.lobby-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #cfe4ee;
}
.lobby-lb-table thead th {
  font-weight: 600;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(106, 183, 212, 0.2);
  color: #6ab7d4;
  font-variant-caps: all-small-caps;
  letter-spacing: 1.5px;
  white-space: nowrap;
  font-size: 11px;
}
.lobby-lb-table tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.lobby-lb-table tbody tr:last-child td { border-bottom: none; }

.lobby-lb-table .lb-rank {
  width: 26px;
  text-align: right;
  color: #888;
  font-variant-numeric: tabular-nums;
}
.lobby-lb-table .lb-player {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.lobby-lb-table .lb-num {
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.lobby-lb-table .lb-xnt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.lobby-lb-table .lb-xnt-pos  { color: #6ee68a; }
.lobby-lb-table .lb-xnt-neg  { color: #e67676; }
.lobby-lb-table .lb-xnt-zero { color: #aaa; }

.lobby-lb-empty {
  margin: 14px 0 0;
  font-size: 11px;
  color: #666;
  text-align: center;
  letter-spacing: 1px;
  padding: 16px 0;
}

/* ── Spectate call-to-action ────────────────────────────────────────── */
.lobby-spectate-row {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}
.spectate-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
  border-radius: 12px;
  text-decoration: none;
  color: #cfe4ee;
  transition: all 0.2s;
}
.spectate-cta:hover {
  background: rgba(0, 212, 255, 0.16);
  border-color: rgba(0, 212, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 212, 255, 0.18);
}
.spectate-cta-icon {
  width: 26px;
  height: 26px;
  filter: brightness(1.4);
}
.spectate-cta-label {
  font-size: 16px;
  letter-spacing: 2px;
  font-variant-caps: all-small-caps;
  color: #00d4ff;
}
.spectate-cta-sub {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #6ab7d4;
}

@media (max-width: 480px) {
  .lobby-title    { font-size: 32px; letter-spacing: 6px; }
  .game-card      { padding: 18px 16px 14px; }
  .game-card-name { font-size: 19px; letter-spacing: 2px; }
  .spectate-cta-sub { display: none; }
}
