/* ==========================================================================
   Big Two Web (BTW) Modern Styling & Responsive Design
   ========================================================================== */

:root {
  --table-felt: radial-gradient(circle at center, #1e4d3b 0%, #0b251a 100%);
  --table-border: #382315;
  --gold-accent: #f59e0b;
  --gold-light: #fbbf24;
  --bg-dark: #0f172a;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --card-bg: #ffffff;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Status Bar */
header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gold-accent);
}

/* Status Banner */
.status-banner {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.status-message {
  font-weight: 600;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badges {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--text-light);
}

/* Main Oval Felt Game Table */
.table-container {
  flex: 1;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.poker-table {
  width: 100%;
  max-width: 1100px;
  height: 640px;
  background: var(--table-felt);
  border: 14px solid var(--table-border);
  border-radius: 60px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.85), 0 20px 50px rgba(0,0,0,0.7);
  position: relative;
  display: grid;
  grid-template-rows: 110px 1fr 180px;
  grid-template-columns: 140px 1fr 140px;
  gap: 10px;
  padding: 16px;
}

/* Player Seats */
.player-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.seat-top {
  grid-row: 1;
  grid-column: 2;
}

.seat-left {
  grid-row: 2;
  grid-column: 1;
}

.seat-right {
  grid-row: 2;
  grid-column: 3;
}

.seat-bottom {
  grid-row: 3;
  grid-column: 1 / span 3;
}

/* Player Info Avatar Card */
.player-avatar {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
}

.player-seat.active .player-avatar {
  border-color: var(--gold-light);
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.avatar-icon {
  font-size: 24px;
}

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

.player-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
}

.player-count {
  font-size: 11px;
  color: var(--gold-light);
}

.pass-tag {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Table Center Area */
.table-center {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.played-cards-area {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.last-play-info {
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--gold-light);
  font-weight: 600;
}

.played-cards-stack {
  display: flex;
  gap: 8px;
  perspective: 1000px;
}

.event-log-box {
  position: absolute;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 80%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Human Hand Cards Area */
.human-hand-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.human-hand-cards {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  max-width: 100%;
  overflow-x: auto;
}

/* Playing Cards Styling */
.playing-card {
  width: 72px;
  height: 104px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  margin-left: -24px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
  position: relative;
}

.playing-card:first-child {
  margin-left: 0;
}

.playing-card:hover {
  transform: translateY(-8px);
  z-index: 50;
}

.playing-card.selected {
  transform: translateY(-20px);
  box-shadow: 0 0 15px var(--gold-light), 0 8px 16px rgba(0,0,0,0.4);
  z-index: 60;
  border: 2px solid var(--gold-accent);
}

.card-inner {
  width: 100%;
  height: 100%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.card-rank {
  font-size: 15px;
  font-weight: 800;
}

.card-suit-small {
  font-size: 12px;
}

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
}

.bottom-right {
  align-self: flex-end;
  transform: rotate(180deg);
}

/* Card Back Pattern */
.card-back-stack {
  width: 54px;
  height: 78px;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border: 2px solid #ffffff;
  border-radius: 8px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.card-back-logo {
  font-size: 20px;
  color: white;
}

.card-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gold-light);
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Control Buttons Footer */
.table-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Modal Overlay & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-light);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-light);
  max-height: 60vh;
  overflow-y: auto;
}

/* Keyframe Animations */
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .poker-table {
    height: 540px;
    border-width: 8px;
    border-radius: 30px;
    grid-template-rows: 90px 1fr 160px;
    grid-template-columns: 90px 1fr 90px;
    padding: 8px;
  }

  .playing-card {
    width: 56px;
    height: 82px;
    margin-left: -20px;
  }

  .card-rank { font-size: 13px; }
  .card-center { font-size: 20px; }

  .btn-primary, .btn-secondary {
    padding: 8px 14px;
    font-size: 13px;
  }
}
