:root {
  --cell-size: 32px;
  --bg: #0f1220;
  --panel: #171a2b;
  --ink: #e9ecf1;
  --muted: #9aa3b2;
  --accent: #7bd88f;
  --warn: #ffb86b;
  --danger: #ff6b7a;
  --wall: #394066;
  --floor: #22263b;
  --target: #275a72;
  --box: #d9a441;
  --boxOn: #7bd88f;
  --player: #7aa2ff;
  --gap: 8px;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: radial-gradient(1200px 800px at 70% -10%, #1a1e34 0%, #0f1220 60%, #0d1020 100%);
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft Yahei", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 顶部状态栏 */
.top-bar {
  width: min(980px, 96vw);
  background: color-mix(in oklab, var(--panel) 88%, black 12%);
  border: 1px solid #22263b;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: var(--gap);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.04);
}

.stat { color: var(--muted); font-weight: 600; }
.stat b { color: var(--ink); }

/* 棋盘容器 */
.wrap {
  width: min(980px, 96vw);
  margin-top: var(--gap);
  display: grid;
  justify-items: center;
  align-items: center;
}

#board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 10), var(--cell-size));
  grid-auto-rows: var(--cell-size);
  gap: 2px;
  background: #14182a;
  padding: 8px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid #232746;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 10px 30px rgba(0,0,0,.35);
  touch-action: none;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 6px;
  display: grid;
  place-items: center;
  user-select: none;
}

.wall { background: linear-gradient(160deg, #2e3458, var(--wall)); box-shadow: inset 0 2px 0 rgba(255,255,255,.03); }
.floor { background: linear-gradient(180deg, #1b2038, var(--floor)); }
.target {
  background:
    radial-gradient(closest-side, #2fa8cc 30%, transparent 31%),
    linear-gradient(180deg, #1b2038, var(--target));
}
.box {
  background:
    radial-gradient(120% 120% at 20% 20%, rgba(255,255,255,.15), transparent 40%),
    linear-gradient(160deg, #e5bd6b, var(--box));
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.3);
}
.box.on { outline: 2px solid var(--boxOn); }
.player::after {
  content: "";
  width: 62%; height: 62%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #cfe1ff, var(--player));
  box-shadow: 0 3px 10px rgba(122,162,255,.35), inset 0 -3px 6px rgba(0,0,0,.25);
}
.player.on::after { outline: 2px solid var(--accent); }

/* 底部按钮栏 */
.bottom-bar {
  width: min(980px, 96vw);
  background: color-mix(in oklab, var(--panel) 88%, black 12%);
  border: 1px solid #22263b;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: var(--gap) 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

button, select {
  background: #1a1f39;
  color: var(--ink);
  border: 1px solid #2a2f4f;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, background .2s ease;
}
button:hover { background: #1f2544; }
button:active { transform: translateY(1px); }
button.primary { background: #23305a; border-color: #2f3d6e; }
button.good { background: #1c3a2a; border-color: #27593d; color: #c6f6d5; }
button.warn { background: #3a2a1c; border-color: #5a3d27; color: #ffe0bf; }

select { padding-right: 28px; }

/* 提示气泡 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.toast.show { opacity: 1; }

/* 移动端优化 */
@media (max-width: 520px) {
  .top-bar { flex-direction: row; gap: 10px; font-size: 14px; }
  .bottom-bar { flex-direction: row; gap: 6px; }
  button, select { font-size: 14px; padding: 6px 10px; }
}
