/* CHIP Industries Games — Post-Apocalyptic Brutalism Theme (Light Containers) */

:root {
  --bg: #b8b29f;
  --bg-texture: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='20' height='20' fill='%23b8b29f'/%3E%3Cpath d='M0 0L20 20M20 0L0 20' stroke='%23a39d8a' stroke-width='1'/%3E%3C/svg%3E");
  --concrete: #c4bca9;
  --concrete-dark: #a89e8a;
  --concrete-light: #b8ae8e;
  --concrete-lighter: #c8bea1;
  --moss: #6b8a6b;
  --moss-light: #8bb88b;
  --fern: #5a8a5a;
  --fern-light: #7db87d;
  --rust: #a67b5b;
  --rust-light: #c09b73;
  --charcoal: #2a2a2a;
  --gray: #7a7a7a;
  --text: #2a2a2a;
  --text-dim: #5a5a5a;
  --border: #a89e8a;
  --shadow: 0 4px 12px rgba(42, 42, 42, 0.25);
  --shadow-dark: 0 2px 6px rgba(42, 42, 42, 0.2);
  --radius: 6px;
  --ink: #23251f;
  --ink-soft: #2a2a2a;
  --paper: #d4ccb8;
  --paper-dark: #b8b29f;
  /* Garden theme variables */
  --garden-bg: #e8f0e8;
  --garden-moss: #6b9a6b;
  --garden-fern: #5a9a5a;
  --garden-bloom: #d4a847;
  --garden-stone: #a0958a;
  --garden-tree: #3a2f22;
  --garden-flower: #f8d8c8;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-texture: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='20' height='20' fill='%231a1a1a'/%3E%3Cpath d='M0 0L20 20M20 0L0 20' stroke='%23252525' stroke-width='1'/%3E%3C/svg%3E");
  --concrete: #2a2a2a;
  --concrete-dark: #1f1f1f;
  --concrete-light: #353535;
  --concrete-lighter: #3d3d3d;
  --moss: #8fbc8f;
  --moss-light: #a8d4a8;
  --fern: #6b8e23;
  --fern-light: #8db44a;
  --rust: #cd5c5c;
  --rust-light: #e07878;
  --charcoal: #e0e0e0;
  --gray: #888888;
  --text: #e0e0e0;
  --text-dim: #a0a0a0;
  --border: #404040;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-dark: 0 2px 6px rgba(0, 0, 0, 0.5);
  --ink: #e0e0e0;
  --ink-soft: #c0c0c0;
  --paper: #2a2a2a;
  --paper-dark: #1f1f1f;
}

* { box-sizing: border-box; }
html { height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  background: var(--bg) url(var(--bg-texture)) repeat;
  color: var(--text);
  font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
  line-height: 1.4;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
#view { flex: 1; }
.mount { width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--charcoal); }
p { margin: 0; }

svg.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  vertical-align: middle;
}

/* Concrete block pattern */
.concrete-bg {
  background: linear-gradient(135deg, var(--concrete) 0%, var(--concrete-dark) 100%);
  border: 2px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(42, 42, 42, 0.15);
}

/* Moss accent */
.moss { color: var(--moss); }
.moss-bg { background: var(--moss); color: #fff; }
.moss-border { border-color: var(--moss); }

/* Fern accent */
.fern { color: var(--fern); }
.fern-bg { background: var(--fern); color: #fff; }
.fern-border { border-color: var(--fern); }

/* Rust accent */
.rust { color: var(--rust); }
.rust-bg { background: var(--rust); color: #fff; }
.rust-border { border-color: var(--rust); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--border);
  background: var(--concrete);
  color: var(--charcoal);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover {
  background: var(--concrete-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-dark);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--moss);
  border-color: var(--fern);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--moss-light);
  color: #000;
}
.btn-ghost {
  background: transparent;
  color: var(--moss);
  border-color: var(--moss);
}
.btn-ghost:hover {
  background: var(--moss);
  color: #000;
}
.btn-block { width: 100%; }

/* ---------- Boot / spinner ---------- */
.boot {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-dim);
}
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--moss);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: var(--concrete);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 4px solid var(--moss); }
.toast-error { border-left: 4px solid var(--rust); }
.toast-info { border-left: 4px solid var(--fern); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(201, 195, 180, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 20px;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--moss); }
.modal-body { padding: 20px; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--moss);
  border: 2px solid var(--fern);
  border-radius: var(--radius);
}
.auth-logo {
  display: inline-block;
  color: #000;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 18px;
  padding: 8px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.auth-brand h1 {
  font-size: 22px;
  color: var(--charcoal);
}
.auth-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 8px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
  /* Auth form: tighter gap for simpler forms */
  .auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .auth-form.auth-form-device {
    margin-top: 8px;
    margin-bottom: 24px;
  }
  .auth-name-field {
    margin-bottom: 8px;
  }
  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
  }
  .field input, .auth-form input {
    background: var(--concrete-lighter);
    border: 2px solid var(--border);
    color: var(--charcoal);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    width: 100%;
  }
  .field input:focus, .auth-form input:focus {
    outline: none;
    border-color: var(--moss);
  }
  /* Link-style toggle between login methods */
  .link-btn {
    background: none;
    border: none;
    color: var(--moss);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all 0.15s ease;
  }
  .link-btn:hover {
    background: rgba(107, 138, 107, 0.15);
    color: #000;
  }
  .auth-error {
    color: var(--rust);
    font-size: 13px;
    margin-top: 4px;
  }
  .auth-busy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-dim);
    font-size: 14px;
    padding: 14px 0;
  }
  .auth-busy[hidden] {
    display: none;
  }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
  margin: 16px 0 8px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Hub ---------- */
.hub-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 18px 48px;
  width: 100%;
}
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 22px;
}
.hub-welcome {
  display: flex;
  align-items: center;
  gap: 16px;
}
.hub-logo {
  background: var(--moss);
  border: 2px solid var(--fern);
  color: #000;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: var(--radius);
  letter-spacing: 0.06em;
}
.hub-welcome h2 {
  font-size: 20px;
  color: var(--charcoal);
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.game-card {
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--moss);
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--moss);
  box-shadow: var(--shadow-dark);
}
.game-icon {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(42,42,42,0.2));
}
.game-info {
  flex: 1;
}
.game-info h3 {
  font-size: 19px;
  margin-bottom: 6px;
  color: var(--moss);
}
.game-tagline {
  color: var(--text-dim);
  font-size: 14px;
}
.game-achievement-hint {
  font-size: 12px;
  color: var(--rust);
  margin-top: 4px;
}

.game-card-memory { background: linear-gradient(135deg, var(--concrete-light) 0%, var(--concrete) 100%); border-color: #c0b262; }
.game-card-memory::before { background: #a67b5b; }
.game-card-memory .game-icon { color: #a67b5b; }
.game-card-memory .game-info h3 { color: #a67b5b; }

.game-card-speed { background: linear-gradient(135deg, var(--concrete-light) 0%, var(--concrete) 100%); border-color: #8ba68b; }
.game-card-speed::before { background: #5a8a5a; }
.game-card-speed .game-icon { color: #5a8a5a; }
.game-card-speed .game-info h3 { color: #5a8a5a; }

.game-card-chess { background: linear-gradient(135deg, var(--concrete-light) 0%, var(--concrete) 100%); border-color: #c0b262; }
.game-card-chess::before { background: #a67b5b; }
.game-card-chess .game-icon { color: #a67b5b; }
.game-card-chess .game-info h3 { color: #a67b5b; }

.mem-wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.mem-main { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 24px; align-items: start; }
.mem-play-col { display: flex; flex-direction: column; gap: 20px; }
.mem-setup { background: var(--concrete); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.mem-field { display: flex; flex-direction: column; gap: 8px; }
.mem-field label { font-size: 14px; color: var(--text-dim); }
.mem-select {
  background: var(--concrete-light);
  color: var(--charcoal);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}
.mem-difficulty { display: flex; align-items: center; gap: 12px; }
.mem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}
.mem-card {
  aspect-ratio: 1;
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.3s ease, border-color 0.15s ease;
  position: relative;
}
.mem-card:hover { border-color: var(--moss); }
.mem-card.mem-flipped {
  transform: rotateY(180deg);
}
.mem-card.mem-matched {
  border-color: var(--moss);
  background: linear-gradient(135deg, var(--moss-light) 0%, var(--fern-light) 100%);
  color: #000;
  pointer-events: none;
  animation: mem-match-burst 0.6s ease-out, mem-ash-drift 0.8s ease-in 0.6s forwards;
  box-shadow: 0 0 0 2px var(--moss), 0 0 24px rgba(107, 138, 107, 0.5);
}
.mem-card.mem-matched .mem-card-back {
  background: linear-gradient(135deg, var(--moss-light) 0%, var(--fern-light) 100%);
  border-color: var(--moss);
  color: #000;
  font-weight: 800;
  animation: mem-text-ash 1.2s ease-in 0.4s forwards;
}
@keyframes mem-match-burst {
  0%   { transform: rotateY(180deg) scale(1); box-shadow: 0 0 0 2px var(--moss), 0 0 0 rgba(107, 138, 107, 0); }
  40%  { transform: rotateY(180deg) scale(1.12); box-shadow: 0 0 0 2px var(--moss), 0 0 32px rgba(123, 184, 125, 0.9); }
  100% { transform: rotateY(180deg) scale(1); box-shadow: 0 0 0 2px var(--moss), 0 0 0 rgba(107, 138, 107, 0); }
}
@keyframes mem-ash-drift {
  0%   { filter: brightness(1) saturate(1); opacity: 0.85; transform: rotateY(180deg) translateY(0); }
  50%  { filter: brightness(0.7) saturate(0.5); opacity: 0.6; transform: rotateY(180deg) translateY(-4px); }
  100% { filter: brightness(0.55) saturate(0.15) contrast(0.8); opacity: 0.45; transform: rotateY(180deg) translateY(0); }
}
@keyframes mem-text-ash {
  0%   { color: #000; text-shadow: 0 0 0 transparent; }
  100% { color: #6a6a6a; text-shadow: 1px 1px 0 rgba(0,0,0,0.15); letter-spacing: 0.04em; }
}
.mem-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}
.mem-card-front, .mem-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  backface-visibility: hidden;
  font-size: 20px;
  font-weight: 800;
  color: var(--charcoal);
}
.mem-card-front {
  background: var(--concrete);
  border: 2px solid var(--border);
}
.mem-card-back {
  background: var(--concrete-light);
  border: 2px solid var(--moss);
  color: var(--charcoal);
  transform: rotateY(180deg);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  word-break: break-word;
}
.mem-loading, .mem-status {
  font-size: 14px;
  color: var(--text-dim);
  min-height: 20px;
  text-align: center;
}
.mem-moves, .mem-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--fern);
}
.mem-lb { width: 50%; }

@media (max-width: 820px) {
  .mem-main { grid-template-columns: 1fr; }
  .mem-lb { max-width: 480px; }
}

.mem-card:nth-child(even) .mem-card-front { background: #c8c0a8; }
.mem-card:nth-child(odd) .mem-card-back { background: #c0b898; }

/* ---------- Game toolbar ---------- */
.game-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
}
.game-title {
  font-size: 20px;
  color: var(--charcoal);
}
.game-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Shared leaderboard panel ---------- */
.lb-panel {
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 240px;
  width: 50%;
}
.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.lb-head h4 {
  font-size: 15px;
  color: var(--moss);
}
.lb-refresh {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.lb-refresh:hover { color: var(--moss); }
.lb-loading, .lb-empty, .lb-error { color: var(--text-dim); font-size: 13px; padding: 8px 0; }
.lb-error { color: var(--rust); }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--concrete-light);
}
.lb-row-me {
  outline: 2px solid var(--moss);
  background: var(--concrete-light);
}
.lb-rank {
  width: 26px;
  color: var(--text-dim);
  font-weight: 700;
}
.lb-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  border: 1px solid var(--border);
}
.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--charcoal);
}
.lb-score {
  font-weight: 700;
  color: var(--moss);
  min-width: 60px;
  text-align: right;
}
.lb-mine {
  margin-top: 12px;
  font-size: 13px;
  color: var(--moss);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-mine::before {
  content: '★';
  color: var(--moss);
  font-weight: 700;
}

/* ---------- Tic-Tac-Toe ---------- */
.ttt-wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.ttt-main {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}
.ttt-board-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.ttt-status {
  font-size: 16px;
  font-weight: 600;
  min-height: 24px;
  color: var(--charcoal);
}
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 340px;
}
.ttt-cell {
  aspect-ratio: 1;
  font-size: 48px;
  font-weight: 800;
  background: var(--concrete-light);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.ttt-cell:hover { background: var(--concrete); }
.ttt-cell:nth-child(1), .ttt-cell:nth-child(3), .ttt-cell:nth-child(7), .ttt-cell:nth-child(9) { color: var(--fern); }
.ttt-cell:nth-child(2), .ttt-cell:nth-child(4), .ttt-cell:nth-child(6), .ttt-cell:nth-child(8) { color: #c0b262; }
.ttt-win {
  background: rgba(105, 155, 105, 0.2);
  border-color: var(--moss);
}
.ttt-score { color: var(--text-dim); font-size: 14px; }
.ttt-mode {
  background: var(--concrete-light);
  color: var(--charcoal);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
}
.ttt-lb { width: 50%; }

/* ---------- Snake ---------- */
.snake-wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.snake-main { display: grid; grid-template-columns: minmax(300px, 480px) 1fr; gap: 24px; align-items: start; }
.snake-board { position: relative; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.snake-canvas {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: #c9c3b4;
}
.snake-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 195, 180, 0.85);
  border-radius: var(--radius);
}
.snake-overlay.hidden { display: none; }
.snake-overlay-msg {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  color: var(--charcoal);
}
.snake-dpad { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.snake-dpad-row { display: flex; gap: 12px; }
.snake-dpad-btn {
  width: 56px;
  height: 48px;
  font-size: 20px;
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--charcoal);
  cursor: pointer;
}
.snake-dpad-btn:hover { background: var(--concrete-light); }
.snake-dpad-btn:active { transform: translateY(2px); }
.snake-score, .snake-best { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.snake-lb { width: 50%; }

/* Wordle */
.wordle-wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.wordle-main { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 24px; align-items: start; }
.wordle-play-col { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.wordle-setup { margin-bottom: 8px; }
.wordle-field { display: flex; align-items: center; gap: 8px; }
.wordle-select {
  padding: 6px 10px;
  background: var(--concrete-light);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.wordle-clue {
  font-size: 15px;
  color: var(--fern);
  font-weight: 600;
  text-align: center;
  min-height: 22px;
  padding: 6px 12px;
  background: var(--moss-light);
  border-radius: var(--radius);
  border: 2px solid var(--moss);
}
.wordle-msg { font-size: 14px; color: var(--text-dim); min-height: 20px; text-align: center; }
.wordle-board { display: flex; flex-direction: column; gap: 8px; }
.wordle-row { display: flex; gap: 8px; justify-content: center; }
.wordle-cell {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--concrete-light);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--charcoal);
}
.wordle-cell.filled { border-color: var(--gray); }
.wordle-cell.state-correct {
  background: linear-gradient(135deg, var(--moss-light) 0%, var(--fern-light) 100%);
  border-color: var(--fern);
  color: #000;
  font-weight: 800;
  animation: wordle-pop 0.4s ease-out;
  box-shadow: 0 0 0 2px var(--moss), 0 0 16px rgba(107, 138, 107, 0.5);
}
@keyframes wordle-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.15); box-shadow: 0 0 0 2px var(--moss), 0 0 28px rgba(123, 184, 125, 0.8); }
  100% { transform: scale(1); }
}
.wordle-cell.state-present {
  background: linear-gradient(135deg, var(--rust) 0%, var(--rust-light) 100%);
  border-color: var(--rust);
  color: #000;
  font-weight: 800;
  animation: wordle-shake 0.4s ease-out;
  box-shadow: 0 0 0 2px var(--rust), 0 0 12px rgba(166, 123, 91, 0.4);
}
@keyframes wordle-shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-4px) rotate(-1deg); }
  40%  { transform: translateX(4px) rotate(1deg); }
  60%  { transform: translateX(-3px) rotate(-0.5deg); }
  80%  { transform: translateX(2px) rotate(0.5deg); }
}
.wordle-cell.state-absent {
  background: var(--concrete-dark);
  border-color: var(--charcoal);
  color: var(--text-dim);
  opacity: 0.6;
  text-decoration: line-through;
  text-decoration-color: var(--gray);
  animation: wordle-dim 0.3s ease-out forwards;
}
@keyframes wordle-dim {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0.55; transform: scale(0.97); }
}
.wordle-key.state-correct {
  background: linear-gradient(135deg, var(--moss) 0%, var(--fern) 100%);
  border-color: var(--fern);
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(90, 138, 90, 0.5);
}
.wordle-key.state-present {
  background: linear-gradient(135deg, var(--rust) 0%, var(--rust-light) 100%);
  border-color: var(--rust);
  color: #000;
  font-weight: 800;
}
.wordle-key.state-absent {
  background: var(--concrete-dark);
  border-color: var(--border);
  color: var(--text-dim);
  opacity: 0.5;
}
.wordle-key {
  flex: 1;
  max-width: 48px;
  height: 56px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--concrete-light);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--charcoal);
  cursor: pointer;
}
.wordle-key:hover { background: var(--concrete); }
.wordle-key:active { transform: translateY(2px); }
.wordle-key-wide { max-width: 72px; }
.wordle-keyboard { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; }
.wordle-key-line { display: flex; gap: 6px; justify-content: center; }
.wordle-score { font-size: 14px; font-weight: 600; color: var(--fern); }
.wordle-lb { width: 50%; }

/* Speed Game */
.speed-wrap { max-width: 1200px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.speed-toolbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.speed-toolbar-label { font-size: 13px; color: var(--text-dim); }
.speed-select-sm {
  padding: 6px 10px;
  font-size: 13px;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.speed-count-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--fern);
  background: var(--concrete-light);
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.speed-layout {
  display: grid;
  grid-template-columns: 160px 1fr 240px;
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}
.speed-left-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.speed-center-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}
.speed-right-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.speed-deck-area {
  display: flex;
  justify-content: center;
  width: 100%;
}
.speed-deck-slot {
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  max-width: 150px;
  background: linear-gradient(135deg, var(--concrete-dark) 0%, var(--border) 100%);
  border: 3px solid var(--rust);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}
.speed-deck-slot:hover {
  transform: scale(1.05);
  border-color: var(--moss);
  box-shadow: 0 0 16px rgba(107, 138, 107, 0.4);
}
.speed-deck-stack {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.speed-status {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 20px;
  text-align: center;
  padding: 8px 12px;
  background: var(--concrete);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}
.speed-table {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.speed-slot {
  width: 100px;
  height: 140px;
  background: var(--concrete);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.speed-slot.speed-outer-left { border-color: var(--rust); }
.speed-slot.speed-outer-right { border-color: var(--rust); }
.speed-slot.speed-inner-left { border-color: var(--moss); }
.speed-slot.speed-inner-right { border-color: var(--moss); }
.speed-hand {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: nowrap;
}
.speed-hand-slot {
  width: 100px;
  height: 140px;
  background: var(--concrete);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.speed-hand-slot:hover {
  border-color: var(--moss);
}
.speed-hand-slot.speed-slot-selected {
  border-color: var(--fern);
  background: rgba(90, 138, 90, 0.15);
  box-shadow: 0 0 8px rgba(90, 138, 90, 0.4);
}
.speed-card {
  width: 90%;
  height: 90%;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid var(--border);
  background: var(--concrete-light);
  color: var(--charcoal);
}
.speed-card.speed-face-down {
  background: linear-gradient(135deg, var(--concrete-dark) 0%, var(--border) 100%);
  color: var(--text-dim);
  cursor: default;
}
.speed-card.speed-current-multiple {
  border-color: var(--moss);
  box-shadow: 0 0 0 2px var(--moss);
}
.speed-card.speed-valid {
  border-color: var(--fern);
  background: rgba(90, 138, 90, 0.1);
}
.speed-card.speed-valid:hover {
  box-shadow: 0 0 12px rgba(90, 138, 90, 0.5);
}
.speed-card.speed-slot-selected {
  border-color: var(--fern);
  background: rgba(90, 138, 90, 0.2);
  box-shadow: 0 0 12px rgba(90, 138, 90, 0.5);
}
.speed-card.speed-target {
  border-color: var(--moss);
  background: rgba(107, 138, 107, 0.2);
  box-shadow: 0 0 12px rgba(107, 138, 107, 0.5);
  animation: speed-pulse 0.8s ease-in-out infinite alternate;
  cursor: pointer;
}
@keyframes speed-pulse {
  0% { box-shadow: 0 0 4px rgba(107, 138, 107, 0.3); }
  100% { box-shadow: 0 0 16px rgba(107, 138, 107, 0.6); }
}
.speed-card:hover:not(.speed-face-down) {
  transform: scale(1.05);
}
.speed-moves {
  font-size: 13px;
  font-weight: 600;
  color: var(--fern);
  background: var(--concrete-light);
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.speed-lb {
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
  width: 50%;
}

@media (max-width: 900px) {
  .speed-layout {
    grid-template-columns: 1fr;
  }
  .speed-left-panel {
    flex-direction: row;
    gap: 16px;
    justify-content: center;
  }
  .speed-status { width: auto; flex: 1; }
  .speed-right-panel { order: 3; }
}
@media (max-width: 600px) {
  .speed-slot, .speed-hand-slot {
    width: 70px;
    height: 100px;
  }
  .speed-card { font-size: 18px; }
}
@media (max-width: 820px) {
  .speed-main { grid-template-columns: 1fr; }
  .speed-lb { max-width: 480px; }
}
.tool { display: inline-block; position: relative; }
.tool::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--moss);
  color: #000;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}
.tool:hover::after { opacity: 1; visibility: visible; }

/* ---------- Profile ---------- */
.profile-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px 48px;
  width: 100%;
}
.profile-main {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
}
.profile-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.profile-card {
  background: var(--concrete);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.profile-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}
.profile-header-actions {
  display: flex;
  justify-content: flex-start;
  padding: 0 24px;
}
.profile-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--moss);
  object-fit: cover;
  background: var(--concrete-light);
}
.profile-avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--moss);
  background: var(--concrete-light);
}
.profile-username {
  font-size: 14px;
  font-weight: 600;
}
.profile-name {
  flex: 1;
}
.profile-username-input {
  background: var(--concrete-lighter);
  border: 2px solid var(--border);
  color: var(--charcoal);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  width: 100%;
}
.profile-username-input:focus {
  outline: none;
  border-color: var(--moss);
}
.profile-avatar-url label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.profile-avatar-url input {
  background: var(--concrete-lighter);
  border: 2px solid var(--border);
  color: var(--charcoal);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  width: 100%;
}
.profile-avatar-url input:focus {
  outline: none;
  border-color: var(--moss);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
.profile-builder-preview-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.profile-builder-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--moss);
  object-fit: cover;
}
.profile-builder-info {
  flex: 1;
}
.profile-builder-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.profile-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.profile-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.profile-color-swatch:hover { transform: scale(1.1); }
.profile-color-swatch.selected {
  border-color: var(--moss);
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(107, 138, 107, 0.3);
}
.profile-emote-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-emote-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--concrete-light);
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s ease;
}
.profile-emote-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: contain; }
.profile-emote-btn:hover { border-color: var(--moss); }
.profile-emote-btn.selected { border-color: var(--moss); background: rgba(107, 138, 107, 0.1); }
.profile-avatar-builder .profile-card {
  padding: 16px;
  background: var(--concrete-light);
  margin-top: 8px;
}
.profile-color-swatch.locked { opacity: 0.3; cursor: not-allowed; }
.profile-color-swatch.locked:hover { transform: none; }
.profile-emote-btn.locked { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.profile-emote-btn.locked:hover { border-color: var(--border); }
.profile-milestone { margin-top: 12px; padding: 8px 0; }
.profile-milestone-label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.profile-milestone-fill { transition: width 0.4s ease; }

/* ---------- Achievements ---------- */
.profile-achievements {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}
.profile-achievements-title {
  font-size: 18px;
  color: var(--charcoal);
  margin: 0 0 16px;
}
.profile-achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-achievement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--concrete);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.profile-achievement-icon {
  font-size: 24px;
  line-height: 1;
}
.profile-achievement-info {
  flex: 1;
}
.profile-achievement-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
}
.profile-achievement-description {
  font-size: 12px;
  color: var(--text-dim);
}
.profile-achievement-date {
  font-size: 11px;
  color: var(--rust);
}
.profile-achievements-empty {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

/* ---------- Chess ---------- */
.chess-wrap { max-width: 800px; margin: 0 auto; padding: 0 18px 48px; width: 100%; }
.chess-main { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 24px; align-items: start; }
.chess-play-col { display: flex; flex-direction: column; gap: 16px; }

.chess-board {
  width: 100%; max-width: 460px; aspect-ratio: 1;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border: 3px solid var(--ink); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}
.chess-anim-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 10;
}
.chess-anim-layer.hidden { display: none; }
.chess-anim-piece {
  will-change: transform;
  transition: left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.chess-sq {
  position: relative; display: flex; align-items: center; justify-content: center;
  cursor: default; user-select: none;
}
.chess-sq--light { background: #e6e3d8; }
.chess-sq--dark { background: #b8b3a2; }
.chess-sq--sel { box-shadow: inset 0 0 0 3px var(--fern); background: #cdd3b8; }
.chess-sq--last { background-image: linear-gradient(rgba(138, 154, 91, 0.55), rgba(138, 154, 91, 0.55)); }
.chess-sq--check { background-image: radial-gradient(circle, rgba(181, 83, 60, 0.85) 0 42%, transparent 46%); }
.chess-sq--move::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(23, 25, 23, 0.55); }
.chess-sq--capture::after { content: ""; inset: 6%; border-radius: 50%; border: 3px solid rgba(122, 75, 42, 0.85); background: rgba(122, 75, 42, 0.12); }

.chess-piece { font-size: clamp(1.5rem, 7.5vw, 2.5rem); line-height: 1; pointer-events: none; }
.chess-piece--w { color: #fbfaf6; text-shadow: 0 0 1.5px #23251f, 0 1.5px 1.5px rgba(0, 0, 0, 0.45); }
.chess-piece--b { color: #23211b; text-shadow: 0 0 1.5px rgba(251, 250, 246, 0.7); }

.chess-status {
  font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink); border-left: 6px solid var(--ink);
  padding-left: 0.75rem; min-height: 1.6em;
}
.chess-status--check { color: #b5533c; border-left-color: #b5533c; }
.chess-status--over { color: var(--fern); border-left-color: var(--fern); }
.chess-status--searching { color: var(--text-dim); border-left-color: var(--text-dim); }

.chess-score { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); }

.chess-question { background: linear-gradient(135deg, #dcd9d0 0%, #c9c6bc 100%); border: 2px solid var(--ink); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16), inset 0 2px 0 rgba(255, 255, 255, 0.75); padding: 1.4rem; }
.chess-question-warning { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: #b5533c; font-weight: 700; margin-bottom: 0.6rem; padding: 0.4rem; background: rgba(181, 83, 60, 0.12); border: 1px solid #b5533c; border-radius: 2px; }
.chess-question-warning.hidden { display: none !important; }
.chess-question-prompt { font-size: 1.02rem; color: var(--ink); margin-bottom: 1rem; }
.chess-options { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.chess-opt-btn { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.04em; text-align: left; color: var(--ink-soft); border: 2px solid var(--ink); background: #dcd9d0; padding: 0.6rem 0.8rem; box-shadow: 3px 3px 0 rgba(23, 25, 23, 0.15); cursor: pointer; transition: all 120ms ease; }
.chess-opt-btn:hover { color: var(--fern); border-color: var(--fern); transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(23, 25, 23, 0.15); }
.chess-opt-btn--correct { color: #fff; background: var(--fern); border-color: var(--fern); }
.chess-opt-btn--wrong { color: #fff; background: #b5533c; border-color: #b5533c; }
.chess-opt-btn:disabled { cursor: default; }
.chess-feedback { margin-top: 0.9rem; font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; min-height: 1.2em; }
.chess-feedback--ok { color: var(--fern); }
.chess-feedback--no { color: #b5533c; }

.chess-promo { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(23, 25, 23, 0.55); }
.chess-promo-inner { background: linear-gradient(135deg, #dcd9d0 0%, #c9c6bc 100%); border: 3px solid var(--ink); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); padding: 1.4rem 1.6rem; text-align: center; }
.chess-promo-title { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); margin-bottom: 1rem; }
.chess-promo-options { display: flex; gap: 0.6rem; }
.chess-promo-options button { font-size: 2.4rem; line-height: 1; color: var(--ink); border: 2px solid var(--ink); background: #dcd9d0; padding: 0.5rem 0.8rem; box-shadow: 3px 3px 0 rgba(23, 25, 23, 0.2); cursor: pointer; transition: all 120ms ease; }
.chess-promo-options button:hover { color: var(--fern); border-color: var(--fern); transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(23, 25, 23, 0.2); }

.chess-side { display: flex; flex-direction: column; gap: 1rem; }

@media (max-width: 760px) { .chess-main { grid-template-columns: 1fr; } }

.chess-mode-select {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 1.5rem; margin-top: 1rem;
  text-align: center;
}
.chess-mode-select h3 { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.chess-mode-btn { width: 100%; max-width: 280px; font-weight: 600; }
.chess-mode-select.hidden { display: none !important; }

.chess-promo.hidden,
.chess-question.hidden,
.chess-promo.hidden *,
.chess-question.hidden * { display: none !important; }

/* ---------- About ---------- */
.about-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 18px 48px;
  width: 100%;
}
.about-main {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.about-card {
  background: var(--paper);
  border: 1px solid var(--concrete);
  border-radius: 6px;
  padding: 20px;
}
.about-card h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--ink);
}
.about-card p {
  margin: 0 0 12px;
  line-height: 1.6;
}
.about-card ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.about-card li {
  margin-bottom: 6px;
  line-height: 1.5;
}
.about-code {
  background: var(--paper-dark);
  border: 1px solid var(--concrete);
  border-radius: 4px;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono), monospace;
  font-size: 0.85rem;
  line-height: 1.5;
white-space: pre;
   margin: 0;
 }

.profile-color-section {
  margin-bottom: 16px;
}
.profile-emote-section {
  margin-bottom: 16px;
}
.profile-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.profile-category-label {
  font-size: 12px;
  color: var(--text-dim);
  margin: 8px 0 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
 .hidden { display: none !important; }

 /* Hub stats panel */
 .hub-stats {
   background: var(--concrete);
   border: 2px solid var(--border);
   border-radius: var(--radius);
   padding: 20px;
   margin-bottom: 24px;
 }
 .hub-stats-head h3 {
   font-size: 18px;
   color: var(--charcoal);
   margin: 0 0 16px;
 }
 .hub-stats-grid {
   display: flex;
   gap: 20px;
   flex-wrap: wrap;
 }
 .hub-stat {
   flex: 1;
   min-width: 100px;
   text-align: center;
 }
 .hub-stat-value {
   font-size: 28px;
   font-weight: 800;
   color: var(--moss);
   line-height: 1;
 }
 .hub-stat-label {
   font-size: 12px;
   color: var(--text-dim);
   text-transform: uppercase;
   letter-spacing: 1px;
 }
 .hub-stats-bygame-wrap {
   padding-top: 16px;
   margin-top: 16px;
   border-top: 1px solid var(--border);
 }
 .hub-stats-bygame-title {
   font-size: 14px;
   color: var(--charcoal);
   margin-bottom: 8px;
 }
 .hub-stats-bygame {
   list-style: none;
   margin: 0;
   padding: 0;
   display: flex;
   flex-direction: column;
   gap: 6px;
 }
 .hub-stats-bygame-row {
   display: flex;
   justify-content: space-between;
   font-size: 14px;
 }
 .hub-stats-bygame-name {
   color: var(--text);
 }
 .hub-stats-bygame-count {
   color: var(--text-dim);
 }
 .hub-stats-loading, .hub-stats-empty {
   color: var(--text-dim);
   font-size: 14px;
   padding: 16px;
   text-align: center;
 }

 /* Hub top players */
 .hub-top-players {
   background: var(--concrete);
   border: 2px solid var(--border);
   border-radius: var(--radius);
   padding: 20px;
   margin-top: 24px;
 }
 .hub-top-players h3 {
   font-size: 18px;
   color: var(--charcoal);
   margin: 0 0 16px;
 }
 .hub-top-list {
   list-style: none;
   margin: 0;
   padding: 0;
   display: flex;
   flex-direction: column;
   gap: 8px;
 }
 .hub-top-row {
   display: flex;
   align-items: center;
   gap: 10px;
   font-size: 14px;
 }
 .hub-top-rank {
   width: 20px;
   color: var(--text-dim);
   font-weight: 700;
 }
 .hub-top-avatar {
   width: 24px;
   height: 24px;
   border-radius: 50%;
   object-fit: cover;
   border: 1px solid var(--border);
 }
 .hub-top-name {
   flex: 1;
   color: var(--charcoal);
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
 }
 .hub-top-score {
   color: var(--moss);
   font-weight: 600;
 }

 /* Hub header button container */
 .hub-header-buttons {
   display: flex;
   align-items: center;
   gap: 8px;
 }

 /* Theme button styling */
 .hub-theme-btn {
   padding: 4px;
 }
 .hub-theme-btn svg {
   width: 20px;
   height: 20px;
 }

 @media (max-width: 820px) {
   .hub-stats-grid {
     justify-content: center;
   }
 }
