  :root {
    --bg: #0f0e0c;
    --surface: #1a1916;
    --surface2: #242320;
    --border: #2e2c28;
    --p1: #4af0a0;
    --p1-dim: #1a5c3d;
    --p2: #ff5f40;
    --p2-dim: #5c2218;
    --neutral: #7a7060;
    --text: #f0ece0;
    --text-muted: #6b6558;
    --grid-dot: #2a2820;
    --field-line: #3a3830;
    --accent: #f5d94e;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    overflow-x: hidden;
  }

  /* ── Layout ── */
  #root {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr;
  }

  /* ── Header ── */
  header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 3px;
    color: var(--text);
    line-height: 1;
  }
  header h1 span { color: var(--accent); }
  .header-ball {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 16px rgba(245,217,78,0.4);
    flex-shrink: 0;
  }
  .header-sep {
    flex: 1;
  }
  .header-tag {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  /* ── Sidebar ── */
  aside {
    grid-column: 1;
    border-right: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
  }

  .panel {
    padding: 20px;
    border-bottom: 1px solid var(--border);
  }
  .panel-label {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
  }

  /* Player cards */
  .player-card {
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
  }
  .player-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
  }
  .player-card.p1::before { background: var(--p1); }
  .player-card.p2::before { background: var(--p2); }
  .player-card.p1 { background: rgba(74,240,160,0.06); border-color: rgba(74,240,160,0.15); }
  .player-card.p2 { background: rgba(255,95,64,0.06); border-color: rgba(255,95,64,0.15); }
  .player-card.active.p1 { background: rgba(74,240,160,0.12); border-color: rgba(74,240,160,0.4); box-shadow: 0 0 20px rgba(74,240,160,0.1); }
  .player-card.active.p2 { background: rgba(255,95,64,0.12); border-color: rgba(255,95,64,0.4); box-shadow: 0 0 20px rgba(255,95,64,0.1); }
  .player-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 2px;
    margin-bottom: 4px;
  }
  .player-card.p1 .player-name { color: var(--p1); }
  .player-card.p2 .player-name { color: var(--p2); }
  .player-goal {
    font-size: 12px;
    color: var(--text-muted);
  }
  .active-badge {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    width: 8px; height: 8px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
  }
  .player-card.p1 .active-badge { background: var(--p1); box-shadow: 0 0 8px var(--p1); }
  .player-card.p2 .active-badge { background: var(--p2); box-shadow: 0 0 8px var(--p2); }
  .player-card.active .active-badge { opacity: 1; }

  /* Status */
  #status-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    min-height: 42px;
    color: var(--text);
  }
  #status-text .bounce-note {
    display: block;
    font-size: 12px;
    color: var(--accent);
    margin-top: 4px;
    font-family: 'DM Mono', monospace;
  }

  /* Settings */
  .setting-row {
    margin-bottom: 14px;
  }
  .setting-row label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-family: 'DM Mono', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .size-options {
    display: flex;
    gap: 6px;
  }
  .size-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    border-radius: 6px;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
  }
  .size-btn:hover { border-color: var(--neutral); color: var(--text); }
  .size-btn.active {
    border-color: var(--accent);
    background: rgba(245,217,78,0.1);
    color: var(--accent);
  }

  #new-game-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #0f0e0c;
    border: none;
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 4px;
  }
  #new-game-btn:hover { background: #f7e070; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(245,217,78,0.3); }
  #new-game-btn:active { transform: translateY(0); }

  /* Rules */
  .rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .rules-list li {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    padding-left: 14px;
    position: relative;
  }
  .rules-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--border);
  }
  .rules-list li strong { color: var(--text); font-weight: 500; }

  /* ── Canvas area ── */
  main {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
  }
  main::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 40% at 50% 0%, rgba(74,240,160,0.04) 0%, transparent 70%),
      radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255,95,64,0.04) 0%, transparent 70%);
    pointer-events: none;
  }

  #canvas-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  #game-canvas {
    cursor: crosshair;
    display: block;
    border-radius: 4px;
  }

  /* Win overlay */
  #win-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
  }
  #win-overlay.show { display: flex; }
  .win-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 56px;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  .win-emoji { font-size: 56px; margin-bottom: 12px; }
  .win-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 48px;
    letter-spacing: 4px;
    margin-bottom: 8px;
  }
  .win-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
  }
  .win-play-again {
    padding: 14px 40px;
    background: var(--accent);
    color: #0f0e0c;
    border: none;
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .win-play-again:hover { background: #f7e070; transform: translateY(-1px); }

  /* Responsive */
  @media (max-width: 700px) {
    #root { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
    aside { grid-column: 1; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; overflow-x: auto; }
    .panel { flex: 1 1 180px; border-bottom: none; border-right: 1px solid var(--border); }
    main { grid-column: 1; padding: 12px; }
  }