:root{ 
  --bg:#0a0a12;
  --panel:#10111a;
  --panel-2:#0e0f17;
  --text:#e8e8ff;
  --muted:#9aa0b3;
  --accent:#8b5cf6; /* purple */
  --accent-2:#22d3ee; /* cyan */
  --danger:#f43f5e;
  --glow: 0 0 24px rgba(139,92,246,.35), 0 0 48px rgba(34,211,238,.15);
}
*{box-sizing:border-box}
html,body{height:75%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(139,92,246,.15), transparent 60%),
    radial-gradient(1000px 500px at 110% 20%, rgba(34,211,238,.12), transparent 60%),
    var(--bg);
}

/* Topbar */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 18px; border-bottom:1px solid #1b1c29; background:rgba(16,17,26,.6);
  backdrop-filter: blur(8px);
}
.brand{display:flex; align-items:center; gap:12px}
.brand h1{margin:0; font-size:20px; letter-spacing:.5px}
.logo-pulse{
  width:18px; height:18px; border-radius:50%;
  background: radial-gradient(circle at 40% 40%, var(--accent), #5b35d6 60%, transparent 61%);
  box-shadow: var(--glow);
  animation:pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{transform:scale(1); box-shadow: 0 0 18px rgba(139,92,246,.55), 0 0 30px rgba(34,211,238,.2)}
  50%{transform:scale(1.08); box-shadow: 0 0 28px rgba(139,92,246,.75), 0 0 60px rgba(34,211,238,.35)}
}
.actions{display:flex; align-items:center; gap:10px}
.score{
  min-width:72px; text-align:center; padding:6px 10px; border-radius:8px;
  border:1px solid #1b1c29; background:linear-gradient(180deg, #121322, #0e0f17);
  box-shadow: inset 0 0 8px rgba(139,92,246,.08);
}
.btn{
  border:1px solid #2a2b3e; background:linear-gradient(180deg,#1a1b2b,#121322);
  color:var(--text); padding:8px 12px; border-radius:10px; cursor:pointer;
  box-shadow: var(--glow);
}
.btn:disabled{opacity:.5; cursor:not-allowed}
.btn-ghost{background:transparent}

/* Layout */
.layout{
  max-width:1100px; margin:20px auto; padding:0 14px;
  display:grid; gap:18px; grid-template-columns: 1fr 320px;
}
.game-card,.side-card{
  border:1px solid #1b1c29; background:linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius:14px; padding:14px; box-shadow: var(--glow);
}
.canvas-wrap{
  position:relative; width:100%; aspect-ratio:1/1; /* Square */
  background:
    linear-gradient(180deg, rgba(139,92,246,.06), rgba(34,211,238,.03)),
    radial-gradient(120% 120% at 50% 0%, rgba(139,92,246,.12), transparent 60%);
  border-radius:12px; overflow:hidden; border:1px solid #23243a;
}
#game{display:block; width:100%; height:100%}

/* D-Pad (mobile only) */
.dpad{
  position:absolute; left:12px; bottom:12px; display:grid; place-items:center;
  gap:8px; pointer-events:auto; user-select:none;
}
.dpad .row{display:flex; gap:8px}
.dpad button{
  width:54px; height:54px; border-radius:10px; border:1px solid #2a2b3e; color:var(--text);
  background:linear-gradient(180deg,#202133,#151627); font-size:18px; box-shadow: var(--glow);
}
@media (hover:hover){ .dpad{ display:none } }

.status{
  margin-top:10px; color:var(--muted); font-size:14px; min-height:20px;
}

.side-card h2{margin:4px 0 10px 0; font-size:18px}
.identity{display:grid; gap:10px; margin-bottom:8px}
.identity input{
  width:100%; padding:8px 10px; border-radius:10px; color:var(--text);
  border:1px solid #2a2b3e; background: #121322;
}
.checkbox{display:flex; gap:8px; align-items:center; color:#c9cde0; font-size:14px}

.board{margin:12px 0 0 16px; padding:0; display:grid; gap:6px}
.board { max-height: 360px; overflow:auto; padding-right:6px }
.board li{background:#131427; border:1px solid #262845; border-radius:10px; padding:8px 10px; list-style:decimal; box-shadow: var(--glow)}
.board .muted{list-style:none; color:var(--muted); background:transparent; border:none; box-shadow:none; padding:0; margin-left:-16px}

.note{margin-top:10px; font-size:12px; color:#b7fffb}
.note.warn{color:#ffd1d9}

.footer{max-width:1100px; margin:16px auto; padding:0 14px; color:var(--muted); font-size:12px}

/* Narrow: stack cols */
@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
}
