:root {
  color-scheme: dark;
  --bg: #101621;
  --panel: rgba(20, 30, 45, 0.88);
  --panel-strong: #1d2a3d;
  --text: #eef5ff;
  --muted: #9fb0c7;
  --accent: #70e1b4;
  --accent-strong: #24b47e;
  --warning: #ffcf6e;
  --danger: #ff6b7a;
  --light-square: #e6d6b8;
  --dark-square: #7a5338;
  --light-square-active: #f4e6bf;
  --dark-square-active: #936a45;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(112, 225, 180, 0.22), transparent 28rem),
    radial-gradient(circle at 90% 5%, rgba(111, 147, 255, 0.18), transparent 24rem),
    linear-gradient(135deg, #0d111a 0%, var(--bg) 48%, #151018 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.7rem, 8vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.04rem;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  line-height: 1.65;
}

.status-card,
.board-panel,
.side-panel,
.info-box {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-card {
  min-width: 230px;
  padding: 18px 20px;
  border-radius: 20px;
}

.status-card .label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.35;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 720px) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}

.board-panel,
.side-panel {
  border-radius: var(--radius);
}

.board-panel {
  padding: clamp(14px, 2.4vw, 24px);
}

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.control-button {
  cursor: pointer;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  color: #08120f;
  background: var(--accent);
  font-weight: 800;
  transition:
    transform 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.control-button:hover,
.control-button:focus-visible {
  background: #96f2ce;
  box-shadow: 0 0 0 4px rgba(112, 225, 180, 0.18);
  transform: translateY(-1px);
}

.control-button:active {
  transform: translateY(0);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(100%, 720px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 10px solid #26364b;
  border-radius: 20px;
  background: #26364b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  color: #1b2230;
  font-family: "Times New Roman", Georgia, serif;
  font-size: clamp(2rem, 7vw, 4.9rem);
  line-height: 1;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  transition:
    background 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.square.light {
  background: var(--light-square);
}

.square.dark {
  background: var(--dark-square);
}

.square.light:hover,
.square.light:focus-visible {
  background: var(--light-square-active);
}

.square.dark:hover,
.square.dark:focus-visible {
  background: var(--dark-square-active);
}

.square.black-piece {
  color: #10141d;
}

.square.white-piece {
  color: #fff7e6;
}

.square.selected {
  outline: 4px solid var(--accent);
  outline-offset: -4px;
  z-index: 2;
}

.square.legal::after {
  content: "";
  position: absolute;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(36, 180, 126, 0.68);
  box-shadow: 0 0 0 6px rgba(36, 180, 126, 0.18);
}

.square.capture::after {
  width: 72%;
  border: 5px solid rgba(255, 107, 122, 0.78);
  background: transparent;
}

.square.last-move {
  box-shadow: inset 0 0 0 999px rgba(255, 207, 110, 0.24);
}

.square.in-check {
  box-shadow: inset 0 0 0 999px rgba(255, 74, 99, 0.38);
}

.square .coord {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-family: var(--font-family, Inter, sans-serif);
  font-size: clamp(0.55rem, 1.6vw, 0.78rem);
  font-weight: 900;
  opacity: 0.55;
  text-shadow: none;
}

.side-panel {
  display: grid;
  gap: 16px;
  padding: clamp(14px, 2vw, 20px);
}

.info-box {
  padding: 18px;
  border-radius: 18px;
  box-shadow: none;
}

.info-box ol {
  margin: 0;
  padding-left: 1.3rem;
  color: var(--muted);
  line-height: 1.65;
}

.note {
  margin: 14px 0 0;
  color: var(--warning);
  font-size: 0.93rem;
  line-height: 1.55;
}

.captures {
  display: grid;
  gap: 14px;
}

.captures span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.captured-list {
  min-height: 32px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  letter-spacing: 0.1em;
}

.move-history {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 6px;
}

.move-history li {
  padding: 8px 10px;
  border-radius: 10px;
  color: #dce8f7;
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .hero,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .board {
    border-width: 6px;
    border-radius: 14px;
  }

  .board-toolbar {
    justify-content: stretch;
  }

  .control-button {
    flex: 1 1 130px;
  }

  .square .coord {
    display: none;
  }
}
