* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #302e2b;
  color: white;
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 180px;
  background: #262522;
  padding: 20px;
}

.logo {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 25px;
  cursor: pointer;
  transition: 0.3s;
}

.logo:hover {
  opacity: 0.8;
}

.menu-item {
  padding: 15px;
  cursor: pointer;
  border-radius: 8px;
  position: relative;
  transition: 0.3s;
}

.menu-item:hover {
  background: #2a2a2a;
}

/* Submenu */
.submenu {
  position: absolute;
  left: 140px;
  top: 0;
  background: #1f1f1f;
  width: 200px;
  display: none;
  flex-direction: column;
  border-radius: 8px;
  padding: 10px;
  z-index: 1000;
}

.menu-item:hover .submenu {
  display: flex;
}

.submenu-item {
  padding: 10px;
  border-radius: 6px;
  transition: 0.3s;
}

.submenu-item:hover {
  background: #333;
}

/* Main content */
.content {
  flex: 1;
  padding: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Center Board */
.center-board {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chessboard {
  width: 650px;
  height: 650px;
  object-fit: cover;
}

/* Right Panel */
.right-panel {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.panel-title {
  font-size: 48px;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 20px;
  color: white;
}

.panel-description {
  font-size: 18px;
  color: #b0b0b0;
  margin-bottom: 30px;
  line-height: 1.6;
}

.get-started-btn {
  padding: 20px 130px;
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(90deg, #7BC043 0%, #6AAD38 100%);
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.3s;
  align-self: center;
  min-width: 280px;
}

.get-started-btn:hover {
  background: linear-gradient(135deg, #6ab838 0%, #4a8e28 100%);
  transform: scale(1.02);
}

.play-panel-wrap {
  align-items: flex-start;
  justify-content: flex-start;
  flex: 0 0 auto;
  padding: 0;
  max-width: none;
}

.play-screen-layout {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 26px;
}

.board-timer-layout {
  width: fit-content;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.board-overlay-host {
  width: fit-content;
  margin: 0;
  display: inline-block;
  position: relative;
}

.promotion-picker {
  position: absolute;
  z-index: 25;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.promotion-piece-btn {
  width: 100%;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0;
}

.promotion-piece-btn-white {
  background: #f3f3f3;
}

.promotion-piece-btn-black {
  background: #f3f3f3;
}

.promotion-piece-btn:hover {
  filter: brightness(0.94);
}

.promotion-piece-img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  display: block;
}

.promotion-cancel-btn {
  width: 100%;
  border: none;
  margin: 0;
  padding: 0;
  background: #dedede;
  color: #8d8d8d;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.promotion-cancel-btn:hover {
  background: #d2d2d2;
  color: #767676;
}

.board-timer-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.board-timer-row.preview-timer-row {
  justify-content: flex-end;
}

.board-timer-row-bottom {
  margin-top: 8px;
  margin-bottom: 0;
}

.play-panel-shell {
  width: 400px;
  margin-top: 44px;
}

.play-panel-head {
  background: #1f1e1b;
  border-radius: 16px 16px 0 0;
  padding: 26px 20px;
}

.play-panel-box {
  background: #262522;
  border-radius: 0 0 16px 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.play-panel-box.play-panel-configured {
  padding: 0;
  gap: 0;
  height: 480px;
}

.play-config-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: #3f3d38 #1f1e1b;
}

.play-config-scroll::-webkit-scrollbar {
  width: 10px;
}

.play-config-scroll::-webkit-scrollbar-track {
  background: #1f1e1b;
}

.play-config-scroll::-webkit-scrollbar-thumb {
  background: #3f3d38;
  border-radius: 10px;
}

.play-config-scroll::-webkit-scrollbar-thumb:hover {
  background: #54514a;
}

.play-config-scroll::-webkit-scrollbar-button {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
}

.play-config-scroll::-webkit-scrollbar-button:single-button,
.play-config-scroll::-webkit-scrollbar-button:vertical:decrement,
.play-config-scroll::-webkit-scrollbar-button:vertical:increment,
.play-config-scroll::-webkit-scrollbar-button:horizontal:decrement,
.play-config-scroll::-webkit-scrollbar-button:horizontal:increment {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
}

.play-config-scroll::-webkit-scrollbar-button:start:decrement,
.play-config-scroll::-webkit-scrollbar-button:end:increment,
.play-config-scroll::-webkit-scrollbar-button:start:increment,
.play-config-scroll::-webkit-scrollbar-button:end:decrement {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
}

.play-start-wrap {
  flex: 0 0 auto;
  padding: 12px 24px 16px;
  background: #262522;
  border-top: none;
  position: relative;
  z-index: 2;
}

.play-panel-title {
  font-size: 40px;
  line-height: 1;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  text-align: center;
}

.play-mode-btn {
  width: 100%;
  min-height: 95px;
  border: none;
  border-radius: 14px;
  background: #33322f;
  color: #fff;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 20px;
}

.play-mode-btn:hover {
  background: #45433f;
  transform: translateY(-1px);
}

.play-mode-label {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.05;
}

.play-mode-desc {
  margin: 0;
  color: #c8c8c8;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  padding: 0;
}

.play-time-heading {
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  text-align: center;
}

.play-time-heading.play-time-heading-bot {
  text-align: left;
}

.play-bot-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-choice-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.side-choice-btn {
  width: 46px;
  height: 42px;
  min-height: 0;
  padding: 0;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid #4a4741;
  background: rgba(248, 248, 248, 0.9);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.side-choice-btn[data-side="black"] {
  background: rgba(43, 43, 43, 0.9);
}

.side-choice-btn.selected {
  border-color: #7bc043;
  box-shadow: 0 0 0 2px rgba(123, 192, 67, 0.22) inset;
}

.side-choice-btn:hover {
  background: #403d37;
}

.side-choice-btn[data-side="white"]:hover {
  background: rgba(255, 255, 255, 0.95);
}

.side-choice-btn[data-side="black"]:hover {
  background: rgba(58, 58, 58, 0.95);
}

.board-editor-layout {
  gap: 24px;
  width: 100%;
  align-items: flex-start;
  justify-content: flex-start;
}

.board-editor-panel-wrap {
  padding: 0 !important;
  align-self: flex-start;
  justify-content: flex-start !important;
  display: flex;
  flex-direction: column;
  margin: 0 !important;
}

.board-editor-layout .center-board,
.board-editor-layout .right-panel {
  align-self: flex-start;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.board-editor-layout .center-board {
  margin-top: 0 !important;
}

#editor-board .square-55d63.holding .piece-417db {
  transform: scale(1.25) !important;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1)) drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

.be-editor-wait-drag #editor-board .square-55d63.holding .piece-417db {
  display: block !important;
}

.be-editor-wait-drag > img.piece-417db {
  opacity: 0 !important;
}

.be-editor-dragging > img.piece-417db {
  transform: scale(1.25) !important;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1)) drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

.board-editor-panel-shell {
  width: 540px;
  margin-top: 0 !important;
}

.board-editor-panel-box {
  gap: 14px;
}

.board-editor-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  justify-items: center;
}

.board-editor-action-btn {
  width: 100%;
  min-height: 52px;
}

#be-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.board-editor-cols-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: end;
  width: 100%;
}

.board-editor-col-label {
  color: #bababa;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  justify-self: center;
}

.board-editor-col-label-right {
  width: 132px;
  justify-self: end;
  text-align: center;
}

.board-editor-side-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.board-editor-castle-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  width: 132px;
  justify-self: end;
  justify-content: center;
}

.board-editor-castle-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d9d9d9;
  font-size: 14px;
  font-weight: 700;
}

.board-editor-castle-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1.5px solid #8f8f8f;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.board-editor-castle-item input[type="checkbox"]::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.85);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.board-editor-castle-item input[type="checkbox"]:checked {
  background: #7bc043;
  border-color: #7bc043;
}

.board-editor-castle-item input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
  animation: be-check-pop 300ms ease-out;
}

.board-editor-castle-item input[type="checkbox"].be-castle-reject::after {
  opacity: 1;
  animation: be-check-reject 170ms ease-out;
}

@keyframes be-check-pop {
  0% {
    opacity: 0;
    transform: rotate(45deg) scale(0.55);
  }
  55% {
    opacity: 1;
    transform: rotate(45deg) scale(1.2);
  }
  100% {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
}

.board-editor-side-btn {
  width: 46px;
  height: 42px;
  border-radius: 10px;
  font-size: 0;
  font-weight: 800;
  justify-self: center;
}

.board-editor-piece-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #2f2e2b;
  border: 1px solid #4a4741;
  border-radius: 12px;
  padding: 10px;
}

.board-editor-piece-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  align-items: center;
}

.board-editor-tool-btn {
  width: 100%;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  box-sizing: border-box;
}

.board-editor-tool-btn:hover {
  border-color: transparent !important;
  box-shadow: none !important;
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateY(-1px);
}

.board-editor-tool-btn.selected {
  border-color: #7bc043 !important;
  box-shadow: 0 0 0 1px rgba(123, 192, 67, 0.55) inset !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.board-editor-tool-btn:focus,
.board-editor-tool-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

@keyframes be-check-reject {
  0% {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
  70% {
    opacity: 0.65;
    transform: rotate(45deg) scale(0.72);
  }
  100% {
    opacity: 0;
    transform: rotate(45deg) scale(0.45);
  }
}

.board-editor-tool-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.board-editor-tool-icon-reset {
  width: 34px;
  height: 34px;
}

.play-dragging > img.piece-417db {
  transform: scale(1.25) !important;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1)) drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

.board-editor-piece-btn {
  width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.board-editor-piece-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.board-editor-piece-btn.selected {
  border-color: #7bc043;
  box-shadow: 0 0 0 1px rgba(123, 192, 67, 0.55) inset;
  background: rgba(255, 255, 255, 0.08);
}

.board-editor-piece-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.be-trash-emoji {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.be-trash-emoji svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: scaleX(1.55);
  transform-origin: center;
}

#be-clear-btn {
  gap: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.board-editor-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.board-editor-history-wrap {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.board-editor-history-row {
  display: flex;
  gap: 6px;
}

.board-editor-mini-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #d8d8d8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.board-editor-mini-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.board-editor-mini-btn:active {
  transform: translateY(0);
}

.board-editor-mini-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  margin: auto;
}

.board-editor-mini-icon-redo {
  transform: scaleX(-1);
}

.board-editor-done-btn {
  min-height: 52px;
  font-size: 22px;
}

.side-choice-king {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.side-choice-king-black {
  filter: drop-shadow(0.8px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(-0.4px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 0.8px 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 -0.4px 0 rgba(255, 255, 255, 0.5));
}

.side-choice-random {
  background: linear-gradient(90deg, rgba(248, 248, 248, 0.9) 0%, rgba(248, 248, 248, 0.9) 50%, rgba(43, 43, 43, 0.9) 50%, rgba(43, 43, 43, 0.9) 100%);
}

.side-choice-random:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.95) 50%, rgba(58, 58, 58, 0.95) 50%, rgba(58, 58, 58, 0.95) 100%);
}

.side-random-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-random-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  margin: auto;
  transform: translateY(1px) scale(1.2);
  transform-origin: center;
}

.bot-dd-trigger {
  min-height: 56px;
}

.difficulty-list {
  margin-top: -4px;
}

.bot-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bot-level-btn {
  min-height: 44px;
  border-radius: 11px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.bot-level-btn:hover {
  background: #403d37;
}

.bot-level-btn.selected {
  border-color: #7bc043;
  box-shadow: 0 0 0 2px rgba(123, 192, 67, 0.2) inset;
}

.time-dropdown-trigger {
  width: 100%;
  min-height: 62px;
  border-radius: 12px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  display: block;
  position: relative;
}

.time-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 16px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  transition: transform 0.18s ease;
}

.time-caret svg {
  width: 100%;
  height: 100%;
  display: block;
}

.time-caret.open {
  transform: translateY(-50%) rotate(180deg);
}

.time-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.time-list.dd-open {
  opacity: 1;
  transform: translateY(0);
}

.time-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.time-preset-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-preset-title {
  color: #ffffff;
  font-size: 16px;
  text-align: left;
  font-weight: 700;
}

.time-preset-btn {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  padding: 6px 10px;
}

.time-preset-btn:hover {
  background: #403d37;
}

.time-preset-btn.selected {
  border-color: #7bc043;
  box-shadow: 0 0 0 2px rgba(123, 192, 67, 0.2) inset;
}

.time-custom-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 12px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.time-custom-btn:hover {
  background: #45433f;
}

.time-custom-btn.selected {
  border-color: #7bc043;
  box-shadow: 0 0 0 2px rgba(123, 192, 67, 0.2) inset;
}

.custom-time-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.custom-time-field {
  width: 96px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #555148;
  background: #2f2d29;
  color: #ffffff;
  padding: 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.custom-time-sep {
  color: #d1d1d1;
  font-size: 16px;
  font-weight: 600;
}

.play-start-btn {
  width: 100%;
  min-width: 0;
  align-self: stretch;
  margin-top: 4px;
  padding: 16px 20px;
  font-size: 20px;
  font-weight: 900;
}

.game-side-panel {
  flex: 0 0 220px;
  padding: 0 0 0 6px;
  justify-content: flex-start;
  align-items: stretch;
}

.game-timer-stack {
  width: 100%;
  height: 570px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.game-timer-box {
  width: 100%;
  height: 82px;
  border-radius: 6px;
  background: #a5a5a5;
  border: 1px solid #b9b9b9;
  color: #555555;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-timer-box {
  width: 142px;
  height: 36px;
  font-size: 20px;
  flex: 0 0 auto;
}

.capture-strip {
  min-height: 24px;
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  overflow: hidden;
}

.capture-piece-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.capture-piece-img.capture-piece-tight {
  margin-left: -16px;
}

.capture-strip.has-lead::after {
  content: attr(data-lead);
  margin-left: 6px;
  color: #d7d7d7;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  align-self: flex-end;
  padding-bottom: 2px;
}

.game-timer-black {
  background: #2a2a2a;
  border-color: #4a4a4a;
  color: #f2f2f2;
}

.game-timer-white {
  background: #e6e6e6;
  border-color: #f0f0f0;
  color: #363636;
}

.game-timer-white.game-timer-active {
  background: #f8f8f8;
  border-color: #ffffff;
  color: #1f1f1f;
}

.game-timer-active {
  opacity: 1;
  box-shadow: none;
}

.game-timer-inactive {
  opacity: 0.6;
}

.game-timer-danger {
  background: #8e2323;
  border-color: #bf3a3a;
  color: #fff0f0;
}

.game-timer-white.game-timer-danger,
.game-timer-black.game-timer-danger,
.game-timer-box.game-timer-danger {
  background: #8e2323;
  border-color: #bf3a3a;
  color: #fff0f0;
}

.game-result-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 15;
}

.game-result-card {
  width: min(392px, 92%);
  background: #24221f;
  border: 1px solid #3b3832;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.game-result-head {
  background: #3a3834;
  padding: 14px 20px 12px;
  position: relative;
  text-align: center;
}

.game-result-close-btn {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #d0d0d0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.game-result-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.game-result-trophy {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 34px;
  line-height: 1;
}

.ba-result-trophy-left {
  left: 6px;
}

.game-result-title {
  color: #ffffff;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.05;
}

.game-result-subtitle {
  color: #d7d7d7;
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
}

.game-result-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-result-review-btn {
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #87c856 0%, #6aab3a 100%);
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.game-result-review-btn:hover {
  background: linear-gradient(180deg, #97d864 0%, #74b642 100%);
  transform: translateY(-1px);
}

.game-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.game-result-small-btn {
  min-height: 52px;
  border-radius: 10px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.game-result-small-btn:hover {
  background: linear-gradient(180deg, #4f4b43 0%, #3d3932 100%);
  transform: translateY(-1px);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
}

.settings-card {
  width: min(392px, 92vw);
  background: #24221f;
  border: 1px solid #3b3832;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.settings-head {
  background: #3a3834;
}

.settings-title {
  font-size: 30px;
}

.settings-body {
  padding: 18px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-label {
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

.settings-switch {
  --settings-switch-pos: 0;
  width: 108px;
  height: 46px;
  border: 1px solid #6f6f6f;
  border-radius: 999px;
  background: linear-gradient(180deg, #74b642 0%, #97d864 100%);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.settings-switch.on {
  border-color: #6f6f6f;
}

.settings-switch::before {
  content: '';
  position: absolute;
  left: calc(24px + (var(--settings-switch-pos) * 62px));
  top: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(180deg, #7a7a7a 0%, #909090 100%);
  transition: left 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-switch-knob {
  position: absolute;
  top: 0px;
  left: 1px;
  width: 45px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: translateX(calc(var(--settings-switch-pos) * 62px));
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-switch.dragging .settings-switch-knob {
  transition: none;
}

.settings-switch.dragging::before {
  transition: none;
}

.game-meta-panel {
  flex: 0 0 360px;
  padding: 36px 0 0;
  align-items: stretch;
  justify-content: flex-start;
}

.game-screen-layout {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 24px;
}

.move-panel-shell {
  width: 100%;
  max-width: 360px;
}

.move-panel-head {
  background: #1f1e1b;
  border-radius: 14px 14px 0 0;
  padding: 14px 16px;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
}

.move-panel-box {
  background: #262522;
  border-radius: 0 0 14px 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 514px;
}

.move-list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  border-radius: 10px;
}

.move-list-body::-webkit-scrollbar {
  width: 10px;
}

.move-list-body::-webkit-scrollbar-track {
  background: #1f1e1b;
}

.move-list-body::-webkit-scrollbar-thumb {
  background: #3f3d38;
  border-radius: 10px;
}

.move-list-body::-webkit-scrollbar-thumb:hover {
  background: #54514a;
}

.move-list-body::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

.move-list-body::-webkit-scrollbar-button:single-button,
.move-list-body::-webkit-scrollbar-button:vertical:decrement,
.move-list-body::-webkit-scrollbar-button:vertical:increment {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

.move-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 58px;
  align-items: center;
  min-height: 36px;
  padding: 0 8px;
  gap: 6px;
}

.move-row.row-dark {
  background: #2c2b28;
}

.move-row.row-light {
  background: #35332f;
}

.move-num {
  color: #cfcfcf;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  align-self: center;
  padding-bottom: 0;
}

.move-cell {
  min-height: 28px;
  padding: 3px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  color: #ececec;
  width: fit-content;
  max-width: 100%;
}

.move-cell-clickable {
  cursor: pointer;
}

.move-cell-clickable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.move-main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.move-cell.latest {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 4px;
}

.move-piece-icon {
  width: 19px;
  height: 19px;
  object-fit: contain;
  align-self: center;
}

.move-piece-icon[src*="/black/"] {
  filter: drop-shadow(0.8px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(-0.4px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 0.8px 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 -0.4px 0 rgba(255, 255, 255, 0.5));
}

.move-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.move-time-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 62px;
}

.move-time-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 11px;
}

.move-time-line.empty {
  visibility: hidden;
}

.move-time-track {
  width: 36px;
  height: 9px;
  border-radius: 3px;
  background: transparent;
  overflow: visible;
  display: flex;
  justify-content: flex-end;
}

.move-time-fill {
  height: 100%;
  border-radius: 2px;
  margin-left: auto;
}

.move-time-fill.white {
  background: #f1f1f1;
}

.move-time-fill.black {
  background: #8f8f8f;
}

.move-time-text {
  font-size: 12px;
  color: #e0e0e0;
  line-height: 1;
  min-width: 28px;
  text-align: right;
}

.move-panel-actions {
  display: flex;
  justify-content: flex-start;
  position: relative;
}

.move-panel-btn {
  min-height: 40px;
  border-radius: 9px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

.move-panel-btn:hover {
  background: linear-gradient(180deg, #4f4b43 0%, #3d3932 100%);
}

.move-panel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.move-panel-review-btn {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(180deg, #87c856 0%, #6aab3a 100%);
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
}

.move-panel-review-btn:hover {
  background: linear-gradient(180deg, #97d864 0%, #74b642 100%);
}

.review-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.review-ctrl-btn {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #dcdcdc;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 0 rgba(0, 0, 0, 0.45);
}

.review-ctrl-icon {
  width: 31px;
  height: 31px;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

.review-ctrl-btn:hover {
  background: linear-gradient(180deg, #4f4b43 0%, #3d3932 100%);
  color: #ffffff;
}

.review-ctrl-btn:disabled {
  background: #3a3936;
  color: #8a8a8a;
  border-color: #4a4945;
  cursor: default;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 0 rgba(0, 0, 0, 0.3);
}

.review-ctrl-btn:disabled .review-ctrl-icon {
  opacity: 0.5;
  filter: grayscale(0.15);
}

.resign-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 220px;
  background: #2c2a26;
  border: 1px solid #4a4741;
  border-radius: 10px;
  padding: 10px;
  z-index: 6;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.resign-popover-text {
  color: #e9e9e9;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.resign-popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.resign-popover-no {
  min-height: 34px;
  font-size: 14px;
}

.resign-popover-yes {
  min-height: 34px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #87c856 0%, #6aab3a 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.resign-popover-yes:hover {
  background: linear-gradient(180deg, #97d864 0%, #74b642 100%);
}

.review-screen-layout {
  gap: 16px;
}

.review-panel-wrap {
  padding-top: 44px;
  flex: 0 0 360px;
  text-align: left;
}

.review-shell {
  width: 100%;
  max-width: 360px;
}

.review-head {
  background: #1f1e1b;
  border-radius: 14px 14px 0 0;
  padding: 14px 16px;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
}

.review-box {
  background: #262522;
  border-radius: 0 0 14px 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.review-box::-webkit-scrollbar {
  width: 10px;
}

.review-box::-webkit-scrollbar-track {
  background: #1f1e1b;
}

.review-box::-webkit-scrollbar-thumb {
  background: #3f3d38;
  border-radius: 10px;
}

.review-box::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

.review-box::-webkit-scrollbar-button:single-button,
.review-box::-webkit-scrollbar-button:vertical:decrement,
.review-box::-webkit-scrollbar-button:vertical:increment {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

.review-side-actions,
.start-review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.review-side-actions .game-result-small-btn,
.start-review-actions .game-result-small-btn {
  min-height: 18px;
  height: 42px;
}

.review-accuracy-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  column-gap: 34px;
  align-items: center;
}

.review-accuracy-label {
  color: #efefef;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
}

.review-acc-box {
  height: 42px;
  border-radius: 8px;
  border: 1px solid #4e4a44;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
}

.review-acc-white {
  background: #f0f0f0;
  color: #202020;
  transform: translateX(-8px);
}

.review-acc-black {
  background: #33322f;
  color: #f1f1f1;
}

.review-sep {
  height: 1px;
  min-height: 1px;
  background: #5b5850;
  opacity: 1;
  margin: 2px 0 4px;
  flex: 0 0 auto;
}

.review-class-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.review-class-row {
  display: grid;
  grid-template-columns: 1fr 44px 28px 44px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.review-class-label {
  color: #ebebeb;
  font-size: 22px;
  font-weight: 700;
}

.review-class-count {
  font-size: 34px;
  font-weight: 800;
  text-align: center;
  line-height: 1;
}

.review-class-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-status {
  margin-top: auto;
  color: #bdbdbd;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.review-timer-row {
  justify-content: flex-end;
}

.review-box {
  height: 514px;
  overflow-y: auto;
}

.review-accuracy-label {
  font-size: 18px;
  font-weight: 600;
}

.review-acc-box {
  height: 48px;
  font-size: 24px;
}

.review-class-row {
  min-height: 24px;
  grid-template-columns: 1fr 80px 24px 80px;
  column-gap: 34px;
}

.review-class-label {
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.review-class-count {
  font-size: 20px;
  font-weight: 700;
  justify-self: center;
  text-align: center;
}

.review-class-count-white {
  transform: translateX(-8px);
}

.review-class-icon {
  width: 22px;
  height: 22px;
  font-size: 12px;
  justify-self: center;
}

.review-start-btn {
  min-height: 52px;
  font-size: 24px;
  margin-top: -1px;
}

.review-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.review-sub-btn {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #4a4741;
  background: #33322f;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.review-sub-btn:hover {
  background: linear-gradient(180deg, #4f4b43 0%, #3d3932 100%);
}

/* Final alignment override: keep number columns perfectly perpendicular to accuracy boxes */
.review-box {
  --review-white-col: 80px;
  --review-mid-col: 18px;
  --review-black-col: 80px;
  --review-gap: 8px;
  overflow-x: hidden;
}

.review-accuracy-row {
  grid-template-columns: 1fr var(--review-white-col) var(--review-mid-col) var(--review-black-col);
  column-gap: var(--review-gap);
}

.review-accuracy-row #review-acc-white {
  grid-column: 2;
  transform: none;
}

.review-accuracy-row #review-acc-black {
  grid-column: 4;
}

.review-class-row {
  grid-template-columns: 1fr var(--review-white-col) var(--review-mid-col) var(--review-black-col);
  column-gap: var(--review-gap);
}

.review-class-icon {
  grid-column: 3;
  justify-self: center;
}

.review-class-icon-excellent {
  color: #ffffff;
  transform: scaleX(-1) !important;
}

.review-box {
  height: 504px;
}

.review-class-count {
  justify-self: center;
  text-align: center;
}

.review-class-count-white,
.review-class-count-black {
  transform: none;
}

.start-review-layout {
  gap: 24px;
}

.start-review-board-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.sr-eval-wrap {
  width: 28px;
  background: #1f1e1b;
  border-radius: 4px;
  padding: 6px;
  display: flex;
}

.sr-eval-bar {
  position: relative;
  width: 100%;
  height: 570px;
  background: #2f2d2a;
  border-radius: 2px;
  overflow: hidden;
}

.sr-eval-white {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 50%;
  background: #efefef;
}

.start-review-head {
  background: #1f1e1b;
  border-radius: 14px 14px 0 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  padding: 0 8px;
}

.start-review-back-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-review-back-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.start-review-back-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.start-review-title {
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  text-align: left;
}

.start-review-panel-box {
  border-radius: 0 0 14px 14px;
}

.start-review-list {
  padding-bottom: 2px;
}

.start-review-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  align-items: center;
  min-height: 36px;
  padding: 0 8px;
  gap: 6px;
}

.start-review-cell {
  min-height: 28px;
  padding: 3px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  color: #ececec;
}

.start-review-cell-clickable {
  cursor: pointer;
}

.start-review-cell-clickable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.start-review-main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.start-review-piece {
  width: 19px;
  height: 19px;
  object-fit: contain;
  align-self: center;
}

.start-review-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.start-review-mark-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-review-cell-marked {
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: color-mix(in srgb, var(--sr-mark, #6aab3a) 23%, transparent);
}

.start-review-cell-current {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.start-review-empty {
  padding: 14px;
  color: #d3d3d3;
  font-size: 15px;
}

.sr-board-emoji {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  z-index: 8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.sr-board-emoji-excellent {
  transform: scaleX(-1) !important;
}

.sr-board-emoji-top-rank {
  top: 2px;
}

.sr-board-emoji-h-file {
  right: 2px;
}

.move-result-row,
.start-review-result-row {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #e6e6e6;
  font-size: 16px;
  font-weight: 700;
  background: transparent;
}

/* Start Review visual overrides */
.start-review-head {
  grid-template-columns: 46px 1fr 46px;
}

.start-review-head-spacer {
  width: 36px;
  height: 36px;
}

.start-review-title {
  font-size: 24px;
  text-align: center;
}

.start-review-row {
  grid-template-columns: 36px 1fr 1fr 58px;
}

.start-review-row.row-dark {
  background: #2c2b28;
}

.start-review-row.row-light {
  background: #35332f;
}

.start-review-cell {
  align-items: center;
}

.start-review-main {
  align-items: center;
}

.start-review-cell-marked {
  border: none;
  background: transparent;
}

.start-review-cell.latest {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 4px;
}

.sr-eval-wrap {
  width: 18px;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.sr-eval-bar {
  border-radius: 0;
  background: #262522;
}

.sr-eval-white {
  transition: height 180ms linear;
}

.start-review-back-icon {
  filter: brightness(0) invert(1);
}

/* Start Review tune-ups */
.sr-eval-wrap {
  width: 27px;
}

.start-review-layout .game-meta-panel {
  padding-top: 44px;
}

.start-review-piece {
  filter: none;
}

.start-review-piece[src*="/black/"] {
  filter: drop-shadow(0.8px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(-0.4px 0 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 0.8px 0 rgba(255, 255, 255, 0.5))
          drop-shadow(0 -0.4px 0 rgba(255, 255, 255, 0.5));
}

/* Start capture strips at board edge (rook file), not from eval-bar edge */
.start-review-layout .board-timer-row .capture-strip {
  margin-left: 37px;
}

.start-review-board-host {
  position: relative;
  width: 570px;
  height: 570px;
}

.sr-best-arrow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

#board .square-55d63.king-check-alert,
#start-review-board .square-55d63.king-check-alert,
#ba-board .square-55d63.king-check-alert {
  position: relative;
  isolation: isolate;
}

#board .square-55d63.king-check-alert::after,
#start-review-board .square-55d63.king-check-alert::after,
#ba-board .square-55d63.king-check-alert::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #EF483B;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: kingCheckOverlayPulse 750ms linear 1;
}

#board .piece-417db.king-check-piece-alert,
#board [data-piece].king-check-piece-alert,
#start-review-board .piece-417db.king-check-piece-alert,
#start-review-board [data-piece].king-check-piece-alert,
#ba-board .piece-417db.king-check-piece-alert,
#ba-board [data-piece].king-check-piece-alert {
  animation: kingCheckPiecePulse 750ms linear 1;
  transform-origin: center;
  position: relative;
  z-index: 2;
}

@keyframes kingCheckOverlayPulse {
  0% { opacity: 0; }
  20% { opacity: 1; }
  40% { opacity: 0.75; }
  60% { opacity: 0.5; }
  80% { opacity: 0.25; }
  100% { opacity: 0; }
}

@keyframes kingCheckPiecePulse {
  0% { transform: scale(1); }
  20% { transform: scale(1.2); }
  40% { transform: scale(1.15); }
  60% { transform: scale(1.1); }
  80% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

#board .square-55d63.game-end-win-square,
#board .square-55d63.game-end-lose-square,
#board .square-55d63.game-end-draw-square,
#start-review-board .square-55d63.game-end-win-square,
#start-review-board .square-55d63.game-end-lose-square,
#start-review-board .square-55d63.game-end-draw-square,
#ba-board .square-55d63.game-end-win-square,
#ba-board .square-55d63.game-end-lose-square,
#ba-board .square-55d63.game-end-draw-square {
  position: relative;
  isolation: isolate;
}

#board .square-55d63.game-end-win-square::after,
#board .square-55d63.game-end-lose-square::after,
#board .square-55d63.game-end-draw-square::after,
#start-review-board .square-55d63.game-end-win-square::after,
#start-review-board .square-55d63.game-end-lose-square::after,
#start-review-board .square-55d63.game-end-draw-square::after,
#ba-board .square-55d63.game-end-win-square::after,
#ba-board .square-55d63.game-end-lose-square::after,
#ba-board .square-55d63.game-end-draw-square::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: boardEndSquarePulse 1100ms ease-in-out 1;
}

#board .square-55d63.game-end-win-square::after,
#start-review-board .square-55d63.game-end-win-square::after,
#ba-board .square-55d63.game-end-win-square::after {
  background: #8fcf62;
}

#board .square-55d63.game-end-lose-square::after,
#start-review-board .square-55d63.game-end-lose-square::after,
#ba-board .square-55d63.game-end-lose-square::after {
  background: #EF483B;
}

#board .square-55d63.game-end-draw-square::after,
#start-review-board .square-55d63.game-end-draw-square::after,
#ba-board .square-55d63.game-end-draw-square::after {
  background: #8d8d8d;
}

#board .piece-417db.game-end-win-piece,
#board [data-piece].game-end-win-piece,
#board .piece-417db.game-end-lose-piece,
#board [data-piece].game-end-lose-piece,
#board .piece-417db.game-end-draw-piece,
#board [data-piece].game-end-draw-piece,
#start-review-board .piece-417db.game-end-win-piece,
#start-review-board [data-piece].game-end-win-piece,
#start-review-board .piece-417db.game-end-lose-piece,
#start-review-board [data-piece].game-end-lose-piece,
#start-review-board .piece-417db.game-end-draw-piece,
#start-review-board [data-piece].game-end-draw-piece,
#ba-board .piece-417db.game-end-win-piece,
#ba-board [data-piece].game-end-win-piece,
#ba-board .piece-417db.game-end-lose-piece,
#ba-board [data-piece].game-end-lose-piece,
#ba-board .piece-417db.game-end-draw-piece,
#ba-board [data-piece].game-end-draw-piece {
  position: relative;
  z-index: 2;
  transform-origin: center;
  animation: boardEndKingPulse 1100ms ease-in-out 1;
}

.board-end-emoji {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  z-index: 8;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

#board .square-55d63.board-end-emoji-host,
#start-review-board .square-55d63.board-end-emoji-host,
#ba-board .square-55d63.board-end-emoji-host {
  position: relative;
  overflow: visible;
  z-index: 9;
}

.board-end-emoji-win {
  background: #8fcf62;
}

.board-end-emoji-lose {
  background: #e53b3b;
}

.board-end-emoji-draw {
  background: #1f1f1f;
  color: #ffffff;
}

.board-end-emoji svg {
  width: 16px;
  height: 16px;
  display: block;
}

.board-end-badge-img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

.board-end-badge-img-flag {
  filter: none;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  mix-blend-mode: screen;
}

.board-end-emoji-flag {
  box-shadow: none;
}

.board-end-badge-img-rotate-left {
  transform: rotate(-90deg);
}

.board-end-emoji-top-rank {
  top: 2px;
}

.board-end-emoji-h-file {
  right: 2px;
}

@keyframes boardEndSquarePulse {
  0% { opacity: 0.18; }
  35% { opacity: 0.95; }
  65% { opacity: 0.55; }
  100% { opacity: 0.18; }
}

@keyframes boardEndKingPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.2); }
  65% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.board-analysis-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.board-analysis-actions .review-ctrl-btn:disabled {
  background: #242424;
  border-color: #333333;
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.board-analysis-redo-icon {
  transform: scaleX(-1);
}

#ba-board .square-55d63.ba-board-badge-host {
  overflow: visible;
}

.ba-board-badge {
  position: absolute;
  right: 6%;
  top: 4%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2f2f2f;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 22;
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.ba-board-badge.ba-badge-right {
  right: 14%;
}

.ba-board-badge.ba-badge-top {
  top: 14%;
}

.ba-board-badge.ba-badge-left {
  right: -2%;
}

.ba-board-badge.ba-badge-bottom {
  top: -6%;
}

.board-analysis-layout .game-meta-panel {
  padding-top: 30px !important;
}

.board-analysis-layout .move-panel-shell {
  margin-top: 0 !important;
}

.board-analysis-layout {
  align-items: flex-start;
}

.board-analysis-layout .center-board,
.board-analysis-layout .game-meta-panel {
  align-self: flex-start;
}

.ba-class-brilliant { background: #2dd4bf !important; color: #ffffff !important; }
.ba-class-great { background: #7fb2e6 !important; color: #ffffff !important; }
.ba-class-best { background: #8bcf44 !important; color: #ffffff !important; }
.ba-class-excellent { background: #8bc34a !important; color: #ffffff !important; }
.ba-class-good { background: #a1c870 !important; color: #ffffff !important; }
.ba-class-inaccuracy { background: #f2c230 !important; color: #ffffff !important; }
.ba-class-mistake { background: #f4a659 !important; color: #ffffff !important; }
.ba-class-miss { background: #f27b68 !important; color: #ffffff !important; }
.ba-class-blunder { background: #f04f47 !important; color: #ffffff !important; }

.ba-text-brilliant { color: #2dd4bf !important; }
.ba-text-great { color: #7fb2e6 !important; }
.ba-text-best { color: #8bcf44 !important; }
.ba-text-excellent { color: #8bc34a !important; }

.start-review-mark-icon.ba-class-excellent,
.ba-board-badge.ba-class-excellent {
  transform: scaleX(1);
}
.ba-text-good { color: #a1c870 !important; }
.ba-text-inaccuracy { color: #f2c230 !important; }
.ba-text-mistake { color: #f4a659 !important; }
.ba-text-miss { color: #f27b68 !important; }
.ba-text-blunder { color: #f04f47 !important; }

.ba-board-badge {
  right: -8px;
  top: -8px;
}

.ba-board-badge.ba-badge-right {
  right: 6px;
}

.ba-board-badge.ba-badge-top {
  top: 6px;
}

.ba-board-badge.ba-badge-left {
  right: -8px;
}

.ba-board-badge.ba-badge-bottom {
  top: -8px;
}

.ba-dragging > img.piece-417db {
  transform: scale(1.3) !important;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1)) drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.35));
}

#ba-board .square-55d63.holding .piece-417db,
#ba-board .square-55d63.holding [data-piece] {
  transform: scale(1.3) !important;
}

#ba-result-overlay {
  background: transparent;
}
