/* Globale Stile und Body */
body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #121213;
  color: white;
  min-height: 100vh;
  margin: 0;
  box-sizing: border-box;
}

/* Lobby-Ansicht (Startseite) */
#lobby-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
  padding-top: 20px;
}

#lobby-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 90%;
  max-width: 400px;
  padding: 20px;
  background-color: #262627;
  border-radius: 8px;
}

#lobby-controls input, #lobby-controls button {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
  border-radius: 5px;
  border: none;
}

#lobby-controls button {
    background-color: #538d4e;
    color: white;
    cursor: pointer;
}

/* Avatar-Auswahl */
#avatar-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}
#avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #3a3a3c;
    border: 2px solid #565758;
    object-fit: cover;
}
.avatar-arrow {
    font-size: 2rem;
    font-weight: bold;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0 10px;
    width: auto !important;
    background-color: transparent !important;
}
.avatar-arrow:hover {
    color: #538d4e;
}

/* Globales Leaderboard */
#global-leaderboard-container {
  width: 90%;
  max-width: 400px;
  padding: 15px 20px;
  background-color: #262627;
  border-radius: 8px;
}
#global-leaderboard-container h2 {
  margin: 0 0 15px 0;
  text-align: center;
  border-bottom: 1px solid #3a3a3c;
  padding-bottom: 10px;
  color: #b59f3b;
}
#global-leaderboard-list {
  list-style: decimal;
  padding-left: 25px;
  margin: 0;
}
#global-leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 5px;
  font-size: 1.1rem;
  border-bottom: 1px solid #3a3a3c;
}
#global-leaderboard-list li:last-child { border-bottom: none; }
#global-leaderboard-list .name { font-weight: bold; color: #fff; }
#global-leaderboard-list .score { font-weight: bold; color: #b59f3b; }

/* Spiel-Ansicht */
#game-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px;
  box-sizing: border-box;
}

#game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 20px;
    margin-bottom: 10px;
}

#game-status-board {
    flex-grow: 1;
}
#game-status-board h3 {
  margin: 0 0 10px 0; text-align: center;
  border-bottom: 1px solid #3a3a3c; padding-bottom: 5px;
}
#status-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap;
  justify-content: center; gap: 15px;
}
#status-list li { font-size: 1rem; font-weight: bold; }
#status-list li.my-status { color: #538d4e; border-bottom: 2px solid #538d4e; }

#share-link-game-view {
    position: relative;
    top: 0;
    right: 0;
    flex-shrink: 0;
    background-color: #262627;
    padding: 10px 15px;
    border-radius: 8px;
}
#share-link-game-view p { margin: 0 0 5px 0; font-size: 0.9rem; }
#share-link-game-view span { font-size: 0.8rem; color: #aaa; }
#share-link-game-view input {
  font-size: 0.9rem; padding: 5px; width: 150px;
  background-color: #3a3a3c; border: 1px solid #565758;
  color: white; border-radius: 4px;
}

#game-content-area {
    display: flex;
    flex-grow: 1;
    gap: 20px;
    overflow: hidden;
}

#opponents-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 10px;
    background-color: #1a1a1b;
    border-radius: 8px;
}
#opponents-sidebar h4 {
    margin: 0;
    text-align: center;
    color: #aaa;
    border-bottom: 1px solid #3a3a3c;
    padding-bottom: 10px;
}
#other-players-boards {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#main-game-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Wichtig für die Positionierung des "Nächste Runde" Buttons */
}

#my-board-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#opponents-sidebar .player-board-wrapper {
    background-color: #262627;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}
#opponents-sidebar .player-header {
    margin-bottom: 8px;
    justify-content: center;
}
#opponents-sidebar .player-avatar {
    width: 25px;
    height: 25px;
}
#opponents-sidebar .player-name {
    font-size: 0.9rem;
}
#opponents-sidebar .game-board-single {
    margin: 0 auto;
}
#opponents-sidebar .tile {
    width: 25px;
    height: 25px;
    border: 1px solid #3a3a3c;
    font-size: 0;
}

#my-board-container .player-board-wrapper {
    transform: scale(1.1);
}
#my-board-container .player-header {
    display: none;
}

#my-board-container .tile {
    width: 60px;
    height: 60px;
    font-size: 2.5rem;
    border: 2px solid #3a3a3c;
}

.player-header { display: flex; align-items: center; gap: 10px; }
.player-avatar { border-radius: 50%; object-fit: cover; border: 2px solid #538d4e; }
.player-name { font-weight: bold; font-size: 1.1rem; }
.game-board-single { display: grid; grid-template-rows: repeat(6, 1fr); gap: 5px; width: min-content; }
.row { display: grid; grid-template-columns: repeat(var(--solution-length, 5), 1fr); gap: 5px; }
.tile {
  text-transform: uppercase;
  display: flex; justify-content: center; align-items: center;
  user-select: none;
  transition: transform 0.3s, background-color 0.5s, border-color 0.5s;
  color: white;
}
.tile.filled { border-color: #565758; }
.tile.correct { background-color: #538d4e; border-color: #538d4e; }
.tile.present { background-color: #b59f3b; border-color: #b59f3b; }
.tile.absent { background-color: #3a3a3c; border-color: #3a3a3c; }

#keyboard {
  padding: 10px 0;
  display: flex; flex-direction: column; gap: 5px;
  width: 100%; max-width: 500px; margin: 0 auto;
}
.key-row { display: flex; gap: 5px; justify-content: center; }
.key {
  padding: 10px 8px; min-width: 30px;
  font-size: 0.9rem; font-weight: bold;
  background-color: #818384; color: white;
  border: none; border-radius: 4px;
  cursor: pointer; text-transform: uppercase;
  flex-grow: 1;
}
.key[data-key="enter"] { flex-grow: 1.5; }
.key[data-key="del"] { flex-grow: 1.5; }
.key.correct { background-color: #538d4e; }
.key.present { background-color: #b59f3b; }
.key.absent { background-color: #3a3a3c; }

#message-area {
  flex-shrink: 0;
  font-size: 1.2rem;
  text-align: center;
  padding: 10px;
  height: 20px;
}

/* NEU: Stile für "Nächste Runde" Button */
.hidden {
    display: none !important;
}

#new-round-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 30px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

#new-round-btn {
    padding: 15px 30px;
    font-size: 1.5rem;
    font-weight: bold;
    background-color: #538d4e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
#new-round-btn:hover {
    background-color: #6aaa64;
}

