:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  color: #f3f0ff;
  background: #11101d;
  --accent: #c7afff;
  --muted: #c3bdce;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 16px;
}
button,
select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  background: #302a43;
  border: 1px solid #696076;
  border-radius: 12px;
  padding: 11px 14px;
  min-height: 44px;
  font-weight: 650;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid #e5d5ff;
  outline-offset: 3px;
}
button:hover:not(:disabled) {
  background: #443956;
}
.shell {
  max-width: 940px;
  margin: auto;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
h1 {
  font-size: clamp(23px, 4vw, 32px);
  margin: 2px 0;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.variant {
  color: var(--muted);
  font-size: 13px;
  text-align: end;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
}
.board-panel {
  min-width: 0;
}
.matchline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
}
#pieces {
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}
.board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1;
  width: 100%;
  max-width: 610px;
  border: 5px solid #5e5275;
  border-radius: 12px;
  overflow: hidden;
  direction: ltr;
}
.square {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  min-height: 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  aspect-ratio: 1;
  background: #b5a7c9;
  outline-offset: -4px !important;
}
.square.dark {
  background: #40324f;
}
.square.dark:hover {
  background: #544363;
}
.square.light {
  pointer-events: none;
}
.square.selected {
  box-shadow: inset 0 0 0 4px #dfc8ff;
}
.square.legal::after {
  content: "";
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: #dfccff;
  box-shadow: 0 0 0 4px #b895ed44;
}
.square.last {
  background: #60506e;
}
.piece {
  width: 76%;
  height: 76%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #fff6;
  box-shadow:
    0 3px 0 #0007,
    inset 0 0 0 4px #0002;
  font-size: clamp(13px, 3vw, 26px);
  font-weight: 900;
  pointer-events: none;
}
.piece.red {
  background: #d95f67;
  color: #fff;
}
.piece.white {
  background: #eee3cb;
  color: #47394a;
}
.piece.king::after {
  content: "♛";
}
.coord {
  position: absolute;
  top: 3px;
  left: 4px;
  color: #f4e9ff;
  font-size: 9px;
  opacity: 0.8;
  pointer-events: none;
}
.controls {
  padding-top: 44px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid #696076;
  background: #242031;
  color: #f3f0ff;
  border-radius: 10px;
  padding: 8px;
  font-size: 14px;
}
.primary {
  background: var(--accent);
  color: #201635;
  width: 100%;
  border-color: var(--accent);
}
.primary:hover:not(:disabled) {
  background: #dbcaff;
}
.actions {
  display: flex;
  gap: 8px;
}
.actions button {
  flex: 1;
}
summary {
  cursor: pointer;
  color: #eee6ff;
  font-weight: 650;
  min-height: 32px;
  padding: 6px 0;
}
details {
  border-top: 1px solid #494151;
  padding-top: 8px;
}
ul {
  padding-inline-start: 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
li {
  margin-bottom: 8px;
}
.hint {
  min-height: 36px;
  font-size: 14px;
  line-height: 1.5;
  color: #e4d4ff;
  margin: 12px 0;
}
.privacy,
footer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
footer {
  margin-top: 14px;
  text-align: center;
}
a {
  color: #dcc4ff;
}
.notice {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #eed7a5;
}
.notice:empty {
  display: none;
}
#restart-confirm {
  border: 1px solid #9982b7;
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
}
#restart-confirm[hidden] {
  display: none;
}
[hidden] {
  display: none !important;
}
.paused .board {
  opacity: 0.55;
}
@media (max-width: 660px) {
  body {
    padding: 10px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .board {
    border-width: 3px;
    max-width: 550px;
    margin: auto;
  }
  .controls {
    padding-top: 0;
    display: block;
  }
  #setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #setup label {
    margin: 0;
  }
  #start,
  #restart-confirm {
    grid-column: 1 / -1;
  }
  #undo,
  #pause {
    margin-top: 10px;
  }
  .actions {
    margin-bottom: 8px;
  }
  #clear-selection {
    width: 100%;
    margin-bottom: 8px;
  }
  .coord {
    display: none;
  }
  .matchline {
    font-size: 13px;
  }
  header {
    margin-bottom: 6px;
  }
  .privacy {
    margin: 8px 0;
  }
  details {
    margin-top: 8px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  body {
    padding: 6px;
  }
  header {
    margin-bottom: 0;
  }
  h1 {
    font-size: 22px;
  }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
    gap: 12px;
  }
  .board {
    max-width: calc(100dvh - 126px);
  }
  .controls {
    padding-top: 8px;
  }
  .hint {
    margin: 4px 0;
  }
  footer {
    margin-top: 3px;
  }
  #setup {
    display: block;
  }
  #setup label {
    margin-bottom: 8px;
  }
  .coord {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
.matchline {
  flex-wrap: wrap;
}
.matchline #pause {
  padding: 7px 12px;
  min-height: 38px;
  font-size: 13px;
  margin: 0;
  margin-inline-start: auto;
}
.matchline #pieces {
  width: 100%;
  padding-bottom: 4px;
}
@media (min-width: 661px) {
  .matchline #pieces {
    width: auto;
    padding: 0;
  }
}
