@font-face {
  font-family: DM Sans;
  src: url(/fonts/dm-sans.woff2);
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: DM Serif Text;
  src: url(/fonts/dm-serif-text.woff2);
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #181917;
  --card: #232421;
  --line: #373834;
  --text: #f2f0e8;
  --muted: #aaa99f;
  --gold: #d7b375;
  --serif: "DM Serif Text", Georgia, serif;
  --frame: clamp(14px, 1.65vw, 21px);
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 290px;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
}
svg:not(:root) {
  overflow: visible;
}
svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
}
.masthead {
  border-bottom: 1px solid #363630;
  background: #1d1e1b;
}
.mast-inner,
main {
  margin: auto;
  width: min(calc(100% - 88px), 1080px);
}
.mast-inner {
  height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 27px var(--serif);
  letter-spacing: -1px;
}
.brand img {
  width: 38px;
  height: 38px;
}
.mode,
.save {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #c6c5bb;
}
.mode {
  border: 1px solid #403f37;
  background: #282923;
  border-radius: 30px;
  padding: 7px 13px;
}
.mode svg {
  color: var(--gold);
  width: 16px;
  height: 16px;
}
.save {
  color: var(--muted);
  font-size: 12px;
}
.save svg {
  width: 16px;
  height: 16px;
  color: #abb195;
}
main {
  padding: 34px 0 42px;
  max-width: 1038px;
}
.page-title,
.card-heading,
.player {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.page-title {
  margin-bottom: 21px;
}
.eyebrow {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--gold);
  font-size: 10px;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 1.9px;
}
.gold-line {
  height: 2px;
  width: 20px;
  background: var(--gold);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font: 46px/1.14 var(--serif);
  letter-spacing: -1.6px;
  margin-top: 4px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.66fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
}
.play-area {
  min-width: 0;
}
.player {
  height: 52px;
  padding: 0 2px;
}
.player:first-child {
  padding-bottom: 9px;
}
.player:last-child {
  padding-top: 9px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 11px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  border: 1px solid #4b4b42;
  background: #30312d;
}
.avatar img {
  width: 28px;
  height: 28px;
}
.avatar.black img {
  filter: drop-shadow(0 0 0.8px #ddd9ca);
}
.avatar.white {
  background: #e2ddd0;
  border-color: #e2ddd0;
}
.player-name {
  font-weight: 650;
  font-size: 16px;
}
.player-no {
  font-size: 12px;
  color: var(--muted);
  border-left: 1px solid #4a4a42;
  padding-left: 11px;
}
.turn-marker {
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}
.frame {
  display: grid;
  grid-template-columns: var(--frame) 1fr var(--frame);
  grid-template-rows: var(--frame) 1fr var(--frame);
  position: relative;
  background:
    linear-gradient(105deg, #593e2dc7, #795238a6 45%, #513928bf),
    url(/wood.png) center/512px 256px;
  border: 1px solid #886445;
  border-radius: 6px;
  box-shadow:
    0 8px 18px #0003,
    inset 0 0 0 2px #3223182e;
  overflow: hidden;
}
.board {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  aspect-ratio: 1;
  min-width: 0;
  background: #dcc39f;
  box-shadow: 0 0 0 1px #453122;
}
.board canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.files,
.ranks {
  display: grid;
  color: #e3ccb0;
  font:
    500 10px/1 "DM Sans",
    sans-serif;
  user-select: none;
  text-transform: uppercase;
}
.files {
  grid-column: 2;
  grid-template-columns: repeat(8, 1fr);
}
.ranks {
  grid-row: 2;
  grid-template-rows: repeat(8, 1fr);
}
.files span,
.ranks span {
  display: grid;
  place-items: center;
}
.top {
  grid-row: 1;
}
.bottom {
  grid-row: 3;
}
.left {
  grid-column: 1;
}
.right {
  grid-column: 3;
}
.grid-input {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.grid-input button {
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  min-height: 0;
  touch-action: manipulation;
}
.grid-input button:focus-visible {
  outline: 3px solid #fae291;
  outline-offset: -4px;
}
.grid-input button:hover {
  box-shadow: inset 0 0 0 2px #fff4;
}
aside {
  display: grid;
  gap: 16px;
  padding-top: 2px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--card);
}
.status {
  position: relative;
  isolation: isolate;
  padding: 23px 22px 24px;
  background: linear-gradient(110deg, #303026, #282821);
  border-color: #494536;
}
.status-art {
  position: absolute;
  width: 116px;
  height: 122px;
  right: 0;
  bottom: -12px;
  opacity: 0.32;
  z-index: -1;
  transform: rotate(9deg);
}
.status h2 {
  font: 33px/1.2 var(--serif);
  letter-spacing: -1px;
  margin: 9px 0 5px;
}
.status p:not(.eyebrow) {
  color: #c6c3b5;
  font-size: 13px;
  line-height: 1.5;
  max-width: 87%;
}
.card-heading {
  min-height: 54px;
  padding: 0 20px;
}
.card-heading h2 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: center;
  letter-spacing: -0.25px;
}
.card-heading h2 svg {
  color: var(--gold);
  width: 17px;
  height: 17px;
}
#move-count {
  border: 1px solid #41423c;
  border-radius: 5px;
  background: #30312c;
  color: #c8c7be;
  font-size: 11px;
  padding: 3px 7px;
  font-variant-numeric: tabular-nums;
}
.columns {
  display: grid;
  grid-template-columns: 16% 42% 42%;
  align-items: center;
  padding: 0 20px;
}
.table-head {
  background: #292a26;
  border-block: 1px solid var(--line);
  height: 31px;
  font-size: 11px;
  font-weight: 600;
  color: #b6b6aa;
}
.history-body {
  height: clamp(138px, 19vh, 220px);
  overflow: auto;
  scrollbar-color: #54544a transparent;
}
#history {
  padding: 0;
  margin: 0;
  list-style: none;
}
#history li {
  min-height: 33px;
  border-bottom: 1px solid #33352f;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
#history li span:first-child {
  color: var(--muted);
  font-size: 12px;
}
#history li:last-child {
  background: #2b2c25;
}
#empty-history {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#empty-history[hidden] {
  display: none;
}
.empty-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid #45453c;
  border-radius: 10px;
  background: #2b2c27;
  color: #a7a38f;
}
.empty-icon svg {
  width: 20px;
  height: 20px;
}
#empty-history p {
  font-size: 14px;
  font-weight: 550;
  margin: 10px 0 3px;
  color: #cfcec4;
}
#empty-history small {
  font-size: 12px;
  color: var(--muted);
}
.controls {
  padding: 0 18px 18px;
}
.controls .card-heading {
  padding: 0 2px;
}
.button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.controls button,
dialog button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 41px;
  border: 1px solid #464740;
  border-radius: 6px;
  background: #30312d;
  color: #e2e1d7;
  font-size: 14px;
  font-weight: 550;
}
.controls button:hover:enabled,
dialog button:hover {
  background: #3b3c35;
}
.controls button:disabled {
  color: #93948a;
  background: #2c2d29;
  border-color: #3c3d37;
}
.controls .primary,
dialog .primary {
  background: var(--gold);
  color: #231e16;
  border-color: #dec08b;
}
.controls .primary {
  width: 100%;
  margin-top: 10px;
}
.controls .primary:hover:enabled,
dialog .primary:hover {
  background: #e4c38c;
}
button svg {
  width: 16px;
  height: 16px;
}
#notice {
  color: #e9c98c;
  font-size: 14px;
  line-height: 1.5;
}
dialog {
  width: min(380px, calc(100% - 32px));
  padding: 27px;
  border: 1px solid #59594c;
  border-radius: 12px;
  color: var(--text);
  background: var(--card);
  box-shadow: 0 20px 90px #0008;
}
dialog::backdrop {
  background: #11120ee0;
}
dialog h2 {
  font: 29px var(--serif);
}
dialog p {
  font-size: 14px;
  color: var(--muted);
  margin: 9px 0 22px;
}
#choices {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
#choices button {
  flex: 1;
  padding: 7px 0;
  flex-direction: column;
  font-size: 11px;
  background: #b79971;
  color: #141310;
}
#choices img {
  width: 40px;
  height: 40px;
}
#promotion > .cancel {
  width: 100%;
}
@media (min-width: 760px) and (max-height: 850px) {
  main {
    padding-top: 23px;
    max-width: 960px;
  }
  .mast-inner {
    height: 64px;
  }
  .page-title {
    margin-bottom: 10px;
  }
  h1 {
    font-size: 40px;
  }
  .layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  }
}
@media (max-width: 759px) {
  .mast-inner,
  main {
    width: min(calc(100% - 32px), 580px);
  }
  .mast-inner {
    height: 63px;
  }
  .brand {
    font-size: 24px;
    gap: 8px;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .mode {
    font-size: 11px;
    padding: 6px 9px;
    gap: 5px;
  }
  main {
    padding-top: 24px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .page-title {
    margin-bottom: 12px;
  }
  .save {
    font-size: 11px;
    gap: 5px;
  }
  h1 {
    font-size: 38px;
  }
  aside {
    gap: 12px;
  }
  .status {
    padding: 18px 20px;
  }
  .history-body {
    height: 145px;
  }
  .player {
    height: 48px;
  }
  .files,
  .ranks {
    font-size: 9px;
  }
}
@media (min-width: 760px) {
  main {
    --board-width: clamp(400px, calc(100svh - 300px), 630px);
    max-width: calc(var(--board-width) + 387px);
  }
  .layout {
    grid-template-columns: minmax(0, var(--board-width)) minmax(275px, 1fr);
  }
}
@media (min-width: 760px) and (max-height: 850px) {
  .mast-inner {
    height: 56px;
  }
  main {
    --board-width: clamp(390px, calc(100svh - 227px), 590px);
    padding: 16px 0 12px;
  }
  .page-title {
    margin-bottom: 7px;
  }
  h1 {
    font-size: 35px;
    margin-top: 2px;
  }
  .player {
    height: 39px;
  }
  .player:first-child {
    padding-bottom: 5px;
  }
  .player:last-child {
    padding-top: 5px;
  }
  .avatar {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }
  .avatar img {
    width: 24px;
    height: 24px;
  }
  aside {
    gap: 12px;
  }
}
