* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.container {
  background: white;
  min-height: 100vh;
  width: 100%;
  padding: 0;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

#gameScreen {
  background: #f5f5f5;
  min-height: 100vh;
  padding: 20px;
}

#menu {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

h1 {
  color: white;
  margin-bottom: 40px;
  font-size: 2.5em;
}

.menu-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 30px;
}

.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-small {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 15px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-small:hover {
  background: #45a049;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.btn-icon.btn-danger {
  background: rgba(244, 67, 54, 0.8);
  border-color: rgba(244, 67, 54, 0.9);
}

.btn-icon.btn-danger:hover {
  background: rgba(244, 67, 54, 1);
}

#roomInputDiv {
  margin-top: 20px;
}

#roomInputDiv.hidden {
  display: none;
}

#roomCodeInput {
  padding: 12px 20px;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-right: 10px;
  width: 200px;
  text-align: center;
  text-transform: uppercase;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left {
  flex: 1;
}

.header-center {
  flex: 2;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.header-right {
  flex: 1;
  justify-content: flex-end;
}

.room-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2em;
  color: white;
  font-weight: bold;
}

.room-title strong {
  color: white;
  font-size: 1.3em;
  letter-spacing: 2px;
}

#currentTurn {
  color: white;
  font-weight: bold;
  padding: 8px 15px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
}

.connection-status {
  font-size: 10px;
  color: #4caf50;
}

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  width: 100%;
  max-width: min(80vw, 640px);
  position: relative;
}

.player-info {
  padding: 10px 20px;
  background: #f0f0f0;
  border-radius: 8px;
  margin: 10px 0;
  font-weight: bold;
  min-width: 200px;
  text-align: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.player-info.top {
  color: #333;
  margin: 0;
  min-width: 250px;
  max-width: 450px;
}

.player-info.bottom {
  color: #666;
  margin: 0;
  flex: 1;
  max-width: 250px;
  gap: 0;
}

.timer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-display {
  font-size: 1em;
  font-weight: bold;
  padding: 5px 10px;
  background: #333;
  color: white;
  border-radius: 5px;
  min-width: 80px;
  text-align: center;
  font-family: "Courier New", monospace;
}

.timer.active {
  transform: translateX(-20px);
  transition: transform 0.3s ease;
}

.timer.active .timer-display {
  background: #4caf50;
  animation: pulse-timer 1s ease-in-out infinite;
}

.timer.warning .timer-display {
  background: #ff9800;
}

.timer.critical .timer-display {
  background: #f44336;
  animation: pulse-critical 0.5s ease-in-out infinite;
}

@keyframes pulse-timer {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes pulse-critical {
  0%,
  100% {
    background: #f44336;
  }
  50% {
    background: #d32f2f;
  }
}

/* Chessboard container for alignment */
.chessboard-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Align all items to the right edge */
  margin: 0 auto;
  width: fit-content;
}

/* Top controls row - zoom and player info */
.top-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 15px;
  gap: 20px;
}

/* Bottom controls row - game controls and timer */
.bottom-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 15px;
  gap: 20px;
}

/* Zoom Controls */
.zoom-controls {
  display: flex;
  flex-direction: row;
  gap: 10px;
  z-index: 10;
  margin-right: auto; /* Push to the left */
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  font-size: 17px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.zoom-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.1);
}

.zoom-btn:active {
  transform: scale(0.95);
}

/* Desktop styles - limit chessboard height to 60vh */
@media (min-width: 769px) {
  #chessboard {
    grid-template-columns: repeat(8, min(7.5vh, 80px));
    grid-template-rows: repeat(8, min(7.5vh, 80px));
  }

  .square {
    width: min(7.5vh, 80px);
    height: min(7.5vh, 80px);
    font-size: min(4.5vh, 48px);
  }

  .square.piece-shadow::after {
    font-size: min(4.5vh, 48px);
  }
}

@media (max-width: 768px) {
  .chessboard-container {
    align-items: center;
  }

  .top-controls-row {
    flex-direction: column;
    gap: 10px;
  }

  .bottom-controls-row {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .zoom-controls {
    justify-content: center;
    margin-bottom: 0;
    gap: 15px;
  }

  .zoom-btn {
    width: 25px;
    height: 25px;
    font-size: 14px;
  }

  .player-info.top {
    max-width: 100%;
    width: 100%;
  }

  .player-info.bottom {
    flex: 0 0 auto;
    min-width: auto;
    padding: 8px 12px;
  }

  /* Adjust check indicator for mobile */
  .check-indicator {
    left: 50%;
    top: -35px;
    transform: translateX(-50%);
    font-size: 12px;
    padding: 5px 10px;
  }

  @keyframes checkPulse {
    0% {
      transform: translateX(-50%) scale(1);
    }
    50% {
      transform: translateX(-50%) scale(1.05);
    }
    100% {
      transform: translateX(-50%) scale(1);
    }
  }
}

/* Check Indicator */
.check-indicator {
  position: absolute;
  left: -100px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #ff6b6b, #ff3838);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 3px 10px rgba(255, 56, 56, 0.4);
  z-index: 200;
  animation: checkPulse 1s infinite;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.check-indicator.hidden {
  display: none;
}

@keyframes checkPulse {
  0% {
    transform: translateY(-50%) scale(1);
    box-shadow: 0 3px 10px rgba(255, 56, 56, 0.4);
  }
  50% {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 56, 56, 0.6);
  }
  100% {
    transform: translateY(-50%) scale(1);
    box-shadow: 0 3px 10px rgba(255, 56, 56, 0.4);
  }
}

/* Chessboard wrapper for positioning check indicator */
.chessboard-wrapper {
  position: relative;
  width: fit-content;
  margin: 0 auto;
}

#chessboard {
  display: grid;
  grid-template-columns: repeat(8, min(7.5vh, 80px));
  grid-template-rows: repeat(8, min(7.5vh, 80px));
  border: 3px solid #333;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin: 0 auto;
}

.square {
  width: min(7.5vh, 80px);
  height: min(7.5vh, 80px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: min(4.5vh, 48px);
  cursor: pointer;
  position: relative;
  font-family: Arial, sans-serif;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.square.white {
  background: #f0d9b5;
}

.square.black {
  background: #b58863;
}

.square.selected {
  background: #7fc97f !important;
}

.square.possible-move {
  position: relative;
}

.square.possible-move::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
}

.square.possible-capture::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid #ff4444;
  box-sizing: border-box;
}

.square.last-move-from,
.square.last-move-to {
  position: relative;
}

.square.last-move-from::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 0, 0.3);
  pointer-events: none;
}

.square.last-move-to::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 0, 0.2);
  pointer-events: none;
}

.square.piece-shadow {
  position: relative;
}

.square.piece-shadow::after {
  content: attr(data-shadow-piece);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: min(4.5vh, 48px);
  opacity: 0.3;
  pointer-events: none;
  font-family: Arial, sans-serif;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.piece {
  cursor: grab;
  user-select: none;
  transition: transform 0.2s;
}

.piece:hover {
  transform: scale(1.1);
}

.piece.dragging {
  cursor: grabbing;
  opacity: 0.5;
}

.game-controls {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

/* Invite Section */
.invite-section {
  text-align: center;
  margin: 20px auto;
  padding: 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 15px;
  border: 2px dashed rgba(102, 126, 234, 0.3);
  max-width: 400px;
  animation: fadeIn 0.5s ease-in;
}

.invite-section.hidden {
  display: none;
}

/* Removed old .btn-invite styles - now using btn-icon in header */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.settings-modal {
  text-align: left;
  padding: 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #ddd;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.modal-body {
  padding: 20px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 10px;
}

.setting-item label {
  font-weight: bold;
  color: #333;
}

.btn-toggle {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s;
}

.btn-toggle.off {
  background: #ccc;
}

.time-select {
  padding: 8px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  background: white;
}

.close-modal {
  background: transparent;
  border: none;
  color: #666;
}

.close-modal:hover {
  background: #f5f5f5;
  color: #333;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid #ddd;
}

.tab-button {
  flex: 1;
  padding: 15px;
  background: none;
  border: none;
  color: #666;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.tab-button:hover {
  background: #f5f5f5;
}

.tab-button.active {
  color: #667eea;
}

.tab-button.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #667eea;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* People List */
.people-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.person-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: #f8f8f8;
  border-radius: 8px;
  transition: all 0.3s;
}

.person-item:hover {
  background: #f0f0f0;
}

.person-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.person-details {
  display: flex;
  flex-direction: column;
}

.person-name {
  font-weight: bold;
  color: #333;
}

.person-role {
  font-size: 12px;
  color: #666;
  padding: 2px 8px;
  background: #e0e0e0;
  border-radius: 10px;
  display: inline-block;
  margin-top: 2px;
}

.person-role.owner {
  background: #ffd700;
  color: #333;
}

.person-role.player {
  background: #4caf50;
  color: white;
}

.person-role.spectator {
  background: #2196f3;
  color: white;
}

.btn-kick {
  padding: 6px 12px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s;
}

.btn-kick:hover {
  background: #d32f2f;
}

.room-info-footer {
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}

.room-capacity {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

.spectator-hint {
  font-size: 12px;
  color: #666;
}

/* Guest List Sidebar */
.guest-sidebar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 250px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: all 0.3s ease;
}

.guest-sidebar.collapsed {
  width: auto;
  max-height: auto;
}

.guest-sidebar.collapsed .guest-list,
.guest-sidebar.collapsed .sidebar-header h4 {
  display: none;
}

.guest-sidebar.collapsed .sidebar-header {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.guest-sidebar-toggle {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
  font-weight: 600;
  transition: all 0.3s;
}

.guest-sidebar-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.guest-sidebar.expanded .guest-sidebar-toggle {
  background: white;
  color: #667eea;
  border-bottom: 2px solid #f0f0f0;
  border-radius: 15px 15px 0 0;
  margin-bottom: 15px;
}

.guest-sidebar.expanded {
  padding: 0;
}

.guest-sidebar.expanded .sidebar-content {
  padding: 0 20px 20px 20px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h4 {
  margin: 0;
  color: #333;
  font-size: 16px;
}

.guest-count {
  background: white;
  color: #667eea;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid #667eea;
}

.guest-sidebar.collapsed .guest-count {
  background: rgba(255, 255, 255, 0.9);
  color: #667eea;
}

.guest-list {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}

.guest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  background: #f8f8f8;
  border-radius: 8px;
  transition: all 0.3s;
}

.guest-item:hover {
  background: #f0f0f0;
  transform: translateX(-5px);
}

.guest-name {
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guest-status {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  display: inline-block;
}

.btn-invite-guest {
  padding: 4px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s;
}

.btn-invite-guest:hover {
  background: #764ba2;
}

/* Guest List Dropdown (Mobile) */
.guest-dropdown {
  position: fixed;
  top: 70px;
  right: 10px;
  width: 280px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 15px;
  max-height: 300px;
  z-index: 1001;
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.dropdown-header h4 {
  margin: 0;
  color: #333;
  font-size: 16px;
}

.guest-list-mobile {
  max-height: 200px;
  overflow-y: auto;
}

.mobile-only {
  display: none;
}

/* Bottom Action Bar */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 15px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.action-bar-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.action-bar-content span {
  color: white;
  font-size: 14px;
  font-weight: 500;
}

.btn-action {
  background: white;
  color: #667eea;
  border: none;
  padding: 10px 30px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-action:disabled {
  background: rgba(255, 255, 255, 0.5);
  color: rgba(0, 0, 0, 0.3);
  cursor: not-allowed;
}

#waitingForHost {
  color: rgba(255, 255, 255, 0.9);
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .action-bar-content {
    flex-direction: column;
    gap: 10px;
  }

  .action-bar-content span {
    text-align: center;
  }
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex;
  }

  .desktop-only {
    display: none;
  }

  .guest-sidebar {
    display: none;
  }
}

.no-guests {
  text-align: center;
  color: #999;
  padding: 20px;
  font-style: italic;
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #333;
}

.promotion-pieces {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.promotion-piece {
  width: 80px;
  height: 80px;
  font-size: 60px;
  border: 2px solid #ddd;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.promotion-piece:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

.check {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0;
    margin: 0;
  }

  #chessboard {
    grid-template-columns: repeat(8, min(11vw, 50px));
    grid-template-rows: repeat(8, min(11vw, 50px));
  }

  .square {
    width: min(11vw, 50px);
    height: min(11vw, 50px);
    font-size: min(7vw, 35px);
  }

  h1 {
    font-size: 1.8em;
  }

  .menu-buttons {
    flex-direction: column;
  }

  .game-area {
    padding: 10px;
    margin: 20px auto;
    width: 100%;
    max-width: 100%;
  }

  .game-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    gap: 10px;
  }

  .game-controls {
    justify-content: flex-start;
    gap: 6px;
  }

  .btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .game-header {
    padding: 10px;
  }

  .header-left {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .header-center {
    display: none; /* Hide center section on mobile */
  }

  .header-right {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 5px;
  }

  .room-title {
    font-size: 0.9em;
  }

  .header-left .room-title {
    color: white;
    font-weight: bold;
  }

  .room-title strong {
    font-size: 1.1em;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  #currentTurn {
    font-size: 0.9em;
    padding: 5px 10px;
  }
}

/* Room List Styles */
.room-list-section {
  margin-top: 20px;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.room-list {
  max-height: 250px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin-top: 10px;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateX(5px);
}

.room-item:last-child {
  margin-bottom: 0;
}

.room-code {
  font-weight: bold;
  color: #fff;
  font-size: 1.1rem;
}

.room-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-count {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.join-room-btn {
  padding: 6px 15px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

.join-room-btn:hover {
  background: #45a049;
}

.no-rooms {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 20px;
}

/* Additional styles for chess game */
.game-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  display: flex;
  flex-direction: column;
}

.game-mode-selection h3,
.time-control-settings h3,
.color-selection h3,
.difficulty-settings h3 {
  margin-bottom: 15px;
  color: #333;
}

.time-control-settings,
.color-selection,
.difficulty-settings {
  margin-top: 20px;
}

/* Override existing chess board styles */
#chessboard {
  display: grid !important;
  grid-template-columns: repeat(8, 70px) !important;
  grid-template-rows: repeat(8, 70px) !important;
  border: 4px solid #8b4513 !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5) !important;
  background: #8b4513 !important;
  padding: 0 !important;
  margin: 0 auto !important;
}

.chess-board {
  display: grid !important;
  grid-template-columns: repeat(8, 70px) !important;
  grid-template-rows: repeat(8, 70px) !important;
  border: 4px solid #8b4513 !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5) !important;
  background: #8b4513 !important;
  padding: 0 !important;
}

.square {
  width: 70px !important;
  height: 70px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s !important;
}

.square.light {
  background: #f0d9b5 !important;
}

.square.dark {
  background: #b58863 !important;
}

.square.selected {
  background: #829769 !important;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4) !important;
}

.square.last-move {
  background: #cdd26a !important;
}

.square.check {
  background: #fe4444 !important;
  animation: checkPulse 1s infinite !important;
}

@keyframes checkPulse {
  0%,
  100% {
    box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.5);
  }
  50% {
    box-shadow: inset 0 0 30px rgba(255, 0, 0, 0.8);
  }
}

.piece {
  font-size: 50px !important;
  cursor: grab !important;
  user-select: none !important;
  z-index: 10 !important;
  transition: transform 0.1s !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.piece:hover {
  transform: scale(1.05) !important;
}

.piece:active {
  cursor: grabbing !important;
  transform: scale(1.1) !important;
}

/* Move hints */
.move-hint {
  position: absolute !important;
  width: 24px !important;
  height: 24px !important;
  background: rgba(0, 0, 0, 0.25) !important;
  border-radius: 50% !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

.capture-hint {
  position: absolute !important;
  width: 66px !important;
  height: 66px !important;
  border: 4px solid rgba(255, 0, 0, 0.6) !important;
  border-radius: 50% !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

/* Coordinates */
.rank-label {
  position: absolute !important;
  left: 3px !important;
  top: 3px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  color: #666 !important;
  opacity: 0.7 !important;
}

.file-label {
  position: absolute !important;
  right: 3px !important;
  bottom: 3px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  color: #666 !important;
  opacity: 0.7 !important;
}

/* Fix game main layout */
.game-main {
  flex: 1 !important;
  display: flex !important;
  padding: 30px !important;
  gap: 30px !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  width: 100% !important;
}

/* Left panel with board */
.left-panel {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 20px !important;
}

/* Player info cards */
.player-info {
  background: rgba(255, 255, 255, 0.95) !important;
  border-radius: 12px !important;
  padding: 12px 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  min-width: 560px !important;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

.player-info.opponent-info {
  background: linear-gradient(135deg, #3498db, #2980b9) !important;
  color: white !important;
}

.player-info.current-player-info {
  background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
  color: white !important;
}

.player-avatar {
  font-size: 40px !important;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

.player-details {
  flex: 1 !important;
}

.player-name {
  font-weight: bold !important;
  font-size: 18px !important;
  margin-bottom: 4px !important;
}

.player-rating {
  font-size: 14px !important;
  opacity: 0.9 !important;
}

.player-timer {
  font-size: 24px !important;
  font-weight: bold !important;
  padding: 8px 16px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 8px !important;
  font-family: "Courier New", monospace !important;
  min-width: 100px !important;
  text-align: center !important;
}

.player-timer.low-time {
  background: #e74c3c !important;
  animation: timePulse 1s infinite !important;
}

@keyframes timePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Right panel */
.right-panel {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 25px !important;
  min-width: 350px !important;
  max-width: 450px !important;
}

/* Game controls */
.game-controls {
  display: flex !important;
  gap: 12px !important;
}

.control-btn {
  flex: 1 !important;
  padding: 14px !important;
  background: linear-gradient(135deg, #fff, #f8f9fa) !important;
  border: 2px solid #dee2e6 !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1) !important;
}

.control-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2) !important;
}

/* Move history */
.move-history {
  background: rgba(255, 255, 255, 0.95) !important;
  border-radius: 12px !important;
  padding: 20px !important;
  flex: 1 !important;
  overflow-y: auto !important;
  max-height: 450px !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.move-history h3 {
  margin-bottom: 15px !important;
  color: #2c3e50 !important;
  font-size: 18px !important;
  border-bottom: 2px solid #ecf0f1 !important;
  padding-bottom: 10px !important;
}

.move-list {
  font-family: "Courier New", monospace !important;
  font-size: 15px !important;
}

.move-row {
  display: flex !important;
  padding: 8px !important;
  border-radius: 6px !important;
  transition: background 0.2s !important;
}

.move-row:hover {
  background: #ecf0f1 !important;
}

.move-number {
  width: 45px !important;
  color: #7f8c8d !important;
  font-weight: bold !important;
}

.move-text {
  flex: 1 !important;
  padding: 0 12px !important;
  cursor: pointer !important;
  border-radius: 4px !important;
  transition: background 0.2s !important;
}

.move-text:hover {
  background: #dfe6e9 !important;
}

/* Game status */
.game-status {
  background: rgba(255, 255, 255, 0.95) !important;
  border-radius: 12px !important;
  padding: 20px !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.status-message {
  font-size: 20px !important;
  font-weight: bold !important;
  color: #2c3e50 !important;
  text-align: center !important;
  margin-bottom: 20px !important;
  padding: 10px !important;
  background: linear-gradient(135deg, #f39c12, #e67e22) !important;
  color: white !important;
  border-radius: 8px !important;
}

.captured-pieces {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

.captured-white,
.captured-black {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  font-size: 24px !important;
  padding: 8px !important;
  background: #ecf0f1 !important;
  border-radius: 6px !important;
}

.captured-white span:first-child,
.captured-black span:first-child {
  font-size: 14px !important;
  color: #7f8c8d !important;
  margin-right: 12px !important;
  font-weight: 600 !important;
}

/* Modal improvements */
.modal {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.8) !important;
  z-index: 1000 !important;
  align-items: center !important;
  justify-content: center !important;
  backdrop-filter: blur(5px) !important;
}

/* When modal needs to be shown */
.modal[style*="display: flex"] {
  display: flex !important;
}

.modal-content {
  background: white !important;
  border-radius: 20px !important;
  padding: 35px !important;
  max-width: 650px !important;
  width: 90% !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
  animation: modalSlideIn 0.3s ease !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Menu styles */
.menu-options {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  margin: 30px 0 !important;
}

.menu-btn {
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
  padding: 20px !important;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
  border: 2px solid #dee2e6 !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  text-align: left !important;
}

.menu-btn:hover {
  transform: translateX(5px) !important;
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  color: white !important;
  border-color: #5568d3 !important;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3) !important;
}

.menu-btn:hover .menu-text strong,
.menu-btn:hover .menu-text small {
  color: white !important;
}

.menu-icon {
  font-size: 36px !important;
  min-width: 50px !important;
  text-align: center !important;
}

.menu-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.menu-text strong {
  font-size: 18px !important;
  color: #2c3e50 !important;
}

.menu-text small {
  font-size: 14px !important;
  color: #6c757d !important;
}

.back-to-home {
  margin-top: 20px !important;
  padding: 12px 24px !important;
  background: transparent !important;
  border: 2px solid #dee2e6 !important;
  border-radius: 8px !important;
  color: #6c757d !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
}

.back-to-home:hover {
  background: #f8f9fa !important;
  border-color: #adb5bd !important;
}

/* Room creation styles */
.room-settings {
  display: flex !important;
  flex-direction: column !important;
  gap: 25px !important;
  margin: 20px 0 !important;
}

.room-code-display {
  text-align: center !important;
  padding: 20px !important;
  background: #f8f9fa !important;
  border-radius: 12px !important;
}

.room-code-display label {
  display: block !important;
  margin-bottom: 10px !important;
  color: #6c757d !important;
  font-size: 14px !important;
}

.room-code {
  font-size: 48px !important;
  font-weight: bold !important;
  letter-spacing: 8px !important;
  color: #667eea !important;
  margin: 15px 0 !important;
  font-family: "Courier New", monospace !important;
}

.copy-btn {
  padding: 10px 20px !important;
  background: #667eea !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
}

.copy-btn:hover {
  background: #5568d3 !important;
  transform: translateY(-2px) !important;
}

.waiting-status {
  text-align: center !important;
  padding: 30px !important;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1)) !important;
  border-radius: 12px !important;
  border: 2px dashed rgba(102, 126, 234, 0.3) !important;
}

.spinner {
  width: 50px !important;
  height: 50px !important;
  border: 4px solid #f3f3f3 !important;
  border-top: 4px solid #667eea !important;
  border-radius: 50% !important;
  animation: spin 1s linear infinite !important;
  margin: 0 auto 20px !important;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.share-text {
  margin-top: 10px !important;
  font-size: 14px !important;
  color: #6c757d !important;
}

.share-text strong {
  color: #667eea !important;
  font-size: 16px !important;
}

/* Join room styles */
.join-room-form {
  padding: 20px !important;
  text-align: center !important;
}

.join-room-form label {
  display: block !important;
  margin-bottom: 15px !important;
  color: #2c3e50 !important;
  font-size: 16px !important;
}

.join-room-form input {
  width: 100% !important;
  padding: 15px !important;
  font-size: 24px !important;
  text-align: center !important;
  letter-spacing: 4px !important;
  border: 2px solid #dee2e6 !important;
  border-radius: 8px !important;
  margin-bottom: 20px !important;
  font-family: "Courier New", monospace !important;
}

.join-room-form input:focus {
  outline: none !important;
  border-color: #667eea !important;
}

/* Responsive */
@media (max-width: 1200px) {
  .game-main {
    flex-direction: column !important;
    align-items: center !important;
  }

  .right-panel {
    width: 100% !important;
    max-width: 600px !important;
  }
}

@media (max-width: 768px) {
  #chessboard,
  .chess-board {
    grid-template-columns: repeat(8, 45px) !important;
    grid-template-rows: repeat(8, 45px) !important;
  }

  .square {
    width: 45px !important;
    height: 45px !important;
  }

  .piece {
    font-size: 32px !important;
  }

  .player-info {
    min-width: auto !important;
    width: 100% !important;
  }

  .menu-icon {
    font-size: 28px !important;
    min-width: 40px !important;
  }

  .menu-text strong {
    font-size: 16px !important;
  }

  .menu-text small {
    font-size: 12px !important;
  }
}
