  :root {
    --bg: #0f172a;
    --panel: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --snake: #4ade80;
    --robot: #f87171;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent;
  }
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    min-height: 100vh;  /* fallback */
    min-height: 100dvh; /* iOS Safari dynamic viewport */
    padding: max(24px, env(safe-area-inset-top))
             max(24px, env(safe-area-inset-right))
             max(24px, env(safe-area-inset-bottom))
             max(24px, env(safe-area-inset-left));
  }
  h1 {
    font-size: clamp(28px, 7vw, 44px);
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #fbbf24, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  #games {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 720px;
  }
  .card {
    flex: 1 1 260px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 20px 22px;
    background: var(--panel);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease, border-color 0.1s ease;
  }
  .card:hover, .card:focus-visible { border-color: rgba(255, 255, 255, 0.3); outline: none; }
  .card:active { transform: scale(0.97); }
  .card .icon { font-size: 56px; line-height: 1; }
  .card h2 { font-size: 22px; font-weight: 800; letter-spacing: 0.04em; }
  .card.snake h2 { color: var(--snake); }
  .card.robot h2 { color: var(--robot); }
  .card.chess h2 { color: #a5b4fc; }
  .card.checkers h2 { color: #fbbf24; }
  .card.breakout h2 { color: #38bdf8; }
  .card.minesweeper h2 { color: #e879f9; }
  .card.connect4 h2 { color: #fb923c; }
  .card.chinese h2 { color: #2dd4bf; }
  .card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
  .card .stat { font-size: 13px; font-weight: 700; color: var(--text); opacity: 0.9; }
  .card .key {
    font-size: 12px;
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 2px 8px;
  }
  footer { color: var(--muted); font-size: 12px; text-align: center; }
  #settings {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 720px;
  }
  .toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--panel);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
  }
  .toggle input {
    width: 20px;
    height: 20px;
    accent-color: #fbbf24;
    cursor: pointer;
  }
  @media (pointer: coarse) { .card .key { display: none; } }
