/* Grundfarben */
:root {
  --main-bg-color: #222831;
  --main-accent-color: #393E46;
  --main-highlight-color: #948979;
  --main-focus-color: #DFD0B8;
  --main-text-color: #ebebeb;
  --secondary-text-color: #DFD0B8;
}

/* Global */
body {
  margin: 0;
  padding: 0;
  background: var(--main-bg-color);
  color: var(--main-text-color);
  font-family: Arial, sans-serif;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* Verstecke alle screen-Container standardmäßig */
.screen {
  display: none;
  padding: 1rem;
  box-sizing: border-box;
}

/* Modals */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: var(--main-accent-color);
  padding: 1.5rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 400px;
  color: var(--main-text-color);
  position: relative;
}
.close {
  position: absolute; top: 0.5rem; right: 0.75rem;
  cursor: pointer; font-size: 1.25rem;
}

/* Buttons & Inputs */
.button {
  background: var(--main-focus-color);
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--main-text-color);
  cursor: pointer;
  font-size: 1rem;
  margin: 0.5rem 0;
  display: inline-block;
  width: 100%;
}
.inputfield {
  width: 100%;
  padding: 0.5rem;
  margin: 0.5rem 0;
  background: var(--main-highlight-color);
  border: none;
  border-radius: 0.5rem;
  box-sizing: border-box;
  color: #000;
}

/* Hauptmenü / Lobby-Liste */

#mainMenu {
  display: block;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

.lobby-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--main-accent-color);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.lobby-table caption {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 1rem;
  color: var(--main-text-color);
  background: var(--main-highlight-color);
  border-radius: 0.5rem 0.5rem 0 0;
}

.lobby-table th, 
.lobby-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid var(--main-bg-color);
}

.lobby-table th {
  background: var(--main-highlight-color);
  color: var(--main-text-color);
}

.lobby-table tr:last-child td {
  border-bottom: none;
}

.lobby-table tr:hover {
  background: rgba(255,255,255,0.05);
  cursor: pointer;
}

.lobby-table td {
  color: var(--main-text-color);
}

/* Warteraum */
#lobby {
  display: block; /* per JS */
  text-align: center;
}
#playerSlots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
  display: block;
}
.playerSlot {
  background: var(--main-highlight-color);
  padding: 0.5rem;
  border-radius: 0.5rem;
  flex: 1 0 30%;
  box-sizing: border-box;
  margin: 3px;
}

#leaveLobby {
  width: auto;
  padding: 0.5rem 2rem;
  margin: 1rem auto;
  display: block;
}

/* Spielansicht */
#game {
  display: block; /* per JS */
  padding: 1rem;
}
#gameContainer {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
#livesContainer {
  background: var(--main-accent-color);
  padding: 1rem;
  border-radius: 0.5rem;
  min-width: 200px;
  margin-right: 1rem;
}
.playerLife {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  margin: 0.5rem 0;
  background: var(--main-highlight-color);
  border-radius: 0.5rem;
}
.lifeCounter {
  display: flex;
  gap: 0.25rem;
}
.lifeDot {
  width: 15px;
  height: 15px;
  background: #FF4444;
  border-radius: 50%;
}
.lifeDot.lost {
  background: var(--main-bg-color);
  opacity: 0.5;
}
#board {
  display: grid;
  gap: 0.2rem;
  background: var(--main-accent-color);
  padding: 0.2rem;
  border-radius: 0.5rem;
  box-sizing: border-box;
  /* Spaltenanzahl wird per JS in --cols gesetzt */
  grid-template-columns: repeat(var(--cols,10), 1fr);
  max-width: 700px;
  width: 100%;
}
.cell {
  position: relative;
  background: var(--main-bg-color);
  border: 2px solid var(--main-accent-color);
  width: 100%;
  padding-bottom: 100%; /* quadratisch */
  border-radius: 0.25rem;
  cursor: pointer;
  box-sizing: border-box;
}
.cell.revealed {
  background: var(--main-highlight-color);
  cursor: default;
}
.cell.flagged {
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="%23ff4444" d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/></svg>') center/60% no-repeat;
}
.cell span {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--main-text-color);
  font-weight: bold;
}

#chatContainer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 300px;
  width: 100%;
}
#messages {
  background: var(--main-accent-color);
  border-radius: 0.5rem;
  padding: 0.5rem;
  height: 200px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
}
#messages li {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--main-bg-color);
}
#messages li .sender {
  color: #FFD700;
  font-weight: bold;
}
#chatContainer input,
#chatContainer button {
  width: 100%;
}

/* Info & Turn */
.info {
  margin: 0.5rem 0;
  text-align: center;
}
#turnStatus{
  display: block;
  text-align: center;
}

/* End-Modal */
#endModal .modal-content {
  text-align: center;
}
#playAgain{
  color: black;
}
#backToMenu{
  color: black;
}

/* Responsive */
@media (max-width: 600px) {
  #gameContainer {
    flex-direction: column;
    align-items: center;
  }
  #board {
    max-width: 90vw;
  }
}