:root {
  --bg: #0d1210;
  --panel: #151d19;
  --panel2: #1b2620;
  --ink: #f2f4ed;
  --muted: #9aa79e;
  --line: #29362f;
  --accent: #d9f36b;
  --danger: #ef8f7b;
  --light: #e8e1cf;
  --dark: #65765d;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background:
    radial-gradient(circle at 80% -10%, #203428 0, transparent 35%), var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  min-height: 100vh;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  gap: 38px;
  position: sticky;
  top: 0;
  background: rgba(13, 18, 16, 0.92);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: 13px;
}
.brandmark {
  font-size: 27px;
  color: var(--accent);
}
nav {
  display: flex;
  gap: 6px;
  flex: 1;
}
button {
  font: inherit;
}
nav button,
.ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
}
.status-pill,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
}
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 58px 24px 80px;
}
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 50px;
  align-items: center;
  min-height: 500px;
}
.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
}
.hero h1 {
  font-size: clamp(48px, 7vw, 86px);
  line-height: 0.93;
  letter-spacing: -0.06em;
  margin: 15px 0 24px;
}
.hero h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
  color: var(--accent);
}
.lede {
  font-size: 18px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 650px;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}
.primary,
.secondary,
.smallbtn {
  border-radius: 10px;
  padding: 13px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 750;
}
.primary {
  background: var(--accent);
  color: #17200f;
}
.secondary,
.smallbtn {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
.smallbtn {
  padding: 9px 12px;
  font-size: 13px;
}
.hero-card,
.card,
.trainpanel {
  background: var(--panel);
  border: 1px solid var(--line);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 60px;
}
.stat {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.stat strong {
  font-size: 28px;
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.pagehead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.pagehead h1 {
  font-size: 48px;
  margin: 8px 0;
}
.pagehead p,
.muted {
  color: var(--muted);
}
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.search,
.select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 10px;
}
.search {
  min-width: 280px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.card {
  border-radius: 16px;
  padding: 20px;
}
.card h3 {
  margin: 8px 0;
}
.card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.moves,
.pgnbox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #101612;
  border-radius: 10px;
}
.moves {
  color: #c9d0cb;
  line-height: 1.8;
  padding: 14px;
  margin: 18px 0;
}
.saved {
  color: var(--accent);
}
.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 60px;
  text-align: center;
}
.trainer {
  display: grid;
  grid-template-columns: minmax(320px, 620px) 1fr;
  gap: 34px;
  align-items: start;
}
.boardwrap {
  position: sticky;
  top: 100px;
}
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow);
  user-select: none;
}
.square {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  cursor: pointer;
  position: relative;
}
.square.light {
  background: var(--light);
}
.square.dark {
  background: var(--dark);
}
.piece {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82%;
  height: 82%;
  font-family:
    "Arial Unicode MS", "Noto Sans Symbols 2", "DejaVu Sans", sans-serif;
  font-size: clamp(36px, 6vw, 66px);
  font-weight: 400;
  line-height: 1;
  font-variant-emoji: text;
  transform: scale(1);
  filter: none;
  text-shadow: none;
}
.white-piece {
  color: #f7f5ed;
  -webkit-text-stroke: 1.5px #182019;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.black-piece {
  color: #151b17;
  -webkit-text-stroke: 1px #151b17;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.12);
}
.square.selected:after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 4px solid var(--accent);
  border-radius: 5px;
  z-index: 3;
}
.square.target:before {
  content: "";
  position: absolute;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: rgba(217, 243, 107, 0.72);
  z-index: 1;
}
.rank-label,
.file-label {
  position: absolute;
  z-index: 4;
  font:
    800 10px/1 ui-sans-serif,
    system-ui;
  color: rgba(12, 18, 14, 0.65);
  pointer-events: none;
}
.rank-label {
  left: 4px;
  top: 4px;
}
.file-label {
  right: 4px;
  bottom: 4px;
}
.square.dark .rank-label,
.square.dark .file-label {
  color: rgba(245, 247, 239, 0.75);
}
.trainpanel {
  border-radius: 18px;
  padding: 24px;
}
.trainpanel h2 {
  font-size: 28px;
  margin: 7px 0;
}
.callout {
  border-left: 3px solid var(--accent);
  padding: 3px 0 3px 14px;
  margin: 20px 0;
}
.feedback {
  padding: 13px;
  border-radius: 9px;
  margin: 14px 0;
  font-weight: 650;
}
.feedback.good {
  background: #26391f;
  color: #dff4b2;
}
.feedback.bad {
  background: #3b2522;
  color: #ffc2b7;
}
.pgnbox {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: #dce2dd;
  line-height: 1.7;
}
.pgnlabel {
  font:
    800 10px/1.2 ui-sans-serif,
    system-ui;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 8px;
}
.pgncurrent {
  font-size: 13px;
  min-height: 22px;
}
.pgnbox details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.pgnbox summary {
  cursor: pointer;
  color: var(--muted);
  font:
    12px ui-sans-serif,
    system-ui;
}
.pgnfull {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 25px;
  text-align: center;
  color: #6f7b73;
  font-size: 12px;
}
@media (max-width: 900px) {
  .hero,
  .trainer {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .boardwrap {
    position: static;
  }
  .topbar nav {
    display: none;
  }
}
@media (max-width: 600px) {
  main {
    padding: 36px 15px 60px;
  }
  .topbar {
    padding: 0 15px;
  }
  .status-pill {
    margin-left: auto;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .stats {
    margin-top: 35px;
  }
  .pagehead {
    align-items: start;
    flex-direction: column;
  }
  .pagehead h1 {
    font-size: 38px;
  }
  .search {
    width: 100%;
    min-width: 0;
  }
  .piece {
    font-size: 12vw;
  }
  .trainpanel {
    padding: 18px;
  }
  .pgnbox {
    margin-top: 10px;
  }
}
/* Accessible vector board and persistent mobile navigation. */
a {
  color: var(--accent);
}
.actions {
  flex-wrap: wrap;
}
.actions a {
  text-decoration: none;
}
.hero {
  grid-template-columns: 1.3fr 0.7fr;
}
.topbar nav {
  display: flex;
  gap: 5px;
}
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 12px 9px;
  font-size: 14px;
  white-space: nowrap;
}
.card h2 {
  font-size: 21px;
}
.card .tag {
  display: inline-block;
  line-height: 1.4;
}
.card .actions {
  margin-top: 12px;
}
.boardwrap {
  min-width: 0;
}
.square {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.board {
  touch-action: none;
}
.chess-piece {
  width: 87%;
  height: 87%;
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.square.last-move {
  box-shadow: inset 0 0 0 100px #d9f36b35;
}
.square.check {
  background: #ba6558;
}
.square.target:before {
  z-index: 3;
  background: #172b2380;
}
.square.capture:before {
  width: 86%;
  height: 86%;
  background: transparent;
  border: 5px solid #d9f36bc0;
}
.board-tools {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.7;
}
textarea {
  width: 100%;
  display: block;
  margin: 10px 0 15px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  font: inherit;
}
label {
  display: block;
  color: var(--muted);
}
.trainpanel label {
  margin-top: 24px;
}
.trainpanel h1 {
  font-size: 28px;
}
.trainpanel li,
.trainpanel p {
  line-height: 1.6;
}
.trainpanel h4 {
  margin-bottom: 6px;
}
.trainpanel ul {
  padding-left: 20px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: calc(100vw - 24px);
}
dialog::backdrop {
  background: #000a;
}
.promotion-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  min-width: 58px;
  cursor: pointer;
}
.promotion-choice img {
  width: 45px;
  height: 45px;
}
dialog .actions {
  margin: 16px 0;
}
.pgnlabel {
  margin-top: 16px;
}
.feedback:empty {
  display: none;
}
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .topbar {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 15px;
  }
  .topbar nav {
    display: flex;
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
  .topbar .status-pill {
    margin-left: auto;
  }
  .trainer {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  main {
    padding-top: 24px;
  }
  .topbar nav a {
    font-size: 13px;
    padding: 10px 8px;
  }
  .hero h1 {
    font-size: 54px;
  }
  .hero {
    gap: 24px;
  }
  .rank-label,
  .file-label {
    font-size: 10px;
  }
  .square.selected:after {
    border-width: 3px;
  }
  .trainer {
    gap: 20px;
  }
  .empty {
    padding: 24px;
  }
}
