.chess-page .game-card {
  padding: 24px;
}

.chess-page .game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chess-page .game-title {
  font-size: 24px;
  font-weight: 700;
}

.chess-page .game-actions {
  display: flex;
  gap: 8px;
}

.chess-page .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.chess-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.chess-controls .field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
}

.chess-controls .field__select {
  width: 100%;
  background: rgba(8, 12, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
}

.chess-controls .timer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
}

.chess-controls .timer-line span:last-child {
  font-weight: 600;
}

.chess-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.chess-page .chess-container {
  margin-top: 8px;
}

.chess-stage {
  position: relative;
  width: min(760px, 100%);
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0f1416;
}

.chess-viewport {
  position: absolute;
  inset: 0;
}

.chess-viewport canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chess-status {
  margin-top: 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  min-height: 20px;
}

.chess-page .keyboard-hint {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.chess-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
}

.chess-modal.is-visible {
  display: flex;
}

.chess-modal__content {
  background: #0f141a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  width: min(460px, 92vw);
}

.chess-modal__content h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.chess-modal__content .field {
  margin-bottom: 12px;
}

.chess-modal__content input,
.chess-modal__content textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 12, 0.7);
  color: #fff;
}

.chess-pgn {
  height: 160px;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.chess-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.chess-modal__note {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
}

.chess-toast {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  min-height: 16px;
}

@media (max-width: 768px) {
  .chess-page .game-card {
    padding: 18px;
  }

  .chess-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
