:root{
  --bg0:#050711; --bg1:#0A0F23;
  --card:rgba(14,20,42,.78);
  --text:#EAF0FF; --muted:#A9B6DF;
  --accent:#7C5CFF; --accent2:#22C55E;
  --danger:#EF4444;
  --border:1px solid rgba(255,255,255,.10);
  --shadow:0 18px 60px rgba(0,0,0,.55);
  --r:18px; --r2:24px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(900px 600px at 18% 8%, rgba(124,92,255,.25), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(34,197,94,.15), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow:hidden;
}
.app{height:100%; display:flex; flex-direction:column}
.topbar{
  padding:14px 14px 12px;
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  background: rgba(5,7,17,.72);
  backdrop-filter: blur(12px);
  border-bottom: var(--border);
  position:sticky; top:0; z-index:30;
}
.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:44px; height:44px; border-radius:14px;
  display:grid; place-items:center;
  border: var(--border);
  background: linear-gradient(135deg, rgba(124,92,255,.40), rgba(34,197,94,.22));
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}
.title{font-weight:900}
.title .v{font-size:12px; opacity:.75; margin-left:6px; padding:3px 8px; border:var(--border); border-radius:999px; background:rgba(255,255,255,.05)}
.subtitle{font-size:12px; color:var(--muted)}
.hud{display:flex; gap:10px; flex-wrap:wrap; justify-content:center}
.pill{
  border: var(--border);
  background: rgba(14,20,42,.60);
  padding:10px 12px;
  border-radius:999px;
  display:flex; gap:8px; align-items:center;
  font-weight:900;
}
.pill.ghost{background: rgba(14,20,42,.35)}
.actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.btn{
  border: var(--border);
  background: rgba(14,20,42,.55);
  color: var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  transition: transform .08s ease, background .2s ease, opacity .2s;
  user-select:none;
}
.btn:hover{transform: translateY(-1px); background: rgba(14,20,42,.80)}
.btn:active{transform: translateY(0)}
.btn.primary{
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(124,92,255,.55));
  border-color: rgba(124,92,255,.65);
}
.btn.ghost{background: rgba(14,20,42,.30)}
.btn.danger{background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35)}
.btn.danger:hover{background: rgba(239,68,68,.18)}
.btn[disabled]{opacity:.55; cursor:not-allowed; transform:none !important}

.main{flex:1; display:flex; padding:12px}
.game-wrap{
  width:100%;
  display:grid;
  grid-template-columns: minmax(0,1fr) 360px;
  gap:12px;
}
canvas{
  width:100%; height:100%;
  background: rgba(10,15,35,.35);
  border: var(--border);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  touch-action:none;
}
.right-panel{
  background: var(--card);
  border: var(--border);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding:12px;
  overflow:auto;
}
.panel-section + .panel-section{margin-top:12px}
.panel-title{font-weight:900; margin:0 0 10px}
.shop{display:grid; gap:10px}
.shop-card{
  border: var(--border);
  background: rgba(10,15,35,.45);
  border-radius: var(--r);
  padding:12px;
  cursor:pointer;
  transition: transform .08s ease, background .2s ease;
}
.shop-card:hover{transform: translateY(-1px); background: rgba(10,15,35,.70)}
.shop-card.selected{outline: 2px solid rgba(124,92,255,.75)}
.shop-card .top{display:flex; justify-content:space-between; gap:10px; align-items:center}
.shop-card .name{font-weight:900}
.shop-card .cost{color: var(--accent2); font-weight:900}
.shop-card .desc{color:var(--muted); font-size:12px; margin-top:6px; line-height:1.4}
.tag{
  display:inline-flex; gap:6px; align-items:center;
  padding:6px 10px; border-radius:999px;
  border: var(--border);
  background: rgba(124,92,255,.12);
  font-size:12px;
  width:fit-content;
}
.tag.green{background: rgba(34,197,94,.12)}
.tag.warn{background: rgba(245,158,11,.12)}
.tag.red{background: rgba(239,68,68,.12)}
.info{font-size:13px; line-height:1.5}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.upgrades{display:grid; gap:10px}
.upgrade{
  border: var(--border);
  background: rgba(10,15,35,.45);
  border-radius: var(--r);
  padding:12px;
}
.upgrade .u-top{display:flex; justify-content:space-between; gap:10px; align-items:center}
.upgrade .u-name{font-weight:900}
.upgrade .u-cost{color: var(--accent2); font-weight:900}
.upgrade .u-desc{color: var(--muted); font-size:12px; margin-top:6px; line-height:1.4}
.small{font-size:12px}
.muted{color:var(--muted)}
.select{
  border: var(--border);
  background: rgba(10,15,35,.55);
  color: var(--text);
  border-radius: 12px;
  padding:8px 10px;
  outline:none;
}
.abilities{display:grid; gap:10px}
.ability{
  border: var(--border);
  background: rgba(10,15,35,.45);
  border-radius: var(--r);
  padding:10px 12px;
}
.ability .a-top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.ability .a-name{font-weight:900}
.ability .a-cd{font-size:12px; color:var(--muted)}
.bar{height:10px; border-radius:999px; border: var(--border); background: rgba(255,255,255,.04); overflow:hidden; margin-top:8px}
.bar > div{height:100%; width:0%; background: linear-gradient(90deg, rgba(34,197,94,.85), rgba(124,92,255,.85));}
.overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:grid; place-items:center;
  padding:18px;
  z-index:100;
}
.hidden{display:none !important}
.modal{
  width: min(980px, 100%);
  background: rgba(14,20,42,.92);
  border: var(--border);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding:16px;
}
.modal-head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.maps-grid{display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px; margin-top:12px}
.map-card{
  border: var(--border);
  border-radius: var(--r2);
  background: rgba(10,15,35,.45);
  padding:12px;
  cursor:pointer;
  transition: transform .08s ease, background .2s ease;
}
.map-card:hover{transform: translateY(-1px); background: rgba(10,15,35,.70)}
.map-card .m-title{font-weight:900}
.map-card .m-desc{color: var(--muted); font-size:12px; margin-top:4px}
.map-preview{
  width:100%; height:180px;
  border-radius: 16px;
  border: var(--border);
  background: rgba(5,7,17,.55);
  margin-top:10px;
}
.toast{
  position:fixed; left:50%; bottom:18px;
  transform: translateX(-50%);
  padding:10px 14px;
  border-radius:999px;
  border: var(--border);
  background: rgba(0,0,0,.65);
  box-shadow: var(--shadow);
  z-index:120;
}
.mobile-hint{
  position:fixed; right:12px; bottom:12px;
  color: rgba(255,255,255,.35);
  font-size:12px;
  pointer-events:none;
}
@media (max-width: 980px){
  body{overflow:auto}
  .main{padding:12px 12px 18px}
  .game-wrap{grid-template-columns: 1fr; grid-template-rows: 56vh auto}
  canvas{height:56vh}
  .right-panel{max-height: 46vh}
}
