body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: #0f172a;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden {
  display: none !important;
}

/* Auth Screen */
.card {
  background: rgba(255,255,255,0.05);
  padding: 30px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 300px;
  border: 1px solid #334155;
}

.title {
  text-align: center;
  background: linear-gradient(135deg, #4361ee, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

input {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: white;
  font-size: 14px;
}

input:focus {
  outline: none;
  border-color: #4361ee;
}

input::placeholder {
  color: #64748b;
}

button {
  padding: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #4361ee, #f72585);
  color: white;
  font-weight: bold;
  font-size: 14px;
  transition: transform 0.2s;
}

button:hover {
  transform: translateY(-2px);
}

.switch {
  color: #94a3b8;
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 10px;
}

.switch:hover {
  color: white;
}

.error {
  background: #f72585;
  color: white;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  display: none; /* Hidden by default */
}

/* Menu Screen */
.menu-container {
  background: rgba(255,255,255,0.05);
  padding: 40px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  text-align: center;
  min-width: 400px;
  border: 1px solid #334155;
}

.menu-container h1 {
  margin-bottom: 10px;
  background: linear-gradient(135deg, #4361ee, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.5rem;
}

#menu-player-info {
  color: #94a3b8;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* FIXED: Class name now matches HTML */
.difficulty-box {
  background: #1e293b;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid #334155;
}

.difficulty-box label {
  display: block;
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 0.9rem;
}

#difficulty-select {
  width: 100%;
  padding: 10px;
  background: #0f172a;
  color: white;
  border: 1px solid #4361ee;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

#difficulty-select:hover {
  border-color: #f72585;
}

.menu-btn {
  padding: 15px;
  font-size: 1.1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  color: white;
  width: 100%;
  margin-top: 10px;
}

.menu-btn:hover {
  background: #2d3a4f;
  border-color: #f72585;
  transform: translateX(5px);
}

.logout-btn {
  background: transparent;
  border: 1px solid #f72585;
  color: #f72585;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  font-weight: normal;
  margin-top: 15px;
}

.logout-btn:hover {
  background: #f72585;
  color: white;
  transform: translateY(-2px);
}

/* Game Screen */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: rgba(255,255,255,0.05);
  padding: 30px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid #334155;
}

#chess-board {
    width: 450px;
    max-width: 90vw;
}
/* FIXED: Removed the broken .piece-41742 selector. 
   ChessboardJS handles images automatically now. */

#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

#game-status {
  margin: 0;
  color: #00ff99;
  font-size: 1.2rem;
  font-weight: bold;
}

#back-to-menu-btn {
  background: #334155;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#back-to-menu-btn:hover {
  background: #475569;
}

.status-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.thinking {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    border-top-color: #00ff99;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ensure the error div is visible when needed */
.error {
    background: #f72585;
    color: white;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 10px;
    display: none;
}
#timer-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}
.timer {
    padding: 5px 15px;
    background: #1e293b;
    border-radius: 6px;
    border: 1px solid #334155;
}
#white-timer { color: #fff; }
#black-timer { color: #000; background: #ddd; } /* Black timer visible on light bg */