/* Tema oscuro para Ajedrez Online */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #14161f;
  color: #e8e8f0;
  min-height: 100vh;
}

.app { max-width: 980px; margin: 0 auto; padding: 20px; }

header { text-align: center; margin-bottom: 20px; }
header h1 { font-size: 1.8rem; letter-spacing: 1px; }
.room-info { margin-top: 8px; font-size: 0.95rem; color: #9aa0b5; }
.room-info code { background: #232636; padding: 3px 8px; border-radius: 6px; color: #7ee0a3; }

.hidden { display: none !important; }

/* Landing */
.landing { display: flex; justify-content: center; padding-top: 40px; }
.card {
  background: #1d2030;
  border: 1px solid #2c3044;
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.card h2 { margin-bottom: 18px; font-size: 1.25rem; }
.card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #33395a;
  background: #12141d;
  color: #e8e8f0;
  font-size: 1rem;
}
.code-input { text-transform: lowercase; letter-spacing: 2px; text-align: center; }
.join-row { display: flex; gap: 8px; }
.join-row .code-input { flex: 1; margin-bottom: 0; }
.or { margin: 14px 0; color: #6b7190; font-size: .9rem; }
.divider { margin: 16px 0 4px; color: #6b7190; font-size: .85rem; }
.ai-box {
  margin-top: 14px;
  background: #171a28;
  border: 1px solid #2c3044;
  border-radius: 10px;
  padding: 14px;
}
.ai-box h3 { font-size: 1rem; margin-bottom: 10px; color: #ffd166; }
.ai-box .level-select {
  width: 100%;
  padding: 11px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #33395a;
  background: #12141d;
  color: #e8e8f0;
  font-size: .95rem;
}
.ai-box .hint { margin-top: 10px; font-size: .8rem; }
/* Análisis del motor */
.side-row { display: flex; gap: 10px; align-items: stretch; }
.side-row > * { flex: 1; min-width: 0; }
.moves-box { flex: 1 1 50%; }
.analysis-box {
  margin-top: 0;
  flex: 1 1 50%;
  background: #171a28;
  border: 1px solid #2c3044;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .82rem;
  overflow: hidden;
}
.analysis-box h3 { font-size: .92rem; margin-bottom: 8px; color: #ffd166; }
.an-line { margin-bottom: 6px; line-height: 1.5; }
.an-tag { color: #7c82a0; font-weight: 600; }

/* Resaltado de selección y destinos (modo clic) */
#board .square-55d63.sel { box-shadow: inset 0 0 0 3px #ffd166; }
#board .square-55d63.dest { box-shadow: inset 0 0 0 2px rgba(255, 209, 102, .65); }
#board .square-55d63.dest::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  background: rgba(255, 209, 102, .5);
  border-radius: 50%;
  pointer-events: none;
}
#btnModoClic { flex: 1; font-size: .85rem; }
#btnModoClic.active { border-color: #ffd166; color: #ffd166; }

.banner-elo { border-color: #ffd166; }
.hint { margin-top: 16px; font-size: .85rem; color: #7c82a0; line-height: 1.5; }

/* Botones */
.btn {
  background: #262b42;
  color: #e8e8f0;
  border: 1px solid #3a4062;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s, transform .05s;
  width: 100%;
}
.btn:hover:not(:disabled) { background: #303755; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #2d6a4f; border-color: #2d6a4f; }
.btn.primary:hover:not(:disabled) { background: #358a64; }
.btn.danger { background: #7a2e2e; border-color: #7a2e2e; }
.btn.danger:hover:not(:disabled) { background: #96403a; }
.btn.copy { margin-top: 10px; background: #2b3a67; border-color: #2b3a67; }

/* Juego */
.game { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.board-wrap { position: relative; }
#board { width: min(92vw, 460px); }
.banner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10,12,20,.88);
  border: 1px solid #3a4062;
  border-radius: 12px;
  padding: 18px 28px;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  z-index: 5;
  max-width: 90%;
}

.sidebar { width: 350px; display: flex; flex-direction: column; gap: 12px; }
.players { background: #1d2030; border: 1px solid #2c3044; border-radius: 12px; padding: 12px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.player-row.active-player { background: #232a45; border-radius: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #555b7d; flex-shrink: 0; }
.white-dot { background: #f0d9b5; }
.black-dot { background: #3a3f55; }
.pname { flex: 1; font-weight: 600; }
.tag { font-size: .8rem; color: #7ee0a3; }

.theme-box {
  background: #1d2030;
  border: 1px solid #2c3044;
  border-radius: 12px;
  padding: 10px 12px;
}
.theme-label { display: block; font-size: .82rem; color: #9aa0b5; margin-bottom: 6px; }
.theme-box select {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #33395a;
  background: #12141d;
  color: #e8e8f0;
  font-size: .9rem;
}

/* Coordenadas fuera del tablero */
.board-with-coords { display: flex; gap: 5px; align-items: stretch; }
.board-col { display: flex; flex-direction: column; }
.coords-rank {
  display: flex; flex-direction: column;
  font-weight: 800; font-size: .8rem; color: #ffd166;
  font-family: 'Consolas', monospace;
  width: 16px;
}
.coords-rank span { flex: 1; display: flex; align-items: center; justify-content: center; }
.coords-file {
  display: flex;
  font-weight: 800; font-size: .8rem; color: #ffd166;
  font-family: 'Consolas', monospace;
  padding-top: 5px;
}
.coords-file span { flex: 1; text-align: center; }

.status {
  background: #1d2030;
  border: 1px solid #2c3044;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-size: .95rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status.check { color: #ffb4a2; font-weight: 700; }
.status.over { color: #ffd166; font-weight: 700; }

.actions { display: flex; gap: 8px; }
.actions .btn { padding: 10px 8px; font-size: .85rem; }

.moves-box { background: #1d2030; border: 1px solid #2c3044; border-radius: 12px; padding: 12px; flex: 1 1 50%; min-height: 120px; max-height: 260px; display: flex; flex-direction: column; }
.moves-box h3 { font-size: .9rem; color: #9aa0b5; margin-bottom: 8px; }
.move-list { list-style: none; overflow-y: auto; font-size: .85rem; font-family: 'Consolas', monospace; }
.move-list li { padding: 2px 0; color: #c9cde0; }

/* Modales */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.modal-box {
  background: #1d2030;
  border: 1px solid #3a4062;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  max-width: 380px;
  width: 90%;
}
.modal-box h3 { margin-bottom: 10px; }
.modal-box p { color: #9aa0b5; margin-bottom: 16px; }
.modal-btns { display: flex; gap: 10px; }
.promo-choices { display: flex; gap: 10px; justify-content: center; }
.promo-btn {
  font-size: 2.2rem;
  width: 64px; height: 64px;
  background: #262b42;
  color: #e8e8f0;
  border: 1px solid #3a4062;
  border-radius: 10px;
  cursor: pointer;
}
.promo-btn:hover { background: #303755; }

@media (max-width: 700px) {
  .sidebar { width: 100%; }
  #board { width: 96vw; }
}
