:root {
  --bg: #1b1e24;
  --panel: #23272f;
  --text: #e8e6e3;
  --muted: #9aa0a8;
  --accent: #4f8a5b;
  --accent-hover: #5d9d6a;
  --border: #333a45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
}

.tagline {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.board-wrap {
  flex: 1 1 520px;
  min-width: 300px;
}

.sidebar {
  flex: 1 1 260px;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.status {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.status.check {
  color: #e8a33d;
}

.status.end {
  color: #4f8a5b;
}

.controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.controls button {
  flex: 1;
  padding: 0.55rem 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--accent);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.controls button:hover {
  background: var(--accent-hover);
}

.history h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.move-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.15rem 0.5rem;
  font-variant-numeric: tabular-nums;
}

.move-list li {
  display: contents;
}

.move-list .num {
  color: var(--muted);
}

.move-list .ply {
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}

.move-list .ply.current {
  background: var(--accent);
  color: #fff;
}

.history-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 760px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
}
