/* ====== Snake Neon Pro (mobile-perfect + circular D-pad) ====== */
.gh-snake{
  --panel: rgba(16,22,46,.6);
  --stroke: rgba(255,255,255,.08);
  --text: #e8ecff;
  --muted: #a9b7ff;
  --accent: #6c7cff;
  --accent2: #33e0ff;
  --success: #17d490;
  --danger: #ff557a;
  --radius: 16px;
  --glow: 0 10px 30px rgba(51,224,255,.25);
  --inner: inset 0 0 0 1px rgba(255,255,255,.05);
  --glass: blur(10px) saturate(120%);
  --speed: .16s;
  --pad: 12px; /* inner board inset */

  color: var(--text);
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  position: relative;
  overflow: hidden;
}

/* aurora backdrop */
.gh-snake .snk-aurora{
  position:absolute; inset:-20% -10% -20% -10%; z-index:0;
  background:
    radial-gradient(800px 600px at 20% 10%, rgba(108,124,255,.35), transparent 60%),
    radial-gradient(800px 600px at 80% 20%, rgba(51,224,255,.35), transparent 60%),
    radial-gradient(700px 700px at 50% 90%, rgba(255,183,3,.20), transparent 65%),
    linear-gradient(180deg,#070c1b 0%, #060912 100%);
  pointer-events:none;
}

/* shell */
.gh-snake .snk-shell{
  position:relative; z-index:1;
  width:min(1100px,100vw); margin:32px auto 46px;
  background:var(--panel); backdrop-filter:var(--glass);
  border:1px solid var(--stroke); border-radius:var(--radius);
  box-shadow:var(--glow), var(--inner);
  padding:clamp(12px,2.5vw,18px);
  box-sizing:border-box;
}

/* header/titlebar with back pill */
.gh-snake .snk-header{ display:grid; grid-template-columns:1fr auto; gap:14px; align-items:center; }
.gh-snake .snk-titlebar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.gh-snake .snk-title{
  margin:0; font-size:34px; font-weight:900;
  background:linear-gradient(90deg,var(--accent),var(--accent2)); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.gh-snake .snk-home{
  display:inline-flex; align-items:center; gap:8px; text-decoration:none; font-weight:900;
  padding:10px 14px; min-height:44px; border-radius:999px; color:#0a0e21;
  background:linear-gradient(90deg,#ffe87c,#7affd9);
  box-shadow:0 10px 28px rgba(122,255,217,.25);
  border:1px solid rgba(255,255,255,.18);
  white-space:nowrap; transform:translateZ(0);
  transition:transform .12s ease, filter .18s ease, box-shadow .18s ease;
}
.gh-snake .snk-home .txt{ display:none; }
.gh-snake .snk-home .ico{ width:20px; height:20px; flex:0 0 20px; transition:transform .18s ease; }
@media (hover:hover){
  .gh-snake .snk-home:hover{ transform:translateY(-1px); filter:brightness(1.05); box-shadow:0 12px 32px rgba(122,255,217,.34); }
  .gh-snake .snk-home:hover .ico{ transform:translateX(3px); }
}
.gh-snake .snk-home:focus-visible{
  outline:none;
  box-shadow:0 0 0 2px rgba(255,255,255,.65), 0 0 0 6px rgba(51,224,255,.35), 0 10px 28px rgba(122,255,217,.25);
}
@media (min-width:680px){ .gh-snake .snk-home .txt{ display:inline; } }

/* meters */
.gh-snake .snk-meters{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.gh-snake .snk-meter{
  background:rgba(255,255,255,.06); border:1px solid var(--stroke);
  border-radius:12px; padding:8px 12px; min-width:90px; text-align:center; box-shadow:var(--inner);
}
.gh-snake .snk-meter .label{ display:block; color:var(--muted); font-size:12px; }
.gh-snake .snk-meter .value{ display:block; font-size:18px; font-weight:900; color:#fff; }

/* controls + selects */
.gh-snake .snk-controls{ display:grid; grid-template-columns:1fr auto; gap:12px; align-items:center; margin:16px 0 18px; }
.gh-snake .snk-selects{ display:flex; gap:10px; flex-wrap:wrap; }
.gh-snake .snk-field{ display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:13px; }
.gh-snake .select-wrap{ position:relative; }
.gh-snake .select-wrap .chev{ position:absolute; right:12px; top:50%; transform:translateY(-50%); font-size:12px; color:var(--muted); pointer-events:none; }
.gh-snake select{
  appearance:none; width:190px; color-scheme: dark;
  background:rgba(255,255,255,.06); border:1px solid var(--stroke); border-radius:12px;
  color:#fff; padding:10px 34px 10px 12px; outline:none; box-shadow:var(--inner);
}
.gh-snake select option,.gh-snake select optgroup{ background-color:#0e1537; color:#fff; }

.gh-snake .snk-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.gh-snake .snk-btn{
  background:linear-gradient(90deg,var(--accent),var(--accent2));
  color:#0a0e21; border:none; border-radius:12px; padding:10px 16px; font-weight:900; letter-spacing:.2px; cursor:pointer;
  box-shadow:var(--glow); transition:transform .08s ease, filter var(--speed);
}
.gh-snake .snk-btn:hover,.gh-snake .snk-btn:focus{ transform:translateY(-1px); filter:brightness(1.06); }
.gh-snake .snk-btn.ghost{ background:transparent; color:#fff; border:1px solid rgba(255,255,255,.16); }

/* sound */
.gh-snake .snk-sound{
  width:42px; height:42px; border-radius:12px; border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.06); color:#fff; cursor:pointer; outline:none;
  display:grid; place-items:center; box-shadow:var(--inner); transition:filter .16s, transform .08s;
}
.gh-snake .snk-sound:hover{ transform:translateY(-1px); filter:brightness(1.1); }
.gh-snake .snk-sound .ico{ width:22px; height:22px; display:block; }
.gh-snake .snk-sound .off{ display:none; }
.gh-snake .snk-sound.is-muted{ color:#d2dae9; border-color:rgba(255,255,255,.12); }
.gh-snake .snk-sound.is-muted .on{ display:none; }
.gh-snake .snk-sound.is-muted .off{ display:block; }

/* stage & board */
.gh-snake .snk-stage{ position:relative; border-radius:var(--radius); padding:14px 10px; }
.gh-snake .snk-board{
  position:relative; width:min(560px, 100%); aspect-ratio:1/1; height:auto; margin:0 auto; box-sizing:border-box;
  touch-action:none; overscroll-behavior:contain;
}
.gh-snake .snk-canvas{
  position:absolute; inset:var(--pad);
  width:calc(100% - var(--pad)*2);
  height:calc(100% - var(--pad)*2);
  border-radius:18px;
  z-index:1;
}
.gh-snake .snk-confetti{
  position:absolute; inset:var(--pad); pointer-events:none; z-index:2;
  width:calc(100% - var(--pad)*2); height:calc(100% - var(--pad)*2);
  border-radius:18px;
}

/* neon frame around board */
.gh-snake .snk-stage::before{
  content:""; position:absolute; left:50%; transform:translateX(-50%);
  width:min(560px, 100%); aspect-ratio:1/1; top:10px;
  border-radius:22px; background:linear-gradient(90deg,var(--accent),var(--accent2));
  filter:blur(22px); opacity:.28; z-index:0; pointer-events:none;
}
.gh-snake .snk-stage::after{
  content:""; position:absolute; left:50%; transform:translateX(-50%);
  width:min(560px, 100%); aspect-ratio:1/1; top:10px;
  border-radius:18px; box-shadow:0 0 0 1px rgba(255,255,255,.12), inset 0 0 28px rgba(0,0,0,.28);
  z-index:0; pointer-events:none;
}

/* overlay pinned to board area */
.gh-snake .snk-overlay{
  position:absolute; left:50%; transform:translateX(-50%);
  width:min(560px, 100%); aspect-ratio:1/1; top:10px;
  display:grid; place-items:center; z-index:4; background:rgba(5,10,22,.55); border-radius:18px;
}
.gh-snake .snk-card{
  width:min(460px,92vw); background:rgba(19,26,56,.85); border:1px solid var(--stroke); border-radius:18px;
  backdrop-filter:var(--glass); box-shadow:var(--glow), var(--inner); padding:16px 16px 18px; text-align:center;
}
.gh-snake .snk-card-title{
  margin:0 0 8px; font-size:26px; font-weight:900;
  background:linear-gradient(90deg,var(--accent),var(--accent2)); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.gh-snake .snk-summary{ color:var(--muted); display:grid; gap:6px; margin:10px 0 14px; }
.gh-snake .snk-card-actions{ display:flex; justify-content:center; gap:10px; }

/* ===== Circular D-pad (below board) — same-size arrows & working taps ===== */
.gh-snake .snk-dpad-wrap{
  margin-top:14px;
  display:none; /* JS toggles */
  justify-content:center;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.gh-snake .snk-dpad-wrap.show{ display:flex; }

.gh-snake .snk-dpad{
  position:relative;
  width:min(320px, 86vw);
  aspect-ratio:1/1;
  border-radius:50%;
  display:grid; place-items:center;
  background:radial-gradient(80% 80% at 50% 50%, rgba(255,255,255,.06), rgba(0,0,0,.25));
  border:1px solid rgba(255,255,255,.12);
  box-shadow:var(--inner), 0 10px 24px rgba(0,0,0,.25), 0 0 40px rgba(51,224,255,.18);
  overflow:hidden;
  transition:opacity .25s ease;
}
.gh-snake .snk-dpad.idle{ opacity:.65; }

.gh-snake .snk-dpad::before{
  content:""; position:absolute; inset:-6px; border-radius:50%;
  background:conic-gradient(from 0deg, var(--accent), var(--accent2), var(--accent), var(--accent2));
  filter:blur(24px); opacity:.25; z-index:-1;
}

/* Full-circle wrapper so left/right size equals up/down */
.gh-snake .snk-dpad .mid{
  position:absolute;
  inset:0;                      /* full D-pad */
  display:grid; place-items:center;
  pointer-events:auto;          /* <— allow taps to reach children */
}

/* Center dot should not intercept taps */
.gh-snake .snk-dpad .dot{
  width:46%;
  aspect-ratio:1/1;
  border-radius:50%;
  background:linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.25));
  border:1px solid rgba(255,255,255,.14);
  box-shadow:var(--inner);
  pointer-events:none;          /* <— ignore touches */
}

/* All four arrows share the same style & size */
.gh-snake .snk-dpad .d{
  position:absolute; display:grid; place-items:center; font-weight:900;
  width:34%; aspect-ratio:1/1;           /* same area for all */
  border-radius:16px;
  background:rgba(255,255,255,.08); color:#fff; border:1px solid rgba(255,255,255,.16);
  box-shadow:var(--inner);
  transition:transform .08s ease, filter .16s ease, background .16s ease;
  touch-action:none; -webkit-tap-highlight-color: transparent;
  z-index:1;                         /* above the dot */
  pointer-events:auto;               /* <— explicitly clickable */
}
.gh-snake .snk-dpad .d:active{ transform:scale(.96); filter:brightness(1.12); }

/* Positions — apply against full circle */
.gh-snake .snk-dpad .up{    top:6%;    left:50%; transform:translate(-50%,0); }
.gh-snake .snk-dpad .down{  bottom:6%; left:50%; transform:translate(-50%,0); }
.gh-snake .snk-dpad .left{  left:6%;   top:50%;  transform:translate(0,-50%); }
.gh-snake .snk-dpad .right{ right:6%;  top:50%;  transform:translate(0,-50%); }

/* how-to */
.gh-snake .snk-howto{ margin-top:14px; background:rgba(255,255,255,.06); border:1px solid var(--stroke); border-radius:12px; padding:10px 12px; }
.gh-snake .snk-inline-toggle{ background:transparent; color:var(--accent2); font-weight:900; border:none; cursor:pointer; }
.gh-snake .snk-howto-content{ display:none; color:var(--muted); margin-top:6px; }

/* responsive tweaks */
@media (max-width:900px){ .gh-snake .snk-header{ grid-template-columns:1fr; } .gh-snake .snk-meters{ justify-content:space-between; } }
@media (max-width:680px){
  .gh-snake .snk-controls{ grid-template-columns:1fr; }
  .gh-snake select{ width:100%; }
  .gh-snake .snk-actions{ justify-content:stretch; }
  .gh-snake .snk-actions .snk-btn{ flex:1; }
}
@media (max-width:480px){ .gh-snake{ --pad: 10px; } }
@media (max-width:360px){ .gh-snake{ --pad: 8px; } }
