/* ========================================
   GUIÑOTE — Premium Card Game Theme
   ======================================== */

:root {
  /* Table felt colors */
  --felt-dark: #0a1a0a;
  --felt-mid: #143314;
  --felt-light: #1e4d1e;
  --felt-accent: #2a6b2a;

  /* Gold accents */
  --gold: #d4a843;
  --gold-light: #e8c870;
  --gold-dark: #a07820;
  --gold-glow: rgba(212, 168, 67, 0.4);

  /* Card colors */
  --card-bg: #faf5e8;
  --card-border: #d4c9a8;
  --card-shadow: rgba(0, 0, 0, 0.5);

  /* Text */
  --text-primary: #e8e0d0;
  --text-secondary: #a89878;
  --text-muted: #6a5a4a;

  /* UI */
  --glass-bg: rgba(20, 51, 20, 0.7);
  --glass-border: rgba(212, 168, 67, 0.2);
  --danger: #c44040;
  --success: #40a040;
  --info: #4080c4;

  /* Sizing */
  --card-width: 80px;
  --card-height: 120px;
  --card-radius: 6px;
  /* Player's own hand — larger than opponent cards for readability */
  --my-card-width: 100px;
  --my-card-height: 150px;

  /* Fonts */
  --font-body: 'Outfit', sans-serif;
  --font-display: 'Playfair Display', serif;
}

/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--felt-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse at 50% 50%, var(--felt-light) 0%, var(--felt-mid) 40%, var(--felt-dark) 100%);
}

/* ========================================
   UTILITIES
   ======================================== */
.hidden { display: none !important; }

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1000;
  box-shadow: 0 4px 15px var(--gold-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1000;
  box-shadow: 0 4px 15px var(--gold-glow);
  animation: pulse-gold 2s ease-in-out infinite;
}

.btn-lg {
  font-size: 1.1rem;
  padding: 14px 32px;
}

.btn-icon {
  font-size: 1.3em;
  margin-right: 8px;
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 4px 15px var(--gold-glow); }
  50% { box-shadow: 0 4px 25px rgba(212, 168, 67, 0.6); }
}

/* ========================================
   OVERLAYS & MODALS
   ======================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s;
}

.overlay-content {
  text-align: center;
  color: var(--text-primary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(212, 168, 67, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  padding: 32px 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.modal-body {
  margin-bottom: 24px;
  line-height: 1.6;
}

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

/* ========================================
   DISCONNECT BANNER
   ======================================== */
.disconnect-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--danger);
  color: white;
  text-align: center;
  padding: 10px;
  z-index: 950;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

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

/* ========================================
   VIEW SYSTEM
   ======================================== */
.view {
  display: none;
  width: 100%;
  height: 100%;
}
.view.active { display: flex; }

/* ========================================
   LANDING VIEW
   ======================================== */
.landing-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.landing-bg-cards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-card {
  position: absolute;
  width: 120px;
  height: 180px;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0.15;
}

.bg-card-1 { top: 10%; left: 8%; transform: rotate(-15deg); animation: float 6s ease-in-out infinite; }
.bg-card-2 { top: 15%; right: 12%; transform: rotate(12deg); animation: float 8s ease-in-out 1s infinite; }
.bg-card-3 { bottom: 15%; left: 15%; transform: rotate(8deg); animation: float 7s ease-in-out 2s infinite; }
.bg-card-4 { bottom: 10%; right: 8%; transform: rotate(-20deg); animation: float 9s ease-in-out 0.5s infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--r, -15deg)); }
  50% { transform: translateY(-20px) rotate(var(--r, -15deg)); }
}

.landing-content {
  text-align: center;
  z-index: 1;
}

.game-title {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.title-accent {
  -webkit-text-fill-color: var(--gold);
  font-size: 0.8em;
}

.game-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.name-form {
  padding: 32px;
  max-width: 400px;
  margin: 0 auto 24px;
}

.name-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--gold);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.lang-selector, .lang-selector-small {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.lang-btn, .lang-btn-sm {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.lang-btn-sm { padding: 4px 10px; font-size: 0.7rem; }

.lang-btn.active, .lang-btn-sm.active {
  background: var(--gold);
  color: #1a1000;
  border-color: var(--gold);
}

.lang-btn:hover, .lang-btn-sm:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lang-btn.active:hover, .lang-btn-sm.active:hover {
  background: var(--gold-light);
}

/* ========================================
   LOBBY VIEW
   ======================================== */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lobby-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
}

.lobby-player-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-badge {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid rgba(212, 168, 67, 0.3);
}

#view-lobby {
  flex-direction: column;
}

.lobby-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.lobby-actions {
  text-align: center;
  margin-bottom: 32px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.2);
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  font-style: italic;
}

.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.room-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold-dark);
}

.room-info {
  flex: 1;
}

.room-name {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.room-players-list {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.room-count {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-count-badge {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-join {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1000;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-join:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
}

/* ========================================
   ONLINE PLAYERS SECTION
   ======================================== */
.online-players-section {
  margin-top: 32px;
}

.online-players-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.online-players-header:hover .online-toggle-icon {
  color: var(--gold);
}

.online-players-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.online-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }
  50% { opacity: 0.7; box-shadow: 0 0 16px rgba(74, 222, 128, 0.4); }
}

.online-count-badge {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.online-toggle-icon {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color 0.2s;
}

.online-players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  overflow: hidden;
  max-height: 300px;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 1;
}

.online-players-list.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.online-player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.online-player-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(74, 222, 128, 0.3);
}

.online-player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.25), rgba(74, 222, 128, 0.1));
  color: #4ade80;
  font-weight: 600;
  font-size: 0.8rem;
}

.online-player-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.online-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  padding: 8px 0;
}

/* ========================================
   WAITING ROOM VIEW
   ======================================== */
#view-waiting {
  align-items: center;
  justify-content: center;
}

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

.waiting-card {
  padding: 40px;
  text-align: center;
}

.waiting-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 32px;
}

.waiting-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.waiting-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.3s;
}

.waiting-seat.occupied {
  border-color: rgba(212, 168, 67, 0.3);
  background: rgba(212, 168, 67, 0.08);
}

.seat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.waiting-seat.occupied .seat-avatar {
  background: var(--gold);
  color: #1a1000;
}

.seat-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.waiting-seat.occupied .seat-name {
  color: var(--text-primary);
  font-weight: 500;
}

.waiting-hint {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-style: italic;
}

/* ========================================
   GAME VIEW — TABLE LAYOUT
   ======================================== */
#view-game {
  flex-direction: column;
  position: relative;
}

.game-table {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Player areas */
.player-area {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.player-top {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.player-bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.player-left {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.player-right {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Player name tags */
.player-name-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
  transition: all 0.3s;
  border: 1px solid transparent;
}

.player-name-tag.active-turn {
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  animation: pulse-turn 1.5s ease-in-out infinite;
}

@keyframes pulse-turn {
  0%, 100% { box-shadow: 0 0 12px var(--gold-glow); }
  50% { box-shadow: 0 0 20px rgba(212, 168, 67, 0.6); }
}

.you-tag {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold);
  border: 1px solid rgba(212, 168, 67, 0.3);
}

/* Disconnected state */
.player-name-tag.disconnected {
  color: var(--danger);
  border-color: var(--danger);
  opacity: 0.7;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  background: var(--card-bg);
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, margin 0.2s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.card-back {
  background:
    linear-gradient(135deg, #6b1010, #8b2020, #6b1010);
  border: 2px solid #a08040;
}

.card-back-pattern {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255,255,255,0.05) 4px, rgba(255,255,255,0.05) 8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-pattern::after {
  content: '♠';
  font-size: 1.8rem;
  color: rgba(255, 215, 0, 0.4);
}

/* Hand layouts */
.opponent-hand {
  display: flex;
  gap: 0;
}

.opponent-hand .card {
  width: calc(var(--card-width) * 0.55);
  height: calc(var(--card-height) * 0.7);
  margin-left: -12px;
}

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

.vertical-hand {
  flex-direction: column;
}

.vertical-hand .card {
  margin-left: 0;
  margin-top: -30px;
  width: calc(var(--card-width) * 0.6);
  height: calc(var(--card-height) * 0.65);
}

.vertical-hand .card:first-child {
  margin-top: 0;
}

/* My hand (bottom player) */
.my-hand {
  display: flex;
  gap: 0;
  perspective: 800px;
}

.my-hand .card {
  width: var(--my-card-width);
  height: var(--my-card-height);
  margin-left: -14px;
  cursor: pointer;
  transition: transform 0.2s ease, margin-top 0.2s ease, box-shadow 0.2s ease;
}

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

.my-hand .card:hover {
  transform: translateY(-12px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.my-hand .card.playable {
  cursor: pointer;
}

.my-hand .card.playable::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--card-radius) + 2px);
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
  opacity: 0;
  animation: card-glow 1.5s ease-in-out infinite;
}

@keyframes card-glow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.my-hand .card.not-playable {
  filter: brightness(0.5) saturate(0.5);
  cursor: not-allowed;
}

/* Card play animation */
.card.playing {
  animation: playCard 0.5s ease forwards;
}

@keyframes playCard {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(0.9) translateY(-20px); opacity: 0; }
}

/* ========================================
   TABLE CENTER — TRICK AREA & STOCK
   ======================================== */
.table-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 40px;
}

.stock-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-pile {
  width: calc(var(--card-width) * 0.7);
  height: calc(var(--card-height) * 0.7);
  background: linear-gradient(135deg, #6b1010, #8b2020);
  border: 2px solid #a08040;
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3), 6px 6px 0 rgba(0,0,0,0.15);
}

.stock-pile.empty {
  opacity: 0.2;
  box-shadow: none;
}

.stock-count {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.trump-card {
  width: calc(var(--card-width) * 0.7);
  height: calc(var(--card-height) * 0.7);
}

.trump-card .card {
  width: 100%;
  height: 100%;
  transform: rotate(90deg);
  box-shadow: 0 0 15px var(--gold-glow);
  border: 2px solid var(--gold);
}

.trump-card.taken {
  opacity: 0.15;
}

/* Trick area */
.trick-area {
  position: relative;
  width: 180px;
  height: 160px;
}

.trick-slot {
  position: absolute;
  width: calc(var(--card-width) * 0.75);
  height: calc(var(--card-height) * 0.75);
}

.trick-slot[data-position="top"] { top: 0; left: 50%; transform: translateX(-50%); }
.trick-slot[data-position="bottom"] { bottom: 0; left: 50%; transform: translateX(-50%); }
.trick-slot[data-position="left"] { left: 0; top: 50%; transform: translateY(-50%); }
.trick-slot[data-position="right"] { right: 0; top: 50%; transform: translateY(-50%); }

.trick-slot .card {
  width: 100%;
  height: 100%;
  animation: cardAppear 0.3s ease;
}

@keyframes cardAppear {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========================================
   SCOREBOARD
   ======================================== */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 50;
}

.score-team {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.score-team.my-team {
  border: 1px solid rgba(212, 168, 67, 0.3);
  background: rgba(212, 168, 67, 0.08);
}

.score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-team-num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.score-values {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-left: 8px;
}

.score-points {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  transition: all 0.3s;
}

.score-points.updated {
  animation: scoreUpdate 0.5s ease;
}

@keyframes scoreUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); color: var(--gold-light); }
  100% { transform: scale(1); }
}

.score-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.score-cotos {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.score-cotos-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.score-divider {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(64, 128, 196, 0.2);
  color: var(--info);
  border: 1px solid rgba(64, 128, 196, 0.3);
}

.phase-badge.arrastre {
  background: rgba(196, 64, 64, 0.2);
  color: #e06060;
  border-color: rgba(196, 64, 64, 0.3);
}

/* ========================================
   GAME ACTIONS
   ======================================== */
.game-actions {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 50;
}

/* ========================================
   GAME LOG
   ======================================== */
.game-log {
  position: absolute;
  bottom: 140px;
  right: 12px;
  width: 250px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

.game-log::-webkit-scrollbar { width: 4px; }
.game-log::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

.game-log-entries {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  animation: logAppear 0.3s ease;
}

.log-entry.highlight {
  color: var(--gold);
  background: rgba(212, 168, 67, 0.1);
}

.log-entry.danger {
  color: #e06060;
}

@keyframes logAppear {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========================================
   TURN INDICATOR
   ======================================== */
.turn-indicator {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  animation: turnPulse 1.5s ease-in-out infinite;
  text-shadow: 0 0 20px var(--gold-glow);
  z-index: 50;
}

@keyframes turnPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ========================================
   DECLARATION ANIMATIONS
   ======================================== */
.declaration-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(212, 168, 67, 0.3);
  z-index: 200;
  animation: declarationBurst 2s ease forwards;
  pointer-events: none;
}

@keyframes declarationBurst {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

/* ========================================
   MATCH OVER — CONFETTI
   ======================================== */
.match-over-card {
  position: relative;
  overflow: hidden;
}

.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

/* ========================================
   VOICE CHAT
   ======================================== */
.voice-bar-container {
  position: absolute;
  top: 54px;
  right: 16px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: auto;
}

.voice-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(10, 26, 10, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.voice-pill.idle {
  border-color: rgba(212, 168, 67, 0.3);
}

.voice-pill.waiting {
  border-color: #e8a830;
  box-shadow: 0 0 12px rgba(232, 168, 48, 0.25);
}

.voice-pill.active {
  border-color: #40d040;
  box-shadow: 0 0 14px rgba(64, 208, 64, 0.3);
}

.voice-pill.speaking {
  box-shadow: 0 0 18px rgba(64, 208, 64, 0.6);
}

.btn-voice-join {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1000;
  border: none;
  border-radius: 14px;
  padding: 5px 14px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
}

.btn-voice-join:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--gold-glow);
}

.voice-active-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge-active {
  background: #40d040;
  box-shadow: 0 0 8px #40d040;
  animation: badge-pulse 2s infinite ease-in-out;
}

.badge-waiting {
  background: #e8a830;
  box-shadow: 0 0 6px #e8a830;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

.voice-status-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.btn-voice-icon {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

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

.btn-voice-icon.muted {
  background: rgba(196, 64, 64, 0.35);
  border-color: var(--danger);
}

.btn-voice-leave:hover {
  background: rgba(196, 64, 64, 0.4);
  color: #ff8888;
  border-color: var(--danger);
}

.voice-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.2);
  color: var(--gold-light);
  border: 1px solid rgba(212, 168, 67, 0.3);
}

.voice-rule-hint {
  font-size: 0.68rem;
  color: var(--gold);
  background: rgba(10, 26, 10, 0.92);
  border: 1px solid rgba(212, 168, 67, 0.25);
  border-radius: 8px;
  padding: 4px 8px;
  max-width: 230px;
  text-align: right;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease;
}

.voice-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  border-top-color: #000;
  animation: spin 0.8s linear infinite;
}

/* Player table badges & speaking pulse */
.player-voice-icon {
  margin-left: 6px;
  font-size: 0.75rem;
  display: inline-block;
  vertical-align: middle;
}

.player-voice-icon.connected {
  color: #50e050;
  text-shadow: 0 0 6px rgba(80, 224, 80, 0.6);
}

.player-voice-icon.muted {
  color: var(--danger);
  opacity: 0.85;
}

.player-name-tag.speaking {
  box-shadow: 0 0 16px rgba(80, 224, 80, 0.8), inset 0 0 8px rgba(80, 224, 80, 0.3) !important;
  border-color: #50e050 !important;
  animation: speaking-pulse 0.8s ease-in-out infinite alternate !important;
}

@keyframes speaking-pulse {
  0% {
    box-shadow: 0 0 8px rgba(80, 224, 80, 0.6), inset 0 0 4px rgba(80, 224, 80, 0.2);
  }
  100% {
    box-shadow: 0 0 20px rgba(80, 224, 80, 0.95), inset 0 0 10px rgba(80, 224, 80, 0.4);
  }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  :root {
    --card-width: 56px;
    --card-height: 84px;
    --my-card-width: 72px;
    --my-card-height: 108px;
  }

  .game-title { font-size: 2.5rem; }
  .game-subtitle { font-size: 0.95rem; }
  .name-form { padding: 24px; }

  .table-center { gap: 16px; }
  .trick-area { width: 130px; height: 120px; }

  .game-log { display: none; }

  .scoreboard { gap: 8px; padding: 8px 12px; }
  .score-team { padding: 4px 10px; }

  .stock-pile, .trump-card {
    width: calc(var(--card-width) * 0.65);
    height: calc(var(--card-height) * 0.65);
  }

  .voice-bar-container {
    top: 50px;
    right: 10px;
  }

  .btn-voice-join {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .voice-pill {
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --card-width: 48px;
    --card-height: 72px;
    --my-card-width: 64px;
    --my-card-height: 96px;
  }
  
  .game-title { font-size: 2rem; }

  .voice-bar-container {
    top: 48px;
    right: 6px;
  }
}
