:root{
  --bg:#081022;
  --panel:#0f1730;
  --card:#111b38;
  --text:#e8ecff;
  --muted:#a8b1d8;
  --border:rgba(255,255,255,.08);
  --accent:#7c5cff;
  --accent2:#2dd4bf;
  --shadow:0 12px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC","Microsoft YaHei", Arial, sans-serif;
  background: radial-gradient(1000px 600px at 30% 0%, rgba(124,92,255,.22), transparent 55%),
              radial-gradient(900px 500px at 85% 20%, rgba(45,212,191,.16), transparent 60%),
              var(--bg);
  color:var(--text);
}

.app{max-width:1100px;margin:0 auto;padding:22px 18px 28px}

.header{
  display:flex;align-items:flex-end;justify-content:space-between;gap:16px;
  padding:14px 16px;border:1px solid var(--border);border-radius:16px;background:rgba(15,23,48,.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.h1{font-size:22px;font-weight:800;letter-spacing:.5px}
.sub{font-size:12px;color:var(--muted);margin-top:6px}

.actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.btn{
  appearance:none;border:1px solid var(--border);background:rgba(255,255,255,.05);
  color:var(--text);padding:10px 12px;border-radius:12px;cursor:pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
  user-select:none;
}
.btn:hover{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.14)}
.btn:active{transform:translateY(1px)}
.btn.primary{
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(45,212,191,.85));
  border-color: transparent;
}

.main{
  display:grid;
  grid-template-columns: 240px 1fr 240px;
  gap:18px;
  margin-top:18px;
  align-items:start;
}

.side{display:flex;flex-direction:column;gap:14px}
.card{
  border:1px solid var(--border);
  background:rgba(17,27,56,.62);
  border-radius:16px;
  box-shadow: var(--shadow);
  padding:12px 12px 14px;
  backdrop-filter: blur(10px);
}
.cardTitle{font-size:12px;color:var(--muted);margin:2px 2px 10px}

.stats{display:flex;flex-direction:column;gap:10px}
.stat{display:flex;justify-content:space-between;align-items:baseline;padding:10px 10px;border-radius:12px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.06)}
.stat .k{font-size:12px;color:var(--muted)}
.stat .v{font-size:18px;font-weight:800}

.boardWrap{
  position:relative;
  border-radius:18px;
  border:1px solid var(--border);
  background: rgba(15,23,48,.55);
  box-shadow: var(--shadow);
  padding:14px;
  display:flex;
  justify-content:center;
}

canvas{
  display:block;
  border-radius:14px;
  background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.55));
  border:1px solid rgba(255,255,255,.08)
}

.overlay{
  position:absolute;inset:14px;
  display:flex;align-items:center;justify-content:center;
  border-radius:14px;
  background: rgba(0,0,0,.48);
  border:1px solid rgba(255,255,255,.08);
}
.overlay.hidden{display:none}
.overlayCard{
  padding:18px 18px 16px;
  background: rgba(17,27,56,.75);
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  max-width: 380px;
  text-align:center;
}
.overlayTitle{font-weight:900;font-size:18px}
.overlayHint{margin-top:8px;color:var(--muted);font-size:12px;line-height:1.4}

.controls{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  align-items:stretch;
}
.ctl{padding:12px}
.ctl.wide{grid-column: span 3}

.rules{margin:0;padding-left:18px;color:var(--muted);font-size:12px;line-height:1.7}
.link{
  display:inline-block;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  color:var(--text);
  text-decoration:none;
  background:rgba(255,255,255,.05);
}
.link:hover{background:rgba(255,255,255,.08)}

.footer{margin-top:14px;color:rgba(232,236,255,.7);font-size:12px;padding:0 4px}

@media (max-width: 980px){
  .main{grid-template-columns: 1fr;}
  .side{flex-direction:row;flex-wrap:wrap}
  .side .card{flex:1 1 240px}
  .boardWrap{order:-1}
  .actions{justify-content:flex-start}
}

