:root {
  --bg: #0f1115;
  --card: #171a21;
  --line: #2a2e38;
  --text: #e8eaed;
  --muted: #8a8f9a;
  --accent: #4f8cff;
  --green: #16a34a;
  --yellow: #ca8a04;
  --gray: #4b4f58;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f6f7f9;
    --card: #ffffff;
    --line: #e1e4e9;
    --text: #1a1d23;
    --muted: #6b7280;
    --gray: #9ca3af;
  }
}
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e1e4e9;
  --text: #1a1d23;
  --muted: #6b7280;
  --gray: #9ca3af;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 60px;
}
a { color: var(--accent); }
.hub-title {
  font-size: 28px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.hub-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 640px;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 16px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: transform .1s ease, border-color .1s ease;
}
.game-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.game-card .emoji { font-size: 32px; display: block; margin-bottom: 8px; }
.game-card .name { font-weight: 700; }
.game-card .status { font-size: 11px; color: var(--muted); margin-top: 4px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
}
.muted { color: var(--muted); }
.back-link {
  align-self: flex-start;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .1s ease, border-color .1s ease;
}
.back-link:hover { transform: translateY(-1px); border-color: var(--accent); }

/* Settings menu (theme picker) -- fixed top-right on every page. */
#settingsBtn {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 100;
}
#settingsMenu {
  position: fixed;
  top: 52px;
  right: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  min-width: 150px;
  z-index: 100;
  overflow: hidden;
  display: none;
}
#settingsMenu.open { display: block; }
#settingsMenu .menu-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  padding: 8px 12px 4px;
}
#settingsMenu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
#settingsMenu button:hover { background: var(--line); }
#settingsMenu button.active::after { content: " \2713"; }

/* Version footer + AMDG mark -- injected by theme.js, present on every page. */
#versionFooter {
  margin-top: 24px;
  font-size: 10px;
  color: var(--muted);
  opacity: .6;
  text-align: center;
}
#amdgMark {
  position: fixed;
  bottom: 8px;
  left: 10px;
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
  opacity: .35;
  user-select: none;
  pointer-events: none;
}

/* "New version available" banner */
#updateBanner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  text-align: center;
  z-index: 300;
}
#updateBanner.show { display: flex; align-items: center; justify-content: center; gap: 12px; }
#updateBanner button {
  border: 1px solid rgba(255,255,255,.6);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
