:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(13, 27, 39, 0.82);
  --line: rgba(163, 197, 219, 0.16);
  --text: #f4f7f9;
  --muted: #9aafbf;
  --cyan: #48d6d2;
  --gold: #e8b45b;
  --board: #d6a24f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(72, 214, 210, .12), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(232, 180, 91, .11), transparent 32rem),
    var(--bg);
}

.app-shell { width: min(1280px, 96vw); margin: 0 auto; padding: 32px 0 42px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .22em; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 58px); letter-spacing: -.04em; }
.subtitle { margin: 10px 0 0; color: var(--muted); }
.home-link { color: var(--text); text-decoration: none; border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.025); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.board-panel, .control-panel > div, .actions { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.board-panel { padding: clamp(10px, 2vw, 20px); border-radius: 24px; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; }
#board { display: block; width: 100%; height: 100%; border-radius: 15px; cursor: crosshair; touch-action: manipulation; }
.thinking { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(4, 12, 18, .48); backdrop-filter: blur(3px); border-radius: 15px; font-weight: 700; }
.thinking.hidden { display: none; }
.thinking span { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(72,214,210,.7); animation: ping 1.2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 12px rgba(72,214,210,0); } 100% { box-shadow: 0 0 0 0 rgba(72,214,210,0); } }

.control-panel { display: grid; gap: 14px; }
.control-panel > div, .actions { border-radius: 18px; padding: 18px; }
.engine-row { display: flex; align-items: center; gap: 9px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #5ce39c; box-shadow: 0 0 16px #5ce39c; }
.engine-card p, .status-card span, .move-card span { color: var(--muted); font-size: 13px; }
.engine-card p { margin: 8px 0 0; }
.status-card { display: grid; gap: 6px; }
.status-card strong { font-size: 23px; }
.label { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.actions { display: grid; gap: 9px; }
button { border: 0; border-radius: 12px; padding: 13px 14px; font: inherit; font-weight: 750; cursor: pointer; transition: transform .16s, opacity .16s; }
button:hover:not(:disabled) { transform: translateY(-2px); }
button:disabled { opacity: .38; cursor: not-allowed; }
.primary { background: linear-gradient(135deg, #4bd8d4, #27a9c4); color: #031418; }
.secondary { background: linear-gradient(135deg, #f3cd7e, #d99a37); color: #211300; }
.ghost { color: var(--text); background: rgba(255,255,255,.055); border: 1px solid var(--line); }
.legend { display: grid; gap: 10px; }
.legend > div { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.stone { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.stone.black { background: radial-gradient(circle at 32% 28%, #5e6670, #050708 62%); }
.stone.white { background: radial-gradient(circle at 32% 28%, #fff, #cfd5da 65%); }
.move-card { display: grid; gap: 7px; }
.move-card div { font-size: 19px; font-weight: 750; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .control-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { grid-column: span 2; grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .app-shell { width: 100%; padding: 18px 12px 28px; }
  .hero { align-items: flex-start; }
  .home-link { font-size: 13px; }
  .control-panel { grid-template-columns: 1fr; }
  .actions { grid-column: auto; grid-template-columns: 1fr; }
}

