@font-face {
  font-family: "Logan Chess";
  src: url("/vendor/chess-symbols.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
  unicode-range: U+265A-265F;
}
@font-face {
  font-family: "Logan Chess";
  src: url("/vendor/chess-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
  unicode-range: U+002B,U+0041-005A,U+007E,U+00D7;
}

.chess-page { width: min(1060px, calc(100% - 40px)); padding: 36px 0 70px; }
.chess-page h1 { font-size: clamp(2.5rem, 8vw, 5rem); margin: 28px 0 20px; }
.chess-page h2 { font-size: clamp(1.5rem, 5vw, 2.2rem); margin: 36px 0 14px; }
.chess-page p { line-height: 1.6; }
.chess-page a:hover, .chess-page a:focus-visible { color: var(--orange); }
.chess-nav, .chess-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 14px; }
.chess-nav { align-items: center; gap: 18px; }
.chess-nav a { text-underline-offset: 4px; }
.chess-page button, .chess-page select, .chess-page input, .chess-page textarea {
  border: 1px solid #686960; border-radius: 6px; background: #23241e; color: var(--text);
  padding: 8px 12px; font: inherit; min-height: 42px;
}
.chess-page label { display: grid; gap: 6px; }
.chess-page button:not(:disabled), .chess-page select:not(:disabled) { cursor: pointer; }
.chess-page button:disabled, .chess-page select:disabled { opacity: .65; }
.chess-page :focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.chess-description, .chess-rules p, .variant-list p { color: #b4b5ac; white-space: pre-wrap; overflow-wrap: anywhere; }
.variant-list { list-style: none; padding: 0; }
.variant-list li { padding: 20px 0; border-top: 1px solid var(--line); }
.variant-list a { font-size: 1.35rem; font-weight: 600; }
.variant-list p { margin: 8px 0 0; }
.chess-form { display: grid; gap: 14px; max-width: 680px; }
.chess-form button { justify-self: start; }
.google-sign-in { max-width: 420px; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.google-sign-in p { color: var(--muted); margin: 6px 0 0; }
.chess-form textarea { resize: vertical; }
.chess-form .ini { font-family: ui-monospace, monospace; }
#admin-status { white-space: pre-wrap; overflow-wrap: anywhere; }
.chess-play-page { width: min(1060px, calc(100% - 24px)); padding-top: 14px; }
.chess-play-page .chess-nav { margin-bottom: 8px; }
.chess-play-page h1 {
  margin: 0 0 8px; font-size: clamp(1.65rem, 5vw, 2.65rem); line-height: 1.1; overflow-wrap: anywhere;
}
.board-status {
  margin: 0 0 8px; min-height: 1.6em; color: var(--text); font-weight: 600; overflow-wrap: anywhere;
}
#admin-status { scroll-margin-top: 12px; }
.chess-stage {
  --board-height: calc(100dvh - 110px);
  --board-width: min(640px, calc(var(--board-height) * var(--files) / var(--ranks)));
  display: grid; align-items: start; gap: 12px;
}
.chess-controls { min-width: 0; }
.chess-controls .chess-toolbar:empty { display: none; }
.chess-controls .chess-toolbar { margin-bottom: 10px; }
.chess-controls label, .chess-controls select { min-width: 0; max-width: 100%; }
.chess-controls .chess-toolbar:first-child {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px;
}
.variant-board {
  display: grid;
  grid-template-columns: repeat(var(--files), minmax(0, 1fr));
  width: min(100%, var(--board-width));
  max-width: 100%;
  justify-self: center;
  container-type: inline-size;
  box-shadow: 0 0 0 1px var(--line);
}
@media (min-width: 720px) {
  .chess-stage { grid-template-columns: minmax(0, var(--board-width)) minmax(150px, 180px); gap: 20px; }
  .variant-board { justify-self: start; }
  .chess-controls .chess-toolbar:first-child { grid-template-columns: 1fr; }
}
.chess-page button.board-cell {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1;
  border: 0; border-radius: 0; padding: 0; min-height: 0; opacity: 1;
  font-size: calc(74cqw / var(--files)); line-height: 1;
}
.chess-page button.light-square { background: #bdb8aa; color: var(--background); }
.chess-page button.dark-square { background: #3c3e35; color: var(--text); }
.piece-glyph { font-family: "Logan Chess", sans-serif; font-weight: 400; font-synthesis: none; line-height: 1; }
.piece-icon { paint-order: stroke fill; -webkit-text-stroke: max(1px, .065em) var(--piece-outline, transparent); }
.piece-letter {
  display: grid; place-items: center; min-width: 1.35em; height: 1.35em; padding-inline: .12em;
  border: max(1px, .085em) solid var(--piece-outline, currentColor); border-radius: .25em; font-size: .55em;
}
.white-piece { --piece-fill: var(--text); --piece-outline: var(--background); }
.black-piece { --piece-fill: var(--background); --piece-outline: var(--text); }
.piece-icon { color: var(--piece-fill); }
.piece-letter { color: var(--piece-outline, inherit); background: var(--piece-fill, transparent); }
.chess-page button.board-cell.selected-square, .chess-page button.board-cell:focus-visible {
  z-index: 1; outline: 3px solid var(--orange); outline-offset: -3px; box-shadow: inset 0 0 0 4px var(--background);
}
.legal-square::after {
  content: ''; position: absolute; width: 23%; aspect-ratio: 1;
  border: 1px solid var(--background); border-radius: 50%; background: var(--orange); pointer-events: none;
}
.legal-square:is(.white-piece, .black-piece)::after {
  inset: 7%; width: auto; border: 2px solid var(--orange); box-shadow: 0 0 0 1px var(--background); background: transparent;
}
.chess-page footer { margin-top: 34px; color: var(--muted); }
