/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
html {
  font-family: "Arial", sans-serif;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hidden {
  display: none !important;
}

/* ===== TELA DE LOGIN ===== */
#auth-section {
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #1e9ed9 0%, #17a2b8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  max-width: 450px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.auth-logo h1 {
  font-size: 48px;
  font-weight: 900;
  color: #2c3e50;
  margin-bottom: 10px;
  line-height: 1.1;
}

.auth-logo h1 span {
  color: #e67e22;
  font-size: 36px;
}

.auth-welcome {
  font-size: 20px;
  color: #34495e;
  margin: 20px 0 30px;
  font-weight: 600;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: #ecf0f1;
  color: #7f8c8d;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.auth-tab.active {
  background: #3498db;
  color: white;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-form input {
  padding: 15px;
  border: 2px solid #ecf0f1;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border 0.3s;
}

.auth-form input:focus {
  border-color: #3498db;
}

.btn-primary {
  padding: 15px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary:hover {
  background: #2980b9;
}

.status {
  font-size: 14px;
  min-height: 20px;
}

.status.error {
  color: #e74c3c;
}

.status.success {
  color: #27ae60;
}

/* ===== LOBBY ===== */
#lobby {
  width: 100%;
  height: 100vh;
  background: radial-gradient(ellipse at center, #2d5016 0%, #1a3009 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.lobby-container {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 8px;
}

.lobby-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-howto {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-howto:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lobby-title {
  font-size: 48px;
  font-weight: 900;
  color: white;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.lobby-title span {
  color: #ff9500;
  font-size: 32px;
}

/* Botões Principais do Lobby */
.lobby-main-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.lobby-main-btn {
  width: 100%;
  padding: 25px 30px;
  border-radius: 15px;
  border: none;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
  border: 2px solid rgba(0, 0, 0, 0.1);
  color: #000;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  backdrop-filter: blur(10px);
}

.lobby-main-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.lobby-main-btn:active {
  transform: translateY(-1px);
}

.lobby-btn-icon {
  font-size: 48px;
  line-height: 1;
}

.lobby-btn-text {
  flex: 1;
}

.lobby-btn-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 5px;
}

.lobby-btn-subtitle {
  font-size: 14px;
  opacity: 0.8;
}

.lobby-btn-play {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border-color: rgba(0, 0, 0, 0.1);
  color: #000;
}

.lobby-btn-play:hover {
  background: linear-gradient(135deg, #2980b9 0%, #1f6391 100%);
  color: #000;
}

.lobby-btn-rooms {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  border-color: rgba(0, 0, 0, 0.1);
  color: #000;
}

.lobby-btn-rooms:hover {
  background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
  color: #000;
}

.lobby-btn-ranking {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  border-color: rgba(0, 0, 0, 0.1);
  color: #000;
}

.lobby-btn-ranking:hover {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
  color: #000;
}

/* Abas do Lobby */
.lobby-tab {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  margin-top: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: tabSlideIn 0.3s ease-out;
}

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

.lobby-tab.hidden {
  display: none;
}

.lobby-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.lobby-tab-header h2 {
  margin: 0;
  font-size: 28px;
  color: #2c3e50;
  font-weight: 700;
}

.close-tab-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #e74c3c;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-tab-btn:hover {
  background: #c0392b;
  transform: rotate(90deg);
}

.lobby-tab-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Filtro de salas */
.rooms-filter {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.rooms-filter select {
  flex: 1;
  padding: 10px 15px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
  background: white;
}

.rooms-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Ranking tabs dentro da aba */
.lobby-tab .ranking-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.lobby-tab .ranking-tab-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.05);
  color: #2c3e50;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.lobby-tab .ranking-tab-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.lobby-tab .ranking-tab-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border-color: #2980b9;
}

/* Abas do Lobby */
.lobby-tab {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  margin-top: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: tabSlideIn 0.3s ease-out;
}

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

.lobby-tab.hidden {
  display: none;
}

.lobby-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.lobby-tab-header h2 {
  margin: 0;
  font-size: 28px;
  color: #2c3e50;
  font-weight: 700;
}

.close-tab-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #e74c3c;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-tab-btn:hover {
  background: #c0392b;
  transform: rotate(90deg);
}

.lobby-tab-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lobby-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 40px;
}

.capacity-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

.capacity-label {
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
}

.capacity-select {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 200px;
  text-align: center;
}

.capacity-select:hover {
  background: white;
  border-color: #1e9ed9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.capacity-select:focus {
  outline: none;
  border-color: #1e9ed9;
  box-shadow: 0 0 0 3px rgba(30, 158, 217, 0.3);
}

/* Seletor de Aposta */
.bet-selector {
  margin-bottom: 20px;
  width: 100%;
}

.bet-label {
  display: block;
  color: #2c3e50;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 12px;
  text-align: center;
}

.bet-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.bet-btn {
  padding: 12px 8px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.bet-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bet-btn.active {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  border-color: #f39c12;
  color: white;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
  transform: scale(1.05);
}

.bet-btn:active {
  transform: scale(0.98);
}

.btn-large {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 30px;
  border-radius: 50px;
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.btn-blue {
  background: linear-gradient(135deg, #1e9ed9 0%, #17a2b8 100%);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.btn-icon-large {
  font-size: 32px;
}

.btn-text {
  text-align: left;
}

.btn-title {
  font-size: 24px;
  font-weight: 900;
}

.btn-subtitle {
  font-size: 14px;
  opacity: 0.9;
}

.rooms-section {
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 15px;
}

.rooms-section h3 {
  color: white;
  margin-bottom: 15px;
  font-size: 18px;
}

.rooms-section select,
.rooms-section button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  margin: 5px;
  cursor: pointer;
}

#rooms-list {
  list-style: none;
  margin-top: 15px;
}

#rooms-list li {
  background: white;
  padding: 12px;
  margin: 8px 0;
  border-radius: 8px;
  color: #2c3e50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#rooms-list button {
  background: #27ae60;
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

#rooms-list button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Botão de fechar sala (admin) */
.btn-close-room {
  background: #e74c3c !important;
  font-weight: 600;
}

.btn-close-room:hover {
  background: #c0392b !important;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

/* ===== MESA DE JOGO ===== */

/* Header da Sala */

/* Indicador de Chat no Header */
.chat-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  padding: 10px 16px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.6);
  animation: chatPulse 2s ease-in-out infinite;
  max-width: 500px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex: 1;
}

.chat-indicator:hover {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.8);
}

@keyframes chatPulse {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.6);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 6px 24px rgba(231, 76, 60, 0.9);
    transform: scale(1.03);
  }
}

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

.chat-indicator-badge {
  background: white;
  color: #e74c3c;
  font-size: 13px;
  font-weight: 900;
  padding: 5px 10px;
  border-radius: 15px;
  min-width: 28px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chat-indicator-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chat-preview-icon {
  font-size: 18px;
  line-height: 1;
}

.chat-preview-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capacity-info {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.btn-start-game {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn-start-game:hover {
  background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.btn-start-game:active {
  transform: translateY(0);
}

.btn-start-game:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.room-info {
  display: flex;
  gap: 15px;
  align-items: center;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.score-badge {
  background: #f39c12;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 14px;
}

/* Menu Hamburguer */
.menu-hamburger {
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 100;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-hamburger:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Badge de notificação no menu */
.menu-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(231, 76, 60, 0.9);
  }
}

.menu-notification-badge.hidden {
  display: none;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: #1e272e;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: 20px;
  transition: transform 0.3s ease;
  transform: translateX(0);
}

.side-menu.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.close-menu {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
}

.menu-items {
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.menu-item {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: background 0.3s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Áreas dos Jogadores */

/* Topo: perfil + prévia da mão do oponente na mesma faixa, centralizados */

.player-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #34495e;
  border: 3px solid #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
}

.player-info {
  color: white;
  font-size: 14px;
  text-align: center;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
}

/* ===== MINI PERFIL DOS JOGADORES ===== */
.mini-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transition: all 0.3s;
  min-width: 120px;
}

.mini-profile.empty {
  opacity: 0.5;
}

.mini-profile.active-turn {
  border-color: #f39c12;
  background: rgba(243, 156, 18, 0.2);
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
  animation: pulse-turn 2s infinite;
}

@keyframes pulse-turn {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
  }
  50% {
    box-shadow: 0 0 25px rgba(243, 156, 18, 0.8);
  }
}

.mini-profile.is-me {
  border-color: #27ae60;
  background: rgba(39, 174, 96, 0.15);
}

.mini-profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: visible;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mini-profile-avatar.empty-avatar {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.level-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 5;
  white-space: nowrap;
}

.mini-profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-profile-initial {
  font-size: 24px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: center;
  color: white;
}

.mini-profile-stats {
  display: flex;
  gap: 8px;
  justify-content: flex-start; /* Começa na esquerda */
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  padding: 4px 0;
  margin-left: -8px; /* ← AJUSTE EM PX AQUI (50px, 100px, etc) */
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
}

.stat-icon {
  font-size: 12px;
  line-height: 1;
}

.stat-value {
  font-weight: 600;
  color: white;
  font-size: 11px;
}

.mini-profile-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mini-admin-badge {
  font-size: 12px;
  filter: drop-shadow(0 0 3px rgba(243, 156, 18, 0.8));
}

.mini-profile-meta {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.turn-indicator {
  animation: bounce-turn 1s infinite;
}

@keyframes bounce-turn {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Ajustes para slots laterais */
.player-side .mini-profile {
  flex-direction: row;
  min-width: auto;
  width: 100%;
  padding: 8px;
}

.player-side .mini-profile-avatar {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.player-side .mini-profile-initial {
  font-size: 20px;
}

.player-side .mini-profile-info {
  flex: 1;
  text-align: left;
  margin-left: 10px;
}

.player-side .mini-profile-name {
  justify-content: flex-start;
}

.player-side .mini-profile-meta {
  justify-content: flex-start;
}

/* Ajustes para slot do topo */
.player-top .mini-profile {
  flex-direction: row;
  min-width: auto;
  padding: 8px 15px;
}

.player-top .mini-profile-avatar {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.player-top .mini-profile-info {
  margin-left: 10px;
  text-align: left;
}

/* Centro do Jogo — min-width:0 evita grid estourar largura no mobile */

.player-top .mini-profile,
.player-bottom .mini-profile {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
}

.player-top .mini-profile-avatar,
.player-bottom .mini-profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 8px;
}

.player-top .mini-profile-info,
.player-bottom .mini-profile-info {
  flex: 1;
  align-items: flex-start;
}

.player-side .player-slot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.player-side .mini-profile {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  min-width: 72px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 14px;
}

/* Sala: evita arrastar a página inteira para o lado no mobile */

/* Pontas + cadeia agrupadas e centralizadas na área útil da mesa */

.end-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.end-pill.end-left {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.35), rgba(41, 128, 185, 0.2));
  border: 1px solid rgba(52, 152, 219, 0.45);
}

.end-pill.end-right {
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.35), rgba(142, 68, 173, 0.2));
  border: 1px solid rgba(155, 89, 182, 0.45);
}

.end-pill .end-label {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
}

.end-pill .end-val {
  font-size: 1.15rem;
  min-width: 1.2em;
  text-align: center;
}

.game-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: min(420px, 92vw);
  padding: 12px 18px;
  background: rgba(20, 25, 35, 0.95);
  color: #fff;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.9rem;
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.game-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-toast.hidden {
  display: none;
}

/* Scroll só na cadeia; não empurra a página horizontalmente */

/* Cadeia horizontal — leitura natural do dominó */

/* Desktop: mesa mais alta e peças um pouco maiores; mesa centralizada na coluna em 3–4 jogadores */

.modal-howto-overlay {
  position: fixed;
  inset: 0;
  z-index: 25000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.modal-howto-overlay.hidden {
  display: none;
}

.modal-howto {
  position: relative;
  max-width: 420px;
  width: 100%;
  max-height: min(85vh, 560px);
  overflow-y: auto;
  background: linear-gradient(165deg, #1e2a3a 0%, #15202b 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  color: #e8ecf1;
}

.modal-howto h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  color: #fff;
}

.modal-howto-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-howto-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-howto-body {
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-howto-body ul {
  margin: 10px 0 0;
  padding-left: 1.2rem;
}

.modal-howto-body li {
  margin-bottom: 8px;
}

.modal-howto-tip {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: rgba(52, 152, 219, 0.15);
  border-radius: 10px;
  border: 1px solid rgba(52, 152, 219, 0.35);
  font-size: 0.85rem;
}

/* Mãos decorativas na borda: duplicam oponente e atrapalham alinhamento — desligado em todas as telas */

/* Baseline responsivo global */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
picture,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Toasts de chat */
.chat-toasts {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3000;
  pointer-events: none;
  width: min(92%, 420px);
}

.chat-toast {
  background: rgba(0, 0, 0, 0.78);
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.chat-toast.system {
  background: rgba(46, 204, 113, 0.9);
  color: #0b2415;
  border-color: rgba(255, 255, 255, 0.3);
}

.chat-toast.me {
  background: rgba(52, 152, 219, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}

.chat-toast-name {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 13px;
}

.chat-toast-text {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

/* Evitar estouro de textos dinâmicos */
.mini-profile-name,
.mini-profile-info,
.player-info,
.chat-message-text,
.chat-message-name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Peças */

/* Peças na mesa (horizontal — metades esq./dir.) */

/* Layout em grade antigo (fallback se remover .table-chain) */

/* Ajustar pips para peças horizontais na mesa */

/* Indicador visual de conexão entre peças - linha verde entre peças conectadas */

/* Destaque nos lados das peças que se conectam */

/* Animação suave para destacar conexões */
@keyframes connect-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(39, 174, 96, 0.8);
  }
}

/* Hover para peças na mesa (horizontal) */

/* Peça selecionada - efeito visual destacado */

@keyframes tile-select {
  0% {
    transform: scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.15);
  }
  100% {
    transform: translateY(-8px) scale(1.1);
  }
}

@keyframes tile-selected-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.4),
      0 4px 20px rgba(243, 156, 18, 0.6);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(243, 156, 18, 0.6),
      0 6px 25px rgba(243, 156, 18, 0.8);
  }
}

@keyframes tile-play {
  0% {
    transform: translateY(-8px) scale(1.1);
    opacity: 1;
  }
  50% {
    transform: translateY(-15px) scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
}

/* Peça voando da mão para a mesa */

/* Efeito de pouso na mesa */
@keyframes tile-land {
  0% {
    transform: scale(0.9) rotate(0deg);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Aplicar animação de pouso quando a peça aparece na mesa */

/* Efeito de brilho quando a peça chega na mesa */
@keyframes tile-glow {
  0%,
  100% {
    box-shadow: 0 4px 20px rgba(39, 174, 96, 0.6);
  }
  50% {
    box-shadow: 0 6px 30px rgba(39, 174, 96, 0.9);
  }
}

/* Padrão de fundo para peça virada */

/* Peças do oponente na mesa também devem aparecer viradas */

/* Peças do oponente visíveis apenas para admin */

/* Mão do Jogador */

/* Botões de Ação */
.game-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-game {
  padding: 15px 30px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  min-height: 48px;
}

.btn-game:hover {
  background: #229954;
  transform: translateY(-2px);
}

.btn-game:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #3498db;
  color: white;
}

/* ===== CARD DE PERFIL AO ENTRAR NA SALA ===== */
.profile-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  animation: profileCardEnter 0.3s ease-out forwards;
  backdrop-filter: blur(10px);
}

@keyframes profileCardEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.profile-card.hidden {
  display: none;
}

.close-profile-card {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 18px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.close-profile-card:hover {
  background: rgba(0, 0, 0, 0.2);
}

.profile-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.profile-card-avatar {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #27ae60;
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-initial {
  font-size: 40px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  text-align: center;
}

.profile-card-name {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  margin-bottom: 5px;
  text-align: center;
  width: 100%;
}

.profile-card-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.profile-card-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(52, 152, 219, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  border: 2px solid rgba(52, 152, 219, 0.2);
}

.profile-card-stat .stat-icon {
  font-size: 18px;
  line-height: 1;
}

.profile-card-stat .stat-value {
  font-weight: 700;
  color: #3498db;
  font-size: 16px;
}

.profile-card-admin {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  width: fit-content;
  margin: 0 auto 10px auto;
  text-align: center;
}

.profile-card-message {
  color: #7f8c8d;
  font-size: 16px;
  margin: 0;
  font-style: italic;
  text-align: center;
  width: 100%;
}

/* Responsivo */
/* ===== RESPONSIVO MOBILE ===== */
@media (max-width: 768px) {
  /* Login e Auth */
  .auth-container {
    padding: 30px 20px;
    max-width: 100%;
    margin: 10px;
  }

  .auth-logo h1 {
    font-size: 36px;
  }

  .lobby-title {
    font-size: 28px;
  }

  .btn-title {
    font-size: 18px;
  }

  /* Mesa de Jogo - Layout Mobile */
  

  

  

  .room-info {
    font-size: 14px;
    gap: 10px;
  }

  .score-badge {
    font-size: 12px;
    padding: 4px 8px;
  }

  .menu-hamburger {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* Badge de notificação no menu - Mobile */
  .menu-notification-badge {
    top: -4px;
    right: -4px;
    font-size: 10px;
    padding: 2px 5px;
    min-width: 18px;
  }

  /* Jogadores Laterais - Mobile */
  

  .player-left {
    order: 1;
  }

  .player-right {
    order: 3;
  }

  

  

  .player-side .mini-profile {
    width: 100%;
    max-width: 100%;
    padding: 4px 2px;
    gap: 2px;
    min-width: 0;
    flex-direction: column;
    align-items: center;
  }

  .player-side .mini-profile-info {
    text-align: center;
    margin-left: 0;
    gap: 2px;
  }

  .player-side .mini-profile-name {
    justify-content: center;
    font-size: 10px;
    margin-bottom: 0;
  }

  .player-side .mini-profile-meta {
    justify-content: center;
    font-size: 8px;
  }

  .player-side .mini-profile-avatar {
    width: 32px;
    height: 32px;
  }

  .player-side .mini-profile-initial {
    font-size: 14px;
  }

  .player-side .mini-profile-stats {
    display: none; /* Ocultar stats nos laterais para economizar espaço */
  }

  .mini-profile-stats {
    gap: 4px;
    padding: 2px 0;
    margin-left: -8px;
  }

  .stat-item {
    padding: 2px 6px;
    font-size: 10px;
  }

  .stat-icon {
    font-size: 10px;
  }

  .stat-value {
    font-size: 10px;
  }

  .level-badge {
    font-size: 9px;
    padding: 1px 4px;
    bottom: -3px;
    right: -3px;
  }

  /* Jogador Topo - Mobile */
  

  .player-top .mini-profile {
    padding: 4px 8px;
    gap: 4px;
  }

  .player-top .mini-profile-avatar {
    width: 35px;
    height: 35px;
  }

  .player-top .mini-profile-name {
    font-size: 11px;
  }

  .player-top .mini-profile-meta {
    font-size: 9px;
  }

  .player-top .mini-profile-stats {
    gap: 3px;
    padding: 1px 0;
    margin-left: -8px;
  }

  .player-top .stat-item {
    padding: 1px 4px;
    font-size: 8px;
  }

  /* Layout geral do jogo no mobile - grid vertical */
  

  

  

  

  

  .player-top .mini-profile {
    padding: 5px 10px;
  }

  .player-top .mini-profile-avatar {
    width: 40px;
    height: 40px;
  }

  .player-top .mini-profile-initial {
    font-size: 16px;
  }

  /* Mesa de Jogo - Mobile */
  

  

  

  

  

  

  

  

  

  /* Peças na mesa (horizontal) - Mobile */
  

  

  /* Peças - Mobile */
  

  

  

  

  /* Mão do Jogador - Mobile */
  

  

  

  

  

  

  

  /* Área de Ações - Mobile */
  .game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 8px 5px;
    touch-action: manipulation;
    width: 100%;
  }

  .btn-game {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    min-width: 100px;
    min-height: 44px;
    flex: 1;
    max-width: 150px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .btn-game:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }

  .btn-game.hidden {
    display: none;
  }

  /* Mini Perfis - Mobile */
  .mini-profile {
    min-width: 100px;
    padding: 8px;
  }

  .mini-profile-avatar {
    width: 50px;
    height: 50px;
  }

  .mini-profile-initial {
    font-size: 20px;
  }

  .mini-profile-name {
    font-size: 12px;
  }

  .mini-profile-meta {
    font-size: 10px;
  }

  /* Lobby - Mobile */
  .lobby-container {
    padding: 15px;
  }

  .lobby-buttons {
    gap: 15px;
  }

  .capacity-selector {
    margin-bottom: 10px;
  }

  .capacity-select {
    min-width: 100%;
    font-size: 14px;
    padding: 10px 15px;
  }

  .bet-selector {
    margin-bottom: 15px;
  }

  .bet-buttons {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .bet-btn {
    padding: 10px 6px;
    font-size: 12px;
  }

  

  

  /* Chat Indicator Mobile */
  .chat-indicator {
    padding: 8px 12px;
    font-size: 12px;
    max-width: 250px;
    flex: 1;
  }

  .chat-indicator-badge {
    font-size: 11px;
    padding: 4px 8px;
    min-width: 24px;
  }

  .chat-preview-icon {
    font-size: 16px;
  }

  .chat-preview-text {
    font-size: 12px;
  }

  .btn-start-game {
    font-size: 12px;
    padding: 6px 12px;
    flex: 1;
  }

  .capacity-info {
    font-size: 11px;
    padding: 3px 8px;
  }

  .btn-large {
    padding: 15px 20px;
    font-size: 18px;
  }

  .btn-icon-large {
    font-size: 28px;
  }

  /* Menu Lateral - Mobile */
  .side-menu {
    width: 100%;
    max-width: 280px;
  }

  /* Card de Perfil - Mobile */
  .profile-card {
    min-width: 280px;
    max-width: 90%;
    padding: 20px;
  }

  .profile-card-avatar {
    width: 80px;
    height: 80px;
  }

  .profile-card-initial {
    font-size: 32px;
  }

  .profile-card-name {
    font-size: 20px;
  }

  .profile-card-stats {
    gap: 8px;
    transform: translateX(-8px);
  }

  .profile-card-stat {
    padding: 6px 12px;
    font-size: 14px;
  }

  .profile-card-stat .stat-icon {
    font-size: 16px;
  }

  .profile-card-stat .stat-value {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  /* Variáveis ajustadas para telas muito pequenas */
  

  /* Garantir que tudo caiba na largura */
  body {
    overflow-x: hidden;
  }

  .chat-toasts {
    top: 60px;
    width: min(94%, 360px);
  }

  

  .mini-profile,
  .profile-card,
  .profile-container,
  .ranking-item,
  .profile-content,
  .lobby-container {
    width: 100%;
    max-width: 100%;
  }

  /* Textos e badges não estourarem */
  .room-info,
  .score-badge,
  .capacity-info,
  .mini-profile-name,
  .mini-profile-meta,
  .player-info {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* =====================
     CONTAINER PRINCIPAL
  ====================== */
  

  

  /* =====================
     HEADER
  ====================== */
  

  .room-info {
    font-size: 13px;
    gap: 10px;
  }
  .score-badge {
    font-size: 12px;
    padding: 4px 8px;
  }

  .menu-hamburger {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* Badge de notificação no menu - Telas Pequenas */
  .menu-notification-badge {
    top: -3px;
    right: -3px;
    font-size: 9px;
    padding: 2px 4px;
    min-width: 16px;
  }

  /* Chat Indicator - Telas Pequenas */
  .chat-indicator {
    padding: 6px 10px;
    font-size: 11px;
    max-width: 200px;
    gap: 6px;
  }

  .chat-indicator-badge {
    font-size: 10px;
    padding: 3px 6px;
    min-width: 20px;
  }

  .chat-preview-icon {
    font-size: 14px;
  }

  .chat-preview-text {
    font-size: 11px;
  }

  /* =====================
     JOGADOR TOPO
  ====================== */
  

  .player-top .mini-profile {
    padding: 5px 10px;
    gap: 4px;
  }

  .player-top .mini-profile-avatar {
    width: 40px;
    height: 40px;
  }

  .player-top .mini-profile-name {
    font-size: 11px;
  }
  .player-top .mini-profile-meta {
    font-size: 9px;
  }

  /* =====================
     CENTRO DO JOGO
  ====================== */
  

  /* =====================
     JOGADORES LATERAIS
  ====================== */
  

  

  .player-side .mini-profile {
    padding: 4px 2px;
    align-items: center;
    width: 48px;
    min-width: 0;
    border-radius: 10px;
  }

  .player-side .mini-profile-avatar {
    width: 32px;
    height: 32px;
  }

  .player-side .mini-profile-name {
    font-size: 10px;
  }
  .player-side .mini-profile-meta {
    font-size: 8px;
  }
  .player-side .mini-profile-stats {
    display: none;
  }

  /* Placeholders laterais mais discretos */
  .player-side .player-info {
    font-size: 10px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }

  /* Placeholder topo mais compacto */
  .player-top .player-info {
    font-size: 11px;
    padding: 4px 6px;
    max-width: 240px;
    margin: 0 auto;
  }

  /* Cartões mais compactos no mobile para não invadirem a mesa */
  .mini-profile {
    min-width: 90px;
    padding: 8px 6px;
  }

  .mini-profile-avatar {
    width: 44px;
    height: 44px;
  }

  .mini-profile-name {
    font-size: 12px;
  }

  .mini-profile-meta {
    font-size: 10px;
  }

  /* =====================
     MESA DE JOGO
  ====================== */
  

  

  

  

  

  /* =====================
     PEÇAS NA MESA (cadeia flex — nunca absolute)
  ====================== */
  

  

  /* =====================
     MÃO DO JOGADOR
  ====================== */
  

  

  

  

  /* =====================
     BOTÕES DE AÇÃO
  ====================== */
  .game-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 8px 5px;
  }

  .btn-game {
    min-height: 44px;
    min-width: 100px;
    max-width: 150px;
    flex: 1;

    font-size: 14px;
    font-weight: 600;

    border-radius: 8px;
  }

  /* =====================
     PERFIS / MODAIS
  ====================== */
  .mini-profile {
    min-width: 100px;
    padding: 8px;
  }

  .profile-card {
    min-width: 280px;
    max-width: 90%;
    padding: 20px;
  }

  .profile-card-avatar {
    width: 80px;
    height: 80px;
  }

  .profile-card-name {
    font-size: 20px;
  }

  /* =====================
     EXTRAS IMPORTANTES
  ====================== */
  body {
    overscroll-behavior: none;
  }
}

/* ===== PÁGINA DE PERFIL ===== */
#profile-section {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.profile-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  margin: 0 auto;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.btn-back {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.btn-back:hover {
  background: #7f8c8d;
}

.profile-header h1 {
  color: #2c3e50;
  font-size: 28px;
  margin: 0;
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Avatar Section */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.avatar-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: visible;
  border: 4px solid #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.avatar-initial {
  font-size: 60px;
  font-weight: 700;
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  text-align: center;
  line-height: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#profile-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
  pointer-events: none;
  border-radius: 50%;
}

.avatar-wrapper:hover .avatar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* No mobile, mostrar overlay sempre ou adicionar botão separado */
@media (max-width: 768px) {
  .avatar-overlay {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
  }
}

.avatar-upload-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #2c3e50;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
  z-index: 20;
  position: relative;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.avatar-upload-btn:hover {
  background: white;
}

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

/* Garantir que o input também seja clicável */
#avatar-upload {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 30;
  cursor: pointer;
}

label[for="avatar-upload"] {
  cursor: pointer;
  display: inline-block;
  pointer-events: auto;
  z-index: 20;
  position: relative;
}

/* Profile Info */
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.profile-field label {
  color: #2c3e50;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 5px;
}

.profile-field-content {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-field-content .profile-input {
  flex: 1;
  min-width: 200px;
}

.profile-field-content .btn-save {
  flex-shrink: 0;
}

.profile-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.profile-input:focus {
  outline: none;
  border-color: #667eea;
}

.profile-input:disabled {
  background: #f5f5f5;
  color: #7f8c8d;
  cursor: not-allowed;
}

.profile-field small {
  color: #7f8c8d;
  font-size: 12px;
  margin-top: 5px;
  display: block;
}

.btn-save {
  background: #27ae60;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
  white-space: nowrap;
}

.btn-save:hover {
  background: #229954;
}

.btn-save:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.admin-badge {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

/* Status messages */
#profile-section .status {
  font-size: 14px;
  padding: 8px;
  border-radius: 5px;
  margin-top: 5px;
}

#profile-section .status.info {
  background: #d1ecf1;
  color: #0c5460;
}

#profile-section .status.success {
  background: #d4edda;
  color: #155724;
}

#profile-section .status.error {
  background: #f8d7da;
  color: #721c24;
}

/* Responsivo para perfil */
@media (max-width: 768px) {
  .profile-container {
    padding: 20px;
  }

  .profile-header h1 {
    font-size: 24px;
  }

  .avatar-wrapper {
    width: 120px;
    height: 120px;
  }

  .avatar-initial {
    font-size: 48px;
  }

  .profile-field-content {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-field-content .profile-input {
    min-width: 100%;
    width: 100%;
  }

  .btn-save {
    width: 100%;
  }
}

/* ===== RANKING ===== */
.ranking-section {
  margin-top: 30px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  width: 100%;
  max-width: 600px;
}

.ranking-section h3 {
  color: white;
  text-align: center;
  margin-bottom: 15px;
  font-size: 24px;
}

.ranking-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.ranking-tab {
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
}

.ranking-tab:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.ranking-tab.active {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  border-color: #f39c12;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.ranking-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.3s;
}

.ranking-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.ranking-item.top-three {
  background: linear-gradient(
    135deg,
    rgba(243, 156, 18, 0.2) 0%,
    rgba(230, 126, 34, 0.1) 100%
  );
  border: 2px solid rgba(243, 156, 18, 0.5);
}

.ranking-position {
  width: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.position-number {
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
}

.ranking-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-avatar-initial {
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.ranking-info {
  flex: 1;
}

.ranking-name {
  color: rgb(0, 0, 0);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.ranking-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.8);
}

.ranking-value {
  font-size: 18px;
  font-weight: 700;
  color: #f39c12;
  min-width: 100px;
  text-align: right;
}

.loading,
.empty-ranking,
.error {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.7);
}

/* ===== PAINEL ADMIN ===== */
.admin-panel-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border: 3px solid white;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
  z-index: 9999;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-panel-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.7);
}

.admin-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.admin-panel-header h3 {
  color: white;
  font-size: 24px;
  margin: 0;
}

.close-admin-panel {
  background: rgba(231, 76, 60, 0.8);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s;
}

.close-admin-panel:hover {
  background: #e74c3c;
  transform: rotate(90deg);
}

.admin-panel-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.admin-section {
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 15px;
}

.admin-section h4 {
  color: white;
  margin-bottom: 15px;
  font-size: 18px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form label {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 14px;
}

.admin-form input {
  padding: 12px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 16px;
}

.admin-form input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.admin-form input:focus {
  outline: none;
  border-color: #3498db;
  background: rgba(255, 255, 255, 0.15);
}

.btn-admin {
  padding: 12px 24px;
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-admin:hover {
  background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.btn-admin-secondary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 15px;
}

.btn-admin-secondary:hover {
  background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
  transform: translateY(-2px);
}

.admin-status {
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  min-height: 20px;
}

.admin-status.success {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.admin-status.error {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.admin-status.info {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.admin-players-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-players-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  color: white;
  font-size: 14px;
}

.admin-player-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.3s;
}

.admin-player-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

.admin-player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-player-initial {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.admin-player-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.admin-player-id {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.admin-player-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.btn-quick-give {
  padding: 6px 12px;
  background: rgba(243, 156, 18, 0.8);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-quick-give:hover {
  background: #f39c12;
  transform: translateY(-2px);
}

/* Responsivo - Admin Panel */
@media (max-width: 768px) {
  .admin-panel {
    width: 95%;
    max-height: 95vh;
  }

  .admin-players-header,
  .admin-player-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-players-header {
    display: none;
  }

  .admin-player-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .ranking-section {
    padding: 15px;
  }

  .ranking-item {
    flex-wrap: wrap;
    gap: 10px;
  }

  .ranking-value {
    width: 100%;
    text-align: left;
  }
}

/* ===== PAINEL DE CHAT ===== */
.chat-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.chat-panel.hidden {
  display: none;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
  color: white;
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}

.close-chat {
  background: rgba(231, 76, 60, 0.8);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-chat:hover {
  background: #e74c3c;
  transform: rotate(90deg);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: chatMessageSlide 0.3s ease-out;
}

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

.chat-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.chat-avatar-initial {
  z-index: 1;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
}

.chat-message-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.chat-message-text {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  word-wrap: break-word;
  line-height: 1.4;
}

.chat-message-me .chat-message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-message-me .chat-message-text {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
}

.chat-system {
  justify-content: center;
  margin: 8px 0;
}

.chat-system-text {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-style: italic;
  text-align: center;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.chat-input-container {
  display: flex;
  gap: 10px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex: 1;
  padding: 12px 15px;
  border-radius: 25px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.chat-input:focus {
  border-color: #3498db;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.chat-send-btn {
  padding: 12px 24px;
  border-radius: 25px;
  border: none;
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  white-space: nowrap;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.chat-send-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .chat-panel {
    width: 95%;
    max-height: 85vh;
  }

  .chat-message-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .chat-message-text {
    font-size: 13px;
    padding: 6px 10px;
  }

  .chat-send-btn {
    padding: 12px 18px;
    font-size: 13px;
  }
}

/* ===== MODAL DE VITÓRIA ===== */
.winner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.winner-modal.show {
  opacity: 1;
  visibility: visible;
}

.winner-modal-content {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  transition: transform 0.3s ease;
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.winner-modal.show .winner-modal-content {
  transform: scale(1);
}

.winner-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.winner-title {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.winner-title.winner {
  color: #f39c12;
  text-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
}

.winner-message {
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  margin-bottom: 25px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
}

.winner-name {
  font-size: 28px;
  font-weight: 900;
  color: #f39c12;
  margin-bottom: 15px;
  text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.winner-gained {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.prize-highlight {
  color: #f39c12;
  font-weight: 900;
  font-size: 22px;
  text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.winner-countdown {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#countdown-number {
  color: #3498db;
  font-weight: 900;
  font-size: 18px;
}

@media (max-width: 768px) {
  .winner-modal-content {
    padding: 30px 20px;
  }

  .winner-icon {
    font-size: 60px;
  }

  .winner-title {
    font-size: 28px;
  }

  .winner-message {
    font-size: 18px;
    padding: 15px;
  }

  .winner-name {
    font-size: 24px;
  }

  .winner-gained {
    font-size: 16px;
  }

  .prize-highlight {
    font-size: 20px;
  }
}

/* ===== Modo offline ===== */
.lobby-btn-offline {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  border-color: rgba(0, 0, 0, 0.1);
  color: #000;
}
.lobby-btn-offline:hover {
  background: linear-gradient(135deg, #8e44ad 0%, #703688 100%);
  color: #000;
}

.auth-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.auth-offline-sep {
  opacity: 0.6;
  font-size: 0.85rem;
}
.btn-offline {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.btn-offline:hover {
  filter: brightness(1.08);
}
.auth-offline small {
  opacity: 0.6;
  text-align: center;
}

.offline-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.btn-offline-count {
  flex: 1 1 120px;
  padding: 14px 12px;
  border: 0;
  border-radius: 10px;
  background: #27ae60;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.btn-offline-count:hover {
  filter: brightness(1.1);
}

/* =====================================================================
   SISTEMA DE PEÇAS E MESA — única fonte de tamanhos
   Tudo deriva de --tw (lado curto da peça na mão). Para ajustar o tamanho
   do jogo inteiro, mexa só nessa variável. Pontos, bordas e divisórias
   escalam em proporção, então nenhuma peça fica maior/menor que as outras.
   ===================================================================== */
:root {
  --tw: clamp(28px, min(8.6vw, 7vh), 64px); /* peça na mão (vertical): largura = --tw, altura = 2×--tw */
  --tt: calc(var(--tw) * 0.72); /* peça na mesa (horizontal): altura = --tt, largura = 2×--tt */
  --to: calc(var(--tw) * 0.46); /* peça virada do adversário: largura = --to, altura = 2×--to */
}

.tile {
  --w: var(--tw); /* lado curto desta peça */
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: var(--w);
  height: calc(var(--w) * 2);
  box-sizing: border-box;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: calc(var(--w) * 0.2);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* divisória entre as duas metades */
.tile::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 1px;
  pointer-events: none;
}

/* peça na mesa: deitada */
.tile.table-tile {
  --w: var(--tt);
  flex-direction: row;
  width: calc(var(--w) * 2);
  height: var(--w);
}
.tile.table-tile::after {
  left: 50%;
  right: auto;
  top: 12%;
  bottom: 12%;
  width: 2px;
  height: auto;
  transform: translateX(-50%);
}

/* peça do adversário visível só para admin (modo cheat) */
.tile.admin-view {
  --w: calc(var(--tw) * 0.55);
  border: 2px solid #e74c3c;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

/* metades e pontos: tudo em proporção à peça */
.pip-grid {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 14%;
}
.pip-grid > div {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
.pip {
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111;
}

/* estados da peça na mão */
.tile.selectable {
  cursor: pointer;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.35), 0 3px 8px rgba(0, 0, 0, 0.25);
}
.tile.selectable:hover {
  transform: translateY(-4px);
}
.tile.selectable.tile-playable-hint {
  border-color: #2ecc71;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.85), 0 3px 8px rgba(0, 0, 0, 0.25);
}
.tile.selectable.tile-blocked {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: not-allowed;
}
.tile.selectable.tile-blocked:hover {
  transform: none;
}
.tile.selected,
.tile.selected:hover {
  border-color: #f39c12;
  box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.5), 0 6px 18px rgba(243, 156, 18, 0.55);
  transform: translateY(-10px);
  z-index: 5;
  animation: tile-selected-pulse 1.5s ease-in-out infinite;
}
@keyframes tile-select {
  0% {
    transform: none;
  }
  50% {
    transform: translateY(-14px);
  }
  100% {
    transform: translateY(-10px);
  }
}

/* mão do jogador */
.player-hand {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: flex-end;
  gap: var(--tile-gap);
  max-width: 100%;
  min-height: calc(var(--tw) * 2 + 24px);
  padding: 14px 8px 8px;
  box-sizing: border-box;
}

/* mesa: a cadeia quebra de linha em vez de rolar para o lado */
.table-chain-scroll {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: calc(var(--tt) + 16px);
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}
#table.table-chain {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: calc(var(--tt) * 0.4) var(--tile-gap);
  width: 100%;
  max-width: 100%;
  padding: 8px;
  box-sizing: border-box;
}
#table .tile.just-played {
  animation: tile-land 0.5s ease-out, tile-glow 1s ease-in-out 0.5s;
  box-shadow: 0 4px 20px rgba(39, 174, 96, 0.6);
}

/* peça virada (adversários) */
.opponent-tile {
  position: relative;
  flex: 0 0 auto;
  width: var(--to);
  height: calc(var(--to) * 2);
  box-sizing: border-box;
  overflow: hidden;
  background: linear-gradient(145deg, #f6f6f6, #d6d6d6);
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: calc(var(--to) * 0.22);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.tile-back-pattern {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0, 0, 0, 0.07) 6px 12px);
}

/* peças de cada adversário, junto ao perfil dele */
.slot-tiles {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  max-width: 100%;
}
.slot-tiles:empty {
  display: none;
}

/* peça voando da mão para a mesa */
.flying-tile {
  margin: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

/* =====================================================================
   LAYOUT DA SALA — substitui as regras antigas (que se sobrepunham em
   vários @media). Grade de 4 áreas: cabeçalho / adversário do topo /
   centro (laterais + mesa) / mão do jogador. Um único ponto de ajuste.
   ===================================================================== */
#room.game-container {
  --side-w: clamp(54px, 12vw, 170px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "header" "top" "center" "bottom";
  gap: 8px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 8px 10px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  background: radial-gradient(ellipse at center, #2d5016 0%, #0a1504 100%);
}

/* cabeçalho: título + placar à esquerda, menu à direita, dica de jogada embaixo */
.room-header-game {
  grid-area: header;
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  min-width: 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}
.room-header-game .room-info {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-header-actions {
  order: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.game-status-hint {
  order: 3;
  flex: 1 1 100%;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.75);
  padding: 0 4px;
}

/* adversário do topo */
.player-top {
  grid-area: top;
  display: flex;
  justify-content: center;
  min-width: 0;
}
.player-top .player-slot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
.player-top .mini-profile {
  width: auto;
  max-width: 100%;
}

/* centro: lateral esquerda | mesa | lateral direita (colunas fixas, mesa sempre centralizada) */
.game-center {
  grid-area: center;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--side-w);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.game-center.single-column {
  grid-template-columns: minmax(0, 1fr);
}
.player-left {
  grid-column: 1;
}
.player-right {
  grid-column: 3;
}
.player-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.player-side .mini-profile {
  min-width: 0;
  width: 100%;
}

/* mesa */
.game-board {
  grid-column: 2;
  justify-self: center;
  width: 100%;
  max-width: 960px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 12px 24px rgba(0, 0, 0, 0.25);
}
.game-center.single-column .game-board {
  grid-column: 1;
}
/* margin:auto centraliza sem cortar o topo quando o conteúdo é maior que a mesa */
.board-play-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  margin: auto 0;
}
.table-ends {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.5vw, 28px);
  max-width: 100%;
  padding: 8px 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* sua mão + botões */
.player-bottom {
  grid-area: bottom;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-bottom: 6px;
}

@media (max-width: 600px) {
  #room.game-container {
    gap: 6px;
    padding: 6px;
  }
  .room-header-game {
    padding: 6px 10px;
  }
  .game-board {
    padding: 8px;
    border-radius: 14px;
  }
}

/* adversários laterais: peças menores para caber na coluna estreita */
.player-side .slot-tiles {
  --to: calc(var(--tw) * 0.34);
  gap: 2px;
}
.player-side .slot-tiles .tile.admin-view {
  --w: calc(var(--tw) * 0.4);
}

@media (max-width: 600px) {
  .game-status-hint {
    font-size: 0.72rem;
    line-height: 1.25;
  }
}
