:root {
  --primary: #8cb365;
  --accent: #e2b740;
  --bg: #1e1d1b;
  --grey: #6b7280;
  --border: #484c53;
}
* {
  scrollbar-color: var(--border) transparent;
}
body {
  margin: 0;
  background: var(--bg);
  font-family: "Inter", sans-serif;
  display: flex;
  user-select: none;
  width: 100vw;
  height: 100vh;
}
.board-box{
  position: relative;
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: start;
  gap: 5px;
  padding: 10px 12px;
  height: 93vh;
  width: 50%;
}
.board-header{
  position: relative;
  width: 100%;
  height: 45px;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-bottom: 8px;
  padding: none;
  align-items: center;
}
#board-footer {
  margin-bottom: 0;
  margin-top: 8px;
}
.board-header img {
  height: 100%;
  border-radius: 3px;
}
.board-header-info-text{
  display: flex;
  flex-direction: row;
  gap: 4px;
  height: 50%;
  align-items: center;
}
.board-header-info-text p{
  margin: 0;
}
.board-header-info-text-elo{
  color: var(--grey);
}
.board-header-info-text span{
  border-radius: 4px;
}
.board-header-box-containers{
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: start;
}
.settings-popup{
  position: absolute;
  display: none;
  flex-direction: column;
  position: absolute;
  width: 250px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px 20px;
  justify-content: space-between;
  z-index: 4;
}
.settings-title{
  font-size: 1.3em;
}
.settings-options-container{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.settings-option{
  display: flex;
  justify-content: space-between;
  width: 100%;
}
.exit-settings-button{
  border: 1px solid var(--grey);
  color: var(--grey);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  position: absolute;
  top: 6px;
  right: 6px;
  cursor: pointer;
}
.settings-button {
  position: absolute;
  bottom: 2px;
  right: -28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 3px;
  cursor: pointer;
  color: var(--grey);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flip-button {
  position: absolute;
  bottom: 34px;
  right: -28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 3px;
  cursor: pointer;
  color: var(--grey);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(90deg);
}
.bot-box{
  position: absolute;
  display: flex;
  top: 50%;
  transform: translateY(-50%);
  right: 5%;
  flex-direction: column;
  align-items: center;
  justify-content: start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 10px;
  height: 90%;
  width: 205px;
}
.bot-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.bot-header p {
  margin: 0;
}
.bot-list{
  display: flex;
  flex-direction: column;
  width: 95%;
  padding: 0 3px;
}
#user-bot-list{
  overflow-y: auto;
}
.bots-list{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 4px;
  column-gap: 3px;
  width: 100%;
  align-items: start;
  margin-bottom: 4px;
}
.bot-list-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--grey);
  gap: 5px;
  height: 30px;
  margin-left: 3px;
}
.bot-option{
  border: 2px solid var(--border);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: flex;
  position: relative;
}
.bot-option.selected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.711);
  z-index: 1;
  border-radius: 6px;
}
.bot-option .fa-regular.fa-circle-xmark{
  display: none;
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary);
  font-size: 1.8em;
}
.bot-option#bot-add{
  border: 2px dashed var(--border);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.bot-option#bot-add i, .bot-option#bot-add p{
  color: var(--grey);
  margin: 0;
}
.bot-option img{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  justify-self: flex-end;
}
.bots-list-hyrax{
  display: flex;
  width: 100%;
  margin-bottom: 4px;
}
.bot-option-hyrax{
  display: flex;
  flex-direction: row;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 8px;
  align-items: center;
  cursor: pointer;
  padding: 6px 0;
}
.bot-option-hyrax img{
  height: 55px;
  aspect-ratio: 1/1;
}
.bot-option-hyrax .title-slider{
  width: calc(100% - 62px);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: default;
}
.bot-option-hyrax .title-slider p{
  margin: 0;
}
.bot-option-hyrax .slider{
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 50%;
}
.bot-option-hyrax .slider #valueInput{
  width: 35px;
}
.bot-option-hyrax .slider #slider {
  width: calc(100% - 35px);
}
#slider {
  --val: 1800;
  --min: 500;
  --max: 3000;

  --range: calc(var(--max) - var(--min));
  --pct: calc((var(--val) - var(--min)) / var(--range) * 100%);

  width: 150px;
  appearance: none;
  background: transparent;
}
#slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary) 0%, var(--accent) var(--pct), var(--border) var(--pct), var(--border) 100%);
}
#slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--accent);
  margin-top: -5px;
}
.slider #valueInput {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 10px;
  font-size: 1em;
  background: var(--bg);
  margin-bottom: 4px;
  text-align: center;
  height: 8px;
  color: var(--primary);
}
.slider #valueInput::-webkit-inner-spin-button,
.slider #valueInput::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.move-history-box {
  position: absolute;
  display: none;
  top: 50%;
  transform: translateY(-50%);
  right: 5%;
  flex-direction: column;
  align-items: start;
  justify-content: start;
  gap: 15px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  height: 90%;
  width: 210px;
}
.move-history-header {
  font-size: 14px;
  margin-top: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--grey);
}
.move-table-container{
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
}
.move-history-table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 14px;
}
.move-history-table td {
  padding: 8px 5px;
  font-weight: bold;
}
.move-history-table td.move-number {
  color: var(--grey);
  width: 20px;
  font-weight: normal;
}
.move-history-table td.move-cell {
  width: 60px;
}
.selected-move {
  background-color: var(--border);
  border: 1px solid var(--grey);
  border-bottom: 2px solid var(--grey);
  border-radius: 6px;
  box-sizing: border-box;
}
.add-bot-popup {
  display: none;
  width: 25vw;
  z-index: 3000;
  background: var(--bg);
}
.add-bot-popup.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 15px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.popup-overlay{
  display: none;
}
.popup-overlay.active {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2999;
  backdrop-filter: blur(2px);
}
.add-bot-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 20px;
  margin-bottom: 15px;
  position: relative;
}
.exit-popup-button{
  border: 1px solid var(--border);
  border-radius: 20%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  position: absolute;
  right: 0;
}
.exit-popup-button:hover{
  cursor: pointer;
}
#input-button-custom-bot{
  width: 100%;
  background-color: var(--primary);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  height: 40px;
}
#input-button-custom-bot:hover{
  cursor: pointer;
}
.sources-container{
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center; 
  justify-content: center;
  width: 100%;
}
.source-option{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  width: 100%;
  position: relative;
}
.source-option .fide-warning{
  display: none;
  position: absolute;
  top: -36px;
  right: 50%;
  transform: translateX(50%);
  background-color: var(--bg);
  padding: 2px 2px;
  color: var(--primary);
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.8em;
  height: 25px;
  width: 90px;
  align-items: center;
  justify-content: center;
}
.source-option.selected{
  border: 1px solid var(--primary);
  cursor: default;
  pointer-events: none;
}
#source-fide:hover .fide-warning{
  display: flex;
}
.source-option img{
  height: 35px;
}
.input-bot-pseudo{
  width: 100%;
}
.input-box-bot-pseudo{
  width: 100%;
}
.input-box-bot-pseudo input{
  all: unset;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  height: 45px;
  font-size: 1em;
  padding: 0 10px;
  color: var(--grey);
}
.legal-move-dot {
  position: relative;
}
.legal-move-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  pointer-events: none;
}
.legal-capture-ring {
  position: relative;
}
.legal-capture-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border: 5px solid rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  background: var(--border);
  position: relative;
  transition: background 300ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: var(--grey);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22),
              0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
              width 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toggle-switch input:checked ~ .toggle-track::after {
  transform: translateX(20px);
}
.toggle-switch:active .toggle-track::after {
  width: 22px;
}
.toggle-switch:active input:checked ~ .toggle-track::after {
  transform: translateX(16px);
  width: 22px;
}
.toggle-green input:checked ~ .toggle-track {
  background: var(--primary);
}
.toggle-switch input:checked ~ .toggle-track::after {
  background: var(--border);
}
.board-with-eval-container {
  position: relative;
  display: block;
  height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
#eval-bar-container {
  position: absolute;
  left: -28px;
  top: 0;
  bottom: 0;
  width: 22px;
  background-color: #333;
  border-radius: 4px;
  overflow: hidden;
  display: none;
}
#eval-bar-fill {
  width: 100%;
  height: 50%;
  background-color: #fff;
  position: absolute;
  bottom: 0;
  transition: height 0.5s ease-in-out;
}
#eval-bar-text {
  position: absolute;
  width: 100%;
  text-align: center;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  mix-blend-mode: difference;
  pointer-events: none;
}
.board-column-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  width: min(calc(50vw - 24px), calc(95vh - 126px));
  margin: 0;
  align-items: center;
  justify-content: center;
}
#board{
  width: 100%;
  height: 100%;
  display: block;
}
.select-player-popup{
  display: none;
}
#board.nothoverable ~ .select-player-popup {
  display: flex;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  text-align: center;
  padding: 0 5px;
}
.annotation-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.board-capture-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
}
.board-discarded-pieces {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
}
.captured-piece-stack {
  position: relative;
  width: 25px;
  height: 25px;
  flex-shrink: 0;
}
.captured-piece-image {
  position: absolute;
  left: 0;
  width: 25px;
  height: 25px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.board-material-advantage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  color: var(--primary, #8cb365);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  user-select: none;
}
.board-material-advantage:not(.has-advantage) {
  display: none;
}
.move-history-legend{
  position: absolute;
  align-self: center;
  bottom: 5px;
  padding: 0 15px;
  border-radius: 8px;
}
.move-history-likely{
  display: flex;
  flex-direction: column;
}
.move-history-likely p{
  font-size: .8em;
  color: #fff;
  margin: 0;
}
.arrow-container {
  width: 100%;
}
.arrow-svg {
  display: block;
  width: 100%;
  height: auto;
}
.arrow-shaft {
  stroke: var(--grey);
  stroke-width: 4;
  stroke-linecap: round;
}
#arrow-shaft-green{
  stroke: var(--primary);
}
.arrow-head {
  fill: var(--grey);
}
#arrow-head-green{
  fill: var(--primary);
}
.remove-bot-button{
  display: none;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 10px;
  border: 1px solid var(--border);
  color: var(--grey);
  margin: 0;
  line-height: 1;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  cursor: pointer;
}

#board {
  position: relative;
}
#game-over-popup {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 21, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  border-radius: 4px;
  animation: gameover-fade-in 0.25s ease-out;
}
@keyframes gameover-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
#game-over-card {
  background: var(--bg);
  color: var(--grey);
  border-radius: 10px;
  padding: 24px 32px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  max-width: 80%;
}
#game-over-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px 0;
}
#game-over-title.win { color: var(--primary); }
#game-over-title.loss { color: var(--primary); }
#game-over-title.draw { color: var(--primary); }
#game-over-detail {
  font-size: 14px;
  margin: 0 0 18px 0;
  color: var(--grey);
}
#game-over-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}
#game-over-new-btn {
  background: var(--primary);
  color: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}
#game-over-review-btn {
  background: var(--bg);
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}