body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0a0a0a;
  margin: 0;
  padding: 20px;
  color: #fff;
}
#status {
  font-size: 22px;
  margin: 15px 0;
  font-weight: bold;
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.7);
}
#chessboard {
  display: grid;
  grid-template-columns: repeat(8, 60px);
  grid-template-rows: repeat(8, 60px);
  border: 3px solid #555;
  box-shadow: 0 0 20px rgba(200, 0, 0, 0.6);
  position: relative;
}
.square {
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 40px;
  cursor: pointer;
  position: relative;
  z-index: 2;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS",
    sans-serif;
}
.white {
  background-color: #f0d9b5;
}
.black {
  background-color: #b58863;
}
.highlight {
  box-shadow: inset 0 0 0 4px #00ccff;
}
.move-possible {
  box-shadow: inset 0 0 0 4px #00ff66;
}
.target {
  box-shadow: inset 0 0 0 4px #ff3333;
}
.piece-white {
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}
.piece-black {
  color: black;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.4);
}
.laser {
  position: absolute;
  background: linear-gradient(
    90deg,
    transparent,
    #ff0000,
    #ff9900,
    #ff0000,
    transparent
  );
  height: 4px;
  z-index: 10;
  transform-origin: left center;
  animation: laserShoot 0.3s forwards;
}
@keyframes laserShoot {
  0% {
    width: 0;
    opacity: 1;
  }
  100% {
    width: var(--laser-length);
    opacity: 0;
  }
}
.blood {
  position: absolute;
  font-size: 28px;
  z-index: 20;
  animation: bloodSplatter 1s forwards;
  pointer-events: none;
  color: #ff0000;
  font-weight: bold;
  text-shadow: 0 0 6px #ff0000;
}
@keyframes bloodSplatter {
  0% {
    transform: scale(0.2);
    opacity: 1;
  }
  70% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}
.info {
  margin-top: 15px;
  color: #ccc;
  max-width: 540px;
  text-align: center;
  line-height: 1.4;
}
.controls {
  margin-top: 10px;
  font-size: 14px;
  color: #aaa;
}
h1 {
  font-family: "Courier New", monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ddd;
  margin: 10px 0;
}

/* Главное меню */
#main-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}
.menu-title {
  font-size: 36px;
  margin-bottom: 30px;
  color: #ffcc00;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}
.menu-btn {
  background: #333;
  color: #ffcc00;
  border: 2px solid #555;
  padding: 12px 24px;
  margin: 10px;
  font-size: 18px;
  cursor: pointer;
  width: 250px;
  text-align: center;
  border-radius: 8px;
  transition: all 0.2s;
}
.menu-btn:hover {
  background: #444;
  transform: scale(1.05);
}
.difficulty-group {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}
#new-game-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #333;
  color: #ffcc00;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1000;
}

/* PGN Window */
#pgn-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: #ffcc00;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
  z-index: 1000;
}
#pgn-button:hover {
  background: #444;
  transform: scale(1.1);
}
#pgn-window {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 300px;
  height: 200px;
  background: #1a1a1a;
  border: 2px solid #555;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
  z-index: 2000;
  resize: both;
  overflow: hidden;
  flex-direction: column;
}
#pgn-header {
  padding: 8px 12px;
  background: #2a2a2a;
  cursor: move;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #ffcc00;
}
#pgn-close {
  background: none;
  border: none;
  color: #ff5555;
  font-size: 18px;
  cursor: pointer;
}
#pgn-content {
  flex: 1;
  padding: 10px;
  color: #ccc;
  font-family: monospace;
  font-size: 13px;
  overflow: auto;
  white-space: pre-wrap;
}
/* Обёртка доски */
.chessboard-wrapper {
  display: grid;
  grid-template-columns: 24px auto;
  grid-template-rows: auto 24px;
  gap: 4px;
  justify-content: start;
  align-content: start;
  margin-top: 10px;
}

/* Цифры слева */
.board-ranks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 480px; /* 8 * 60px */
  margin-right: 4px;
}
.board-ranks > div {
  color: #aaa;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  line-height: 1;
}

/* Буквы снизу */
.board-files {
  display: flex;
  justify-content: space-between;
  width: 480px; /* 8 * 60px */
  margin-top: 4px;
  margin-left: 24px; /* ширина + отступ цифр */
}
.board-files > div {
  color: #aaa;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  line-height: 1;
  width: 60px;
}
.menu-group {
  margin: 20px 0;
  text-align: center;
  color: #ccc;
}
.menu-group label {
  display: inline-block;
  margin: 0 10px;
  cursor: pointer;
}
.menu-group input[type="radio"] {
  margin-right: 5px;
}
#advisor-button {
  position: fixed;
  bottom: 20px;
  right: 70px;
  background: #333;
  color: #ffcc00;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
  z-index: 1000;
}
#advisor-button:hover {
  background: #444;
  transform: scale(1.1);
}
#advisor-window {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 70px;
  width: 300px;
  height: 150px;
  background: #1a1a1a;
  border: 2px solid #555;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
  z-index: 2000;
  resize: both;
  overflow: hidden;
  flex-direction: column;
}
#advisor-header {
  padding: 8px 12px;
  background: #2a2a2a;
  cursor: move;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #ffcc00;
}
#advisor-close {
  background: none;
  border: none;
  color: #ff5555;
  font-size: 18px;
  cursor: pointer;
}
#advisor-content {
  flex: 1;
  padding: 10px;
  color: #ccc;
  font-family: monospace;
  font-size: 13px;
  overflow: auto;
  white-space: pre-wrap;
}
#fen-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #ccc;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
}
#fen-display {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#copy-fen {
  background: #555;
  color: #ffcc00;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
#copy-fen:hover {
  background: #666;
}
