  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: #0a0e1a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #fff;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
  }
  #game { display: block; width: 100vw; height: 100vh; }

  #hud {
    position: fixed; top: 0; left: 0; right: 0;
    padding: 14px 18px;
    padding-top: max(14px, env(safe-area-inset-top));
    display: flex; justify-content: space-between; align-items: center;
    pointer-events: none;
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    gap: 12px;
  }
  #hud > * { pointer-events: auto; }
  #score { font-weight: 600; font-size: 20px; }
  #timer {
    font-weight: 700;
    font-size: 22px;
    color: #ffd166;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7), 0 0 8px rgba(255,209,102,0.5);
    font-variant-numeric: tabular-nums;
  }
  #timer.warning { color: #ff6b6b; text-shadow: 0 1px 3px rgba(0,0,0,0.7), 0 0 8px rgba(255,80,80,0.7); animation: pulse 0.5s infinite; }
  @keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
  #lives { font-size: 20px; letter-spacing: 2px; transition: transform 0.2s; }
  #pauseBtn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 38px; height: 38px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
  }
  #pauseBtn:active { transform: scale(0.92); }

  .overlay {
    position: fixed; inset: 0;
    background: rgba(10,14,26,0.92);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    backdrop-filter: blur(6px);
    z-index: 10;
  }
  .overlay h1 {
    font-size: 40px; margin-bottom: 8px;
    background: linear-gradient(135deg, #4ecdc4, #ffd166);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .overlay h2 {
    font-size: 28px; margin-bottom: 24px;
    color: #fff;
  }
  .overlay p {
    font-size: 14px; opacity: 0.55; margin-bottom: 22px;
    max-width: 320px; line-height: 1.5;
  }

  .btn {
    padding: 14px 32px; font-size: 17px; font-weight: 600;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white; border: none; border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(78,205,196,0.4);
    margin: 6px;
    min-width: 200px;
  }
  .btn:active { transform: scale(0.96); }
  .btn.secondary {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: none;
  }

  .modes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 360px;
  }
  .mode-card {
    --accent: #4ecdc4;
    --accent-dim: rgba(78,205,196,0.18);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    width: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 3px solid var(--accent);
    border-radius: 16px;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
  }
  .mode-card:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, var(--accent-dim), rgba(255,255,255,0.04));
    border-color: var(--accent);
    box-shadow: 0 4px 18px var(--accent-dim);
  }
  .mode-card[data-mode="timeattack"] {
    --accent: #ffd166;
    --accent-dim: rgba(255,209,102,0.18);
  }
  .mode-card[data-mode="survival"] {
    --accent: #ff6b6b;
    --accent-dim: rgba(255,107,107,0.18);
  }

  .mode-icon {
    flex-shrink: 0;
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--accent-dim);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
  }
  .mode-icon svg {
    filter: drop-shadow(0 0 6px var(--accent));
  }
  .mode-info {
    flex: 1;
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
  }
  .mode-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
  }
  .mode-sub {
    font-size: 12.5px;
    opacity: 0.6;
    font-weight: 500;
    line-height: 1.2;
  }
  .mode-best-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    min-width: 36px;
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.3px;
  }
  .mode-best-badge.has-best {
    background: rgba(255,209,102,0.15);
    color: #ffd166;
    box-shadow: 0 0 0 1px rgba(255,209,102,0.2);
  }

  .results {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 24px;
    min-width: 240px;
  }
  .result-row {
    display: flex; justify-content: space-between;
    padding: 6px 0;
    font-size: 16px;
    gap: 20px;
  }
  .result-row .label { opacity: 0.6; }
  .result-row .value { font-weight: 600; color: #ffd166; }
  .result-row.big .value { font-size: 22px; }

  .hidden { display: none !important; }

  #damageFlash {
    position: fixed; inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(255,50,50,0.4) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
  }
  #damageFlash.show { opacity: 1; }

  #buffs {
    position: fixed;
    left: 14px;
    top: 60px;
    padding-top: calc(60px + env(safe-area-inset-top));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 4;
  }
  .buff {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    position: relative;
    overflow: hidden;
  }
  .buff .ring {
    position: absolute; inset: 0;
    pointer-events: none;
  }
  .buff .timer-text {
    position: absolute;
    bottom: 2px; right: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  }
