/* Chess table. Felt, a wood frame, and readable controls. */

:root {
  color-scheme: dark;
}

body.chess-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(232, 208, 160, 0.14), transparent 55%),
    linear-gradient(180deg, #1a4634 0%, #0e2a1e 48%, #081810 100%);
  color: #f6f1e7;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

.table {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.top h1 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.home {
  color: #f6f1e7;
  text-decoration: none;
  border-bottom: 1px solid #c4a574;
  padding-bottom: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.home:hover { color: #f3e6c8; }

.status {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #10281d;
  border-left: 6px solid #c4a574;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.45rem;
}
.status.check { border-left-color: #e2b340; color: #ffe7a3; }
.status.win { border-left-color: #7dcea0; color: #d8ffe8; }
.status.draw { border-left-color: #9bb0c9; color: #e4eef8; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.layout > * { min-width: 0; }

.board-frame {
  background: linear-gradient(145deg, #8a5a32, #4a2812 42%, #6b3f1d);
  padding: 16px;
  border: 1px solid #c4a574;
  box-shadow: 0 16px 0 #3d2110, 0 22px 40px rgba(0, 0, 0, 0.35);
}
#board {
  width: 100%;
  margin: 0;
}
#board img { max-width: none; }
#board .sq-selected { box-shadow: inset 0 0 0 4px #f3e6c8; }

.white-1e1d7 { background: #f3e6c8 !important; color: #5c3317 !important; }
.black-3c85d { background: #b58863 !important; color: #f3e6c8 !important; }

.side { display: grid; gap: 14px; }
label { font-weight: 650; }
select, .move-entry, button {
  font: inherit;
  color: #1a120c;
  background: #f3e6c8;
  border: 1px solid #1a120c;
  min-height: 44px;
  padding: 8px 12px;
}
select { width: 100%; }
.move-entry { width: 100%; box-sizing: border-box; }
button { cursor: pointer; font-weight: 700; }
button:hover, select:hover { background: #fff6df; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.controls button { width: 100%; margin: 0; }

.fen, .history, .engine {
  background: #10281d;
  border: 1px solid #2f6a4e;
  padding: 12px;
  color: #f6f1e7;
  text-align: left;
}
.fen { cursor: pointer; text-align: left; }
.fen small { display: block; letter-spacing: 0.08em; text-transform: uppercase; color: #c4a574; font-size: 0.75rem; }
#fenString {
  display: block;
  margin-top: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.fen.copied small { color: #b7f0cb; }
.engine { font-variant-numeric: tabular-nums; }
.history {
  max-height: 180px;
  overflow: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.92rem;
}
.history strong { font-family: "Source Sans 3", sans-serif; display: block; margin-bottom: 6px; }

.promo {
  margin-top: 8px;
  padding: 10px;
  background: #f3e6c8;
  color: #1a120c;
}
.promo p { margin: 0 0 8px; font-weight: 700; }
.promo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.promo button { min-width: 44px; }

:focus-visible { outline: 3px solid #f3e6c8; outline-offset: 2px; }

.chess-privacy {
  text-align: center;
  padding: 0 0 28px;
  font-size: 0.92rem;
}
.chess-privacy a {
  color: #f6f1e7;
  text-decoration: none;
  border-bottom: 1px solid #c4a574;
  padding-bottom: 2px;
}
.chess-privacy a:hover { color: #f3e6c8; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .table { width: min(100% - 16px, 920px); }
  .board-frame { box-shadow: 0 10px 0 #3d2110; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
