:root {
  --bg-dark: #0a1410;
  --felt-center: #175c3b;
  --felt-edge: #0c3320;
  --wood-rim: #3b2213;
  --gold: #f5c451;
  --gold-bright: #ffe07d;
  --team-us: #3b82f6;
  --team-them: #ef4444;
  --text-light: #f1f5f9;
  --text-muted: #94a3b8;
  --card-bg: #ffffff;
  --card-red: #d92626;
  --card-black: #171717;
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

/* ==================== TOPBAR & SCOREBOARD ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  background: rgba(10, 20, 16, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}

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

.brand-logo {
  font-size: 1.7rem;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--gold);
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.scoreboard {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.score-team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.score-value {
  font-size: 1.35rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 8px;
  min-width: 36px;
  text-align: center;
}

.score-team--us .score-value {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.5);
}

.score-team--them .score-value {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.onze-pill {
  background: #f59e0b;
  color: #111;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  animation: pulse 1.2s infinite;
}

.score-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.stake-badge {
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.stake-badge strong {
  font-size: 1.05rem;
  color: #fff;
}

.target-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-group {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.select-group select {
  background: transparent;
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.select-group select option {
  background: #13241c;
  color: #fff;
}

/* ==================== TRICKS BAR (RODADAS 1, 2, 3) ==================== */
.tricks-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 5px 12px;
  background: rgba(15, 32, 24, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.trick-pill {
  font-size: 0.78rem;
  padding: 3px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.trick-pill--active {
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

.trick-pill--us {
  background: rgba(59, 130, 246, 0.22);
  border-color: #3b82f6;
  color: #bfdbfe;
  font-weight: 700;
}

.trick-pill--them {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fecaca;
  font-weight: 700;
}

.trick-pill--tie {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fde68a;
  font-weight: 700;
}

/* ==================== MAIN TABLE & SIDEBAR ==================== */
.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 270px;
  overflow: hidden;
  min-height: 0;
}

.table-felt {
  position: relative;
  margin: 10px;
  border-radius: 28px;
  background: radial-gradient(circle at center, var(--felt-center) 0%, var(--felt-edge) 85%);
  border: 8px solid var(--wood-rim);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.65), 0 8px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ==================== SEATS ==================== */
.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: box-shadow 0.25s, border-color 0.25s;
}

.seat--active-turn {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.45);
}

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

.seat--bottom {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.42);
  padding: 8px 16px;
}

.seat--left {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.seat--right {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-avatar {
  font-size: 1.35rem;
  background: rgba(255, 255, 255, 0.1);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-name {
  font-weight: 700;
  font-size: 0.86rem;
}

.mao-tag {
  background: var(--gold);
  color: #111;
  font-size: 0.63rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.player-team-tag {
  font-size: 0.68rem;
  font-weight: 600;
}

.team-tag--us {
  color: #93c5fd;
}

.team-tag--them {
  color: #fca5a5;
}

.turn-indicator {
  background: #22c55e;
  color: #052e16;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
}

.partner-peek-label {
  font-size: 0.72rem;
  color: var(--gold-bright);
  font-weight: 700;
}

.player-hand {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ==================== SPEECH BUBBLES ==================== */
.speech-bubble {
  position: absolute;
  z-index: 30;
  top: -36px;
  background: #fff;
  color: #111;
  font-weight: 900;
  font-size: 0.92rem;
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  animation: popIn 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.seat--top .speech-bubble {
  top: auto;
  bottom: -36px;
}

.speech-bubble--truco {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: 2px solid #fff;
  font-size: 1.05rem;
}

.speech-bubble--accept {
  background: #22c55e;
  color: #052e16;
  border: 2px solid #fff;
}

.speech-bubble--run {
  background: #64748b;
  color: #fff;
}

/* ==================== PLAYING CARDS ==================== */
.playing-card {
  position: relative;
  width: 78px;
  height: 112px;
  border-radius: 9px;
  background: var(--card-bg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 2px solid #e2e8f0;
}

.card--small {
  width: 52px;
  height: 74px;
  padding: 4px;
  border-radius: 6px;
}

.card--red {
  color: var(--card-red);
}

.card--black {
  color: var(--card-black);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  transform: translateY(-12px) scale(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
  border-color: var(--gold);
}

.card--manilha {
  border: 2px solid #eab308;
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.55);
  background: linear-gradient(160deg, #ffffff 65%, #fef9c3 100%);
}

.card--winning {
  border: 3px solid #22c55e;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.85);
}

.card--back {
  background: linear-gradient(135deg, #1e3a8a, #172554);
  border: 2px solid #93c5fd;
  padding: 4px;
}

.card-back-pattern {
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
}

.card-covered-tag {
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fde047;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

.card-corner {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-weight: 800;
  font-size: 0.92rem;
}

.card--small .card-corner {
  font-size: 0.72rem;
}

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

.card-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.card-center-suit {
  font-size: 1.9rem;
}

.card--small .card-center-suit {
  font-size: 1.2rem;
}

.card-manilha-badge {
  margin-top: 2px;
  background: #ca8a04;
  color: #fff;
  font-size: 0.56rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-owner-tag {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

/* ==================== TABLE CENTER (VIRA & PLAYED CARDS) ==================== */
.table-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
  z-index: 2;
}

.vira-station {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.26);
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.vira-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vira-label {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
}

.manilha-hint-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.manilha-hint-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--gold);
}

.manilha-suits-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.7rem;
  color: #e2e8f0;
}

.arena-slots {
  min-width: 240px;
  min-height: 155px;
  border-radius: 18px;
  border: 2px dashed rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px 26px;
  position: relative;
}

.arena-placeholder {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
  font-style: italic;
}

.center-toast {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  padding: 6px 16px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
  z-index: 20;
}

/* ==================== SIDEBAR LOGS ==================== */
.game-sidebar {
  background: rgba(12, 24, 19, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h3 {
  font-size: 0.86rem;
  color: var(--gold);
}

.log-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.log-item {
  font-size: 0.76rem;
  line-height: 1.35;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid #64748b;
}

.log-item--call {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.log-item--score {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.14);
  font-weight: 600;
}

.log-item--trick {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

.log-item--alert {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.16);
  font-weight: 700;
}

/* ==================== BOTTOM ACTION BAR ==================== */
.bottom-bar {
  background: rgba(10, 20, 16, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 20px;
}

.action-toolbar,
.decision-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.turn-hint {
  font-size: 0.9rem;
}

.action-buttons,
.decision-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.decision-panel {
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.decision-panel--truco {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
}

.decision-panel--warning {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid #eab308;
}

.decision-panel--win {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
}

.decision-panel--lose {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
}

.decision-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.88rem;
}

.decision-text span {
  font-size: 0.78rem;
  color: #cbd5e1;
}

.no-truco-badge {
  font-size: 0.78rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ==================== BUTTONS ==================== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s, background 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn--lg {
  padding: 10px 20px;
  font-size: 0.95rem;
}

.btn--primary {
  background: #3b82f6;
  color: #fff;
}

.btn--success {
  background: #22c55e;
  color: #052e16;
}

.btn--warning {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
}

.btn--danger {
  background: #ef4444;
  color: #fff;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn--active-toggle {
  background: #eab308;
  color: #111;
  border: 1px solid #fff;
}

/* ==================== MODAL DE REGRAS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: #102119;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

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

.modal-header h2 {
  font-size: 1.1rem;
  color: var(--gold);
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rules-desc {
  font-size: 0.9rem;
  color: #cbd5e1;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rules-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-box h3 {
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.hierarchy-list,
.rules-bullets {
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hierarchy-list ul {
  padding-left: 18px;
  margin-top: 4px;
}

.rules-arch-note {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
}

@keyframes popIn {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-sidebar {
    display: none;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }
}


/* ==================== MODE TABS & ONLINE STATUS ==================== */
.mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 8px;
  margin-left: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab--active {
  background: var(--gold);
  color: #111;
}

.ws-status-pill,
.online-room-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.ws--ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

.ws--off {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.online-room-pill strong {
  color: var(--gold);
}

/* ==================== SIGNALS BAR ==================== */
.tricks-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.tricks-group,
.signals-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.signals-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.signal-chip {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  padding: 2px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.signal-chip:hover {
  background: rgba(245, 196, 81, 0.22);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.speech-bubble--signal {
  background: #1e293b;
  color: var(--gold-bright);
  border: 1.5px solid var(--gold);
}

/* ==================== MULTIPLAYER LOBBY ==================== */
.lobby-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.lobby-alert-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fecaca;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.lobby-offline-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 28px;
  max-width: 620px;
  margin: 30px auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-offline-card h2 {
  color: var(--gold);
  font-size: 1.25rem;
}

.lobby-offline-card pre {
  background: #050a08;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #86efac;
  font-size: 0.9rem;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
}

.lobby-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lobby-panel {
  background: rgba(15, 32, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lobby-panel h3 {
  color: var(--gold);
  font-size: 1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label,
.form-row-2col label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-row input,
.form-row-2col select,
.join-code-box input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 0.86rem;
  outline: none;
}

.form-row-2col select option {
  background: #0f2018;
  color: #fff;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-2col > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.avatar-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.avatar-option {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.2rem;
  cursor: pointer;
}

.avatar-option--selected {
  border: 2px solid var(--gold);
  background: rgba(245, 196, 81, 0.22);
}

.rooms-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.join-code-box {
  display: flex;
  gap: 6px;
}

.join-code-box input {
  width: 150px;
  text-transform: uppercase;
}

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

.empty-rooms {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 10px;
}

.room-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.room-code-pill {
  background: var(--gold);
  color: #111;
  font-weight: 900;
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 6px;
}

.room-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.status--lobby {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.status--ingame {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

.room-list-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==================== ROOM WAITING (SEATS SELECTION) ==================== */
.lobby-room-waiting {
  max-width: 860px;
  margin: 0 auto;
}

.room-waiting-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.room-badge-code {
  display: inline-block;
  background: rgba(245, 196, 81, 0.18);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 6px;
}

.lobby-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.room-config-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.24);
  border-radius: 10px;
}

.rules-summary-tag {
  font-size: 0.78rem;
  color: #cbd5e1;
}

.lobby-seats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lobby-seat-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-seat--blue {
  border-left: 4px solid #3b82f6;
}

.lobby-seat--red {
  border-left: 4px solid #ef4444;
}

.lobby-seat--me {
  background: rgba(245, 196, 81, 0.1);
  border-color: var(--gold);
}

.lobby-seat-team {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
}

.lobby-seat-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-seat-avatar {
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.08);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-seat-name {
  font-size: 0.92rem;
  font-weight: 700;
}

.lobby-seat-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.room-waiting-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

@media (max-width: 900px) {
  .lobby-grid,
  .lobby-seats-grid {
    grid-template-columns: 1fr;
  }
}


/* ==================== PLACAR DE QUEDAS ==================== */
.quedas-pill {
  background: rgba(245, 196, 81, 0.16);
  border: 1px solid rgba(245, 196, 81, 0.5);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
}

/* ==================== ANIMAÇÃO DE DISTRIBUIÇÃO DE CARTAS ==================== */
@keyframes dealCardIn {
  0% {
    opacity: 0;
    transform: translateY(-45px) scale(0.6) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.card--deal-anim {
  animation: dealCardIn 0.32s cubic-bezier(0.2, 0.85, 0.35, 1.15) backwards;
}

/* ==================== AVISO DE VEZ ("SUA VEZ!") & TIMER DE TURNO ==================== */
@keyframes myTurnGlow {
  0%, 100% {
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.55), inset 0 0 12px rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
  }
  50% {
    box-shadow: 0 0 30px rgba(245, 196, 81, 0.85), inset 0 0 16px rgba(245, 196, 81, 0.3);
    border-color: var(--gold-bright);
  }
}

.seat--my-turn-pulse {
  animation: myTurnGlow 1.5s infinite;
}

.turn-indicator--mine {
  background: linear-gradient(135deg, #22c55e, #eab308);
  color: #052e16;
  font-size: 0.72rem;
  padding: 3px 9px;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.action-toolbar--my-turn {
  background: rgba(34, 197, 94, 0.12);
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.my-turn-highlight {
  color: #86efac;
  letter-spacing: 0.3px;
}

.seat-timer-pill,
.bottom-timer-tag {
  font-size: 0.74rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid rgba(245, 196, 81, 0.35);
}

.timer-urgent {
  background: rgba(239, 68, 68, 0.35) !important;
  color: #fecaca !important;
  border-color: #ef4444 !important;
  animation: pulse 0.5s infinite;
}

.seat-timer-bar-bg {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

.seat-timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308);
  transition: width 0.2s linear;
}

.timer-bar-urgent {
  background: #ef4444 !important;
}

/* ==================== SINAIS VISUAIS DE PARCEIRO ==================== */
.signals-divider {
  color: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

.signal-chip--gesture {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.38);
}

.sig-emoji {
  font-size: 0.92rem;
}

.sig-meaning {
  font-size: 0.7rem;
  color: #bfdbfe;
}

.avatar-wrapper {
  position: relative;
  display: inline-flex;
}

@keyframes winkBounce {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  30% {
    transform: scale(1.32) rotate(-10deg);
  }
  60% {
    transform: scale(1.25) rotate(8deg);
  }
}

.avatar-wrapper--signaling .player-avatar {
  animation: winkBounce 0.7s ease-in-out 2;
  background: rgba(245, 196, 81, 0.35);
  border: 2px solid var(--gold);
}

.gesture-badge {
  position: absolute;
  bottom: -4px;
  right: -6px;
  font-size: 0.85rem;
  background: #111;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signal-popup {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 0.73rem;
  animation: popIn 0.22s ease-out;
}

.signal-popup--ally {
  background: rgba(34, 197, 94, 0.22);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}

.signal-popup--enemy {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  color: #fde68a;
}

.signal-popup-emoji {
  font-size: 1.25rem;
}

.signal-popup-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

/* ==================== CHAT DA SALA & LOGS SPLIT ==================== */
.game-sidebar {
  display: grid;
  grid-template-rows: 1.15fr 0.85fr;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.sidebar-section--chat {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-empty {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  margin: auto 0;
  font-style: italic;
}

.chat-msg {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #64748b;
  font-size: 0.77rem;
}

.chat-msg--blue {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

.chat-msg--red {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.chat-msg--sys {
  border-left-color: var(--gold);
  background: rgba(245, 196, 81, 0.12);
}

.chat-msg-head {
  font-weight: 700;
  font-size: 0.72rem;
  color: #cbd5e1;
  margin-bottom: 2px;
}

.chat-msg-body {
  color: #fff;
  word-break: break-word;
  line-height: 1.3;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-row input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  outline: none;
}

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


/* ==================== PLACAR DE RODADAS DA MÃO (1x0, 1x1, 2x1) ==================== */
.round-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 196, 81, 0.45);
  padding: 3px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 800;
}

.round-score-title {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.4px;
}

.round-score-team--blue {
  color: #93c5fd;
  font-size: 0.9rem;
}

.round-score-team--red {
  color: #fca5a5;
  font-size: 0.9rem;
}

.round-score-vs {
  color: var(--text-muted);
  font-weight: 600;
}

.round-score-ties {
  color: #fde68a;
  font-size: 0.72rem;
}

.arena-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.arena-round-scoreboard {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 5px 14px;
  border-radius: 99px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.arena-round-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.arena-round-num {
  font-size: 1rem;
  font-weight: 900;
  padding: 1px 8px;
  border-radius: 6px;
}

.arena-round-num--blue {
  background: rgba(59, 130, 246, 0.28);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.55);
}

.arena-round-num--red {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.55);
}

.arena-round-vs {
  font-weight: 800;
  color: rgba(255, 255, 255, 0.6);
}

.arena-round-tie-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fde68a;
}

.arena-dots-group {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.arena-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-muted);
}

.arena-dot--active {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 8px rgba(245, 196, 81, 0.5);
}

.arena-dot--blue {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
}

.arena-dot--red {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

.arena-dot--tie {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
}


/* ==================== BARRA DE AÇÕES NO CENTRO DA MESA ==================== */
.center-actions-slot {
  width: 100%;
  max-width: 520px;
  z-index: 15;
}

.center-actions-slot .action-toolbar,
.center-actions-slot .decision-panel {
  background: rgba(10, 20, 16, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.center-actions-slot .action-toolbar--my-turn {
  border-color: #22c55e;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
}

.center-actions-slot .decision-panel--truco {
  background: rgba(120, 53, 15, 0.88);
  border-color: #f59e0b;
}

.center-actions-slot .decision-panel--warning {
  background: rgba(113, 63, 18, 0.88);
  border-color: #eab308;
}

.center-actions-slot .decision-panel--win {
  background: rgba(20, 83, 45, 0.9);
  border-color: #22c55e;
}

.center-actions-slot .decision-panel--lose {
  background: rgba(127, 29, 29, 0.9);
  border-color: #ef4444;
}

.center-actions-slot .turn-hint {
  font-size: 0.82rem;
}

.center-actions-slot .decision-text {
  font-size: 0.84rem;
  align-items: center;
}


/* ==================== MODO CARTA COBERTA NA MÃO DO JOGADOR ==================== */
.card--cover-mode {
  border: 2px dashed #60a5fa !important;
  background: linear-gradient(160deg, #dbeafe 0%, #bfdbfe 100%) !important;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.55);
}

.card-will-cover-badge {
  margin-top: 3px;
  background: #1e3a8a;
  color: #fde047;
  font-size: 0.54rem;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #93c5fd;
  letter-spacing: 0.3px;
}


/* ==================== TEMAS DE TAPETE DA MESA ==================== */
.table-felt.theme--green {
  background: radial-gradient(circle at center, #175c3b 0%, #0c3320 85%);
  border-color: #3b2213;
}

.table-felt.theme--red {
  background: radial-gradient(circle at center, #7f1d1d 0%, #450a0a 85%);
  border-color: #29150c;
}

.table-felt.theme--blue {
  background: radial-gradient(circle at center, #1e3a8a 0%, #0f172a 85%);
  border-color: #1e293b;
}

.table-felt.theme--purple {
  background: radial-gradient(circle at center, #581c87 0%, #2e1065 85%);
  border-color: #3b1c54;
}

/* ==================== SCREEN SHAKE & IMPACTO DE ZAP / TRUCO ==================== */
@keyframes shakeZap {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  12% { transform: translate(-7px, 5px) rotate(-0.7deg); }
  25% { transform: translate(7px, -5px) rotate(0.7deg); }
  38% { transform: translate(-5px, -3px) rotate(-0.4deg); }
  52% { transform: translate(5px, 4px) rotate(0.4deg); }
  68% { transform: translate(-3px, 2px) rotate(0deg); }
}

@keyframes shakeTruco {
  0%, 100% { transform: scale(1) translate(0, 0); }
  15% { transform: scale(1.012) translate(-8px, -4px); }
  30% { transform: scale(1.015) translate(8px, 5px); }
  45% { transform: scale(1.008) translate(-6px, 4px); }
  60% { transform: scale(1.004) translate(5px, -3px); }
}

.table-felt--shake-zap {
  animation: shakeZap 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.table-felt--shake-truco {
  animation: shakeTruco 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes zapRingPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 196, 81, 0.9), 0 0 25px rgba(234, 179, 8, 0.95);
    transform: scale(1.14);
  }
  100% {
    box-shadow: 0 0 0 24px rgba(245, 196, 81, 0), 0 0 18px rgba(234, 179, 8, 0.7);
    transform: scale(1.04);
  }
}

.played-slot--zap-impact .playing-card {
  animation: zapRingPulse 0.65s ease-out forwards;
  border: 3px solid #facc15 !important;
}

.played-slot--manilha-impact .playing-card {
  box-shadow: 0 0 20px rgba(245, 196, 81, 0.75);
}

.impact-burst-banner {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  padding: 5px 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.8px;
  white-space: nowrap;
  pointer-events: none;
  animation: popIn 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.impact-burst--zap {
  background: linear-gradient(135deg, #facc15, #ea580c);
  color: #111;
  border: 2px solid #fff;
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.95);
}

.impact-burst--manilha {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #fff;
  border: 2px solid #fef08a;
  box-shadow: 0 0 18px rgba(234, 179, 8, 0.8);
}

.impact-burst--truco {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: 2px solid #fde047;
  box-shadow: 0 0 26px rgba(239, 68, 68, 0.9);
  font-size: 1.08rem;
}

/* ==================== MÃO DE FERRO "NA TESTA" ==================== */
.forehead-mode-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fde047;
  background: rgba(180, 83, 9, 0.45);
  border: 1px solid #f59e0b;
  padding: 2px 9px;
  border-radius: 99px;
}

.card--forehead.card--back {
  background: linear-gradient(135deg, #7c2d12, #431407);
  border-color: #f59e0b;
}


/* ==================== RESPONSIVIDADE MOBILE & TABLET ==================== */
.mobile-only-btn,
.mobile-quick-actions {
  display: none;
}

.sidebar-header--flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  margin-left: 3px;
}

@media (max-width: 960px) {
  #app {
    height: 100dvh;
    max-height: 100dvh;
  }

  .mobile-only-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  /* Topbar compacta em 2 linhas no celular */
  .topbar {
    padding: 6px 10px;
    gap: 6px;
  }

  .brand {
    width: 100%;
    gap: 6px;
  }

  .brand-logo {
    font-size: 1.35rem;
  }

  .brand-title {
    font-size: 0.98rem;
  }

  .brand-sub {
    display: none;
  }

  .mode-tabs {
    margin-left: 4px;
  }

  .mode-tab {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .scoreboard {
    width: 100%;
    justify-content: space-between;
    padding: 4px 10px;
    gap: 6px;
  }

  .score-name small {
    display: none;
  }

  .score-name {
    font-size: 0.78rem;
  }

  .score-value {
    font-size: 1.1rem;
    padding: 1px 7px;
    min-width: 28px;
  }

  .quedas-pill {
    font-size: 0.66rem;
    padding: 1px 6px;
  }

  .stake-badge {
    font-size: 0.72rem;
  }

  .stake-badge strong {
    font-size: 0.88rem;
  }

  .target-label {
    font-size: 0.62rem;
  }

  /* Esconde controles avançados por padrão no celular até clicar em ⚙️ */
  .topbar-controls {
    display: none;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
    gap: 6px;
  }

  .topbar-controls.topbar-controls--mobile-open {
    display: flex;
  }

  /* Barra de Rodadas e Sinais com scroll horizontal suave por toque */
  .tricks-bar {
    padding: 4px 8px;
    gap: 5px;
    flex-direction: column;
    align-items: stretch;
  }

  .tricks-group,
  .signals-group {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .tricks-group::-webkit-scrollbar,
  .signals-group::-webkit-scrollbar {
    display: none;
  }

  .round-score-badge,
  .trick-pill,
  .signal-chip {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 2px 8px;
  }

  /* Layout da Mesa em Grid Vertical de 4 Zonas (zero sobreposição no celular!) */
  .game-layout {
    grid-template-columns: 1fr;
  }

  .table-felt {
    margin: 4px;
    border-width: 4px;
    border-radius: 18px;
    padding: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "top top"
      "left right"
      "center center"
      "bottom bottom";
    align-items: center;
    justify-items: center;
    gap: 6px;
    overflow-y: auto;
  }

  /* Remove posicionamento absoluto dos 4 assentos no mobile */
  .seat {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    padding: 4px 8px;
    gap: 4px;
    max-width: 100%;
  }

  .seat--top {
    grid-area: top;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .seat--left {
    grid-area: left;
    justify-self: stretch;
  }

  .seat--right {
    grid-area: right;
    justify-self: stretch;
  }

  .seat--bottom {
    grid-area: bottom;
    width: 100%;
    padding: 6px 10px;
  }

  .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 1.05rem;
  }

  .player-name {
    font-size: 0.76rem;
  }

  .player-team-tag {
    font-size: 0.62rem;
  }

  /* Cartas dos bots compactas no celular para sobrar espaço na mesa */
  .player-hand--bot .playing-card.card--small {
    width: 34px;
    height: 48px;
    padding: 2px;
  }

  .player-hand--bot .card--small .card-corner {
    font-size: 0.56rem;
  }

  .player-hand--bot .card--small .card-center-suit {
    font-size: 0.85rem;
  }

  /* Cartas da mão do jogador humano grandes e confortáveis para o polegar */
  .player-hand--human {
    gap: 10px;
  }

  .player-hand--human .playing-card {
    width: 72px;
    height: 102px;
  }

  .card--interactive:hover {
    transform: translateY(-6px) scale(1.03);
  }

  /* Centro da Mesa empilhado verticalmente no celular */
  .table-center {
    grid-area: center;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .vira-station {
    padding: 4px 10px;
    gap: 8px;
  }

  .vira-station .deck-stack {
    display: none;
  }

  .manilha-suits-order {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.66rem;
  }

  .arena-column {
    width: 100%;
    gap: 6px;
  }

  .center-actions-slot {
    max-width: 100%;
  }

  .center-actions-slot .action-toolbar,
  .center-actions-slot .decision-panel {
    padding: 6px 10px;
    gap: 6px;
  }

  .center-actions-slot .turn-hint {
    font-size: 0.75rem;
  }

  .center-actions-slot .btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .arena-slots {
    min-width: 0;
    width: 100%;
    min-height: 105px;
    padding: 10px 8px 22px;
    gap: 8px;
  }

  .arena-slots .playing-card {
    width: 56px;
    height: 80px;
    padding: 4px;
  }

  .arena-slots .card-corner {
    font-size: 0.75rem;
  }

  .arena-slots .card-center-suit {
    font-size: 1.35rem;
  }

  .card-owner-tag {
    font-size: 0.58rem;
    bottom: -17px;
    padding: 1px 5px;
  }

  /* Balões de fala reposicionados para não cortar no topo do celular */
  .speech-bubble {
    top: -26px;
    font-size: 0.78rem;
    padding: 3px 10px;
  }

  /* Gaveta de Chat e Histórico em tela cheia no Mobile quando aberta pelo botão 💬 */
  .game-sidebar {
    display: none;
    position: fixed;
    inset: 48px 0 0 0;
    z-index: 95;
    background: rgba(10, 20, 16, 0.98);
  }

  .game-sidebar.game-sidebar--mobile-open {
    display: grid;
  }

  .lobby-container {
    padding: 12px;
  }
}


/* ==================== CACHETA / PIF-PAF STYLES ==================== */
.scoreboard--cacheta {
  flex-wrap: wrap;
  gap: 10px;
}

.cacheta-score-player {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.cacheta-score--me {
  border-color: var(--gold);
  background: rgba(245, 196, 81, 0.15);
}

.cacheta-lives-val {
  color: #fca5a5;
  font-weight: 800;
}

.meld-count--ready {
  color: #86efac;
  font-size: 0.92rem;
}

.seat--cacheta-human {
  max-width: 96%;
}

.player-hand--cacheta {
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding: 12px 6px 4px;
}

.player-hand--cacheta .playing-card {
  width: 68px;
  height: 98px;
  flex-shrink: 0;
}

/* Destaque de jogos já formados na mão do jogador (Jogo 1, Jogo 2, Jogo 3) */
.card--meld-group-0 {
  border: 2.5px solid #22c55e !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}

.card--meld-group-1 {
  border: 2.5px solid #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

.card--meld-group-2 {
  border: 2.5px solid #c084fc !important;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.45);
}

.card-meld-tag {
  margin-top: 2px;
  background: #15803d;
  color: #fff;
  font-size: 0.5rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.card--meld-group-1 .card-meld-tag {
  background: #0369a1;
}

.card--meld-group-2 .card-meld-tag {
  background: #7e22ce;
}

.card--beat-discard {
  border: 2.5px dashed #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.75);
}

.card-beat-discard-tag {
  margin-top: 2px;
  background: linear-gradient(135deg, #f59e0b, #dc2626);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Mão compacta dos Bots na Cacheta */
.cacheta-bot-hand-fan {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mini-card-back {
  font-size: 0.95rem;
  color: #93c5fd;
  margin-right: -4px;
}

.cacheta-card-count-badge {
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold-bright);
}

.cacheta-bot-hand--folded {
  font-size: 0.72rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 10px;
  border-radius: 99px;
}

/* Arena de Monte e Lixo da Cacheta */
.cacheta-piles-arena {
  gap: 26px;
  padding: 12px 24px 24px;
}

.cacheta-pile-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  transition: transform 0.15s, background 0.15s;
}

.cacheta-pile--clickable {
  cursor: pointer;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.cacheta-pile--clickable:hover {
  transform: translateY(-3px);
  background: rgba(34, 197, 94, 0.22);
}

.pile-title {
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.discard-stack-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prev-discards-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 6px;
  border-radius: 6px;
}

/* Mostruário dos 3 Jogos Batidos no Fim da Mão */
.cacheta-winning-showcase {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.showcase-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--gold-bright);
}

.showcase-melds-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.winning-meld-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 10px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.winning-meld-title {
  font-size: 0.68rem;
  font-weight: 800;
  color: #86efac;
}

.winning-meld-cards {
  display: flex;
  gap: 4px;
}

@media (max-width: 960px) {
  .player-hand--cacheta {
    justify-content: flex-start;
    padding: 8px 4px 2px;
  }

  .player-hand--cacheta .playing-card {
    width: 56px;
    height: 82px;
    padding: 4px;
  }

  .player-hand--cacheta .card-corner {
    font-size: 0.72rem;
  }

  .player-hand--cacheta .card-center-suit {
    font-size: 1.25rem;
  }

  .cacheta-piles-arena {
    gap: 14px;
    padding: 8px 12px 18px;
  }
}


/* ==================== PÁGINA DE RANKING & ESTATÍSTICAS ==================== */
.ranking-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ranking-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(23, 92, 59, 0.85), rgba(12, 32, 24, 0.95));
  border: 1px solid rgba(245, 196, 81, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.hero-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-avatar {
  font-size: 2.6rem;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-tier-badge {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.hero-name {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
}

.hero-sub {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.hero-kpis {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.kpi-box {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 135px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kpi-box--gold {
  border-color: var(--gold);
  background: rgba(245, 196, 81, 0.15);
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  margin: 2px 0;
}

.kpi-box--gold .kpi-value {
  color: var(--gold-bright);
}

.kpi-sub {
  font-size: 0.68rem;
  color: #cbd5e1;
}

.stats-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.stats-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
}

.metric-val small {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.history-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
}

.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid #22c55e;
  font-size: 0.78rem;
}

.history-card--lose {
  border-left-color: #ef4444;
}

.history-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-game-pill {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 800;
}

.history-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.history-delta {
  font-weight: 900;
  font-size: 0.85rem;
  white-space: nowrap;
}

.delta--pos {
  color: #86efac;
}

.delta--neg {
  color: #fca5a5;
}

.ranking-filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ranking-table-wrapper {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ranking-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--gold);
  font-size: 0.74rem;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rank-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.rank-row--me {
  background: rgba(245, 196, 81, 0.14) !important;
  border-left: 3px solid var(--gold);
}

.rank-pos {
  font-weight: 900;
  white-space: nowrap;
}

.rank-player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-avatar {
  font-size: 1.35rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-player-name {
  font-weight: 800;
  color: #fff;
}

.you-tag {
  background: var(--gold);
  color: #111;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 5px;
}

.rank-player-tier {
  font-size: 0.7rem;
  font-weight: 700;
}

.rank-num {
  white-space: nowrap;
}

.rank-num small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

@media (max-width: 960px) {
  .stats-2col-grid {
    grid-template-columns: 1fr;
  }
  .ranking-hero-card {
    padding: 14px;
  }
  .kpi-box {
    flex: 1;
    min-width: 110px;
  }
}
