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

:root {
  /* Green felt palette with Balatro flair */
  --bg: #0e2a1b;
  --bg-dark: #081a10;
  --bg-felt: #1a4d2e;
  --card-bg: #fffef8;
  --card-border: #a8a090;
  --text: #e8e8e0;
  --accent: #d4af37;
  --accent-cyan: #5ce0d6;
  --red: #cc2936;
  --blue: #3498db;
  --green: #4ade80;
  --overlay-bg: rgba(6, 18, 10, 0.88);

  /* Card sizing - responsive via media queries */
  --card-w: 82px;
  --card-h: 118px;
  --card-overlap: -16px;
  --card-rank-size: 0.8rem;
  --card-suit-sm: 0.65rem;
  --card-center-size: 1.6rem;
  --card-corner-top: 2px;
  --card-corner-left: 3px;
  --card-radius: 7px;
  --card-back-w: 26px;
  --card-back-h: 40px;
  --trick-area-w: 340px;
  --trick-area-h: 290px;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: url('Table.png') center center / 100% auto no-repeat fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.in-game {
  background: url('Table2.png') center center / 100% auto no-repeat fixed;
}

/* Screens */
.screen { display: none; width: 100vw; height: 100vh; height: 100dvh; }
.screen.active { display: flex; }

/* ========== CRT + VIGNETTE OVERLAYS ========== */
#screen-game {
  flex-direction: column;
  position: relative;
}

/* Subtle scanlines */
#screen-game::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.04) 0px,
    rgba(0, 0, 0, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 900;
  opacity: 0.3;
}

/* Vignette */
#screen-game::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 899;
}

/* ========== LOBBY ========== */
.lobby-container {
  margin: auto;
  text-align: center;
  padding: 1.5rem 1rem;
  max-width: 400px;
  width: 100%;
}

#lobby-logo {
  max-width: 280px;
  width: 80%;
  height: auto;
  margin-bottom: 1.2rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.lobby-container input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  border: 2px solid rgba(212,175,55,0.35);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.lobby-container input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(212,175,55,0.2);
}

.lobby-container input::placeholder { color: #5a6b5a; }

/* Avatar picker */
#avatar-picker {
  margin-bottom: 0.6rem;
}

.avatar-options {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.avatar-option {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(212,175,55,0.25);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  background: var(--bg-dark);
}

.avatar-option:hover {
  transform: scale(1.12);
  border-color: rgba(212,175,55,0.6);
}

.avatar-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(212,175,55,0.55);
  transform: scale(1.1);
}


.player-slot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(212,175,55,0.3);
}

.lobby-buttons { display: flex; flex-direction: column; gap: 0.6rem; }

.join-row {
  display: flex;
  gap: 0.5rem;
}

.join-row input {
  width: 120px;
  flex-shrink: 0;
  margin-bottom: 0;
}

button {
  padding: 0.7rem 1.2rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.1);
}

button:hover {
  background: rgba(212, 175, 55, 0.22);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

button:active { transform: scale(0.97); }

.room-code {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  color: var(--accent);
}

.room-code span {
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 4px;
}

#btn-copy-code {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0 4px;
  font-size: 1.2rem;
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.7;
  transition: opacity 0.2s;
}
#btn-copy-code:hover { opacity: 1; }
#btn-copy-code:active { transform: scale(0.9); }

#lobby-host-controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

#btn-config {
  background: rgba(14, 42, 27, 0.7);
  border: 2px solid #2a4a2a;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
#btn-config:hover {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.08);
  color: var(--accent);
}

#config-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.game-choice-btn.config-selected {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.game-choice-btn.config-inactive {
  opacity: 0.35;
  border-color: #1a2a1a;
}

.config-count-label {
  font-size: 0.85rem;
  color: var(--accent);
  margin: -0.3rem 0 0.6rem;
  opacity: 0.85;
}

#player-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.player-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-dark);
  border-radius: 8px;
  border: 1px solid #1a3a24;
  font-size: 1rem;
}

.player-slot.host { border-color: var(--accent); box-shadow: 0 0 6px rgba(212,175,55,0.12); }

.info-text { color: #5a7a5a; font-style: italic; margin-top: 0.8rem; }
.error-text { color: var(--red); margin-top: 0.5rem; }
.hidden { display: none !important; }

/* Screen reader only — visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== GAME SCREEN ========== */

#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.6rem;
  background: rgba(4, 12, 7, 0.96);
  z-index: 10;
  min-height: 40px;
  flex-shrink: 0;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(212,175,55,0.18);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

#header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(212,175,55,0.4));
}

#header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

#round-info {
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  letter-spacing: 0.02em;
}

#scoreboard-mini {
  display: flex;
  gap: 0.5rem;
  font-size: 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
}

#btn-mute {
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  flex-shrink: 0;
  text-shadow: none;
  box-shadow: none;
  line-height: 1;
}

#btn-mute:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}

#btn-leave {
  padding: 0.2rem 0.5rem;
  font-size: 0.6rem;
  background: rgba(204, 41, 54, 0.1);
  border: 1px solid rgba(204, 41, 54, 0.4);
  color: rgba(204, 41, 54, 0.7);
  border-radius: 4px;
  flex-shrink: 0;
  text-shadow: none;
  box-shadow: none;
}

#btn-leave:hover {
  background: rgba(204, 41, 54, 0.2);
  border-color: var(--red);
  color: var(--red);
}

.score-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-entry .name { color: #6a8a6a; font-size: 0.6rem; white-space: nowrap; }
.score-entry .pts { color: var(--accent); font-weight: bold; }
.score-entry.active-player { position: relative; }
.score-entry.active-player .name { color: var(--green); font-weight: 700; text-shadow: 0 0 6px rgba(74,222,128,0.4); }
.score-entry.active-player::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--green);
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(74,222,128,0.5);
}

/* ========== GAME TABLE (green felt) ========== */
/* ========== YOUR TURN INDICATOR ========== */
#your-turn-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
}

#your-turn-indicator img {
  width: 280px;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(212,175,55,0.7));
}

#your-turn-indicator.show {
  animation: yourTurnAnim 2.4s ease forwards;
}

@keyframes yourTurnAnim {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.6); }
  18%  { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
  30%  { opacity: 1;   transform: translate(-50%, -50%) scale(1); }
  65%  { opacity: 1;   transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1); }
}

#game-table {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

/* Inner vignette / ornate shadow frame */
#game-table::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.55),
    inset 0 0 6px rgba(212,175,55,0.12);
  pointer-events: none;
  z-index: 0;
}

/* ========== OTHER PLAYERS (absolutely around the table) ========== */
#other-players {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.other-player {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(4, 16, 8, 0.72);
  border: 1px solid rgba(212,175,55,0.22);
  border-radius: 8px;
  padding: 6px 7px 5px 6px;
  backdrop-filter: blur(4px);
  box-shadow: 0 3px 14px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.04);
  transition: box-shadow 0.3s;
}

.player-top-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 7px;
}

/* Active (turn) glow on player panel */
.other-player.is-active {
  box-shadow: 0 0 0 2px rgba(74,222,128,0.5), 0 3px 14px rgba(0,0,0,0.55);
}

/* ========== 4-PLAYER POSITIONS (default) ========== */
.layout-4p .pos-right {
  top: 35%;
  right: 8px;
  transform: translateY(-50%);
}
.layout-4p .pos-across {
  top: 8px;
  left: 50%;
  transform: translateX(-55%);
}
.layout-4p .pos-left {
  top: 35%;
  left: 8px;
  transform: translateY(-50%);
}

/* ========== 5-PLAYER POSITIONS ========== */
.layout-5p .pos-5p-1 {
  bottom: 18%;
  right: 8px;
}
.layout-5p .pos-5p-2 {
  top: 8px;
  right: 15%;
}
.layout-5p .pos-5p-3 {
  top: 8px;
  left: 15%;
}
.layout-5p .pos-5p-4 {
  bottom: 18%;
  left: 8px;
}

/* ========== 6-PLAYER POSITIONS ========== */
.layout-6p .pos-6p-1 {
  top: 45%;
  right: 8px;
  transform: translateY(-50%);
}
.layout-6p .pos-6p-2 {
  top: 8px;
  right: 12%;
}
.layout-6p .pos-6p-3 {
  top: 8px;
  left: 50%;
  transform: translateX(-55%);
}
.layout-6p .pos-6p-4 {
  top: 8px;
  left: 12%;
}
.layout-6p .pos-6p-5 {
  top: 45%;
  left: 8px;
  transform: translateY(-50%);
}

/* ========== PLAYER PORTRAIT ========== */
.player-portrait-wrap {
  flex-shrink: 0;
  width: 52px;
  height: 66px;
  border-radius: 5px;
  position: relative;
  border: 1.5px solid rgba(212,175,55,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.08);
  background: #0d1f10;
}

.player-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  border-radius: 4px;
}

.portrait-rank-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  z-index: 3;
  pointer-events: none;
}

.portrait-rank-badge .rank-icon {
  height: 18px;
  width: auto;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.9));
}

/* ========== PLAYER INFO PANEL ========== */
.player-info-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  min-width: 0;
}

.player-rank-icon {
  display: flex;
  align-items: center;
  margin-bottom: 1px;
}

.player-rank-icon .rank-icon {
  height: 14px;
  width: auto;
  object-fit: contain;
  border-radius: 2px;
}


.other-player .player-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: #d0ddd0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  letter-spacing: 0.01em;
}

.other-player .player-name.is-turn {
  color: var(--green);
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.other-player .player-name.disconnected {
  color: #445;
  opacity: 0.5;
  text-shadow: none;
}

.player-stats-row {
  display: flex;
  gap: 6px;
  margin-top: 1px;
}

.pstat-cards,
.pstat-score {
  font-size: 0.58rem;
  color: rgba(212,175,55,0.65);
  white-space: nowrap;
}

.other-player .player-cards {
  display: flex;
  flex-direction: row;
  gap: 2px;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* Tiny card backs inside player panels */
.other-player .card-back {
  width: 11px;
  height: 16px;
  border-radius: 1px;
  flex-shrink: 0;
}

/* ========== CARD BACKS ========== */
.card-back {
  width: var(--card-back-w);
  height: var(--card-back-h);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 4px),
    repeating-linear-gradient(-45deg, transparent, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 4px),
    linear-gradient(135deg, #1a3f8a 0%, #1a2d6b 40%, #152555 100%);
  border-radius: 2px;
  border: 1px solid #2a4a8a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 0 0 0.5px rgba(255,255,255,0.1);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Inner gold border on card backs */
.card-back::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px; right: 1px; bottom: 1px;
  border: 0.5px solid rgba(212,175,55,0.2);
  border-radius: 1px;
}

/* Shimmer sweep on card backs */
.card-back::before {
  content: '';
  position: absolute;
  top: -100%; left: -100%;
  width: 300%; height: 300%;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.04) 48%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 52%,
    transparent 60%
  );
  animation: back-shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes back-shimmer {
  0%, 100% { transform: translate(-20%, -20%); }
  50% { transform: translate(20%, 20%); }
}

/* ========== PLAY AREA ========== */
#play-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  z-index: 1;
  /* top padding clears the player-across / player-right panels (≈ 90px tall + gap) */
  padding-top: 98px;
}

/* Subtle ambient light drift */
#play-area::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(212, 175, 55, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(92, 224, 214, 0.012) 0%, transparent 50%);
  animation: bg-drift 30s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes bg-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

#trick-area {
  position: relative;
  width: var(--trick-area-w);
  height: var(--trick-area-h);
  z-index: 1;
}

#trick-self {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

/* 4-player trick positions */
.layout-4p .tpos-right   { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.layout-4p .tpos-across  { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.layout-4p .tpos-left    { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }

/* 5-player trick positions (pentagon) */
.layout-5p .tpos-5p-1    { position: absolute; bottom: 10%; right: 5%; }
.layout-5p .tpos-5p-2    { position: absolute; top: 5%; right: 15%; }
.layout-5p .tpos-5p-3    { position: absolute; top: 5%; left: 15%; }
.layout-5p .tpos-5p-4    { position: absolute; bottom: 10%; left: 5%; }

/* 6-player trick positions (hexagon) */
.layout-6p .tpos-6p-1    { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.layout-6p .tpos-6p-2    { position: absolute; top: 0; right: 15%; }
.layout-6p .tpos-6p-3    { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.layout-6p .tpos-6p-4    { position: absolute; top: 0; left: 15%; }
.layout-6p .tpos-6p-5    { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }

.trick-card {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== CARDS (Realistic Playing Cards) ========== */
.card {
  width: var(--card-w);
  height: var(--card-h);
  background: transparent;
  border: none;
  border-radius: var(--card-radius);
  position: relative;
  flex-shrink: 0;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.15),
    0 3px 6px rgba(0,0,0,0.1),
    0 6px 12px rgba(0,0,0,0.05);
  cursor: default;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Card image */
.card-img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--card-radius);
  object-fit: fill;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* Subtle sheen on top half */
.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  pointer-events: none;
  z-index: 2;
}

/* Cards on the trick table */
.trick-card .card {
  box-shadow:
    0 2px 4px rgba(0,0,0,0.25),
    0 6px 12px rgba(0,0,0,0.15);
}

#trick-pos-1 .card { transform: rotate(-2deg); }
#trick-pos-2 .card { transform: rotate(-1.5deg); }
#trick-pos-3 .card { transform: rotate(2.5deg); }
#trick-pos-4 .card { transform: rotate(1.5deg); }
#trick-pos-5 .card { transform: rotate(-1deg); }
#trick-self .card { transform: rotate(1deg); }

/* ========== HAND ========== */
#my-hand {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0.5rem 0.5rem;
  gap: 0;
  overflow-x: auto;
  min-height: calc(var(--card-h) + 36px);
  background: linear-gradient(180deg, rgba(4,14,8,0) 0%, rgba(4,14,8,0.85) 35%, #040e08 100%);
  border-top: 1px solid rgba(212,175,55,0.1);
  align-items: flex-end;
  flex-shrink: 0;
  z-index: 2;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

#my-hand .card {
  cursor: pointer;
  margin-left: var(--card-overlap);
  transform: rotate(var(--fan-angle, 0deg)) translateY(var(--fan-lift, 0px));
  transform-origin: bottom center;
}

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

#my-hand .card:hover {
  transform: translateY(-16px) rotate(0deg) scale(1.08) !important;
  z-index: 10;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.3),
    0 8px 24px rgba(0,0,0,0.15),
    0 0 8px rgba(212, 175, 55, 0.2);
  border-color: rgba(212, 175, 55, 0.5);
}

/* Playable cards - green glow with color cycling */
#my-hand .card.playable {
  border-color: #2ea44f;
  box-shadow:
    0 0 6px rgba(46, 164, 79, 0.3),
    0 0 12px rgba(46, 164, 79, 0.12),
    0 2px 6px rgba(0,0,0,0.15);
  animation: playable-glow 2.5s ease-in-out infinite;
  overflow: hidden;
}

/* Holographic shimmer sweep on playable cards */
#my-hand .card.playable::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  width: 300%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(92, 224, 214, 0.06) 40%,
    rgba(212, 175, 55, 0.07) 50%,
    rgba(74, 222, 128, 0.05) 55%,
    transparent 65%
  );
  animation: shimmer-sweep 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 4;
  border-radius: var(--card-radius);
}

@keyframes shimmer-sweep {
  0% { transform: translateX(-33%); }
  100% { transform: translateX(33%); }
}

@keyframes playable-glow {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(46, 164, 79, 0.3),
      0 0 12px rgba(46, 164, 79, 0.12),
      0 2px 6px rgba(0,0,0,0.15);
  }
  33% {
    box-shadow:
      0 0 8px rgba(92, 224, 214, 0.3),
      0 0 16px rgba(92, 224, 214, 0.1),
      0 2px 6px rgba(0,0,0,0.15);
  }
  66% {
    box-shadow:
      0 0 8px rgba(212, 175, 55, 0.3),
      0 0 16px rgba(212, 175, 55, 0.1),
      0 2px 6px rgba(0,0,0,0.15);
  }
}

#my-hand .card.playable:hover {
  animation: none;
  box-shadow:
    0 0 14px rgba(212, 175, 55, 0.4),
    0 0 28px rgba(212, 175, 55, 0.12),
    0 4px 12px rgba(0,0,0,0.25);
  border-color: var(--accent);
}

#my-hand .card.not-playable {
  opacity: 0.35;
  cursor: not-allowed;
  filter: saturate(0.2) brightness(0.8);
}

#my-hand .card.not-playable:hover {
  transform: rotate(var(--fan-angle, 0deg)) translateY(var(--fan-lift, 0px)) !important;
  z-index: auto;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.12),
    0 3px 6px rgba(0,0,0,0.08);
  border-color: var(--card-border);
}

/* ========== REUSSITE BOARD ========== */
#reussite-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0.3rem;
  min-height: 0;
}

.reussite-row {
  display: flex;
  gap: 2px;
  align-items: center;
}

.reussite-cell {
  width: calc(var(--card-w) * 0.78);
  height: calc(var(--card-h) * 0.78);
  border: 1px dashed #2a4a2a;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #3a5a3a;
}

.reussite-cell.filled {
  border: none;
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.reussite-cell.filled.hearts,
.reussite-cell.filled.diamonds { color: #c41e3a; }

.reussite-cell .rank { font-size: 0.7rem; }
.reussite-cell .suit-symbol { font-size: 0.8rem; }

.reussite-cell .card {
  width: 100%;
  height: 100%;
  cursor: default;
  transform: none !important;
  box-shadow: none;
}

#btn-skip {
  position: fixed;
  bottom: calc(var(--card-h) + 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 901;
  background: rgba(204, 41, 54, 0.15);
  border-color: var(--red);
  color: var(--red);
}

/* ========== OVERLAYS ========== */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 0.5rem;
}

.overlay-content {
  background: linear-gradient(145deg, #0e2a1b 0%, #153a25 50%, #081a10 100%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  max-width: 90vw;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow:
    0 0 16px rgba(212, 175, 55, 0.12),
    0 0 32px rgba(212, 175, 55, 0.04),
    inset 0 1px 0 rgba(212, 175, 55, 0.06);
}

.overlay-content h2 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.2rem;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

/* Game choices */
#game-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.game-choice-btn {
  padding: 0.8rem 0.5rem 0.6rem;
  background: rgba(14, 42, 27, 0.8);
  border: 2px solid #2a4a2a;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
  text-shadow: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.game-choice-btn .game-rule-sub {
  font-size: 0.6rem;
  color: #5a7a5a;
  font-weight: 400;
}

.game-choice-btn:hover {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.06);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
  color: var(--accent);
}

.game-choice-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

/* Trump choices */
#trump-choices {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.trump-btn {
  width: 60px;
  height: 60px;
  font-size: 1.8rem;
  background: var(--card-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #aaa;
  box-shadow: none;
  text-shadow: none;
  transition: transform 0.15s, box-shadow 0.3s, border-color 0.3s;
}

.trump-btn:hover {
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
  border-color: var(--accent);
}

.suit-hearts, .suit-diamonds { color: #c41e3a; }
.suit-clubs, .suit-spades { color: #1a1a2e; }

/* Result scores */
#result-scores, #final-scores {
  margin-bottom: 1.2rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid #1a3a24;
  font-size: 1rem;
  animation: score-appear 0.4s ease-out both;
}

.result-row:nth-child(1) { animation-delay: 0.1s; }
.result-row:nth-child(2) { animation-delay: 0.2s; }
.result-row:nth-child(3) { animation-delay: 0.3s; }
.result-row:nth-child(4) { animation-delay: 0.4s; }

@keyframes score-appear {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.result-row .delta.positive { color: var(--green); }
.result-row .delta.negative { color: var(--red); }
.result-row .total { color: var(--accent); margin-left: 0.8rem; }

/* Scoreboard */
.overlay-scoreboard { min-width: 280px; }
#overlay-scoreboard { z-index: 1200; }

#full-scoreboard table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

#full-scoreboard th, #full-scoreboard td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #1a3a24;
  text-align: center;
  font-size: 0.8rem;
}

#full-scoreboard th {
  color: var(--accent);
  font-size: 0.7rem;
}

/* Disconnect notice - top toast, non-blocking */
#disconnect-notice {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 26, 16, 0.95);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  border: 1px solid var(--red);
  box-shadow: 0 0 10px rgba(204, 41, 54, 0.15);
  z-index: 1050; /* Below overlays (1100) but above game UI */
  text-align: center;
  white-space: nowrap;
  font-size: 0.8rem;
}

/* Turn indicator */
.turn-indicator {
  color: var(--green);
  font-size: 0.65rem;
  margin-top: 0.15rem;
}

/* Waiting overlay text */
.waiting-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(212,175,55,0.3);
  text-align: center;
  padding: 0.6rem 1.5rem;
  z-index: 1;
  background: rgba(8, 26, 16, 0.7);
  border-radius: 20px;
  border: 1px solid rgba(212, 175, 55, 0.12);
}

.waiting-text::after {
  content: '';
  display: inline-block;
  width: 1em;
  animation: waiting-dots 1.5s steps(4, end) infinite;
}

@keyframes waiting-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Trick win animation */
.trick-card .card.trick-won {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease-in;
}

.trick-card .card.trick-won.animate-to-self {
  transform: translateY(120px) scale(0.3) rotate(8deg) !important;
  opacity: 0 !important;
}
.trick-card .card.trick-won.animate-to-right {
  transform: translateX(160px) scale(0.3) rotate(-8deg) !important;
  opacity: 0 !important;
}
.trick-card .card.trick-won.animate-to-across {
  transform: translateY(-120px) scale(0.3) rotate(-6deg) !important;
  opacity: 0 !important;
}
.trick-card .card.trick-won.animate-to-left {
  transform: translateX(-160px) scale(0.3) rotate(8deg) !important;
  opacity: 0 !important;
}

.trick-winner-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  text-shadow:
    0 0 10px rgba(212, 175, 55, 0.8),
    0 0 20px rgba(212, 175, 55, 0.4);
  z-index: 2;
  letter-spacing: 1px;
}

.trick-winner-label.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Trick winner glow on player names */
.other-player .player-name.trick-winner-glow {
  color: var(--accent) !important;
  font-weight: bold;
  font-size: 0.85rem !important;
  animation: winner-name-pulse 0.5s ease-in-out 4;
  text-shadow:
    0 0 10px rgba(212, 175, 55, 1),
    0 0 20px rgba(212, 175, 55, 0.6),
    0 0 30px rgba(212, 175, 55, 0.3);
}

/* Trick winner glow on self hand area */
#my-hand.trick-winner-glow {
  border-top: 2px solid var(--accent);
  box-shadow: 0 -6px 20px rgba(212, 175, 55, 0.4), 0 -2px 10px rgba(212, 175, 55, 0.3);
  animation: winner-hand-pulse 0.5s ease-in-out 4;
}

@keyframes winner-name-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(212, 175, 55, 1),
      0 0 20px rgba(212, 175, 55, 0.6),
      0 0 30px rgba(212, 175, 55, 0.3);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 16px rgba(212, 175, 55, 1),
      0 0 32px rgba(212, 175, 55, 0.8),
      0 0 48px rgba(212, 175, 55, 0.5);
    transform: scale(1.1);
  }
}

@keyframes winner-hand-pulse {
  0%, 100% {
    box-shadow: 0 -6px 20px rgba(212, 175, 55, 0.4), 0 -2px 10px rgba(212, 175, 55, 0.3);
  }
  50% {
    box-shadow: 0 -8px 30px rgba(212, 175, 55, 0.6), 0 -4px 16px rgba(212, 175, 55, 0.45);
  }
}

/* Last trick button */
#btn-last-trick {
  position: fixed;
  bottom: calc(var(--card-h) + 64px);
  right: 0.5rem;
  z-index: 901;
  background: rgba(80, 100, 80, 0.2);
  border-color: #5a7a5a;
  color: #8a9a8a;
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  text-shadow: none;
  box-shadow: none;
}

#btn-last-trick:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 6px rgba(212,175,55,0.15);
}

/* Cancel game button */
#btn-cancel-game {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 901;
  background: rgba(204, 41, 54, 0.1);
  border-color: rgba(204, 41, 54, 0.4);
  color: rgba(204, 41, 54, 0.7);
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  text-shadow: none;
  box-shadow: none;
}

#btn-cancel-game:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(204, 41, 54, 0.2);
}

/* ========== CANCEL VOTE DIALOG ========== */
.cancel-vote-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 0.5rem;
  backdrop-filter: blur(2px);
}

.cancel-vote-dialog {
  background: linear-gradient(145deg, #12221a 0%, #1a3528 50%, #0d1c14 100%);
  border: 2px solid rgba(204, 41, 54, 0.5);
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  text-align: center;
  max-width: 360px;
  width: 90vw;
  box-shadow:
    0 0 20px rgba(204, 41, 54, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: cv-appear 0.25s ease-out;
}

@keyframes cv-appear {
  0% { opacity: 0; transform: scale(0.92) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.cancel-vote-dialog h2 {
  color: var(--red);
  font-size: 1.15rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px rgba(204, 41, 54, 0.3);
}

/* Player vote rows */
#cancel-vote-players {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.2rem;
}

.cv-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.2s;
}

.cv-player-row:last-child { border-bottom: none; }

.cv-player-name {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.cv-player-name.cv-is-me {
  color: var(--accent-cyan);
}

.cv-player-status {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.cv-status-icon { margin-right: 2px; }

.cv-status-pending {
  color: #6a8a6a;
  background: rgba(255, 255, 255, 0.04);
}

.cv-status-cancel {
  color: var(--green);
  background: rgba(74, 222, 128, 0.1);
}

.cv-status-continue {
  color: var(--red);
  background: rgba(204, 41, 54, 0.1);
}

/* Action buttons */
#cancel-vote-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.cv-btn {
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
  text-shadow: none;
}

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

.cv-btn-cancel {
  background: rgba(204, 41, 54, 0.12);
  border: 2px solid var(--red);
  color: var(--red);
  box-shadow: 0 0 8px rgba(204, 41, 54, 0.1);
}

.cv-btn-cancel:hover {
  background: rgba(204, 41, 54, 0.22);
  box-shadow: 0 0 14px rgba(204, 41, 54, 0.2);
}

.cv-btn-continue {
  background: rgba(74, 222, 128, 0.1);
  border: 2px solid var(--green);
  color: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.08);
}

.cv-btn-continue:hover {
  background: rgba(74, 222, 128, 0.2);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.18);
}

/* -200 penalty button inline */
.cv-btn-200 {
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 5px;
  background: rgba(212, 175, 55, 0.08);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  text-shadow: none;
  box-shadow: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cv-btn-200:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.2);
}

.cv-btn-200.cv-200-voted {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--accent);
  opacity: 0.6;
  cursor: default;
}

.cv-200-count {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Vote result messages */
.cv-result-msg {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 0.5rem;
  text-align: center;
  animation: cv-appear 0.3s ease-out;
}

.cv-result-ok { color: var(--green); }
.cv-result-penalty { color: var(--accent); font-size: 1.3rem; }
.cv-result-rejected { color: #8a9a8a; }

/* Last trick overlay cards */
#last-trick-cards {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

#last-trick-cards .card-with-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

#last-trick-cards .card-with-name .player-label {
  font-size: 0.7rem;
  color: #6a8a6a;
}

#last-trick-cards .card-with-name .player-label.winner {
  color: var(--green);
  font-weight: bold;
}

#last-trick-winner {
  color: var(--green);
  margin-bottom: 0.8rem;
  font-weight: bold;
}

/* Hand preview in overlays */
#trump-hand-preview, #choose-hand-preview {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

#trump-hand-preview .card, #choose-hand-preview .card {
  margin-left: -6px;
  cursor: default;
  transform: rotate(var(--fan-angle, 0deg)) translateY(var(--fan-lift, 0px));
  transform-origin: bottom center;
}

#trump-hand-preview .card:first-child, #choose-hand-preview .card:first-child { margin-left: 0; }

#choose-hand-preview { margin-top: 1rem; margin-bottom: 0; }

/* ========== PAPER SCOREBOARD ========== */
.paper-scoreboard {
  background: #f5f0e1 !important;
  border: none !important;
  box-shadow: 2px 3px 20px rgba(0,0,0,0.5), inset 0 0 60px rgba(0,0,0,0.03) !important;
  font-family: 'Caveat', cursive !important;
  color: #2a2a2a;
  min-width: 300px;
  max-width: 95vw;
  padding: 1.5rem 1.8rem !important;
  position: relative;
}

/* Faint ruled lines */
.paper-scoreboard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 28px,
    rgba(180, 160, 140, 0.18) 28px,
    rgba(180, 160, 140, 0.18) 29px
  );
  pointer-events: none;
  border-radius: 12px;
}

.paper-scoreboard h2,
.paper-scoreboard button {
  font-family: 'Caveat', cursive !important;
}

.paper-scoreboard button {
  font-size: 1.1rem;
  background: rgba(42, 42, 42, 0.08);
  border-color: #bba;
  color: #444;
  text-shadow: none;
  box-shadow: none;
}

.paper-scoreboard button:hover {
  background: rgba(42, 42, 42, 0.15);
  border-color: #888;
}

#paper-matrix table,
#paper-scores table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Caveat', cursive;
  position: relative;
  z-index: 1;
}

#paper-matrix table { font-size: 1.1rem; margin-bottom: 0.8rem; }
#paper-scores table { font-size: 1rem; }

#paper-matrix th, #paper-matrix td {
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: center;
}

#paper-matrix th {
  color: #555;
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 2px solid #bba;
}

#paper-matrix td.played {
  color: #2a7a2a;
  font-weight: bold;
  font-size: 1.3rem;
}

#paper-matrix td.current-chooser {
  background: rgba(212, 175, 55, 0.1);
}

#paper-matrix .game-label {
  text-align: left;
  color: #666;
  font-size: 1rem;
}

#paper-matrix .chooser-col {
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.3);
}

#paper-scores {
  border-top: 2px solid #bba;
  padding-top: 0.6rem;
  margin-top: 0.3rem;
}

#paper-scores th, #paper-scores td {
  padding: 0.15rem 0.3rem;
  text-align: center;
}

#paper-scores th {
  color: #555;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2px solid #bba;
}

#paper-scores .round-label {
  text-align: left;
  color: #888;
  font-size: 0.85rem;
}

#paper-scores .delta-positive { color: #2a7a2a; }
#paper-scores .delta-negative { color: #b82030; }

#paper-scores .shop-row td { background: #f5f0e8; font-style: italic; }

#paper-scores .old-total {
  text-decoration: line-through;
  color: #aaa;
  font-size: 0.9rem;
}

#paper-scores .current-total {
  font-weight: 700;
  font-size: 1.4rem;
  color: #222;
  border-top: 2px solid #999;
}

/* Game over ranking in paper scoreboard */
.game-over-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #222;
  text-align: center;
  margin-bottom: 0.5rem;
}

.game-over-ranking {
  margin-bottom: 1rem;
  border-bottom: 2px solid #bba;
  padding-bottom: 0.8rem;
}

.ranking-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  padding: 0.15rem 0;
}

.ranking-row:first-child {
  font-size: 1.5rem;
  font-weight: 700;
}

.ranking-pos { color: #888; min-width: 2rem; text-align: right; }
.ranking-name { color: #333; }
.ranking-score { color: #2a7a2a; font-weight: 700; min-width: 3rem; text-align: left; }

/* ========== BELOTE/REBELOTE ANNOUNCEMENT ========== */
#belote-announcement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow:
    0 0 20px rgba(212, 175, 55, 0.9),
    0 0 40px rgba(212, 175, 55, 0.6),
    0 0 80px rgba(212, 175, 55, 0.4),
    0 0 120px rgba(212, 175, 55, 0.2);
  z-index: 1150;
  pointer-events: none;
  opacity: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  letter-spacing: 2px;
}

#belote-announcement.show {
  animation: belote-explode 1.8s ease-out forwards;
}

@keyframes belote-explode {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-5deg); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.4) rotate(2deg); opacity: 1; }
  25% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.8) rotate(3deg); opacity: 0; }
}

.belote-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1140;
}

/* Screen flash for belote */
.screen-flash {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(212, 175, 55, 0.1);
  pointer-events: none;
  z-index: 1130;
  opacity: 0;
  transition: opacity 0.08s ease-in;
}

.screen-flash.active {
  opacity: 1;
  animation: flash-fade 0.5s ease-out forwards;
}

@keyframes flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== BELOTE DECLARATIONS ========== */
.declaration-display {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: center;
  padding: 4px 8px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 6px;
  animation: declaration-fade 5s ease-out forwards;
  z-index: 5;
  margin-top: 4px;
}

.declaration-display .card {
  width: calc(var(--card-w) * 0.55);
  height: calc(var(--card-h) * 0.55);
}

.declaration-self {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes declaration-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== MODE TOGGLE (Lobby) ========== */
.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 0.6rem;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(212, 175, 55, 0.25);
}

.mode-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0;
  background: var(--bg-dark);
  color: #5a6b5a;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  text-shadow: none;
  box-shadow: none;
}

.mode-btn.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

/* Player count toggle (reuse mode-toggle layout) */
#np-toggle { margin-bottom: 0.6rem; }
.np-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0;
  background: var(--bg-dark);
  color: #5a6b5a;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.np-btn.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

.mode-btn:hover:not(.active) {
  background: rgba(212, 175, 55, 0.06);
  color: #8a9a8a;
}

/* Mode badge in lobby */
.mode-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  vertical-align: middle;
  margin-left: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  color: #8a9a8a;
}

.mode-badge-super {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(255, 215, 0, 0.15));
  color: var(--accent);
  border: 1px solid rgba(212, 175, 55, 0.4);
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.4);
  animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(212, 175, 55, 0.1); }
  50% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.3); }
}

/* ========== SHOP OVERLAY ========== */
.shop-content {
  min-width: 280px;
  max-width: 400px;
}

.shop-content h2 {
  color: var(--accent) !important;
  font-size: 1.4rem !important;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

#shop-banner {
  display: block;
  width: 100%;
  max-width: 360px;
  border-radius: 8px;
  margin: 0 auto 12px;
}

#shop-balance {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

#shop-balance strong {
  color: var(--accent);
  font-size: 1.2rem;
}

#shop-items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.shop-item {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(14, 42, 27, 0.6) 100%);
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shop-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.shop-item-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.shop-item-desc {
  font-size: 0.8rem;
  color: #8a9a8a;
  margin-bottom: 0.4rem;
}

.shop-item-cost {
  font-size: 0.85rem;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.shop-buy-btn {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.1);
  color: var(--accent);
  cursor: pointer;
  text-shadow: none;
  box-shadow: none;
  transition: background 0.2s, box-shadow 0.2s;
}

.shop-buy-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

#shop-my-jokers {
  margin-bottom: 0.8rem;
}

#shop-my-jokers h3 {
  color: var(--accent-cyan);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.shop-joker-owned {
  font-size: 0.8rem;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  background: rgba(92, 224, 214, 0.06);
  border: 1px solid rgba(92, 224, 214, 0.2);
  border-radius: 6px;
  margin-bottom: 0.3rem;
}

#shop-ready-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.shop-ready-player {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #5a6b5a;
}

.shop-ready-player.ready {
  color: var(--green);
  background: rgba(74, 222, 128, 0.1);
}

/* ========== JOKER BUTTONS IN CHOOSE OVERLAY ========== */
#choose-jokers {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

#choose-jokers:empty {
  display: none;
}

.choose-joker-btn {
  padding: 0.4rem 0.8rem;
  border: 2px solid rgba(212, 175, 55, 0.5);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(14, 42, 27, 0.8) 100%);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.1);
  animation: joker-pulse 3s ease-in-out infinite;
}

.choose-joker-btn:hover {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.35);
}

/* ========== JOKER TRAY (non-chooser players) ========== */
#joker-tray {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: rgba(212, 175, 55, 0.04);
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  flex-shrink: 0;
  position: relative;
  z-index: 901;
}

.joker-btn {
  padding: 0.35rem 0.7rem;
  border: 2px solid rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(14, 42, 27, 0.8) 100%);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.08);
  animation: joker-pulse 3s ease-in-out infinite;
}

.joker-btn:hover {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

@keyframes joker-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(212, 175, 55, 0.08); }
  50% { box-shadow: 0 0 12px rgba(212, 175, 55, 0.2); }
}

.joker-name {
  font-size: 0.75rem;
}

/* ========== JOKER TARGET OVERLAY ========== */
#joker-target-players {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.joker-target-btn {
  padding: 0.7rem 1.2rem;
  background: rgba(14, 42, 27, 0.8);
  border: 2px solid rgba(92, 224, 214, 0.3);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-shadow: none;
  box-shadow: none;
}

.joker-target-btn:hover {
  border-color: var(--accent-cyan);
  background: rgba(92, 224, 214, 0.08);
  box-shadow: 0 0 10px rgba(92, 224, 214, 0.15);
  color: var(--accent-cyan);
}

/* ========== SUPER MODE VISUALS ========== */
body.mode-super #screen-game::before {
  /* Enhanced scanlines */
  opacity: 0.4;
}

body.mode-super #screen-game::after {
  /* Enhanced vignette */
  background: radial-gradient(
    ellipse at center,
    transparent 45%,
    rgba(0, 0, 0, 0.5) 100%
  );
}

body.mode-super #game-table {
  background: transparent;
}

body.mode-super #play-area {
  /* no override needed; game-table is the background */
}

body.mode-super #play-area::before {
  background:
    radial-gradient(circle at 30% 40%, rgba(212, 175, 55, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(92, 224, 214, 0.025) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.015) 0%, transparent 40%);
}

/* Gold pulsing border around game screen */
body.mode-super #screen-game {
  box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.06);
  animation: super-border-pulse 4s ease-in-out infinite;
}

@keyframes super-border-pulse {
  0%, 100% { box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.06); }
  50% { box-shadow: inset 0 0 50px rgba(212, 175, 55, 0.1); }
}

/* Brighter card glows in super mode */
body.mode-super #my-hand .card.playable {
  animation: super-playable-glow 2s ease-in-out infinite;
}

@keyframes super-playable-glow {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(46, 164, 79, 0.4),
      0 0 16px rgba(46, 164, 79, 0.15),
      0 2px 6px rgba(0,0,0,0.15);
  }
  25% {
    box-shadow:
      0 0 10px rgba(92, 224, 214, 0.4),
      0 0 20px rgba(92, 224, 214, 0.15),
      0 2px 6px rgba(0,0,0,0.15);
  }
  50% {
    box-shadow:
      0 0 10px rgba(255, 215, 0, 0.4),
      0 0 20px rgba(255, 215, 0, 0.15),
      0 2px 6px rgba(0,0,0,0.15);
  }
  75% {
    box-shadow:
      0 0 10px rgba(212, 175, 55, 0.4),
      0 0 20px rgba(212, 175, 55, 0.15),
      0 2px 6px rgba(0,0,0,0.15);
  }
}

body.mode-super #my-hand .card:hover {
  box-shadow:
    0 4px 12px rgba(0,0,0,0.3),
    0 8px 24px rgba(0,0,0,0.15),
    0 0 12px rgba(212, 175, 55, 0.3);
}

/* Enhanced header in super mode */
body.mode-super #game-header {
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  background: linear-gradient(180deg, var(--bg-dark) 0%, rgba(14, 42, 27, 0.95) 100%);
}

/* Enhanced scoreboard glow */
body.mode-super .score-entry .pts {
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

/* ========== RECONNECTING OVERLAY ========== */
#overlay-reconnecting .overlay-content {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(92, 224, 214, 0.15);
}

#overlay-reconnecting h2 {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(92, 224, 214, 0.4);
}

#reconnecting-status {
  color: #8a9a8a;
  margin-bottom: 0.5rem;
}

.reconnecting-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(92, 224, 214, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  margin: 0.5rem auto 0;
}

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

/* ========== YOUR TURN INDICATOR ========== */
#my-hand.my-turn {
  border-top: 2px solid var(--green);
  box-shadow: 0 -4px 16px rgba(74, 222, 128, 0.25);
  position: relative;
}

#my-hand.my-turn::before {
  content: 'A ton tour !';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
  animation: turn-pulse 1.5s ease-in-out infinite;
  z-index: 11;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes turn-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* When NOT your turn, mute the hand slightly */
#my-hand.not-my-turn .card {
  cursor: default;
}

/* ========== MINI-GAME RULE HINT ========== */
.game-rule-hint {
  position: absolute;
  top: 8px;
  left: 35%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(232, 232, 224, 0.6);
  background: rgba(8, 26, 16, 0.85);
  padding: 0.25rem 0.8rem;
  border-radius: 20px;
  border: 1px solid rgba(212, 175, 55, 0.15);
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
  animation: hint-fade-in 0.5s ease-out;
}

@keyframes hint-fade-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }

}

/* ========== TRUMP SUIT INDICATOR ========== */
.trump-indicator {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 1.6rem;
  opacity: 0.25;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.5));
}

/* ========== NEXT ROUND BUTTON PULSE ========== */
#overlay-result button,
#overlay-shop #btn-shop-confirm {
  animation: next-btn-pulse 2s ease-in-out infinite;
}

@keyframes next-btn-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(212, 175, 55, 0.1); }
  50% { box-shadow: 0 0 16px rgba(212, 175, 55, 0.4); }
}

/* ========== RESPONSIVE: Small phones (< 380px) ========== */
@media (max-width: 380px) {
  :root {
    --card-w: 58px;
    --card-h: 84px;
    --card-overlap: -20px;
    --card-rank-size: 0.6rem;
    --card-suit-sm: 0.45rem;
    --card-center-size: 1.15rem;
    --card-corner-top: 1px;
    --card-corner-left: 2px;
    --card-radius: 5px;
    --card-back-w: 20px;
    --card-back-h: 30px;
    --trick-area-w: 250px;
    --trick-area-h: 210px;
  }

  #screen-game::before { opacity: 0.15; }
  #my-hand .card.playable::after { display: none; }

  #game-header { padding: 0.15rem 0.3rem; min-height: 30px; }
  #header-logo { height: 20px; }
  #round-info { font-size: 0.58rem; }
  #scoreboard-mini { gap: 0.25rem; font-size: 0.55rem; }
  .score-entry .name { font-size: 0.48rem; }
  .player-portrait-wrap { width: 38px; height: 50px; }
  .other-player { padding: 4px 5px 4px 4px; gap: 5px; }
  .other-player .player-name { font-size: 0.6rem; max-width: 70px; }
  .pstat-cards, .pstat-score { font-size: 0.5rem; }
  #play-area { padding-top: 78px; }
  .layout-4p .pos-left { top: 37%; }
  .layout-4p .pos-right { top: 37%; }
  .overlay-content { padding: 1rem; }
  .overlay-content h2 { font-size: 1rem; margin-bottom: 0.7rem; }
  #game-choices { grid-template-columns: 1fr; gap: 0.4rem; }
  .game-choice-btn { padding: 0.6rem; font-size: 0.75rem; }
  .trump-btn { width: 48px; height: 48px; font-size: 1.4rem; }
  .result-row { font-size: 0.85rem; padding: 0.3rem 0.5rem; }
  .waiting-text { font-size: 0.9rem; }
  #belote-announcement { font-size: 1.6rem; }
  .reussite-cell { font-size: 0.5rem; }
  .reussite-cell .rank { font-size: 0.55rem; }
  .reussite-cell .suit-symbol { font-size: 0.65rem; }
}

/* ========== RESPONSIVE: Phones (380px - 480px) ========== */
@media (min-width: 381px) and (max-width: 480px) {
  :root {
    --card-w: 68px;
    --card-h: 98px;
    --card-overlap: -18px;
    --card-rank-size: 0.7rem;
    --card-suit-sm: 0.5rem;
    --card-center-size: 1.3rem;
    --card-corner-top: 2px;
    --card-corner-left: 2px;
    --card-radius: 6px;
    --card-back-w: 23px;
    --card-back-h: 35px;
    --trick-area-w: 290px;
    --trick-area-h: 248px;
  }

  #game-choices { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .game-choice-btn { padding: 0.6rem; font-size: 0.8rem; }
  .trump-btn { width: 52px; height: 52px; font-size: 1.5rem; }
}

/* ========== RESPONSIVE: Large phones / small tablets (481px - 767px) ========== */
@media (min-width: 481px) and (max-width: 767px) {
  :root {
    --card-w: 86px;
    --card-h: 124px;
    --card-overlap: -14px;
    --card-rank-size: 0.85rem;
    --card-suit-sm: 0.65rem;
    --card-center-size: 1.85rem;
    --card-corner-top: 3px;
    --card-corner-left: 3px;
    --card-radius: 7px;
    --card-back-w: 28px;
    --card-back-h: 42px;
    --trick-area-w: 370px;
    --trick-area-h: 316px;
  }

  #game-header { padding: 0.3rem 0.7rem; }
  #header-logo { height: 26px; }
  #round-info { font-size: 0.75rem; }
  #scoreboard-mini { gap: 0.55rem; font-size: 0.7rem; }
  .score-entry .name { font-size: 0.58rem; }
  .player-portrait-wrap { width: 56px; height: 72px; }
  .other-player .player-name { font-size: 0.72rem; max-width: 96px; }
  .overlay-content { padding: 1.5rem; }
  .overlay-content h2 { font-size: 1.2rem; }
  .trump-btn { width: 60px; height: 60px; font-size: 1.6rem; }
  .result-row { font-size: 1rem; }
  .reussite-cell { font-size: 0.6rem; }
  .reussite-cell .rank { font-size: 0.65rem; }
  .reussite-cell .suit-symbol { font-size: 0.75rem; }
}

/* ========== RESPONSIVE: Tablets (768px+) ========== */
@media (min-width: 768px) {
  :root {
    --card-w: 100px;
    --card-h: 143px;
    --card-overlap: -10px;
    --card-rank-size: 1rem;
    --card-suit-sm: 0.75rem;
    --card-center-size: 2.2rem;
    --card-corner-top: 3px;
    --card-corner-left: 4px;
    --card-radius: 8px;
    --card-back-w: 32px;
    --card-back-h: 48px;
    --trick-area-w: 420px;
    --trick-area-h: 370px;
  }

  #game-header { padding: 0.4rem 1rem; }
  #header-logo { height: 30px; }
  #round-info { font-size: 0.8rem; }
  #scoreboard-mini { gap: 0.8rem; font-size: 0.75rem; }
  .score-entry .name { font-size: 0.65rem; }
  .player-portrait-wrap { width: 62px; height: 80px; }
  .other-player .player-name { font-size: 0.78rem; max-width: 110px; }
  .pstat-cards, .pstat-score { font-size: 0.62rem; }
  #play-area { padding-top: 108px; }
  .layout-4p .pos-left { top: 35%; }
  .layout-4p .pos-right { top: 35%; }
  .overlay-content { padding: 2rem; }
  .overlay-content h2 { font-size: 1.4rem; }
  .trump-btn { width: 70px; height: 70px; font-size: 2rem; }
  .result-row { font-size: 1.1rem; padding: 0.5rem 1rem; }
  #game-matrix table { font-size: 0.6rem; }
  #game-matrix th { font-size: 0.55rem; }
  .reussite-cell { font-size: 0.7rem; }
  .reussite-cell .rank { font-size: 0.75rem; }
  .reussite-cell .suit-symbol { font-size: 0.85rem; }
}

/* ========== RESPONSIVE: Desktop (1024px+) ========== */
@media (min-width: 1024px) {
  :root {
    --card-w: 115px;
    --card-h: 165px;
    --card-overlap: -8px;
    --card-rank-size: 1.1rem;
    --card-suit-sm: 0.8rem;
    --card-center-size: 2.5rem;
    --card-corner-top: 4px;
    --card-corner-left: 5px;
    --card-radius: 10px;
    --card-back-w: 38px;
    --card-back-h: 55px;
    --trick-area-w: 500px;
    --trick-area-h: 430px;
  }

  #scoreboard-mini { gap: 1.2rem; }
  .other-player .player-cards { gap: 2px; }
}

/* ========== RESPONSIVE: Landscape phones ========== */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --card-w: 60px;
    --card-h: 86px;
    --card-overlap: -18px;
    --card-rank-size: 0.6rem;
    --card-suit-sm: 0.45rem;
    --card-center-size: 1.15rem;
    --card-back-w: 20px;
    --card-back-h: 30px;
    --trick-area-w: 260px;
    --trick-area-h: 200px;
  }

  #screen-game::before { opacity: 0.15; }

  #game-header { padding: 0.12rem 0.4rem; min-height: 26px; }
  #header-logo { height: 18px; }
  #round-info { font-size: 0.58rem; }
  #scoreboard-mini { font-size: 0.55rem; gap: 0.3rem; }
  .score-entry .name { font-size: 0.46rem; }
  .player-portrait-wrap { width: 34px; height: 44px; }
  .other-player { padding: 3px 4px; gap: 4px; }
  .other-player .player-name { font-size: 0.55rem; max-width: 64px; }
  .pstat-cards, .pstat-score { font-size: 0.46rem; }
  #play-area { padding-top: 70px; }
  #my-hand { min-height: calc(var(--card-h) + 8px); padding: 0.8rem 0.2rem 0.2rem; }
  .overlay-content { padding: 0.8rem; max-height: 95vh; }
  .overlay-content h2 { font-size: 0.9rem; margin-bottom: 0.5rem; }
  #game-matrix { padding: 0.1rem 0.2rem; }
  .reussite-cell { font-size: 0.45rem; gap: 2px; }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  .card-back::before,
  #my-hand .card.playable::after,
  #play-area::before {
    animation: none !important;
  }
  #my-hand .card.playable {
    animation: none !important;
    box-shadow:
      0 0 6px rgba(46, 164, 79, 0.3),
      0 0 12px rgba(46, 164, 79, 0.12),
      0 2px 6px rgba(0,0,0,0.15);
  }
  .screen-flash { display: none !important; }
  #belote-announcement { animation-duration: 0.01ms !important; }
  .result-row { animation: none !important; opacity: 1 !important; }
  .reconnecting-spinner { animation-duration: 2s; }
  .cancel-vote-dialog { animation: none !important; }
  .joker-reveal-content { animation: none !important; }
  #joker-reveal-icon { animation: none !important; }
  .shop-offer-card { animation: none !important; }
  #my-hand.my-turn::before { animation: none !important; }
  .game-rule-hint { animation: none !important; }
  #overlay-result button,
  #overlay-shop #btn-shop-confirm { animation: none !important; }
}

/* ========== DEBUG PANEL ========== */
#debug-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 9999;
  background: rgba(10, 20, 14, 0.92);
  border: 1px solid #2e6e3e;
  border-radius: 8px;
  min-width: 230px;
  max-width: 300px;
  font-size: 0.8rem;
  color: #b8dfc4;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

#debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(30, 80, 45, 0.6);
  border-radius: 8px 8px 0 0;
  font-weight: bold;
  letter-spacing: 0.05em;
  color: #6dffaa;
  cursor: default;
}

#debug-collapse-btn {
  background: none;
  border: none;
  color: #6dffaa;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 2px;
  line-height: 1;
}

#debug-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#debug-body hr {
  border: none;
  border-top: 1px solid #2e6e3e;
  margin: 2px 0;
}

.debug-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.debug-btn {
  background: rgba(30, 90, 50, 0.7);
  border: 1px solid #3a9e5a;
  color: #b8dfc4;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.debug-btn:hover {
  background: rgba(50, 130, 70, 0.85);
}

.debug-btn-danger {
  background: rgba(90, 20, 20, 0.7);
  border-color: #cc2936;
  color: #ffaaaa;
}

.debug-btn-danger:hover {
  background: rgba(130, 30, 30, 0.85);
}

#debug-body input[type="range"] {
  flex: 1;
  accent-color: #4ade80;
}

#debug-body input[type="number"] {
  background: rgba(10, 30, 15, 0.8);
  border: 1px solid #2e6e3e;
  color: #b8dfc4;
  border-radius: 4px;
  padding: 2px 4px;
  text-align: center;
}

#debug-all-hands {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.debug-hand {
  background: rgba(20, 50, 30, 0.6);
  border-radius: 4px;
  padding: 3px 5px;
}

.debug-hand-label {
  font-size: 0.72rem;
  font-weight: bold;
  color: #6dffaa;
  margin-bottom: 2px;
}

.debug-hand-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.debug-hand-cards .card {
  --card-w: 32px;
  --card-h: 46px;
  width: var(--card-w);
  height: var(--card-h);
  cursor: default;
  transform: none !important;
}

/* ========== JOKER WINDOW OVERLAY ========== */
.joker-window-content {
  min-width: 280px;
  max-width: 380px;
}

#joker-window-game-badge {
  display: inline-block;
  background: rgba(92, 224, 214, 0.12);
  border: 1px solid rgba(92, 224, 214, 0.4);
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  margin-bottom: 0.6rem;
  letter-spacing: 0.5px;
}

.joker-window-content h2 {
  font-size: 1.05rem !important;
  margin-bottom: 0.5rem !important;
}


#joker-window-timer-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-bottom: 1rem;
  overflow: hidden;
}

#joker-window-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent));
  border-radius: 3px;
  transition: width 0.9s linear;
}

#joker-window-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.joker-window-use-btn {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(14, 42, 27, 0.8));
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
  animation: joker-pulse 2s ease-in-out infinite;
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

.joker-window-use-btn:hover {
  background: rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
  transform: scale(1.02);
}

.joker-window-pass-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  color: #6a8a6a;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  text-shadow: none;
  box-shadow: none;
}

.joker-window-pass-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.joker-window-waiting {
  color: #5a7a5a;
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}

#joker-window-decisions {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.jw-scores-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.3rem;
  margin-bottom: 0.2rem;
}

.jw-decision-chip {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #5a6b5a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.jw-chip-score {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

.jw-chip-joker {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  color: var(--accent);
  opacity: 0.85;
}

.joker-card-img--chip {
  width: 28px;
  height: auto;
}

.jw-decision-chip.passed {
  color: #4a6a4a;
  background: rgba(74, 222, 128, 0.06);
}

.jw-decision-chip.played {
  color: var(--accent);
  background: rgba(212, 175, 55, 0.1);
}

.jw-decision-chip.blocked {
  color: #a04a4a;
  background: rgba(220, 80, 80, 0.08);
  opacity: 0.7;
}

/* ========== NOPE PHASE OVERLAY ========== */
.nope-phase-content {
  min-width: 300px;
  max-width: 480px;
  text-align: center;
}

.nope-phase-title {
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.nope-phase-subtitle {
  font-size: 0.85rem;
  color: #8a9a8a;
  margin-bottom: 1rem;
}

#nope-joker-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.nope-joker-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
}

.nope-joker-img {
  width: 56px;
  height: auto;
  border-radius: 6px;
  flex-shrink: 0;
}

.nope-joker-emoji {
  font-size: 2rem;
  flex-shrink: 0;
}

.nope-joker-info {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nope-joker-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.nope-joker-owner {
  font-size: 0.75rem;
  color: #6a8a6a;
}

.nope-cancel-btn {
  padding: 0.4rem 0.9rem;
  background: rgba(220, 80, 80, 0.15);
  border: 1px solid rgba(220, 80, 80, 0.4);
  border-radius: 8px;
  color: #e07a5f;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.nope-cancel-btn:hover {
  background: rgba(220, 80, 80, 0.28);
  border-color: #e07a5f;
}

.nope-super-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: rgba(220, 80, 80, 0.18);
  border: 2px solid rgba(220, 80, 80, 0.5);
  border-radius: 10px;
  color: #e07a5f;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0 auto 0.6rem;
  transition: background 0.15s, border-color 0.15s;
}

.nope-super-btn:hover {
  background: rgba(220, 80, 80, 0.32);
  border-color: #e07a5f;
}

.nope-pass-btn {
  padding: 0.45rem 1.2rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #6a8a6a;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.nope-pass-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.nope-empty {
  color: #6a8a6a;
  font-size: 0.9rem;
  font-style: italic;
}

/* ========== JOKER REVEAL OVERLAY ========== */
.joker-reveal-content {
  min-width: 300px;
  max-width: 420px;
  text-align: center;
  animation: joker-reveal-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes joker-reveal-pop {
  0% { transform: scale(0.7) rotate(-3deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

#joker-reveal-icon {
  font-size: 4rem;
  margin-bottom: 0.8rem;
  animation: joker-icon-spin 0.6s ease-out;
  display: inline-block;
  filter: drop-shadow(0 0 28px rgba(212, 175, 55, 0.85));
}

@keyframes joker-icon-spin {
  0% { transform: rotateY(0deg) scale(0.5); }
  60% { transform: rotateY(180deg) scale(1.2); }
  100% { transform: rotateY(360deg) scale(1); }
}

#joker-reveal-player-name {
  font-size: 1rem;
  color: #8a9a8a;
  margin-bottom: 0.3rem;
}

#joker-reveal-joker-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
  margin-bottom: 0.6rem;
}

#joker-reveal-effect {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.4;
}

#joker-reveal-target-label {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e07a5f;
  line-height: 1.4;
}

/* ========== JOKER INDICATOR IN PLAYER HUD ========== */
.joker-indicator {
  display: inline-block;
  font-size: 0.7em;
  opacity: 0.9;
  animation: joker-pulse 2s ease-in-out infinite;
}

/* ========== SHOP OVERLAY — New offer-based design ========== */
.shop-offer-card {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(14, 42, 27, 0.8) 100%);
  border: 2px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.8rem;
  animation: shop-offer-appear 0.4s ease-out;
}

@keyframes shop-offer-appear {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.shop-offer-joker-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.shop-offer-joker-desc {
  font-size: 0.8rem;
  color: #8a9a8a;
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.shop-offer-price {
  font-size: 1rem;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.shop-offer-btns {
  display: flex;
  gap: 0.5rem;
}

.shop-offer-buy-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 2px solid var(--accent);
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}

.shop-offer-buy-btn:hover {
  background: rgba(212, 175, 55, 0.25);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.shop-offer-buy-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.shop-offer-skip-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #6a8a6a;
  border-radius: 8px;
  cursor: pointer;
  text-shadow: none;
  box-shadow: none;
}

.shop-offer-skip-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.shop-inventory-full {
  background: rgba(92, 224, 214, 0.08);
  border: 1px solid rgba(92, 224, 214, 0.3);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 0.6rem;
}

.shop-current-joker-label {
  font-size: 0.75rem;
  color: #5a7a5a;
  margin-bottom: 0.2rem;
}

.shop-current-joker-name {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.shop-decided-msg {
  font-size: 0.9rem;
  color: var(--green);
  padding: 0.5rem;
  text-align: center;
}

.shop-replace-note {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  padding: 0.3rem 0.6rem;
  background: rgba(92, 224, 214, 0.06);
  border: 1px solid rgba(92, 224, 214, 0.15);
  border-radius: 6px;
  margin-bottom: 0.6rem;
  text-align: center;
}

/* ========== BLOCK MINIGAME JOKER ========== */

/* Blocked game in choose overlay */
.game-choice-btn.blocked {
  opacity: 0.5;
  cursor: not-allowed;
  background: #5a1a1a;
  border-color: #cc4444;
}

/* Joker select subtitle */
.joker-select-subtitle {
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

/* Game select list in joker overlay */
#joker-game-select-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

/* Game select buttons in joker overlay */
.joker-game-select-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.6rem 1rem;
  background: var(--bg-felt);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  text-shadow: none;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}
.joker-game-select-btn:hover {
  background: var(--accent);
  color: var(--bg-dark);
}

/* ========== JOKER CARD IMAGES ========== */

/* Base image used everywhere */
.joker-card-img {
  display: block;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* In shop offer card — prominent */
.shop-offer-card .joker-card-img {
  width: 120px;
  height: auto;
  margin: 0 auto 0.6rem;
}

/* In shop owned-joker section — smaller */
.joker-card-img--small {
  width: 60px;
  height: auto;
  flex-shrink: 0;
}

.shop-joker-owned {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(92, 224, 214, 0.08);
  border: 1px solid rgba(92, 224, 214, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

/* In joker tray (choosing phase) */
.joker-card-img--tray {
  width: 48px;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}

.joker-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--accent);
}

/* In joker window use button */
.joker-card-img--btn {
  width: 36px;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* In joker reveal overlay */
.joker-card-img--reveal {
  width: 220px;
  height: auto;
  margin: 0 auto;
  display: block;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(212, 175, 55, 0.5), 0 2px 12px rgba(0,0,0,0.6);
  animation: joker-reveal-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== USED JOKERS PANEL ========== */

#used-jokers-panel {
  position: fixed;
  bottom: calc(var(--card-h) + 24px);
  right: 0.5rem;
  background: rgba(10, 30, 15, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(6px);
}

#used-jokers-label {
  font-size: 0.7rem;
  color: rgba(212, 175, 55, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

#used-jokers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.joker-card-img--used {
  width: 80px;
  height: auto;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border-radius: 6px;
}

.joker-card-img--used:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

/* ========== JOKER FULLVIEW OVERLAY ========== */

.joker-fullview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  max-width: 320px;
}

.joker-fullview-content img {
  width: 260px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: joker-reveal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#joker-fullview-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

#joker-fullview-player {
  font-size: 0.9rem;
  color: #8a9a8a;
}
