@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@400;500;700&display=swap');

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

body {
  font-family: 'Roboto', sans-serif;
  background: #0a0a0a;
  color: #f0f0f0;
  min-height: 100vh;
  overflow-x: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

#lobby-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1f12 0%, #1a0d1f 100%);
}

.lobby-container {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #2e7d32;
  border-radius: 16px;
  padding: 40px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 0 40px rgba(46, 125, 50, 0.3);
}

.title {
  font-family: 'Playfair Display', serif;
  font-size: 2.8em;
  text-align: center;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin-bottom: 8px;
}

.subtitle {
  text-align: center;
  color: #aaa;
  margin-bottom: 30px;
  font-size: 0.9em;
}

.panel {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  color: #ffd700;
  margin-bottom: 15px;
  font-size: 1.2em;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 1em;
}

input:focus {
  outline: none;
  border-color: #2e7d32;
}

.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.settings-row label {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85em;
  color: #aaa;
}

.settings-row input {
  margin: 0;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1em;
  transition: all 0.2s;
  font-family: 'Roboto', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #388e3c, #4caf50);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85em;
  background: #333;
  color: #fff;
  margin-left: 8px;
}

.divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #333;
}

.divider span {
  background: rgba(0, 0, 0, 0.6);
  padding: 0 15px;
  color: #666;
  font-size: 0.9em;
}

#waiting-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1f12 0%, #1a0d1f 100%);
}

.waiting-container {
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.waiting-container h2 {
  color: #ffd700;
  margin-bottom: 20px;
}

.room-info {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.room-info p {
  margin-bottom: 8px;
  color: #ccc;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.player-badge {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95em;
  animation: popIn 0.3s ease-out;
}

.player-badge.host {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
}

@keyframes popIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.settings-display {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  margin: 20px 0;
  color: #aaa;
  font-size: 0.9em;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.2em;
}

#waiting-status {
  margin-top: 15px;
  color: #888;
  font-size: 0.9em;
}

#game-screen {
  flex-direction: column;
  background: radial-gradient(ellipse at center, #1a5c1a 0%, #0d1f0d 100%);
  min-height: 100vh;
}

#game-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  margin-bottom: 10px;
}

.game-info {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #aaa;
  font-size: 0.9em;
}

.twist-indicator {
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85em;
}

.phase-badge {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid #ffd700;
  color: #ffd700;
  padding: 4px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85em;
}

.pot-display {
  font-size: 1.2em;
  font-weight: 700;
  color: #ffd700;
}

.position-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.7em;
  font-weight: 900;
  line-height: 1;
}

.dealer-tag {
  background: #ffd700;
  color: #000;
}

.sb-tag {
  background: #4fc3f7;
  color: #000;
}

.bb-tag {
  background: #ff9800;
  color: #000;
}

.player-tocall {
  color: #e74c3c;
  font-size: 0.8em;
  font-weight: 700;
  margin-top: 3px;
}

.twist-banner {
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #ffd700;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
  text-align: center;
  animation: bannerPulse 2s infinite;
}

@keyframes bannerPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.twist-card-display {
  font-size: 4em;
  margin-bottom: 10px;
}

.twist-banner p {
  color: #ffd700;
  font-weight: 700;
  font-size: 1.1em;
}

.table-area {
  background: radial-gradient(ellipse, #2e7d32 0%, #1b5e20 100%);
  border: 6px solid #4a2c0a;
  border-radius: 200px;
  min-height: 180px;
  margin: 20px auto;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.community-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px;
}

.dealer-chip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #000;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9em;
  border: 2px solid #ffd700;
}

.card {
  width: 70px;
  height: 100px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: cardDeal 0.4s ease-out;
}

@keyframes cardDeal {
  from { transform: translateY(-50px) rotate(20deg); opacity: 0; }
  to { transform: translateY(0) rotate(0); opacity: 1; }
}

.card .rank {
  font-size: 1.6em;
  line-height: 1;
}

.card .suit {
  font-size: 2em;
  line-height: 1;
}

.card-back {
  width: 70px;
  height: 100px;
  background: linear-gradient(135deg, #1a237e, #283593);
  border-radius: 8px;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.card-back::after {
  content: '♠♥♦♣';
  font-size: 1.2em;
  color: rgba(255, 255, 255, 0.3);
}

.players-table {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin: 15px 0;
}

.player-seat {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 15px;
  min-width: 140px;
  max-width: 200px;
  flex: 1;
  text-align: center;
  transition: all 0.3s;
}

.player-seat.active {
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: activePulse 1.5s infinite;
}

@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.player-seat.folded {
  opacity: 0.4;
  filter: grayscale(1);
}

.player-name {
  font-weight: 700;
  margin-bottom: 5px;
  font-size: 0.95em;
}

.player-stack {
  color: #ffd700;
  font-weight: 700;
  font-size: 0.9em;
  margin-bottom: 8px;
}

.player-cards {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 5px;
  min-height: 30px;
}

.player-cards .mini-card {
  width: 35px;
  height: 50px;
  background: #fff;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.player-cards .mini-card.revealed {
  border: 3px solid #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

.card-back-mini {
  width: 35px;
  height: 50px;
  background: linear-gradient(135deg, #1a237e, #283593);
  border-radius: 4px;
  border: 2px solid #fff;
}

.player-bet {
  color: #4fc3f7;
  font-size: 0.85em;
  margin-top: 5px;
}

.player-status {
  font-size: 0.8em;
  margin-top: 5px;
  font-weight: 700;
}

.player-status.folded-tag {
  color: #e74c3c;
}

.player-status.allin-tag {
  color: #ff9800;
}

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 12px;
  margin: 15px 0;
}

#raise-amount {
  width: 100px;
  padding: 12px;
  text-align: center;
}

.btn-fold {
  background: #c62828;
  color: white;
}

.btn-check {
  background: #2e7d32;
  color: white;
}

.btn-call {
  background: #1565c0;
  color: white;
}

.btn-raise {
  background: #e65100;
  color: white;
}

.btn-allin {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
}

.btn-check:hover { background: #388e3c; }
.btn-check:disabled { background: #1b5e20; opacity: 0.5; cursor: not-allowed; }
.btn-call:hover { background: #1976d2; }
.btn-raise:hover { background: #ef6c00; }
.btn-raise:disabled { background: #bf360c; opacity: 0.5; cursor: not-allowed; }
.btn-allin:hover { filter: brightness(1.1); }

.message-log {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 10px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.85em;
  color: #aaa;
  margin-bottom: 10px;
}

.message-log .msg {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.message-log .msg:last-child {
  border-bottom: none;
  color: #fff;
}

.winner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.winner-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 3px solid #ffd700;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.5);
  animation: winnerPop 0.5s ease-out;
}

@keyframes winnerPop {
  from { transform: scale(0.5); }
  to { transform: scale(1); }
}

.winner-content h1 {
  font-size: 2.5em;
  color: #ffd700;
  margin-bottom: 10px;
}

.winner-content .winner-name {
  font-size: 1.5em;
  color: #fff;
  margin-bottom: 10px;
}

.winner-content .winning-hand {
  color: #4fc3f7;
  font-size: 1.1em;
  margin-bottom: 10px;
}

.winner-content .pot-won {
  color: #ffd700;
  font-size: 1.2em;
  margin-bottom: 20px;
}

.error-msg {
  color: #e74c3c;
  text-align: center;
  margin-top: 10px;
  font-size: 0.9em;
}

#reconnect-banner.show {
  display: block !important;
}

.disconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
