:root{
    --bg: #0f1220;
    --panel: #171b2e;
    --text: #e7e9f3;
    --muted: #9aa3b2;
    --accent: #7c5cff;
    --snake: #14dc7b;
    --food: #ff6b6b;
    --grid: rgba(255,255,255,0.05);
  }
  
  *{ box-sizing: border-box; }
  
  body{
    margin:0;
    min-height:100vh;
    display:grid;
    place-items:center;
    background:
      radial-gradient(1000px 600px at 70% -10%, #1c2150, transparent),
      radial-gradient(1000px 600px at 10% 110%, #1a3a2b, transparent),
      var(--bg);
    color:var(--text);
    font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  }
  
  .wrap{
    width:min(92vw, 520px);
    display:flex;
    flex-direction:column;
    gap:12px;
  }
  
  .hud{
    display:flex;
    align-items:center;
    justify-content:space-between;
    background:var(--panel);
    border:1px solid rgba(255,255,255,0.06);
    padding:10px 12px;
    border-radius:14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  }
  
  .hud .left{
    display:flex;
    gap:14px;
    align-items:center;
    font-weight:600;
  }
  
  .badge{
    background: rgba(124,92,255,0.15);
    border:1px solid rgba(124,92,255,0.35);
    color: #cfc6ff;
    padding:4px 8px;
    border-radius:999px;
    font-size:13px;
    letter-spacing:0.2px;
  }
  
  .btns{
    display:flex;
    gap:8px;
  }
  
  button{
    appearance:none;
    border:1px solid rgba(255,255,255,0.08);
    background: #10142b;
    color:var(--text);
    padding:7px 10px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    transition: transform .05s ease, background .2s ease, border-color .2s ease;
  }
  button:hover{
    background:#141a3a;
    border-color: rgba(255,255,255,0.18);
  }
  button:active{ transform: translateY(1px); }
  button.primary{
    background: var(--accent);
    border-color: transparent;
    color:white;
  }
  
  canvas{
    width:100%;
    aspect-ratio: 1 / 1;
    background:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px),
      #0c0f1d;
    background-size: 20px 20px;
    border-radius:18px;
    border:1px solid rgba(255,255,255,0.06);
    box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  }
  
  .help{
    text-align:center;
    color:var(--muted);
    font-size:14px;
  }
  
  .overlay{
    position:fixed;
    inset:0;
    display:grid;
    place-items:center;
    background: rgba(9,11,20,0.6);
    backdrop-filter: blur(4px);
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
  }
  .overlay.show{
    opacity:1;
    pointer-events:auto;
  }
  
  .card{
    width:min(90vw, 420px);
    background:var(--panel);
    border:1px solid rgba(255,255,255,0.08);
    border-radius:16px;
    padding:18px;
    text-align:center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  }
  .card h1{
    margin:0 0 6px;
    font-size:28px;
    letter-spacing:0.3px;
  }
  .card p{
    margin:6px 0 12px;
    color:var(--muted);
  }
  .card .row{
    display:flex;
    gap:8px;
    justify-content:center;
    flex-wrap:wrap;
  }
  #playerNameInput {
    background: #0f1220;
    color: white;
    outline: none;
    border: 1px solid rgba(255,255,255,0.15);
  }
  #playerNameInput:focus {
    border-color: var(--accent);
  }
    