:root {
  --bg-1: #08101a;
  --bg-2: #132a43;
  --bg-3: #3b2038;
  --text: #eefaff;
  --muted: #acd7e8;
  --accent: #67f0ff;
  --accent-2: #ffb86c;
  --panel: rgba(8, 16, 27, 0.84);
  --border: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 13% 13%, rgba(103, 240, 255, 0.18), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(255, 184, 108, 0.14), transparent 24%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3));
}

.chess-shell {
  width: min(1150px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(2.2rem, 5.6vw, 4.4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.hero-copy {
  margin: 14px 0 0;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.board-panel,
.control-panel {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.38);
}

.board-panel {
  padding: 12px;
}

.chess-board {
  width: min(90vw, 640px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-radius: 0;
  overflow: hidden;
  border: 2px solid #1d1d1d;
}

.square {
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1 / 1;
  font-size: clamp(1.4rem, 4.6vw, 3.1rem);
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Color Emoji", sans-serif;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}

.square.light {
  background: #f0d9b5;
}

.square.dark {
  background: #b58863;
}

.square.piece-white {
  color: #ffffff;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.78),
    1px -1px 0 rgba(0, 0, 0, 0.78),
    -1px 1px 0 rgba(0, 0, 0, 0.78),
    1px 1px 0 rgba(0, 0, 0, 0.78);
}

.square.piece-black {
  color: #000000;
  text-shadow:
    -1px -1px 0 rgba(255, 255, 255, 0.72),
    1px -1px 0 rgba(255, 255, 255, 0.72),
    -1px 1px 0 rgba(255, 255, 255, 0.72),
    1px 1px 0 rgba(255, 255, 255, 0.72);
}

.square.selected {
  box-shadow: inset 0 0 0 4px rgba(103, 240, 255, 0.9);
}

.square.last-move {
  box-shadow: inset 0 0 0 4px rgba(255, 184, 108, 0.8);
}

.square.legal::after {
  content: "";
  width: 28%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: rgba(103, 240, 255, 0.75);
  position: absolute;
}

.square.legal.capture::after {
  width: 78%;
  aspect-ratio: 1 / 1;
  background: transparent;
  border: 4px solid rgba(255, 120, 120, 0.8);
  border-radius: 999px;
}

.control-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.panel-block label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

select,
button {
  font: inherit;
}

select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(8, 16, 28, 0.95);
}

.buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

button {
  border: 0;
  border-radius: 999px;
  padding: 9px 11px;
  font-weight: 700;
  cursor: pointer;
  color: #06101d;
  background: linear-gradient(135deg, var(--accent), #ddfcff);
}

button:hover {
  filter: brightness(1.05);
}

.label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.value {
  margin: 0;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.captured-row {
  margin: 0;
  min-height: 28px;
  font-size: 1.2rem;
  line-height: 1.4;
}

.fen-output {
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 18, 0.7);
  padding: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .chess-shell {
    width: min(100%, calc(100% - 14px));
    padding: 16px 0 20px;
  }

  .buttons {
    grid-template-columns: 1fr;
  }
}
