:root {
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #3d2c2e;
  background: #fdf0e0;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select { font: inherit; }

button {
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-radius: 16px;
  background: linear-gradient(180deg, #ff9f43, #ee5a24);
  box-shadow: 0 6px 0 #c44218, 0 8px 20px rgba(0, 0, 0, 0.12);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  min-height: 46px;
  padding: 0 20px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease, box-shadow 0.2s ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-3px);
  box-shadow: 0 9px 0 #c44218, 0 12px 28px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
  box-shadow: 0 2px 0 #c44218, 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(3px);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.5;
}

button.secondary, .ghostButton {
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid rgba(210, 155, 80, 0.35);
  box-shadow: 0 4px 0 rgba(210, 155, 80, 0.2), 0 6px 16px rgba(0, 0, 0, 0.08);
  color: #b87a2e;
  text-shadow: none;
}

button.secondary:hover:not(:disabled), .ghostButton:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 6px 0 rgba(210, 155, 80, 0.25), 0 8px 20px rgba(0, 0, 0, 0.1);
}

.hudActions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hudActions .ghostButton {
  min-height: 34px;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  border-width: 2px;
  box-shadow: 0 2px 0 rgba(210, 155, 80, 0.15);
}

.hudActions .ghostButton:hover:not(:disabled) {
  transform: none;
  filter: brightness(1.05);
  box-shadow: 0 3px 0 rgba(210, 155, 80, 0.2);
}

.hudActions .ghostButton:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(210, 155, 80, 0.15);
}

.hudActions .battleLog {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  max-width: none;
  backdrop-filter: none;
  box-shadow: none;
}

.hudActions .battleLog summary {
  min-height: 34px;
  height: 34px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(210, 155, 80, 0.3);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(210, 155, 80, 0.15);
  color: #b87a2e;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  list-style: none;
  display: inline-flex;
  align-items: center;
  text-shadow: none;
  transition: filter 0.15s, box-shadow 0.15s;
}

.hudActions .battleLog summary:hover {
  filter: brightness(1.05);
  box-shadow: 0 3px 0 rgba(210, 155, 80, 0.2);
}

.hudActions .battleLog summary::-webkit-details-marker { display: none; }

.hudActions .battleLog[open] summary {
  border-radius: 8px 8px 0 0;
}

.hudActions .battleLog[open] {
  z-index: 50;
}

.hudActions .battleLog p {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(210, 155, 80, 0.3);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  min-width: 200px;
  padding: 4px 10px;
  font-size: 12px;
  margin: 0;
}

.hudActions .battleLog p:first-of-type {
  padding-top: 8px;
}

.hudActions .battleLog p:last-of-type {
  padding-bottom: 8px;
}

input, select {
  width: 100%;
  border: 3px solid rgba(210, 155, 80, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #3d2c2e;
  min-height: 46px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  border-color: #d4943a;
  box-shadow: 0 0 0 4px rgba(212, 148, 58, 0.15);
}

h1, h2, p { margin: 0; }

.appShell { min-height: 100vh; overflow: hidden; }

.gameScene {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 183, 77, 0.35), transparent 40%),
    radial-gradient(ellipse at 80% 15%, rgba(255, 159, 67, 0.25), transparent 35%),
    radial-gradient(ellipse at 50% 80%, rgba(232, 168, 88, 0.2), transparent 40%),
    linear-gradient(180deg, #fdf0e0 0%, #f5dfc0 40%, #e8d5b0 100%);
  min-height: 100vh;
  padding: 18px clamp(14px, 3vw, 34px) 24px;
  position: relative;
}

.woodgrain {
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
  position: absolute;
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 159, 67, 0.3), transparent 8%),
    radial-gradient(circle at 45% 10%, rgba(210, 155, 80, 0.2), transparent 6%),
    radial-gradient(circle at 75% 30%, rgba(232, 168, 88, 0.25), transparent 7%),
    radial-gradient(circle at 30% 60%, rgba(255, 107, 107, 0.15), transparent 5%),
    radial-gradient(circle at 85% 70%, rgba(255, 183, 77, 0.2), transparent 6%);
}

.hud {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(210px, 1fr) minmax(220px, 520px) auto;
  margin: 0 auto;
  max-width: 1280px;
  position: relative;
  z-index: 5;
}

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

.mark {
  align-items: center;
  aspect-ratio: 1;
  background: linear-gradient(145deg, #ff6b6b, #ee5a24);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.12), 0 8px 20px rgba(238, 90, 36, 0.3);
  color: #fff;
  display: flex;
  font-size: 26px;
  font-weight: 1000;
  justify-content: center;
  width: 62px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  animation: markPulse 2s ease-in-out infinite;
}

.brand h1 {
  font-size: clamp(22px, 2.4vw, 36px);
  line-height: 1;
  color: #5a3e36;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}

.brand p, .hudStatus span, .empty, .seatCard small, .betControls small {
  color: rgba(90, 62, 54, 0.65);
}

.hudStatus {
  align-items: center;
  background: rgba(255, 255, 255, 0.75);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 16px;
  display: flex;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  backdrop-filter: blur(8px);
}

.hudStatus span {
  border: 2px solid rgba(232, 168, 88, 0.5);
  border-radius: 999px;
  color: #c48830;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  background: rgba(255, 183, 77, 0.1);
}

.hudStatus strong { color: #3d2c2e; font-size: 14px; line-height: 1.35; }

.lobbyStage {
  align-items: center;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 440px);
  margin: 24px auto 0;
  max-width: 1180px;
  min-height: calc(100vh - 116px);
  position: relative;
  z-index: 2;
}

.setupPanel {
  background: rgba(255, 255, 255, 0.8);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(210, 155, 80, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
  display: grid;
  gap: 18px;
  padding: 22px;
  position: relative;
  z-index: 6;
  backdrop-filter: blur(12px);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.setupPanel.compact { bottom: 22px; left: 22px; max-width: 420px; position: fixed; }
.setup, .rooms, .formGrid { display: grid; gap: 12px; }
label { color: #5a3e36; display: grid; font-size: 13px; font-weight: 900; gap: 7px; }
.actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.sectionTitle { align-items: center; display: flex; justify-content: space-between; }
.sectionTitle h2 { font-size: 15px; color: #5a3e36; }
.sectionTitle span { align-items: center; background: #d4943a; border-radius: 50%; color: #fff; display: flex; font-weight: 1000; height: 28px; justify-content: center; width: 28px; }
.roomList { display: grid; gap: 8px; max-height: 150px; overflow: auto; }

.roomButton {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid rgba(210, 155, 80, 0.2);
  box-shadow: 0 4px 0 rgba(210, 155, 80, 0.1);
  color: #3d2c2e;
  display: flex;
  justify-content: space-between;
  min-height: 50px;
  text-align: left;
  text-shadow: none;
}

.roomButton:hover:not(:disabled) { border-color: rgba(210, 155, 80, 0.4); }

.emptyTable { align-items: center; display: grid; gap: 18px; justify-items: center; text-align: center; }

.previewMat {
  align-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.15), transparent 60%), linear-gradient(145deg, #5cb85c, #3da63d);
  border: 14px solid #8B6914;
  border-radius: 24px;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.15), inset 0 0 40px rgba(0, 0, 0, 0.1), 0 12px 40px rgba(0, 0, 0, 0.12);
  display: flex;
  gap: 22px;
  min-height: 300px;
  padding: 38px;
  animation: breathe 3s ease-in-out infinite;
}

/* ========== GAME TABLE LAYOUT ========== */

.tableStage {
  margin: 16px auto 0;
  max-width: 1180px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: auto 1fr auto;
  gap: 0;
  min-height: calc(100vh - 120px);
  max-height: 820px;
}

.roundNotice {
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid rgba(210, 155, 80, 0.25);
  border-radius: 16px;
  color: #5a3e36;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 20px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 8;
  backdrop-filter: blur(10px);
  animation: ribbonSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* seat-2: top center */
.seat-2 {
  grid-row: 1;
  grid-column: 2;
  justify-self: center;
  margin-bottom: 8px;
}

/* seat-3: left middle */
.seat-3 {
  grid-row: 2;
  grid-column: 1;
  align-self: center;
  margin-right: 8px;
}

/* seat-1: right middle */
.seat-1 {
  grid-row: 2;
  grid-column: 3;
  align-self: center;
  margin-left: 8px;
}

/* seat-0: bottom center */
.seat-0 {
  grid-row: 3;
  grid-column: 2;
  justify-self: center;
  margin-top: 8px;
}

/* felt table: center cell */
.feltTable {
  grid-row: 2;
  grid-column: 2;
  align-self: center;
  justify-self: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.12), transparent 40%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 14px),
    linear-gradient(145deg, #5cb85c, #3da63d);
  border: 14px solid #8B6914;
  border-radius: 24px;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.15), inset 0 0 50px rgba(0, 0, 0, 0.12), 0 16px 50px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px;
  width: min(60vw, 560px);
  height: min(50vh, 380px);
  position: relative;
  perspective: 800px;
}

.roundBadge {
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid rgba(210, 155, 80, 0.25);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px;
  backdrop-filter: blur(8px);
  animation: badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.roundBadge span { color: rgba(90, 62, 54, 0.6); font-size: 11px; font-weight: 900; }
.roundBadge strong { color: #d4943a; font-size: 22px; }

.centerCards {
  align-items: center;
  display: flex;
  gap: clamp(16px, 4vw, 34px);
  justify-content: center;
  perspective: 600px;
}

.deckPile { height: 140px; position: relative; width: 100px; }

.deckPile span {
  background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.3), transparent 20%), repeating-linear-gradient(45deg, #ffb74d 0 5px, #ff9800 5px 10px);
  border: 4px solid #fff;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  height: 100%;
  left: calc(var(--i, 0) * 4px);
  position: absolute;
  top: calc(var(--i, 0) * -4px);
  transform: rotate(calc(var(--i, 0) * -1deg));
  width: 100%;
}

.deckPile span:nth-child(1) { --i: 0; }
.deckPile span:nth-child(2) { --i: 1; }
.deckPile span:nth-child(3) { --i: 2; }
.dealPulse { animation: deckFloat 2.4s ease-in-out infinite; }

.tableCard {
  align-items: center;
  animation: cardFlip3D 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  aspect-ratio: 3 / 4;
  background: #fff;
  border: 4px solid #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  color: #3d2c2e;
  display: grid;
  justify-items: center;
  padding: 9px;
  position: relative;
  width: clamp(90px, 10vw, 130px);
}

.tableCard.red { color: #e74c3c; }
.tableCard.black { color: #2c3e50; }
.tableCard strong { font-size: clamp(44px, 5.5vw, 68px); line-height: 1; animation: suitPulse 1.5s ease-in-out infinite; }

.corner { display: grid; font-size: 18px; font-weight: 1000; line-height: 0.9; position: absolute; }
.corner small { font-size: 14px; }
.corner.top { left: 9px; top: 9px; }
.corner.bottom { bottom: 9px; right: 9px; transform: rotate(180deg); }
.previewCard { transform: rotate(1deg); }

/* table bets: inside feltTable, positioned at edges */
.tableBet {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.tableBet .chipStack { transform: scale(1); }

.tableBet b {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(255, 159, 67, 0.4);
  border-radius: 999px;
  color: #ff9f43;
  font-size: 14px;
  font-weight: 1000;
  min-width: 28px;
  padding: 2px 8px;
  text-align: center;
  backdrop-filter: blur(6px);
  animation: betPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tableBet-0 { bottom: 4%; left: 50%; transform: translateX(-50%); }
.tableBet-1 { right: 4%; top: 50%; transform: translateY(-50%); }
.tableBet-2 { top: 4%; left: 50%; transform: translateX(-50%); }
.tableBet-3 { left: 4%; top: 50%; transform: translateY(-50%); }

.passBadge {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(180, 180, 180, 0.5);
  border-radius: 12px;
  color: #999;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  animation: passBadgeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

@keyframes passBadgeIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

/* ========== PLAYER PANEL ========== */

.playerPanel {
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  display: grid;
  gap: 6px;
  grid-template-columns: 50px minmax(80px, 1fr);
  min-height: 110px;
  padding: 12px;
  width: min(220px, 22vw);
  backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s, filter 0.3s;
  overflow: visible;
}

.playerPanel.active {
  border-color: #ff9f43;
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.25), 0 0 24px rgba(255, 159, 67, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);
  animation: activeSeatPulse 1.2s ease-in-out infinite;
}

.playerPanel.winner {
  border-color: #4ecdc4;
  box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.25), 0 0 24px rgba(78, 205, 196, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);
  animation: winnerGlow 1s ease-in-out infinite;
}

.playerPanel.celebrating {
  border-color: #ffc857;
  box-shadow: 0 0 0 4px rgba(255, 200, 87, 0.3), 0 0 30px rgba(255, 200, 87, 0.2), 0 0 60px rgba(255, 159, 67, 0.1);
  animation: celebrateBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: visible;
}

.playerPanel.celebrating::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 24px;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.15), transparent 70%);
  animation: celebrateGlow 1.2s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.playerPanel.celebrating::after {
  content: "✦ ✦ ✦";
  position: absolute;
  top: -12px;
  right: -8px;
  font-size: 12px;
  color: #ffc857;
  animation: sparkleFloat 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 0 6px rgba(255, 200, 87, 0.6);
}

.playerPanel.disappointed {
  border-color: rgba(150, 130, 120, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: scale(0.96);
  filter: brightness(0.88) saturate(0.7);
  opacity: 0.75;
}

.playerPanel.disappointed .playerInfo strong {
  color: rgba(90, 62, 54, 0.5);
}

.avatarWrap { grid-row: span 2; position: relative; }

.avatar {
  align-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: #fff;
  display: flex;
  font-size: 22px;
  font-weight: 1000;
  height: 50px;
  justify-content: center;
  width: 50px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.playerPanel.active .avatar { animation: avatarBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }

.playerPanel.celebrating .avatar {
  animation: celebrateAvatarBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
  box-shadow: 0 0 16px rgba(255, 200, 87, 0.5), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.playerPanel.disappointed .avatar {
  animation: sadAvatarDroop 0.6s ease-out forwards;
  filter: saturate(0.5) brightness(0.85);
}

.seat-0 .avatar { background: linear-gradient(145deg, #ff6b6b, #ee5a24); }
.seat-1 .avatar { background: linear-gradient(145deg, #d4943a, #b87a2e); }
.seat-2 .avatar { background: linear-gradient(145deg, #4ecdc4, #2db5a3); }
.seat-3 .avatar { background: linear-gradient(145deg, #ff9f43, #ff6348); }

.avatar.big { height: 82px; justify-self: center; width: 82px; font-size: 32px; }

.thinking {
  animation: think 0.8s ease-in-out infinite;
  background: #ff9f43;
  border: 3px solid #fff;
  border-radius: 50%;
  height: 16px;
  position: absolute;
  right: -3px;
  top: -3px;
  width: 16px;
}

.speechBubble {
  position: absolute;
  background: #fff;
  border: 3px solid #ff9f43;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 900;
  color: #3d2c2e;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(255, 159, 67, 0.25);
  animation: bubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.speechBubble::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 3px solid #ff9f43;
  border-bottom: 3px solid #ff9f43;
  transform: rotate(45deg);
}

.seat-0 .speechBubble { top: -40px; left: 50%; transform: translateX(-50%); }
.seat-0 .speechBubble::after { bottom: -8px; left: 50%; margin-left: -6px; transform: rotate(-135deg); }
.seat-1 .speechBubble { left: -110px; top: 50%; transform: translateY(-50%); }
.seat-1 .speechBubble::after { right: -8px; top: 50%; margin-top: -6px; transform: rotate(-45deg); }
.seat-2 .speechBubble { bottom: -40px; left: 50%; transform: translateX(-50%); }
.seat-2 .speechBubble::after { top: -8px; left: 50%; margin-left: -6px; transform: rotate(45deg); }
.seat-3 .speechBubble { right: -110px; top: 50%; transform: translateY(-50%); }
.seat-3 .speechBubble::after { left: -8px; top: 50%; margin-top: -6px; transform: rotate(135deg); }

.playerInfo span { color: rgba(90, 62, 54, 0.6); display: block; font-size: 11px; font-weight: 900; }
.playerInfo strong { color: #3d2c2e; display: block; font-size: 16px; margin-top: 2px; }

.playerStats { align-items: center; display: flex; gap: 6px; }

.playerStats > span {
  align-items: center;
  background: rgba(210, 155, 80, 0.08);
  border: 2px solid rgba(210, 155, 80, 0.15);
  border-radius: 10px;
  display: flex;
  gap: 4px;
  min-height: 28px;
  padding: 4px 7px;
}

.playerStats .chipDot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d4943a, #b87a2e);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.playerStats b, .score { color: #d4943a; font-weight: 1000; }
.score { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.score.pop { animation: scorePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.score small { color: rgba(90, 62, 54, 0.5); font-size: 11px; }

.miniCards { display: flex; gap: 4px; grid-column: span 2; min-height: 26px; }

.miniCard {
  align-items: center;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  color: #3d2c2e;
  display: grid;
  font-size: 10px;
  height: 26px;
  justify-items: center;
  line-height: 0.85;
  width: 22px;
  animation: miniCardIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.miniCard.red { color: #e74c3c; }
.miniCard em { font-style: normal; }

/* ========== MOOD BUBBLE ========== */

.moodBubble {
  position: absolute;
  background: linear-gradient(135deg, #fffef8, #fff5e6);
  border: 2px solid #ff9f43;
  border-radius: 12px;
  padding: 4px 10px 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  color: #3d2c2e;
  z-index: 10;
  box-shadow: 0 3px 12px rgba(255, 159, 67, 0.25), 0 1px 4px rgba(0, 0, 0, 0.06);
  animation: moodBubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
  --arrow-color: #ff9f43;
}

.moodBubble .moodEmoji {
  font-size: 13px;
  line-height: 1;
}

.playerPanel.celebrating .moodBubble {
  border-color: #4ecdc4;
  box-shadow: 0 3px 12px rgba(78, 205, 196, 0.25), 0 1px 4px rgba(0, 0, 0, 0.06);
  --arrow-color: #4ecdc4;
}

.playerPanel.disappointed .moodBubble {
  border-color: #ff6b6b;
  box-shadow: 0 3px 12px rgba(255, 107, 107, 0.2), 0 1px 4px rgba(0, 0, 0, 0.06);
  --arrow-color: #ff6b6b;
}

.seat-0 .moodBubble {
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
}

.seat-0 .moodBubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  margin-left: -5px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--arrow-color);
}

.seat-1 .moodBubble {
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
}

.seat-1 .moodBubble::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  margin-top: -5px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--arrow-color);
}

.seat-2 .moodBubble {
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
}

.seat-2 .moodBubble::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  margin-left: -5px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid var(--arrow-color);
}

.seat-3 .moodBubble {
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
}

.seat-3 .moodBubble::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  margin-top: -5px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid var(--arrow-color);
}

/* ========== CHIPS ========== */

.chipStack { display: inline-flex; height: 22px; position: relative; width: 34px; }

.chip, .betChip {
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
  height: 22px;
  left: calc(var(--i) * 5px);
  position: absolute;
  top: calc(var(--i) * -2px);
  width: 22px;
}

.violet { background: linear-gradient(145deg, #d4943a, #b87a2e); }
.gold { background: linear-gradient(145deg, #ff9f43, #ff6348); }
.cyan { background: linear-gradient(145deg, #4ecdc4, #2db5a3); }
.rose { background: linear-gradient(145deg, #ff6b6b, #ee5a24); }
.lime { background: linear-gradient(145deg, #5cb85c, #3da63d); }

.flyingChip {
  position: fixed;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 100;
  pointer-events: none;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flyingChip.violet { background: linear-gradient(145deg, #d4943a, #b87a2e); }
.flyingChip.gold { background: linear-gradient(145deg, #ff9f43, #ff6348); }
.flyingChip.cyan { background: linear-gradient(145deg, #4ecdc4, #2db5a3); }
.flyingChip.rose { background: linear-gradient(145deg, #ff6b6b, #ee5a24); }
.flyingChip.lime { background: linear-gradient(145deg, #5cb85c, #3da63d); }
.flyingChip.landing { transform: scale(0.5); opacity: 0.6; }

/* ========== BET CONTROLS ========== */

.betControls {
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 20px;
  bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
  color: #3d2c2e;
  display: grid;
  gap: 11px;
  padding: 18px;
  position: fixed;
  right: 20px;
  width: min(320px, calc(100vw - 40px));
  z-index: 6;
  backdrop-filter: blur(16px);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.betControls.live {
  border-color: rgba(255, 159, 67, 0.5);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.12), 0 0 20px rgba(255, 159, 67, 0.1), 0 8px 32px rgba(0, 0, 0, 0.1);
  animation: controlsPulse 2s ease-in-out infinite;
}

.betHeader { align-items: center; display: flex; justify-content: space-between; }
.betHeader span { color: #5a3e36; font-weight: 900; }

.betHeader strong {
  align-items: center;
  background: linear-gradient(145deg, #d4943a, #b87a2e);
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 24px;
  height: 50px;
  justify-content: center;
  width: 50px;
  box-shadow: 0 4px 12px rgba(212, 148, 58, 0.3);
}

.chipChoices { display: grid; gap: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); }

.chipButton {
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.4), 0 4px 0 rgba(0, 0, 0, 0.1);
  min-height: 48px;
  padding: 0;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chipButton:hover:not(:disabled) { transform: scale(1.15); }
.chipButton.selected { filter: brightness(1.15); outline: 3px solid rgba(210, 155, 80, 0.6); outline-offset: 2px; transform: scale(1.1); }

.betControls input[type="range"] { accent-color: #d4943a; padding: 0; border: none; background: transparent; box-shadow: none; }
.betNumber { display: grid; gap: 8px; grid-template-columns: 42px minmax(0, 1fr) 42px; }
.betNumber button { padding: 0; }

/* ========== WINNER ========== */

.winnerBanner {
  animation: winnerIn 0.62s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(255, 255, 255, 0.95);
  border: 4px solid #4ecdc4;
  border-radius: 24px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25), 0 16px 60px rgba(0, 0, 0, 0.15);
  color: #3d2c2e;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 24px 38px;
  position: fixed;
  right: 50%;
  text-align: center;
  top: 50%;
  transform: translate(50%, -50%);
  width: min(340px, calc(100vw - 36px));
  z-index: 10;
}

.winnerBanner span { color: #4ecdc4; font-weight: 1000; font-size: 14px; text-transform: uppercase; letter-spacing: 2px; }
.winnerBanner strong { font-size: 32px; color: #3d2c2e; }
.winnerBanner p { color: rgba(90, 62, 54, 0.7); }

.settleBanner {
  animation: settleBannerIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: linear-gradient(135deg, rgba(255, 248, 230, 0.98), rgba(255, 255, 255, 0.96));
  border: 4px solid #ffc857;
  border-radius: 24px;
  box-shadow:
    0 0 0 6px rgba(255, 200, 87, 0.2),
    0 0 40px rgba(255, 200, 87, 0.15),
    0 0 80px rgba(255, 159, 67, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  backdrop-filter: blur(16px);
  overflow: visible;
}

.settleBanner::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 32px;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.1), transparent 70%);
  animation: settleSparkleGlow 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.settleAvatar {
  align-items: center;
  background: linear-gradient(145deg, #ffc857, #ff9f43);
  border: 5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 200, 87, 0.5), 0 4px 16px rgba(255, 159, 67, 0.4);
  color: #fff;
  display: flex;
  font-size: 38px;
  height: 80px;
  justify-content: center;
  width: 80px;
  animation: settleAvatarBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  position: relative;
}

.settleAvatar::after {
  content: "✦";
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 16px;
  color: #ffc857;
  animation: settleSparkle 1.2s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(255, 200, 87, 0.8);
}

.settleText {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settleText strong {
  color: #3d2c2e;
  font-size: 22px;
}

.settleText span {
  color: #d4943a;
  font-size: 15px;
  font-weight: 900;
}

.settleText small {
  color: rgba(90, 62, 54, 0.6);
  font-size: 12px;
  font-weight: 700;
}

.settleCard {
  flex-shrink: 0;
  animation: settleCardSpin 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settleCard .miniCard {
  width: 40px;
  height: 48px;
  font-size: 14px;
  border: 3px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes settleBannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
  50% { transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  70% { transform: translate(-50%, -50%) scale(0.95) rotate(-1deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}

@keyframes settleAvatarBounce {
  0% { transform: scale(0) rotate(-180deg); }
  50% { transform: scale(1.3) rotate(10deg); }
  70% { transform: scale(0.9) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes settleCardSpin {
  0% { opacity: 0; transform: rotateY(180deg) scale(0.3); }
  60% { transform: rotateY(-10deg) scale(1.15); }
  100% { opacity: 1; transform: rotateY(0) scale(1); }
}

/* ========== SETTLE SPARKLE ========== */

.settleSparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffc857;
  pointer-events: none;
  z-index: 21;
  animation: settleSparkle var(--duration, 1.2s) ease-in-out infinite;
  box-shadow: 0 0 6px rgba(255, 200, 87, 0.8);
}

.settleSparkle:nth-child(1) { top: -10px; left: 10%; --duration: 1s; animation-delay: 0s; }
.settleSparkle:nth-child(2) { top: -8px; right: 15%; --duration: 1.3s; animation-delay: 0.2s; }
.settleSparkle:nth-child(3) { bottom: -10px; left: 20%; --duration: 1.1s; animation-delay: 0.4s; }
.settleSparkle:nth-child(4) { bottom: -8px; right: 10%; --duration: 1.4s; animation-delay: 0.1s; }
.settleSparkle:nth-child(5) { top: 30%; left: -10px; --duration: 1.2s; animation-delay: 0.3s; }
.settleSparkle:nth-child(6) { top: 30%; right: -10px; --duration: 1s; animation-delay: 0.5s; }

/* ========== ROUND SPARKLE (mini confetti for round winners) ========== */

.roundSparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  animation: roundSparklePop var(--duration, 0.8s) ease-out forwards;
}

.roundSparkle.gold { background: #ffc857; box-shadow: 0 0 4px rgba(255, 200, 87, 0.6); }
.roundSparkle.amber { background: #ff9f43; box-shadow: 0 0 4px rgba(255, 159, 67, 0.6); }
.roundSparkle.warm { background: #ff6b6b; box-shadow: 0 0 4px rgba(255, 107, 107, 0.6); }

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 200;
  pointer-events: none;
  animation: confettiFall var(--duration, 2s) linear forwards;
}

/* ========== SCREEN EFFECTS ========== */

.screenFlash {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  z-index: 999;
  pointer-events: none;
  transition: background 0.15s ease-out;
}

.screenShake {
  animation: screenShakeAnim 0.4s ease-out;
}

/* ========== ROUND TRANSITION ========== */

/* ========== ROUND TRANSITION (JS-driven, see below) ========== */

/* ========== BATTLE LOG ========== */

.battleLog {
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 16px;
  max-width: 260px;
  padding: 12px 14px;
  position: fixed;
  right: 20px;
  top: 86px;
  z-index: 7;
  backdrop-filter: blur(12px);
}

.battleLog summary { color: #5a3e36; cursor: pointer; font-weight: 1000; }
.battleLog p { border-top: 2px solid rgba(210, 155, 80, 0.1); color: rgba(90, 62, 54, 0.7); font-size: 13px; line-height: 1.4; margin-top: 8px; padding-top: 8px; animation: logFade 0.3s ease; }

/* ========== WAITING ROOM ========== */

.waitingRoom {
  background: rgba(255, 255, 255, 0.6);
  border: 3px solid rgba(210, 155, 80, 0.2);
  border-radius: 20px;
  display: grid;
  gap: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.waitingSeats { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

.seatCard {
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border: 3px solid rgba(210, 155, 80, 0.15);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 152px;
  padding: 14px;
  text-align: center;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}

.seatCard:hover { transform: translateY(-2px); }
.seatCard.ready { border-color: rgba(78, 205, 196, 0.5); background: rgba(78, 205, 196, 0.08); animation: seatReady 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.seatCard span { color: rgba(90, 62, 54, 0.6); font-size: 12px; font-weight: 900; }
.seatCard strong { font-size: 18px; color: #3d2c2e; }

/* ========== KEYFRAMES ========== */

@keyframes cardFlip3D {
  0% { opacity: 0; transform: rotateY(180deg) scale(0.5) translateZ(100px); }
  40% { opacity: 1; transform: rotateY(-20deg) scale(1.1) translateZ(20px); }
  60% { transform: rotateY(10deg) scale(1.05) translateZ(10px); }
  80% { transform: rotateY(-3deg) scale(0.98); }
  100% { opacity: 1; transform: rotateY(0) scale(1) translateZ(0); }
}

@keyframes deckFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}

@keyframes activeSeatPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.25), 0 0 24px rgba(255, 159, 67, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 0 0 8px rgba(255, 159, 67, 0.1), 0 0 32px rgba(255, 159, 67, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08); }
}

@keyframes avatarBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  50% { transform: scale(0.9); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes think {
  0%, 100% { transform: scale(0.82); }
  50% { transform: scale(1.18); }
}

@keyframes betPop {
  0% { opacity: 0; transform: translateY(10px) scale(0.5); }
  50% { transform: translateY(-6px) scale(1.15); }
  70% { transform: translateY(2px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes scorePop {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); color: #ff9f43; }
  60% { transform: scale(0.85); }
  80% { transform: scale(1.15); }
  100% { transform: scale(1); color: #d4943a; }
}

@keyframes winnerIn {
  0% { opacity: 0; transform: translate(50%, -42%) scale(0.5) rotate(-5deg); }
  50% { transform: translate(50%, -52%) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: translate(50%, -50%) scale(1) rotate(0); }
}

@keyframes winnerGlow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.25), 0 0 20px rgba(78, 205, 196, 0.1), 0 8px 24px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 0 0 8px rgba(78, 205, 196, 0.15), 0 0 40px rgba(78, 205, 196, 0.2), 0 8px 24px rgba(0, 0, 0, 0.08); }
}

@keyframes bubbleIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(calc(100vh + 50px)) rotate(var(--rotate, 720deg)) scale(0.3); }
}

@keyframes slideUp {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}

@keyframes markPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes suitPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes badgePop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ribbonSlide {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes logFade {
  0% { opacity: 0; transform: translateX(-10px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes seatReady {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes miniCardIn {
  0% { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  60% { transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes controlsPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.12), 0 0 20px rgba(255, 159, 67, 0.1), 0 8px 32px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(255, 159, 67, 0.2), 0 0 30px rgba(255, 159, 67, 0.15), 0 8px 32px rgba(0, 0, 0, 0.1); }
}

/* ========== NEW KEYFRAMES: CHARACTER REACTIONS ========== */

@keyframes celebrateBounce {
  0% { transform: scale(1); }
  20% { transform: scale(1.06) translateY(-4px); }
  40% { transform: scale(0.97) translateY(2px); }
  60% { transform: scale(1.03) translateY(-2px); }
  80% { transform: scale(0.99) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes celebrateGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-6px) scale(1.2); opacity: 0.7; }
}

@keyframes celebrateAvatarBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-8px) scale(1.1); }
  50% { transform: translateY(0) scale(0.95); }
  75% { transform: translateY(-4px) scale(1.05); }
}

@keyframes sadAvatarDroop {
  0% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(4px) rotate(-5deg); }
  60% { transform: translateY(6px) rotate(-3deg); }
  100% { transform: translateY(5px) rotate(-4deg); }
}

/* ========== NEW KEYFRAMES: MOOD BUBBLE ========== */

@keyframes moodBubbleIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

/* ========== NEW KEYFRAMES: SCREEN EFFECTS ========== */

@keyframes screenFlashAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes screenShakeAnim {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-3px, -2px); }
  20% { transform: translate(3px, 1px); }
  30% { transform: translate(-2px, 3px); }
  40% { transform: translate(2px, -2px); }
  50% { transform: translate(-1px, 2px); }
  60% { transform: translate(1px, -1px); }
  70% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, 0); }
  90% { transform: translate(0, -1px); }
}

/* ========== NEW KEYFRAMES: ROUND TRANSITION ========== */

/* ========== NEW KEYFRAMES: SETTLE SPARKLE ========== */

@keyframes settleSparkle {
  0%, 100% { opacity: 0; transform: scale(0.3); }
  20% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.6; transform: scale(0.8); }
  60% { opacity: 1; transform: scale(1.1); }
  80% { opacity: 0.4; transform: scale(0.6); }
}

@keyframes settleSparkleGlow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.03); }
}

/* ========== NEW KEYFRAMES: ROUND SPARKLE ========== */

@keyframes roundSparklePop {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  50% { opacity: 0.8; transform: translate(var(--tx, 10px), var(--ty, -20px)) scale(1.3); }
  100% { opacity: 0; transform: translate(var(--tx2, 15px), var(--ty2, -40px)) scale(0.2); }
}

/* ========== SCREEN EFFECTS (JS-driven) ========== */

.screenFlash.active {
  background: rgba(255, 255, 255, 0.6);
}

.tableStage.shake {
  animation: screenShake 0.5s ease-in-out;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-6px) rotate(-0.5deg); }
  20% { transform: translateX(6px) rotate(0.5deg); }
  30% { transform: translateX(-5px) rotate(-0.3deg); }
  40% { transform: translateX(5px) rotate(0.3deg); }
  50% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  90% { transform: translateX(-1px); }
}

@keyframes celebratePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.2), 0 0 20px rgba(78, 205, 196, 0.1), 0 8px 24px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 0 0 6px rgba(78, 205, 196, 0.3), 0 0 30px rgba(78, 205, 196, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08); }
}

@keyframes disappointSag {
  0% { transform: translateY(0); }
  50% { transform: translateY(4px); }
  100% { transform: translateY(0); }
}

/* ========== MINI CONFETTI ========== */

.miniConfetti {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  animation: miniConfettiBurst var(--duration, 0.8s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes miniConfettiBurst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -60px)) rotate(var(--rotate, 720deg)) scale(0.3); }
}

/* ========== ROUND TRANSITION (JS-driven) ========== */

.roundTransition {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  pointer-events: none;
  transition: background 0.3s ease;
}

.roundTransition.active {
  background: rgba(0, 0, 0, 0.35);
}

.roundTransition.fadeout {
  background: rgba(0, 0, 0, 0);
  transition: background 0.5s ease;
}

.roundTransitionText {
  color: #fff;
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 1000;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 60px rgba(212, 148, 58, 0.5);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.roundTransition.active .roundTransitionText {
  opacity: 1;
  transform: scale(1);
}

.roundTransition.fadeout .roundTransitionText {
  opacity: 0;
  transform: scale(1.2);
  transition: all 0.5s ease;
}

/* ========== GOLDEN SHIMMER SETTLE BANNER ========== */

.settleBanner.goldenShimmer {
  background: linear-gradient(135deg, rgba(255, 248, 220, 0.98), rgba(255, 255, 255, 0.96), rgba(255, 248, 220, 0.98));
  border-color: #ffd700;
  box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.2), 0 0 40px rgba(255, 215, 0, 0.15), 0 12px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.settleBanner.goldenShimmer::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 215, 0, 0.08) 50%, transparent 70%);
  animation: shimmerMove 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmerMove {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(100%) rotate(25deg); }
}

.settleAvatar.big {
  height: 80px;
  width: 80px;
  font-size: 40px;
  border-width: 5px;
  box-shadow: 0 6px 24px rgba(255, 159, 67, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
}

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffd700;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleFloat 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.8);
}

.sparkle:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.sparkle:nth-child(2) { top: 5%; right: 15%; animation-delay: 0.2s; }
.sparkle:nth-child(3) { bottom: 15%; left: 10%; animation-delay: 0.4s; }
.sparkle:nth-child(4) { bottom: 10%; right: 8%; animation-delay: 0.6s; }
.sparkle:nth-child(5) { top: 50%; left: 2%; animation-delay: 0.1s; }
.sparkle:nth-child(6) { top: 40%; right: 3%; animation-delay: 0.3s; }
.sparkle:nth-child(7) { top: 8%; left: 50%; animation-delay: 0.5s; }
.sparkle:nth-child(8) { bottom: 5%; left: 45%; animation-delay: 0.7s; }

.bigCardValue {
  align-items: center;
  background: #fff;
  border: 4px solid #ffd700;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3), 0 0 30px rgba(255, 215, 0, 0.15);
  color: #3d2c2e;
  display: grid;
  font-size: 20px;
  height: 60px;
  justify-items: center;
  line-height: 0.85;
  width: 52px;
  animation: settleCardSpin 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bigCardValue span {
  font-size: 28px;
  font-weight: 1000;
}

.bigCardValue.red { color: #e74c3c; }
.bigCardValue.black { color: #2c3e50; }
.bigCardValue em { font-style: normal; font-size: 16px; }

/* ========== RESPONSIVE ========== */

@media (max-width: 980px) {
  .hud { grid-template-columns: 1fr; }
  .ghostButton { justify-self: start; }
  .lobbyStage { grid-template-columns: 1fr; }
  .setupPanel.compact { bottom: auto; left: 14px; right: 14px; top: 92px; max-width: none; position: static; margin-top: 12px; }

  .tableStage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 0;
    max-height: none;
  }

  .feltTable { width: min(92vw, 680px); height: 380px; }

  .seat-0, .seat-1, .seat-2, .seat-3 {
    grid-row: auto;
    grid-column: auto;
    justify-self: auto;
    align-self: auto;
    margin: 0;
  }

  .playerPanel { width: min(300px, calc(100vw - 36px)); }

  .betControls { bottom: 16px; left: 14px; right: 14px; width: auto; }
  .battleLog { left: 14px; right: auto; top: auto; bottom: 154px; }
  .moodBubble { display: none; }
  .roundNotice { left: 14px; top: 14px; }
  .settleBanner { padding: 14px 18px; gap: 12px; }
  .settleAvatar { height: 52px; width: 52px; font-size: 26px; }
  .settleAvatar.big { height: 60px; width: 60px; font-size: 30px; }
  .settleText strong { font-size: 17px; }
  .bigCardValue { height: 48px; width: 42px; }
  .bigCardValue span { font-size: 22px; }
}

@media (max-width: 640px) {
  .gameScene { padding: 14px; }
  .brand h1 { font-size: 22px; }
  .mark { width: 48px; }
  .hudStatus { align-items: flex-start; display: grid; }
  .previewMat { min-height: 230px; padding: 20px; }
  .deckPile { height: 110px; width: 80px; }
  .waitingSeats { grid-template-columns: 1fr 1fr; }
  .feltTable { border-width: 10px; height: 320px; width: calc(100vw - 28px); padding: 16px; }
  .tableCard { width: 86px; }
  .tableCard strong { font-size: 44px; }
  .playerPanel { grid-template-columns: 44px minmax(0, 1fr); min-height: 100px; padding: 10px; width: 100%; }
  .avatar { height: 44px; width: 44px; font-size: 18px; }
  .chipChoices { grid-template-columns: repeat(5, minmax(42px, 1fr)); }
  .betControls { position: relative; left: auto; right: auto; bottom: auto; width: 100%; }
  .battleLog { display: none; }
  .moodBubble { display: none; }
  .settleBanner { padding: 12px 14px; gap: 10px; flex-direction: column; text-align: center; }
  .settleAvatar { height: 44px; width: 44px; font-size: 22px; }
  .settleAvatar.big { height: 52px; width: 52px; font-size: 26px; }
  .settleText { align-items: center; }
  .settleText strong { font-size: 15px; }
  .settleCard .miniCard { width: 32px; height: 40px; font-size: 12px; }
  .bigCardValue { height: 40px; width: 36px; }
  .bigCardValue span { font-size: 18px; }
  .sparkle { display: none; }
}
