* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #1a472a 0%, #2a623d 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 100%;
  text-align: center;
}

.game-title {
  color: #2a623d;
  margin-bottom: 30px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.input-section {
  margin: 30px 0;
  text-align: left;
}

.input-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
  font-size: 1.1em;
}

.input-section input {
  width: 100%;
  padding: 15px;
  border: 2px solid #4caf50;
  border-radius: 10px;
  font-size: 1.2em;
  transition: all 0.3s;
}

.input-section input:focus {
  outline: none;
  border-color: #2a623d;
  box-shadow: 0 0 10px rgba(42, 98, 61, 0.3);
}

.hint {
  margin-top: 5px;
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

/* Key Code Section Styles */
.key-code-section {
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#keyCodeStatus {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9em;
  display: none;
}

#keyCodeStatus.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

#keyCodeStatus.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

/* Fade-in animation for sections */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Code input styling */
#keyCode {
  text-transform: uppercase;
  font-family: monospace;
  font-size: 1.3em;
  letter-spacing: 2px;
  text-align: center;
}

/* ===== UPDATED BUTTONS SECTION - CENTERED AND SAME SIZE ===== */
.buttons-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 40px auto;
  width: 100%;
  max-width: 300px;
}

.btn {
  width: 100%;
  padding: 18px 20px;
  border: none;
  border-radius: 10px;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
}

/* Responsive: Side by side on larger screens */
@media (min-width: 768px) {
  .buttons-section {
    flex-direction: row;
    justify-content: center;
    max-width: 600px;
  }
  
  .btn {
    width: auto;
    min-width: 180px;
  }
}

.btn-primary {
  background: linear-gradient(to right, #4caf50, #2a623d);
  color: white;
}

.btn-secondary {
  background: linear-gradient(to right, #2196f3, #0b7dda);
  color: white;
}

.btn-info {
  background: linear-gradient(to right, #ff9800, #f57c00);
  color: white;
}

.btn-success {
  background: linear-gradient(to right, #4caf50, #388e3c);
  color: white;
}

.btn-danger {
  background: linear-gradient(to right, #f44336, #d32f2f);
  color: white;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(-1px);
}

.btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ========== LOBBY PAGE STYLES ========== */

/* Lobby Header */
.lobby-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.game-info {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;
}

.info-box {
  background: #f8f9fa;
  padding: 15px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.info-label {
  font-weight: bold;
  color: #2a623d;
}

.info-value {
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
}

.btn-small {
  padding: 8px 15px;
  font-size: 0.9em;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Current Role Section */
.current-role-section {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  padding: 25px;
  border-radius: 15px;
  margin: 30px 0;
  text-align: left;
}

.current-role-section h2 {
  color: #2a623d;
  margin-bottom: 15px;
}

.role-display {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border-left: 5px solid #4caf50;
}

.role-name {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
}

.role-name span {
  color: #2a623d;
}

.role-description p {
  line-height: 1.6;
  color: #666;
}

/* Roles Grid */
.roles-section h2 {
  color: #2a623d;
  margin: 30px 0 20px 0;
  text-align: left;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.role-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  border: 2px solid #e0e0e0;
  text-align: left;
}

.role-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.role-card.occupied {
  border-color: #f44336;
  opacity: 0.8;
}

.role-card.selected {
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.role-header h3 {
  color: #2a623d;
  font-size: 1.3em;
}

.role-status {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: bold;
}

.role-status.available {
  background: #e8f5e9;
  color: #2e7d32;
}

.role-status.occupied {
  background: #ffebee;
  color: #c62828;
}

.role-status.required {
  background: #fff3e0;
  color: #ef6c00;
}

.role-status.you {
  background: #e3f2fd;
  color: #1565c0;
}

.role-card p {
  color: #666;
  margin-bottom: 15px;
  line-height: 1.5;
  min-height: 60px;
}

.role-assigned {
  font-size: 0.9em;
  color: #888;
  margin-bottom: 15px;
  font-style: italic;
}

/* Lobby Controls */
.lobby-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 30px;
}

.players-list-section,
.game-settings {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 15px;
}

.players-list-section h3,
.game-settings h3 {
  color: #2a623d;
  margin-bottom: 20px;
  text-align: left;
}

.players-list {
  max-height: 300px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: white;
  margin-bottom: 10px;
  border-radius: 10px;
  border-left: 4px solid #4caf50;
}

.player-item.ready {
  border-left-color: #4caf50;
}

.player-name {
  font-weight: bold;
  color: #333;
}

.player-role {
  color: #666;
  font-size: 0.9em;
}

.player-status {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: bold;
}

.player-status.ready {
  background: #e8f5e9;
  color: #2e7d32;
}

.player-status.waiting {
  background: #fff3e0;
  color: #ef6c00;
}

/* Round Selector */
.round-selector {
  margin: 20px 0;
  text-align: left;
}

.round-selector label {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
  color: #333;
}

.round-selector select {
  width: 100%;
  padding: 12px;
  border: 2px solid #4caf50;
  border-radius: 8px;
  font-size: 1.1em;
  background: white;
}

.lobby-buttons,
.lobby-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.lobby-buttons .btn,
.lobby-actions .btn {
  flex: 1;
}

/* Status Message */
#statusMessage {
  margin-top: 20px;
  padding: 15px;
  border-radius: 10px;
  display: none;
  text-align: left;
}

#statusMessage.show {
  display: block;
}

#statusMessage.info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

#statusMessage.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

#statusMessage.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* ========== COMMON STYLES (for both pages) ========== */

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.close:hover {
  color: #333;
}

.input-group {
  margin: 20px 0;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1.1em;
}

.status-message {
  margin-top: 20px;
  padding: 10px;
  border-radius: 8px;
  display: none;
}

.status-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

.status-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

.info-content {
  text-align: left;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 10px;
}

.info-content h3 {
  color: #2a623d;
  margin: 20px 0 10px 0;
  padding-bottom: 5px;
  border-bottom: 2px solid #4caf50;
}

.info-content p,
.info-content li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.info-content ul {
  margin-left: 20px;
  margin-bottom: 20px;
}

.credits {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #ddd;
}

.status-area {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 10px;
  border-left: 5px solid #4caf50;
  text-align: left;
  display: none;
}

.status-area.show {
  display: block;
}

/* Modal Buttons */
.modal-buttons {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

/* Responsive Design */
@media (max-width: 900px) {
  .lobby-controls {
    grid-template-columns: 1fr;
  }

  .roles-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 600px) {
  .container {
    padding: 20px;
  }

  .game-title {
    font-size: 1.8em;
  }

  .game-info {
    flex-direction: column;
  }

  .info-box {
    min-width: auto;
  }

  .lobby-buttons,
  .lobby-actions {
    flex-direction: column;
  }

  .modal-content {
    margin: 10% auto;
    padding: 20px;
  }
}

/* ===== FIX FOR BUTTON CENTERING ===== */
#actionButtonsSection {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 40px auto !important;
    text-align: center !important;
}

#actionButtonsSection .btn {
    width: 100% !important;
    max-width: 280px !important;
    margin: 0 auto !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* For larger screens, make them side by side */
@media (min-width: 768px) {
    #actionButtonsSection {
        flex-direction: row !important;
        gap: 20px !important;
        max-width: 600px !important;
    }
    
    #actionButtonsSection .btn {
        width: auto !important;
        min-width: 180px !important;
        max-width: none !important;
    }
}