/* ═══════════════════════════════════════════════════════════════
   CARD GAME — Tavern Card Game Styling
   Medieval theme consistent with Embers of Eldara UI
   ═══════════════════════════════════════════════════════════════ */

/* ── Board Container ── */
.cg-board {
  position: relative;
  width: 100%;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: 'Crimson Text', serif;
  color: #e8d5a3;
  overflow: hidden;
}

/* ── Areas: Hand areas (top AI, bottom Player) ── */
.cg-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  position: relative;
  z-index: 2;
}

.cg-area--ai-hand {
  background: none;
  padding: 0 12px 0;
}

.cg-area--player-hand {
  background: none;
  padding: 8px 12px 4px;
}

/* ── Battlefield Rows (Gwent-style) ── */
.cg-battlefield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 16px;
  background: none;
  border: none;
  position: relative;
  z-index: 2;
  min-height: 90px;
}

.cg-battlefield--ai {
  border: none;
}

.cg-battlefield--player {
  border: none;
}

.cg-bf-divider {
  width: 0;
  display: none;
}

/* ── Center: Deck, Dice, Discard ── */
.cg-center {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  position: relative;
  z-index: 1;
  padding: 8px 0;
  background: none;
  border: none;
}

.cg-deck-pile,
.cg-discard-pile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cg-deck-img {
  width: 70px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.cg-deck-count,
.cg-discard-count {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: rgba(26,20,8,0.95);
  border: 1px solid rgba(212,165,69,0.4);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 1rem;
  color: #d4a545;
  font-family: 'Cinzel', serif;
}

/* ── Hand ── */
.cg-hand {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  padding: 4px 0;
  min-height: 60px;
}

.cg-hand--ai {
  gap: 0;
  min-height: 0;
  align-items: flex-start;
  justify-content: center;
}

.cg-hand--ai .cg-hand-card {
  transform: scale(0.55)
             rotate(calc((var(--card-i, 0) - (var(--card-n, 1) - 1) / 2) * -2deg));
  transform-origin: top center;
  margin: -90px -58px;
}

.cg-hand--player {
  gap: 0;
  padding: 12px 0 4px;
  min-height: 260px;
}

.cg-hand--player .cg-hand-card {
  margin: 0 -42px;
  transform: rotate(calc((var(--card-i, 0) - (var(--card-n, 1) - 1) / 2) * 3.5deg))
             translateY(calc(abs(var(--card-i, 0) - (var(--card-n, 1) - 1) / 2) * 8px));
  transform-origin: bottom center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, z-index 0s;
}

.cg-hand--player .cg-hand-card:hover {
  transform: translateY(-30px) scale(1.1) rotate(0deg) !important;
  z-index: 20;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6), 0 0 20px rgba(212,165,69,0.3);
}

/* ── Card (Gwent-style: large player cards) ── */
.cg-card {
  width: 276px;
  height: 397px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.cg-card--clickable {
  cursor: pointer;
}

.cg-card--clickable:hover {
  z-index: 15;
}

.cg-card--selected {
  transform: translateY(-35px) scale(1.1) rotate(0deg) !important;
  box-shadow: 0 0 25px rgba(212,165,69,0.7), 0 0 50px rgba(212,165,69,0.25) !important;
  z-index: 25 !important;
}

.cg-card--back {
  background: #1a1408;
  border: 1px solid rgba(212,165,69,0.3);
}

.cg-card--back .cg-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.cg-card--empty {
  width: 80px;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,20,8,0.6);
  border: 2px dashed rgba(212,165,69,0.2);
  font-size: 0.75rem;
  color: rgba(212,165,69,0.4);
  font-family: 'Cinzel', serif;
  border-radius: 6px;
}

.cg-card--discard {
  width: 92px;
  height: 132px;
}

/* ── Card Face ── */
.cg-card-face {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background-color: #1a1408;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(212,165,69,0.35);
  border-radius: 8px;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* Art area — gradient background per class with large icon */
.cg-card-art {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.cg-card-art-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  opacity: 0.6;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

/* Art overlay mask */
.cg-card-art-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58%;
  background: rgba(13,10,4,0.15);
  pointer-events: none;
}

/* Stat wrap — positioned at the divider between art and bottom */
.cg-card-stat-wrap {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  margin-bottom: 4px;
}

.cg-card-stat-border {
  position: absolute;
  width: 68px;
  height: 68px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  opacity: 0.7;
}

.cg-card-stat {
  width: 56px;
  height: 56px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.cg-card-value {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 12px rgba(0,0,0,0.5);
}

.cg-card-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d4a545;
  letter-spacing: 0.8px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
  padding: 2px 4px 6px;
  position: relative;
  z-index: 3;
}

/* Card description (small text below label) */
.cg-card-desc {
  font-size: 0.5rem;
  color: rgba(220,200,160,0.85);
  text-align: center;
  line-height: 1.25;
  padding: 0 6px 4px;
  max-width: 110px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  position: relative;
  z-index: 3;
}

/* ── Full PNG Card Image ── */
.cg-card-img-full {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* ── Name fallback (when card image is missing) ── */
.cg-card-name-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #d4a545;
  background: linear-gradient(135deg, #1a1510 0%, #2a2015 50%, #1a1510 100%);
  border-radius: 6px;
  padding: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ── Description Overlay (bottom of card, over PNG) ── */
.cg-card-text-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 13%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to top, rgba(20,14,5,0.95), rgba(20,14,5,0.6), rgba(20,14,5,0));
  padding: 0 10px 4px;
  pointer-events: none;
  z-index: 5;
}

.cg-card-desc-overlay {
  font-family: 'Crimson Text', serif;
  font-size: 0.48rem;
  color: rgba(220,200,160,0.9);
  text-align: center;
  font-style: italic;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Tooltip on hover (hand cards) */
.cg-card[data-tooltip] {
  position: relative;
}
.cg-card[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: rgba(10,8,3,0.96);
  border: 1px solid rgba(212,165,69,0.5);
  color: #e8d5a3;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: 'Cinzel', serif;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
.cg-card[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.cg-card-icon {
  width: 28px;
  height: 28px;
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
}

.cg-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cg-card-icon-sm {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* Card type border colors */
.cg-card--trap .cg-card-face {
  border-color: rgba(220,60,60,0.6);
}

.cg-card--protect .cg-card-face {
  border-color: rgba(60,120,220,0.6);
}

.cg-card--chaos .cg-card-face {
  border-color: rgba(160,60,220,0.6);
}

/* ── Zone Label ── */
.cg-zone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}

.cg-zone-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(212,165,69,0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cg-zone-empty {
  font-size: 1rem;
  color: rgba(212,165,69,0.3);
}

/* ── Set Slots ── */
.cg-sets-zone {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  align-items: center;
  perspective: 800px;
}

.cg-set-slot {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(26,20,8,0.12);
  border: 1px dashed rgba(212,165,69,0.08);
  border-radius: 6px;
  min-width: 110px;
  min-height: 130px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
  transform-style: preserve-3d;
}

.cg-set-slot--clickable {
  cursor: pointer;
  border-color: rgba(212,165,69,0.5);
  animation: cgPulse 1s ease-in-out infinite;
}

.cg-set-slot--clickable:hover {
  background: rgba(212,165,69,0.1);
  border-color: #d4a545;
}

.cg-set--protected {
  border-color: rgba(60,120,220,0.5);
  background: rgba(60,120,220,0.08);
}

.cg-set--complete {
  border-color: rgba(80,200,80,0.6) !important;
  background: rgba(80,200,80,0.08) !important;
  border-style: solid !important;
}

.cg-set-card {
  width: 80px;
  height: 115px;
  transform: rotateX(6deg);
  transform-origin: bottom center;
  transition: transform 0.2s ease, z-index 0s;
}

.cg-set-card:hover {
  transform: scale(2.8) rotateX(0deg);
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.8);
}

.cg-set-card .cg-card-face {
  font-size: 0.6rem;
}

.cg-set-card .cg-card-art-icon {
  width: 42px;
  height: 42px;
}

.cg-set-card .cg-card-value {
  font-size: 1.4rem;
}

.cg-set-card .cg-card-stat {
  width: 48px;
  height: 48px;
}

.cg-set-card .cg-card-stat-border {
  width: 58px;
  height: 58px;
}

.cg-set-card .cg-card-label {
  font-size: 0.65rem;
  max-width: 90px;
  padding: 2px 4px 4px;
}

.cg-set-card .cg-card-desc-overlay {
  font-size: 0.38rem;
}

.cg-set-card .cg-card-text-overlay {
  padding: 0 6px 2px;
}

.cg-set-card .cg-card-icon {
  width: 22px;
  height: 22px;
  top: 4px;
  right: 4px;
}

.cg-set-card .cg-card-icon-sm {
  width: 20px;
  height: 14px;
}

.cg-set-type {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  color: #1a1408;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.cg-set-pts {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-left: 3px;
}

.cg-slot-empty {
  font-size: 1rem;
  color: rgba(212,165,69,0.3);
  font-family: 'Cinzel', serif;
}

.cg-protect-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  font-size: 0.85rem;
}

/* ── Status Banners (Poison, Storm) ── */
.cg-status-banner {
  position: absolute;
  left: 12px;
  z-index: 10;
  padding: 4px 14px;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 6px;
  animation: cgPulse 1.5s ease-in-out infinite;
}

.cg-status-banner--p0 {
  bottom: 280px;
  background: rgba(100,40,130,0.5);
  border: 1px solid rgba(160,80,220,0.5);
  color: #d8b0ff;
}

.cg-status-banner--p1 {
  top: 60px;
  background: rgba(100,40,130,0.5);
  border: 1px solid rgba(160,80,220,0.5);
  color: #d8b0ff;
}

/* ── Poisoned Slot ── */
.cg-set-slot--poisoned {
  border-color: rgba(120,40,180,0.6) !important;
  background: rgba(120,40,180,0.12) !important;
  animation: cgPoisonPulse 1.5s ease-in-out infinite;
}

@keyframes cgPoisonPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(120,40,180,0.2); }
  50% { box-shadow: 0 0 18px rgba(120,40,180,0.5); }
}

/* ── React Options ── */
.cg-react-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0;
}

/* ── Action Prompt ── */
.cg-action-prompt {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #e8d5a3;
  text-align: center;
  padding: 2px 8px;
}

/* ── Steal Grid (Pickpocket) ── */
.cg-steal-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0;
  max-width: 600px;
}

.cg-steal-option {
  width: 90px;
  height: 130px;
  cursor: pointer;
  border: 2px solid rgba(212,165,69,0.3);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.cg-steal-option:hover {
  border-color: #d4a545;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(212,165,69,0.4);
}

/* ── Set Type Badge ── */
.cg-set-type-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  color: #1a1408;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  z-index: 5;
}

/* ── Hand Card Type Indicators (border glow) ── */
.cg-hand-card--play { box-shadow: 0 0 6px rgba(220,60,60,0.4); }
.cg-hand-card--react { box-shadow: 0 0 6px rgba(60,180,220,0.4); }
.cg-hand-card--guard { box-shadow: 0 0 6px rgba(60,120,220,0.4); }
.cg-hand-card--chaos { box-shadow: 0 0 6px rgba(160,60,220,0.4); }
.cg-hand-card--unit { /* no extra glow for units */ }

/* ── Set slot type colors ── */
.cg-set-slot--faction { border-color: rgba(212,165,69,0.5) !important; border-style: solid !important; }
.cg-set-slot--run { border-color: rgba(85,187,68,0.6) !important; border-style: solid !important; }
.cg-set-slot--identic { border-color: rgba(224,85,85,0.6) !important; border-style: solid !important; }

/* ── Phase Banner Announcement ── */
.cg-banner {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  pointer-events: none;

  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #f0e0c0;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 0 12px rgba(212,165,69,0.8),
    0 2px 6px rgba(0,0,0,0.9);

  background: linear-gradient(135deg, rgba(20,15,5,0.92), rgba(35,25,10,0.88));
  border: 2px solid rgba(212,165,69,0.5);
  border-radius: 8px;
  padding: 14px 40px;
  box-shadow:
    0 0 30px rgba(212,165,69,0.25),
    inset 0 0 20px rgba(212,165,69,0.06);

  animation: cgBannerIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cg-banner--out {
  animation: cgBannerOut 0.35s ease-in forwards;
}

@keyframes cgBannerIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes cgBannerOut {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}

/* ── Top Status Bar ── */
.cg-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 16px;
  background: linear-gradient(180deg, rgba(10,8,3,0.92) 0%, rgba(10,8,3,0.6) 80%, transparent 100%);
  pointer-events: none;
  flex-wrap: wrap;
}

.cg-topbar-turn {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.cg-topbar-phase {
  font-size: 1.05rem;
  color: #b8a67a;
}

.cg-topbar-round {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #d4a545;
}

.cg-topbar-sets {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #e8d5a3;
  background: rgba(212,165,69,0.12);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid rgba(212,165,69,0.2);
}

.cg-topbar-sep {
  color: rgba(212,165,69,0.3);
  font-size: 0.9rem;
  user-select: none;
}

.cg-topbar-fog {
  font-size: 1.1rem;
  animation: cgPulse 1.5s ease-in-out infinite;
}

/* ── Help Panel (toggle button + dropdown) ── */
.cg-help-toggle {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 45;
  background: rgba(212,165,69,0.15);
  border: 1px solid rgba(212,165,69,0.35);
  border-radius: 4px;
  color: #d4a545;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.2s;
}
.cg-help-toggle:hover { background: rgba(212,165,69,0.3); }

.cg-help-panel {
  position: absolute;
  top: 34px;
  right: 8px;
  z-index: 44;
  background: rgba(10,8,3,0.94);
  border: 1px solid rgba(212,165,69,0.3);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.72rem;
  line-height: 1.55;
  color: #b8a67a;
  min-width: 290px;
  max-width: 320px;
  display: none;
}
.cg-help-panel.visible { display: block; }

.cg-help-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #d4a545;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(212,165,69,0.15);
}
.cg-help-section-title:not(:first-child) { margin-top: 8px; }

.cg-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 1px 0;
}
.cg-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cg-legend-dot--faction { background: #d4a545; }
.cg-legend-dot--run { background: #55bb44; }
.cg-legend-dot--identic { background: #e05555; }
.cg-legend-val {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: #d4a545;
  font-size: 0.72rem;
  min-width: 22px;
}
.cg-legend-row b {
  color: #e8d5a3;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
}
/* ── HUD: Actions only ── */
.cg-hud {
  position: relative;
  z-index: 20;
  background: rgba(13,10,4,0.95);
  border-top: 1px solid rgba(212,165,69,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Actions ── */
.cg-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cg-action-wait {
  font-size: 1.15rem;
  color: rgba(212,165,69,0.5);
  font-style: italic;
}

/* ── Buttons ── */
.cg-btn {
  padding: 10px 20px;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 1px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cg-btn:hover {
  transform: scale(1.05);
}

.cg-btn:active {
  transform: scale(0.97);
}

.cg-btn--play {
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  box-shadow: 0 2px 8px rgba(212,165,69,0.3);
}

.cg-btn--skip {
  color: #b8a67a;
  background: rgba(212,165,69,0.1);
  border: 1px solid rgba(212,165,69,0.3);
}

/* (btn--dice, btn--gamble removed — no longer used in v2) */

.cg-declare-zone {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.cg-btn--declare {
  color: #fff;
  background: linear-gradient(135deg, #8b6914 0%, #d4a545 40%, #f0c860 60%, #b8860b 100%);
  border: 2px solid #ffd700;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 16px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  animation: cg-declare-pulse 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.cg-btn--declare:hover {
  background: linear-gradient(135deg, #a07818 0%, #e8b84a 40%, #ffe080 60%, #c89810 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255,215,0,0.5);
}

@keyframes cg-declare-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.3); }
  50% { box-shadow: 0 0 20px rgba(255,215,0,0.6), 0 0 40px rgba(255,215,0,0.2); }
}

.cg-btn--quit {
  color: #c0a070;
  background: rgba(100,80,50,0.3);
  border: 1px solid rgba(100,80,50,0.5);
  padding: 5px 14px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  margin-left: auto;
  flex-shrink: 0;
}
.cg-btn--quit:hover {
  background: rgba(180,60,60,0.35);
  border-color: rgba(180,60,60,0.6);
  color: #f0c0a0;
}

.cg-btn--primary {
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545, #b8860b);
  padding: 12px 24px;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(212,165,69,0.3);
}

.cg-btn--secondary {
  color: #b8a67a;
  background: rgba(212,165,69,0.1);
  border: 1px solid rgba(212,165,69,0.3);
  padding: 12px 24px;
  font-size: 0.9rem;
}

.cg-btn--start {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 24px auto 0;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545, #b8860b);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 20px rgba(212,165,69,0.3);
}

.cg-btn--start:hover {
  box-shadow: 0 4px 25px rgba(212,165,69,0.5);
}

/* ── Action Log ── */
.cg-log {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 280px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(13,10,4,0.9);
  border: 1px solid rgba(212,165,69,0.15);
  border-radius: 8px;
  padding: 8px;
  z-index: 15;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,165,69,0.3) transparent;
}

.cg-log::-webkit-scrollbar { width: 4px; }
.cg-log::-webkit-scrollbar-track { background: transparent; }
.cg-log::-webkit-scrollbar-thumb { background: rgba(212,165,69,0.3); border-radius: 2px; }

.cg-log-entry {
  font-size: 0.95rem;
  color: #b8a67a;
  padding: 2px 0;
  border-bottom: 1px solid rgba(212,165,69,0.06);
  line-height: 1.3;
}

.cg-log-entry:last-child {
  color: #e8d5a3;
  border-bottom: none;
}

/* ── Game Over Overlay ── */
.cg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,10,4,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: cgFadeIn 0.5s ease;
}

.cg-overlay-content {
  text-align: center;
  padding: 40px;
}

.cg-overlay-title {
  font-family: 'Cinzel', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #d4a545;
  margin-bottom: 16px;
  text-shadow: 0 0 30px rgba(212,165,69,0.4);
}

.cg-overlay-sub {
  font-size: 1rem;
  color: #b8a67a;
  margin-bottom: 8px;
}

.cg-overlay-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

/* ── Setup Screen ── */
.cg-setup {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
}

.cg-setup-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #d4a545;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.cg-setup-section {
  margin-bottom: 24px;
}

.cg-setup-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4a545;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(212,165,69,0.12);
}

/* Board selection */
.cg-board-select {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.cg-board-option {
  cursor: pointer;
  text-align: center;
  padding: 8px;
  border: 2px solid rgba(212,165,69,0.15);
  border-radius: 8px;
  background: rgba(26,20,8,0.6);
  transition: all 0.2s;
}

.cg-board-option:hover {
  border-color: rgba(212,165,69,0.4);
  background: rgba(212,165,69,0.08);
}

.cg-board-option--active {
  border-color: #d4a545;
  background: rgba(212,165,69,0.12);
  box-shadow: 0 0 15px rgba(212,165,69,0.15);
}

.cg-board-thumb {
  width: 200px;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  margin-bottom: 8px;
}

.cg-board-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #e8d5a3;
  letter-spacing: 1px;
}

/* Deck skin selection */
.cg-skin-select {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.cg-skin-option {
  cursor: pointer;
  text-align: center;
  padding: 8px;
  border: 2px solid rgba(212,165,69,0.15);
  border-radius: 8px;
  background: rgba(26,20,8,0.6);
  transition: all 0.2s;
}

.cg-skin-option:hover {
  border-color: rgba(212,165,69,0.4);
}

.cg-skin-option--active {
  border-color: #d4a545;
  background: rgba(212,165,69,0.12);
  box-shadow: 0 0 12px rgba(212,165,69,0.15);
}

.cg-skin-thumb {
  width: 70px;
  height: auto;
  border-radius: 4px;
  display: block;
  margin-bottom: 4px;
}

.cg-skin-name {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: #e8d5a3;
}

/* ── Game Mode Selector ── */
.cg-mode-select {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.cg-mode-option {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 24px;
  border: 2px solid rgba(212,165,69,0.2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26,20,8,0.7) 0%, rgba(18,14,6,0.85) 100%);
  transition: all 0.25s ease;
  min-width: 120px;
}

.cg-mode-option:hover {
  border-color: rgba(212,165,69,0.5);
  background: linear-gradient(180deg, rgba(40,32,14,0.8) 0%, rgba(26,20,8,0.9) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212,165,69,0.15);
}

.cg-mode-option--active {
  border-color: #d4a545;
  background: linear-gradient(180deg, rgba(50,40,16,0.85) 0%, rgba(30,24,10,0.95) 100%);
  box-shadow:
    0 0 20px rgba(212,165,69,0.25),
    inset 0 0 15px rgba(212,165,69,0.06);
}

.cg-mode-pts {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #d4a545;
  text-shadow: 0 0 10px rgba(212,165,69,0.4);
  line-height: 1;
}

.cg-mode-option--active .cg-mode-pts {
  text-shadow: 0 0 16px rgba(212,165,69,0.7);
}

.cg-mode-label {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: #b8a67a;
  letter-spacing: 0.5px;
}

.cg-mode-option--active .cg-mode-label {
  color: #e8d5a3;
}

/* ── Tavern Hub ── */
.tavern-hub {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
}

.tavern-hub-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #d4a545;
  letter-spacing: 3px;
  margin-bottom: 32px;
  text-shadow: 0 0 20px rgba(212,165,69,0.2);
}

.tavern-hub-games {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.tavern-hub-card {
  width: 220px;
  padding: 24px 16px;
  background: linear-gradient(180deg, rgba(26,20,8,0.9) 0%, rgba(13,10,4,0.95) 100%);
  border: 1px solid rgba(212,165,69,0.2);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tavern-hub-card:hover {
  transform: translateY(-4px);
  border-color: rgba(212,165,69,0.5);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4), 0 0 15px rgba(212,165,69,0.1);
}

.tavern-hub-icon {
  font-size: 4.5rem;
  margin-bottom: 14px;
  line-height: 1;
}

.tavern-hub-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #d4a545;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.tavern-hub-desc {
  font-size: 0.85rem;
  color: #b8a67a;
  margin-bottom: 16px;
  line-height: 1.4;
}

.tavern-hub-play {
  display: inline-block;
  padding: 8px 20px;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s;
}

.tavern-hub-play:hover {
  transform: scale(1.05);
}

.tavern-hub-back {
  display: inline-block;
  margin-top: 32px;
  padding: 10px 28px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-decoration: none;
  text-transform: uppercase;
  color: #b8a67a;
  background: rgba(26,20,8,0.85);
  border: 1px solid rgba(212,165,69,0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.tavern-hub-back:hover {
  background: rgba(212,165,69,0.15);
  border-color: rgba(212,165,69,0.5);
  color: #d4a545;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(212,165,69,0.15);
}

/* ── Animations ── */
@keyframes cgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* (Dice animations, frozen badge, combo token, bluff removed — no longer used in v2) */

/* ── React Alert ── */
.cg-action-alert {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255,215,0,0.4);
  animation: cgPulse 0.6s ease-in-out infinite;
}

/* ── Action Button ── */
.cg-btn--action {
  color: #e8d5a3;
  background: rgba(212,165,69,0.15);
  border: 1px solid rgba(212,165,69,0.4);
  padding: 8px 16px;
  font-size: 0.9rem;
}

.cg-btn--action:hover {
  background: rgba(212,165,69,0.3);
  border-color: #d4a545;
}

/* ── React Button ── */
.cg-btn--react {
  color: #a0d8ff;
  background: rgba(60,140,220,0.2);
  border: 1px solid rgba(60,140,220,0.5);
  padding: 8px 16px;
  font-size: 0.9rem;
}

.cg-btn--react:hover {
  background: rgba(60,140,220,0.4);
  border-color: #60b0ff;
  box-shadow: 0 0 12px rgba(60,140,220,0.3);
}

/* ── Game Over ── */
.cg-gameover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: rgba(13,10,4,0.95);
  text-align: center;
  padding: 40px;
}

.cg-gameover--win .cg-go-title {
  color: #80dd80;
  text-shadow: 0 0 30px rgba(80,220,80,0.4);
}

.cg-gameover--lose .cg-go-title {
  color: #e88080;
  text-shadow: 0 0 30px rgba(220,80,80,0.4);
}

.cg-go-title {
  font-family: 'Cinzel', serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 24px;
}

.cg-go-stats {
  font-family: 'Crimson Text', serif;
  font-size: 1.15rem;
  color: #b8a67a;
  line-height: 1.8;
  margin-bottom: 32px;
}

.cg-go-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Topbar Score ── */
.cg-topbar-score {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #e8d5a3;
  background: rgba(212,165,69,0.12);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid rgba(212,165,69,0.2);
}

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

/* Card draw animation — slides in from deck area */
@keyframes cgCardDraw {
  0% {
    opacity: 0;
    transform: translateY(-60px) translateX(-80px) scale(0.3) rotate(-15deg);
  }
  40% {
    opacity: 1;
    transform: translateY(-20px) translateX(-30px) scale(0.7) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1) rotate(0deg);
  }
}

/* Card played — lifts up from hand toward battlefield */
@keyframes cgCardPlay {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  30% {
    transform: scale(1.15) translateY(-10px);
    box-shadow: 0 12px 30px rgba(212,165,69,0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    box-shadow: none;
  }
}

/* Card placed into set slot — pops in */
@keyframes cgCardPlace {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(30px);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Card discard — fades out sideways */
@keyframes cgCardDiscard {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(10deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* AI card draw — slides in from top */
@keyframes cgCardDrawAI {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(40px);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.5) translateY(15px);
  }
  100% {
    opacity: 1;
    transform: scale(0.55) translateY(0);
  }
}

.cg-card--anim-draw {
  animation: cgCardDraw 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards;
  transition: none !important; /* prevent transform transition interference */
}

.cg-card--anim-draw-ai {
  animation: cgCardDrawAI 0.4s ease-out backwards;
  transition: none !important;
}

.cg-card--anim-place {
  animation: cgCardPlace 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards;
}

.cg-card--anim-discard {
  animation: cgCardDiscard 0.35s ease-out backwards;
}

/* (Debug panel and Dice bet overlay removed — no longer used in v2) */


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (stacked layout)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .cg-center {
    gap: 16px;
    padding: 4px 0;
  }

  .cg-deck-img {
    width: 50px;
  }

  .cg-banner {
    font-size: 1.5rem;
    padding: 10px 28px;
    letter-spacing: 2px;
  }

  .cg-topbar {
    gap: 10px;
    padding: 5px 10px;
  }
  .cg-topbar-turn { font-size: 1rem; }
  .cg-topbar-phase { font-size: 0.9rem; }
  .cg-topbar-round { font-size: 0.85rem; }
  .cg-topbar-sets { font-size: 0.8rem; padding: 2px 8px; }

  .cg-help-panel { font-size: 0.6rem; min-width: 230px; max-width: 260px; padding: 6px 10px; }
  .cg-help-toggle { font-size: 0.65rem; padding: 2px 8px; }

  .cg-card {
    width: 95px;
    height: 138px;
  }

  .cg-card-art-icon {
    width: 36px;
    height: 36px;
  }

  .cg-card-value {
    font-size: 1.3rem;
  }

  .cg-card-stat {
    width: 38px;
    height: 38px;
  }

  .cg-card-stat-border {
    width: 46px;
    height: 46px;
  }

  .cg-card-label {
    font-size: 0.6rem;
    max-width: 80px;
  }

  .cg-card-desc {
    font-size: 0.4rem;
    padding: 0 4px 2px;
    max-width: 80px;
  }

  .cg-card-desc-overlay {
    font-size: 0.36rem;
  }

  .cg-card-text-overlay {
    padding: 0 6px 2px;
  }

  .cg-card-icon {
    width: 20px;
    height: 20px;
  }

  .cg-hand--player {
    min-height: 100px;
  }

  .cg-hand--player .cg-hand-card {
    margin: 0 -10px;
  }

  .cg-hand--ai .cg-hand-card {
    transform: scale(0.28)
               rotate(calc((var(--card-i, 0) - (var(--card-n, 1) - 1) / 2) * 2deg));
    margin: -100px -82px;
  }

  .cg-battlefield {
    min-height: 70px;
    padding: 4px 8px;
    gap: 8px;
  }

  .cg-set-slot {
    min-width: 72px;
    min-height: 80px;
    padding: 3px;
    gap: 2px;
  }

  .cg-set-card {
    width: 50px;
    height: 72px;
  }

  .cg-set-card .cg-card-art-icon {
    width: 20px;
    height: 20px;
  }

  .cg-set-card .cg-card-stat {
    width: 24px;
    height: 24px;
  }

  .cg-action-alert {
    font-size: 0.95rem;
  }

  .cg-set-card .cg-card-stat-border {
    width: 30px;
    height: 30px;
  }

  .cg-set-card .cg-card-value {
    font-size: 0.8rem;
  }

  .cg-set-card .cg-card-label {
    font-size: 0.4rem;
  }

  .cg-log {
    width: 200px;
    max-height: 100px;
    font-size: 0.6rem;
  }

  .cg-hud {
    padding: 4px 8px;
    gap: 6px;
  }

  .cg-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .cg-board-select {
    flex-direction: column;
    align-items: center;
  }

  .cg-board-thumb {
    width: 160px;
    height: 110px;
  }

  .cg-overlay-title {
    font-size: 1.5rem;
  }

  .cg-overlay-btns {
    flex-direction: column;
    gap: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   LANDSCAPE MOBILE
   ═══════════════════════════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {
  .cg-area {
    padding: 2px 8px;
  }

  .cg-hand--player {
    min-height: 70px;
  }

  .cg-hand--ai {
    height: 40px;
    min-height: 0;
  }

  .cg-card {
    width: 72px;
    height: 105px;
  }

  .cg-card-art-icon {
    width: 28px;
    height: 28px;
  }

  .cg-card-value {
    font-size: 1rem;
  }

  .cg-card-desc {
    display: none;
  }

  .cg-card-text-overlay {
    display: none;
  }

  .cg-card-stat {
    width: 30px;
    height: 30px;
  }

  .cg-card-stat-border {
    width: 36px;
    height: 36px;
  }

  .cg-hand--player .cg-hand-card {
    margin: 0 -14px;
  }

  .cg-center {
    gap: 14px;
    padding: 4px 0;
  }

  .cg-deck-img {
    width: 40px;
  }

  .cg-banner {
    font-size: 1.2rem;
    padding: 8px 20px;
    letter-spacing: 1px;
  }

  .cg-topbar {
    gap: 8px;
    padding: 4px 8px;
  }
  .cg-topbar-turn { font-size: 0.9rem; }
  .cg-topbar-phase { font-size: 0.8rem; }
  .cg-topbar-round { font-size: 0.8rem; }
  .cg-topbar-sets { font-size: 0.75rem; padding: 1px 6px; }

  .cg-battlefield {
    min-height: 55px;
    padding: 2px 8px;
  }

  .cg-set-slot {
    min-width: 54px;
    min-height: 60px;
    padding: 2px;
    gap: 1px;
  }

  .cg-set-card {
    width: 40px;
    height: 58px;
  }

  .cg-log {
    max-height: 70px;
    width: 170px;
  }

  .cg-hud {
    padding: 3px 8px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   MULTIPLAYER UI — Game Mode, Queue, Lobby, Invite
   ═══════════════════════════════════════════════════════════════ */

/* ── Game Mode Selector ── */
.cg-gamemode-select {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.cg-gamemode-option {
  min-width: 100px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #2a2218, #1a150e);
  border: 2px solid #5a4a35;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  color: #c8b896;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
}

.cg-gamemode-option:hover {
  border-color: #d4a545;
  background: linear-gradient(180deg, #3a2e1e, #2a2018);
  color: #e8d8b8;
}

.cg-gamemode-option--active {
  border-color: #d4a545;
  background: linear-gradient(180deg, #3a2e1e, #2a2018);
  color: #d4a545;
  box-shadow: 0 0 12px rgba(212, 165, 69, 0.3);
}

/* ── Queue Screen ── */
.cg-queue-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
  padding: 40px 20px;
}

.cg-queue-title {
  font-family: 'Cinzel', serif;
  color: #d4a545;
  font-size: 1.6rem;
  text-align: center;
}

.cg-queue-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(212, 165, 69, 0.2);
  border-top-color: #d4a545;
  border-radius: 50%;
  animation: cgSpin 0.8s linear infinite;
}

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

.cg-queue-hint {
  color: #a09080;
  font-size: 0.95rem;
  text-align: center;
}

.cg-btn--cancel {
  background: linear-gradient(180deg, #5a3030, #3a1a1a);
  border: 2px solid #8a4444;
  color: #e8a8a8;
  padding: 10px 28px;
  border-radius: 6px;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cg-btn--cancel:hover {
  background: linear-gradient(180deg, #6a3535, #4a2020);
  border-color: #aa5555;
}

/* ── Lobby Screen ── */
.cg-lobby-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60vh;
  gap: 16px;
  padding: 30px 20px;
}

.cg-lobby-title {
  font-family: 'Cinzel', serif;
  color: #d4a545;
  font-size: 1.5rem;
}

.cg-lobby-room-code {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid #5a4a35;
}

.cg-lobby-room-label {
  color: #a09080;
  font-size: 0.9rem;
}

.cg-lobby-code {
  font-family: 'Cinzel', serif;
  color: #d4a545;
  font-size: 1.6rem;
  letter-spacing: 4px;
  font-weight: bold;
}

.cg-lobby-waiting {
  color: #a09080;
  font-size: 0.9rem;
  animation: cgPulseText 2s ease-in-out infinite;
}

@keyframes cgPulseText {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Lobby Players ── */
.cg-lobby-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  margin: 8px 0;
}
.cg-lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(212,165,69,0.25);
  border-radius: 8px;
  padding: 8px 14px;
}
.cg-lobby-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #7a6a50;
}
.cg-lobby-name {
  flex: 1;
  color: #e0d0b0;
  font-size: 0.95rem;
}
.cg-lobby-ready-badge {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(180,60,60,0.35);
  color: #cc8888;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.cg-lobby-ready--yes {
  background: rgba(60,180,80,0.35);
  color: #88cc88;
}
.cg-btn--ready {
  padding: 10px 30px;
  background: linear-gradient(135deg, #5a4a3a, #3a2a1a);
  border: 2px solid #7a6a50;
  border-radius: 8px;
  color: #d0c0a0;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.cg-btn--ready:hover { border-color: #d4a545; color: #fff; }
.cg-btn--ready-active {
  background: linear-gradient(135deg, #4a6a3a, #2a4a1a);
  border-color: #88cc66;
  color: #ccffaa;
}
.cg-btn--start {
  padding: 12px 40px;
  background: linear-gradient(135deg, #d4a545, #b8942e);
  border: 2px solid #e0c060;
  border-radius: 8px;
  color: #1a1208;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s;
}
.cg-btn--start:hover { filter: brightness(1.15); }
.cg-btn--start.cg-btn--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ── Lobby Tabs ── */
.cg-lobby-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 4px;
}

.cg-lobby-tab {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #a09080;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cg-lobby-tab:hover {
  color: #d4a545;
  background: rgba(212, 165, 69, 0.1);
}

.cg-lobby-tab--active {
  color: #d4a545;
  background: rgba(212, 165, 69, 0.15);
  box-shadow: inset 0 -2px 0 #d4a545;
}

/* ── Lobby Player List ── */
.cg-lobby-list {
  width: 100%;
  max-width: 420px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}

.cg-lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #2a2218, #1e1810);
  border: 1px solid #3a3020;
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.cg-lobby-player:hover {
  border-color: #5a4a35;
}

.cg-lobby-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #5a4a35;
}

.cg-lobby-name {
  flex: 1;
  color: #d8c8a8;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cg-lobby-empty {
  color: #706050;
  text-align: center;
  padding: 20px;
  font-style: italic;
}

/* ── Invite Button ── */
.cg-btn--invite {
  padding: 6px 14px;
  background: linear-gradient(180deg, #4a6a30, #2a4018);
  border: 1px solid #6a8a40;
  border-radius: 4px;
  color: #c8e8a8;
  font-size: 0.8rem;
  font-family: 'Cinzel', serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cg-btn--invite:hover {
  background: linear-gradient(180deg, #5a7a38, #3a5020);
  border-color: #8aaa55;
}

.cg-btn--invited {
  opacity: 0.5;
  cursor: default;
  background: linear-gradient(180deg, #3a3a30, #2a2a20);
  border-color: #5a5a45;
  color: #a0a080;
}

/* ── Invite Toast ── */
.cg-invite-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  animation: cgToastSlideIn 0.4s ease-out;
}

@keyframes cgToastSlideIn {
  from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.cg-invite-toast-inner {
  background: linear-gradient(180deg, #2a2218, #1a150e);
  border: 2px solid #d4a545;
  border-radius: 10px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(212, 165, 69, 0.2);
  min-width: 280px;
}

.cg-invite-toast-text {
  color: #d8c8a8;
  font-size: 0.95rem;
  text-align: center;
  margin: 0;
}

.cg-invite-toast-text strong {
  color: #d4a545;
}

.cg-invite-toast-btns {
  display: flex;
  gap: 10px;
}

.cg-btn--accept {
  padding: 8px 20px;
  background: linear-gradient(180deg, #4a6a30, #2a4018);
  border: 1px solid #6a8a40;
  border-radius: 6px;
  color: #c8e8a8;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cg-btn--accept:hover {
  background: linear-gradient(180deg, #5a7a38, #3a5020);
}

.cg-btn--decline {
  padding: 8px 20px;
  background: linear-gradient(180deg, #5a3030, #3a1a1a);
  border: 1px solid #6a4040;
  border-radius: 6px;
  color: #d8a8a8;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cg-btn--decline:hover {
  background: linear-gradient(180deg, #6a3535, #4a2020);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .cg-gamemode-option {
    min-width: 80px;
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .cg-queue-title {
    font-size: 1.2rem;
  }

  .cg-lobby-title {
    font-size: 1.2rem;
  }

  .cg-lobby-code {
    font-size: 1.3rem;
    letter-spacing: 3px;
  }

  .cg-lobby-list {
    max-height: 220px;
  }

  .cg-invite-toast-inner {
    min-width: 240px;
    padding: 12px 16px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   CONNECTION STATUS BANNER
   ═══════════════════════════════════════════════════════════════ */

.cg-conn-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  text-align: center;
  padding: 10px 20px;
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  animation: cgConnSlideIn 0.3s ease;
}
.cg-conn-banner--warn {
  background: linear-gradient(135deg, #5a4000, #7a5500);
  color: #ffd966;
  border-bottom: 2px solid #d4a545;
}
.cg-conn-banner--error {
  background: linear-gradient(135deg, #5a1010, #7a2020);
  color: #ff8888;
  border-bottom: 2px solid #ff4444;
}
@keyframes cgConnSlideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}


/* ═══════════════════════════════════════════════════════════════
   IN-GAME CHAT (PvP only)
   ═══════════════════════════════════════════════════════════════ */

.cg-chat {
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 240px;
  z-index: 9000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #5a4a35;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
}

.cg-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: linear-gradient(180deg, #3a2e1e, #2a2018);
  cursor: pointer;
  user-select: none;
}

.cg-chat-title {
  color: #d4a545;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
}

.cg-chat-toggle-icon {
  color: #a09080;
  font-size: 1rem;
  font-weight: bold;
}

.cg-chat-body {
  background: rgba(20, 16, 10, 0.92);
  transition: max-height 0.3s ease;
  max-height: 300px;
}

.cg-chat-body--hidden {
  max-height: 0;
  overflow: hidden;
}

.cg-chat-messages {
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cg-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.cg-chat-messages::-webkit-scrollbar-thumb {
  background: #5a4a35;
  border-radius: 2px;
}

.cg-chat-msg {
  display: flex;
  gap: 6px;
  align-items: baseline;
  line-height: 1.3;
}

.cg-chat-name {
  font-weight: bold;
  font-size: 0.7rem;
  white-space: nowrap;
}

.cg-chat-msg--mine .cg-chat-name {
  color: #d4a545;
}

.cg-chat-msg--opp .cg-chat-name {
  color: #88aacc;
}

.cg-chat-text {
  color: #c8b896;
  word-break: break-word;
}

.cg-chat-taunt-msg {
  color: #e8d8b8;
  font-style: italic;
}

/* ── Taunt Buttons ── */
.cg-chat-taunts {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid #3a3020;
  justify-content: center;
}

.cg-chat-taunt {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #5a4a35;
  background: linear-gradient(180deg, #2a2218, #1e1810);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cg-chat-taunt:hover:not(:disabled) {
  border-color: #d4a545;
  background: linear-gradient(180deg, #3a2e1e, #2a2018);
  transform: scale(1.1);
}

.cg-chat-taunt--cd {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Chat Responsive ── */
@media (max-width: 768px) {
  .cg-chat {
    width: 200px;
    bottom: 5px;
    right: 5px;
  }

  .cg-chat-messages {
    max-height: 120px;
  }
}

@media (max-width: 500px) {
  .cg-chat {
    width: 170px;
    font-size: 0.7rem;
  }

  .cg-chat-taunt {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }
}

