/* The chess room: original vector pieces, slate tiles and a machined frame. */
.chess-dialog {
  width: min(1040px, 96vw);
  border: 1px solid #424f43;
  background: radial-gradient(ellipse at 2% 0%, #52624622, transparent 55%), #101713;
  border-radius: 20px;
  box-shadow:
    0 35px 120px #000c,
    0 0 70px #9fbb5910;
}
.chess-shell {
  padding: 25px 28px 27px;
}
.dialog-header {
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid #ffffff0e;
}
.chess-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chess-brand-emblem {
  display: grid;
  place-items: center;
  width: 49px;
  height: 52px;
  border: 1px solid #cbbd7b46;
  border-radius: 13px;
  background: linear-gradient(135deg, #64714a22, #151e16);
}
.chess-brand-emblem img {
  width: 45px;
  height: 45px;
  transform: rotate(-9deg);
}
.dialog-header .eyebrow {
  font-size: 8px;
  letter-spacing: 2.1px;
  color: #d7c798;
}
.dialog-header h2 {
  font-size: 28px;
  margin-top: 5px;
  letter-spacing: -1px;
  font-weight: 750;
}
.dialog-header h2 span {
  font-weight: 350;
  color: #9bac9c;
}
.match-header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.match-edition {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 7px;
  letter-spacing: 1.4px;
  color: #798d79;
}
.match-edition i {
  width: 24px;
  height: 1px;
  background: #9ebd4c;
}
.dialog-header .close-dialog {
  border-radius: 50%;
  background: #ffffff04;
  border-color: #3a483b;
  width: 36px;
  height: 36px;
}
.chess-layout {
  grid-template-columns: minmax(0, 1fr) 265px;
  gap: 27px;
  align-items: stretch;
}
.board-column {
  max-width: min(100%, calc(92dvh - 250px));
  width: 100%;
  margin: auto;
}
.player-row {
  min-height: 57px;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #ffffff03;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.player-row:last-child {
  margin: 14px 0 0;
}
.player-row.is-turn {
  background: linear-gradient(100deg, #c3fa4c0b, transparent);
  border-color: #b7d27626;
}
.player-avatar,
.player-avatar.opponent {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid #6e806344;
  background: radial-gradient(ellipse at 35% 0, #6e856342, #1e2b20);
  overflow: hidden;
}
.player-avatar img {
  height: 40px;
  width: 40px;
  filter: drop-shadow(0 2px 2px #0006);
}
.player-avatar.opponent {
  background: linear-gradient(130deg, #8b9e8a45, #233128);
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-row strong {
  font-size: 12px;
  font-weight: 650;
}
.player-row small {
  font-size: 7px;
  letter-spacing: 1.35px;
  color: #8a9b88;
  margin-top: 5px;
}
.turn-pill {
  font-size: 7px;
  letter-spacing: 1px;
  border: 0;
  background: #ffffff03;
  color: #6f856f;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.turn-pill i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.turn-pill.active {
  color: var(--lime);
  background: #c3fa4c0d;
  box-shadow: 0 0 0 1px #c3fa4c29;
}
.captured-pieces {
  display: flex;
  align-items: center;
  height: 18px;
  margin: 3px 0 -3px;
}
.captured-pieces:empty {
  display: none;
}
.captured-pieces .piece {
  width: 19px !important;
  height: 19px !important;
  margin-right: -5px;
  filter: none !important;
}
.board-stage {
  position: relative;
  padding: 12px;
  border-radius: 13px;
  background: linear-gradient(135deg, #435044, #1a291e 40%, #111e16 70%, #394738);
  box-shadow:
    0 12px 35px #0005,
    inset 0 1px 0 #c3d4ac50,
    inset 0 -2px 0 #06110a;
  border: 1px solid #6a7e5055;
}
.board-stage:before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #b9be7730;
  border-radius: 9px;
  pointer-events: none;
}
.board-corner {
  position: absolute;
  width: 27px;
  height: 27px;
  pointer-events: none;
  z-index: 3;
  border-color: #c9d49d;
  opacity: 0.8;
}
.corner-tl {
  left: -1px;
  top: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
  border-top-left-radius: 13px;
}
.corner-br {
  right: -1px;
  bottom: -1px;
  border-bottom: 2px solid;
  border-right: 2px solid;
  border-bottom-right-radius: 13px;
}
.chess-board {
  position: relative;
  border: 1px solid #0b1a10;
  border-radius: 5px;
  overflow: visible;
  isolation: isolate;
  box-shadow:
    0 0 0 1px #b2c09030,
    0 4px 10px #0006;
  background: #53695b;
}
.square {
  background: linear-gradient(145deg, #b7c5b7, #9eafa1);
  overflow: visible;
  isolation: auto;
  box-shadow: inset 0 1px 0 #ffffff14;
  transition: background 0.18s;
  min-width: 0;
  min-height: 0;
}
.square.dark {
  background: linear-gradient(145deg, #536b5d, #40594c);
  box-shadow: inset 0 1px 0 #ffffff04;
}
.square:first-child {
  border-top-left-radius: 4px;
}
.square:nth-child(8) {
  border-top-right-radius: 4px;
}
.square:nth-child(57) {
  border-bottom-left-radius: 4px;
}
.square:last-child {
  border-bottom-right-radius: 4px;
}
.square:before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: #d5ed8744;
  box-shadow: inset 0 0 0 2px #d4f77e70;
  transition: opacity 0.18s;
  pointer-events: none;
}
.square.last-move {
  box-shadow: inset 0 0 0 100px #d5ed871c;
}
.square.last-move:before {
  opacity: 0.4;
}
.square.selected {
  background: linear-gradient(135deg, #9dbe70, #6d9853);
  z-index: 4;
}
.square.selected:before {
  opacity: 1;
  box-shadow:
    inset 0 0 0 2px #d3ff91,
    0 0 16px #c3fa4c24;
}
.square.selected .piece {
  transform: translateY(-3px);
  filter: drop-shadow(0 6px 3px #0c261183);
}
.square.legal:after {
  width: 17%;
  height: 17%;
  left: 41.5%;
  top: 41.5%;
  background: #c9f78d;
  border: 2px solid #263f2870;
  box-shadow: 0 1px 4px #18271f55;
  z-index: 2;
}
.square.legal.has-piece:after {
  inset: 5%;
  width: 90%;
  height: 90%;
  border: 2px solid #e5ffaf;
  border-radius: 22%;
  background: none;
  box-shadow:
    inset 0 0 12px #d9ff822e,
    0 0 10px #c3fa4c33;
}
.square.checked {
  background: linear-gradient(135deg, #ad6a58, #7f3c35);
}
.square.checked:before {
  opacity: 1;
  background: transparent;
  box-shadow: inset 0 0 0 2px #ffb99c;
  animation: check-breathe 2s ease-in-out infinite;
}
.square.moving {
  z-index: 8;
}
.chess-dialog .piece {
  display: block;
  width: 88%;
  height: 88%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 3px 1.5px #12291f70);
  font-size: initial;
  -webkit-text-stroke: 0;
  text-shadow: none;
  transition:
    filter 0.18s,
    transform 0.18s;
}
.chess-dialog .piece.black {
  filter: drop-shadow(0 3px 1.5px #04140a75);
}
.coordinate {
  font-size: 7px;
  z-index: 1;
  color: #3d5846;
  font-weight: 700;
  opacity: 0.85;
}
.dark .coordinate {
  color: #c8d6b7;
}
.coordinate.rank {
  top: 4px;
  left: 4px;
}
.coordinate.file {
  bottom: 3px;
  right: 4px;
}
.game-panel {
  border: 1px solid #3f4c3a70;
  background: linear-gradient(165deg, #26322260, #141d16);
  border-radius: 13px;
  padding: 18px;
  position: relative;
}
.game-status {
  gap: 9px;
  background: #a9ce6810;
  border: 1px solid #b4d67522;
  padding: 15px 11px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.game-status > div {
  flex: 1;
}
.game-status strong {
  font-size: 11px;
  line-height: 1.45;
  display: block;
  margin-top: 5px;
}
.status-caption {
  font-size: 6px;
  letter-spacing: 1.6px;
  color: #94aa7b;
  display: block;
}
.game-status > svg {
  color: #a8c87a;
  width: 25px;
  height: 25px;
  opacity: 0.55;
}
.game-status.is-check {
  border-color: #e9a17b66;
  background: #b8593614;
}
.game-status.is-check .status-dot {
  background: #efa57f;
}
.game-status.is-over {
  border-color: #d7c18466;
  background: #c6a65010;
}
.game-panel label {
  font-size: 10px;
  font-weight: 600;
  color: #c6d1bc;
  margin-bottom: 9px;
}
.game-panel select {
  border: 1px solid #4b5b4255;
  background: #101b13;
  font-size: 10px;
  padding: 12px 9px;
  border-radius: 7px;
  min-height: 42px;
}
.game-help {
  font-size: 10px;
  line-height: 1.8;
  color: #7f9678;
  margin: 13px 0 17px;
}
.board-controls {
  gap: 7px;
}
.board-controls .outline-button {
  background: #ffffff03;
  border-color: #52634960;
  font-size: 10px;
  min-height: 39px;
  border-radius: 6px;
}
.history-heading {
  font-size: 10px;
  color: #b3c0a7;
  margin: 22px 0 11px;
}
.history-heading > span:last-child {
  font-size: 9px;
  background: #ffffff08;
  padding: 2px 6px;
  border-radius: 4px;
  color: #a7c188;
}
.history-columns {
  display: grid;
  grid-template-columns: 24px 1fr 1fr;
  padding: 9px 10px;
  background: #ffffff04;
  border-radius: 5px 5px 0 0;
  color: #738c6f;
  font-size: 8px;
}
.move-history {
  margin: 0 0 18px;
  padding: 0 0 0 30px;
  border: 0;
  background: #0e181168;
  border-radius: 0 0 6px 6px;
  font-size: 10px;
  max-height: 178px;
  min-height: 110px;
  line-height: 2.8;
}
.move-history li {
  padding-left: 4px;
  border-bottom: 1px solid #a6c48609;
  color: #8aa17c;
}
.move-history li:last-child {
  color: #d5edab;
  background: #c3fa4c07;
}
.move-history li::marker {
  font-size: 8px;
  color: #6f8563;
}
.move-history li span {
  width: 47%;
  font-variant-numeric: tabular-nums;
}
.history-empty {
  display: flex;
  flex: 1;
  min-height: 140px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 17px;
  border: 1px dashed #66825126;
  border-radius: 0 0 6px 6px;
  background: #0e181150;
  color: #788f6b;
  font-size: 10px;
  line-height: 1.8;
  text-align: center;
}
.history-empty svg {
  width: 28px;
  height: 28px;
  opacity: 0.5;
}
.game-panel > .primary-button {
  width: 100%;
  justify-content: space-between;
  min-height: 44px;
  padding: 13px;
  font-size: 11px;
  gap: 15px;
  border-radius: 7px;
  margin-top: auto;
}
.chess-note {
  font-size: 7px;
  color: #819773;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 13px;
  white-space: nowrap;
}
.chess-note svg {
  width: 11px;
  height: 11px;
}
.promotion-panel {
  background: #0d1912ec;
  gap: 0;
}
.promotion-panel h3 {
  font-size: 23px;
  letter-spacing: -0.6px;
  margin: 12px 0 26px;
}
.promotion-panel > div {
  gap: 11px;
}
.promotion-panel button {
  font-family: inherit;
  font-size: 9px;
  width: 94px;
  height: 122px;
  padding: 10px;
  background: linear-gradient(145deg, #40513a66, #18271b);
  border: 1px solid #8ba86b55;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #bcd49b;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.promotion-panel button:hover {
  background: #60793b44;
  transform: translateY(-5px);
  border-color: var(--lime);
}
.promotion-panel button img {
  width: 78px;
  height: 78px;
}
.promotion-panel button span {
  font-size: 9px;
  margin-top: 6px;
}
.promotion-panel .eyebrow {
  font-size: 8px;
  color: #cae3a8;
}
@keyframes check-breathe {
  50% {
    box-shadow:
      inset 0 0 0 2px #ffb99c,
      inset 0 0 24px #ef653044;
  }
}
@media (max-width: 760px) {
  .chess-dialog {
    width: 96vw;
  }
  .chess-shell {
    padding: 20px;
  }
  .chess-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 17px;
  }
  .board-stage {
    padding: 9px;
  }
  .game-panel {
    padding: 13px;
  }
  .board-column {
    max-width: 100%;
  }
  .match-edition {
    display: none;
  }
  .game-panel select {
    font-size: 9px;
  }
  .chess-note {
    font-size: 6px;
  }
  .player-row {
    padding: 8px;
    gap: 8px;
  }
  .player-row strong {
    font-size: 10px;
  }
  .player-row small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .turn-pill {
    font-size: 6px;
    padding: 6px;
  }
  .player-avatar,
  .player-avatar.opponent {
    width: 35px;
    height: 35px;
  }
  .player-avatar img {
    width: 34px;
    height: 34px;
  }
  .coordinate {
    font-size: 6px;
  }
}
@media (max-width: 600px) {
  .chess-dialog {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: radial-gradient(ellipse at 0 0, #465b3422, transparent 65%), #101713;
  }
  .chess-shell {
    padding: 16px 12px calc(24px + env(safe-area-inset-bottom));
  }
  .dialog-header {
    margin-bottom: 14px;
    padding-bottom: 15px;
  }
  .chess-brand {
    gap: 10px;
  }
  .chess-brand-emblem {
    width: 40px;
    height: 43px;
    border-radius: 11px;
  }
  .chess-brand-emblem img {
    width: 38px;
    height: 38px;
  }
  .dialog-header .eyebrow {
    font-size: 6px;
    letter-spacing: 1.7px;
  }
  .dialog-header h2 {
    font-size: 24px;
    margin-top: 4px;
  }
  .match-header-actions {
    gap: 0;
  }
  .chess-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 19px;
  }
  .board-column {
    width: 100%;
    max-width: none;
  }
  .board-stage {
    padding: 8px;
    border-radius: 11px;
  }
  .board-stage:before {
    inset: 4px;
    border-radius: 8px;
  }
  .board-corner {
    width: 21px;
    height: 21px;
  }
  .corner-tl {
    border-top-left-radius: 11px;
  }
  .corner-br {
    border-bottom-right-radius: 11px;
  }
  .player-row {
    margin-bottom: 10px;
    min-height: 51px;
    padding: 7px 10px;
    border-radius: 8px;
    gap: 10px;
  }
  .player-row:last-child {
    margin-top: 10px;
  }
  .player-row strong {
    font-size: 11px;
  }
  .player-row small {
    font-size: 6px;
    letter-spacing: 1.2px;
  }
  .player-avatar,
  .player-avatar.opponent {
    width: 37px;
    height: 37px;
  }
  .player-avatar img {
    width: 36px;
    height: 36px;
  }
  .turn-pill {
    font-size: 7px;
    padding: 7px 9px;
  }
  .coordinate {
    font-size: 6px;
  }
  .coordinate.rank {
    top: 2px;
    left: 3px;
  }
  .coordinate.file {
    bottom: 2px;
    right: 3px;
  }
  .chess-dialog .piece {
    width: 92%;
    height: 92%;
  }
  .game-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 16px;
    gap: 11px 10px;
    border-radius: 12px;
  }
  .game-status {
    grid-column: 1/-1;
    grid-row: 1;
    padding: 13px;
    margin: 0;
  }
  .game-status strong {
    font-size: 12px;
  }
  .status-caption {
    font-size: 6px;
  }
  .game-panel label {
    grid-column: 1/-1;
    grid-row: 2;
    font-size: 10px;
    margin: 3px 0 -4px;
  }
  .game-panel select {
    grid-column: 1/-1;
    grid-row: 3;
    font-size: 12px;
    min-height: 44px;
  }
  .game-help {
    grid-column: 1/-1;
    grid-row: 4;
    font-size: 10px;
    margin: 0;
  }
  .board-controls {
    grid-column: 1;
    grid-row: 5;
    gap: 6px;
  }
  .board-controls .outline-button {
    min-height: 44px;
    font-size: 10px;
    padding: 10px;
  }
  .game-panel > .primary-button {
    grid-column: 2;
    grid-row: 5;
    margin: 0;
    font-size: 11px;
    min-height: 44px;
    gap: 8px;
    padding: 12px;
  }
  .history-heading {
    grid-column: 1/-1;
    grid-row: 6;
    margin: 10px 0 0;
  }
  .history-columns {
    grid-column: 1/-1;
    grid-row: 7;
    margin-bottom: -11px;
    font-size: 9px;
    grid-template-columns: 24px 1fr 1fr;
  }
  .move-history {
    grid-column: 1/-1;
    grid-row: 8;
    margin: 0;
    min-height: 85px;
    max-height: 136px;
    font-size: 11px;
    padding-left: 32px;
  }
  .history-empty {
    grid-column: 1/-1;
    grid-row: 8;
    margin: 0;
    min-height: 100px;
    flex-direction: row;
    gap: 12px;
    text-align: left;
  }
  .history-empty span br {
    display: none;
  }
  .chess-note {
    grid-column: 1/-1;
    grid-row: 9;
    font-size: 8px;
    margin: 4px 0 0;
    white-space: normal;
  }
  .promotion-panel h3 {
    font-size: 21px;
  }
  .promotion-panel > div {
    gap: 7px;
  }
  .promotion-panel button {
    width: 71px;
    height: 104px;
    padding: 7px;
  }
  .promotion-panel button img {
    width: 61px;
    height: 67px;
  }
  .promotion-panel button span {
    font-size: 7px;
  }
}
@media (max-width: 360px) {
  .chess-shell {
    padding-left: 9px;
    padding-right: 9px;
  }
  .board-stage {
    padding: 6px;
  }
  .game-panel {
    padding: 12px;
  }
  .player-row {
    padding-left: 7px;
    padding-right: 7px;
  }
  .promotion-panel button {
    width: 64px;
  }
  .chess-brand-emblem {
    width: 37px;
    height: 40px;
  }
  .game-panel > .primary-button {
    font-size: 10px;
  }
}
