:root {
  --bg: #06101f;
  --bg2: #0c1a30;
  --panel: rgba(13, 25, 45, 0.92);
  --panel-border: rgba(148, 163, 184, 0.16);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --gold: #f59e0b;
  --gold-light: #fde047;
  --team-a: #38bdf8;
  --team-a-bg: rgba(56, 189, 248, 0.14);
  --team-b: #fb7185;
  --team-b-bg: rgba(251, 113, 133, 0.14);
  --ok: #22c55e;
  --danger: #ef4444;
  --felt-a: #0d4b36;
  --felt-b: #06291e;
  --felt-rim: #4b2e19;
  --radius: 16px;
}

/* 4 temas da mesa */
body.theme-crimson { --felt-a: #5e1320; --felt-b: #320810; --felt-rim: #3a1e16; }
body.theme-royal   { --felt-a: #123468; --felt-b: #091a38; --felt-rim: #1e293b; }
body.theme-gold    { --felt-a: #1e3b2f; --felt-b: #0d1d16; --felt-rim: #714a18; }

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(circle at 20% 0%, #0e2240 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- BUTTONS & INPUTS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(30, 41, 59, 0.85); color: #fff; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: transform .12s, filter .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #1c1303; border-color: #fde68a;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn.success {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  color: #052e16; border-color: #86efac;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.32);
}
.btn.danger {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  color: #fff; border-color: #fca5a5;
}
.btn.truco-shout-btn {
  background: linear-gradient(180deg, #f97316 0%, #b91c1c 100%);
  color: #fff; border-color: #fdba74; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn.ghost { background: rgba(15, 23, 42, 0.65); border-color: rgba(148,163,184,0.22); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.active-toggle {
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
  border-color: #a5b4fc; box-shadow: 0 0 14px rgba(99, 102, 241, 0.5);
}

input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(6, 16, 31, 0.8); color: #fff; font-size: 14px; outline: none;
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }
label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-top: 6px; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }
.err { color: #fca5a5; font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; font-weight: 600; }

/* ---------- AUTH ---------- */
#scr-loading, #scr-auth { align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 410px; padding: 28px 26px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--panel-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.logo { text-align: center; margin-bottom: 18px; }
.logo h1 { margin: 8px 0 4px; font-size: 26px; letter-spacing: 1px; }
.logo p { margin: 0; color: var(--muted); font-size: 13px; }
.logo-cards { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.lc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 56px; border-radius: 8px; background: #fff; font-weight: 900; font-size: 16px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
}
.lc-red { color: #dc2626; transform: rotate(-10deg); }
.lc-gold { color: #0f172a; border: 2px solid #f59e0b; transform: translateY(-4px); box-shadow: 0 8px 20px rgba(245,158,11,0.35); }
.lc-dark { color: #0f172a; transform: rotate(10deg); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 9px; border-radius: 10px; border: 1px solid rgba(148,163,184,0.2);
  background: rgba(15, 23, 42, 0.6); color: var(--muted); font-weight: 700; cursor: pointer;
}
.tab.active { background: rgba(245, 158, 11, 0.18); border-color: var(--gold); color: var(--gold-light); }
.form { display: none; flex-direction: column; gap: 6px; }
.form.active { display: flex; }

/* ---------- TOPBAR & LOBBY ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(6, 16, 31, 0.85);
  border-bottom: 1px solid var(--panel-border); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #fbbf24, #d97706); color: #1c1303; font-size: 20px; font-weight: 900;
}
.brand strong { display: block; font-size: 15px; letter-spacing: .5px; }
.brand small { color: var(--muted); font-size: 11.5px; }
.suite-links, .userbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: rgba(30, 41, 59, 0.85); border: 1px solid rgba(148,163,184,0.2);
}
.online-pill { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: #86efac; }

.lobby-grid {
  width: 100%; max-width: 1320px; margin: 0 auto; padding: 18px;
  display: grid; grid-template-columns: 1fr 350px; gap: 16px;
}
.lobby-main, .lobby-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lobby-split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }

.panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.panel h2 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

/* Quick Solo Card */
.quick-solo-card {
  background: linear-gradient(135deg, rgba(16, 48, 42, 0.92), rgba(13, 25, 45, 0.95));
  border-color: rgba(245, 158, 11, 0.3);
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.qs-info { flex: 1 1 260px; }
.qs-badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .6px;
  color: var(--gold-light); margin-bottom: 4px;
}
.qs-controls { flex: 1 1 340px; display: flex; flex-direction: column; gap: 10px; }
.qs-row { display: flex; gap: 8px; flex-wrap: wrap; }
.qs-go-btn { width: 100%; padding: 12px; font-size: 15px; }

.seg-group {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: rgba(6, 16, 31, 0.75); border: 1px solid rgba(148,163,184,0.18); flex: 1;
}
.seg-group.full { width: 100%; }
.seg-btn {
  flex: 1; padding: 7px 10px; border-radius: 9px; border: none;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 12.5px; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.active {
  background: linear-gradient(180deg, #fbbf24, #d97706); color: #1c1303;
  box-shadow: 0 2px 10px rgba(245,158,11,0.3);
}
.mode-tip {
  background: rgba(6, 16, 31, 0.6); border: 1px solid rgba(148,163,184,0.14);
  border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.4;
}

/* Filters */
.room-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rf-btn {
  padding: 5px 10px; border-radius: 9px; border: 1px solid rgba(148,163,184,0.22);
  background: rgba(15, 23, 42, 0.7); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer;
}
.rf-btn.active { background: rgba(245, 158, 11, 0.2); border-color: var(--gold); color: var(--gold-light); }

/* Records Mural */
.records-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.rec-card {
  background: rgba(6, 16, 31, 0.65); border: 1px solid rgba(148,163,184,0.16);
  border-radius: 12px; padding: 10px; text-align: center;
}
.rec-icon { font-size: 20px; }
.rec-title { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.rec-name { font-size: 13.5px; font-weight: 800; color: #fff; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-val { font-size: 12px; color: var(--gold-light); font-weight: 700; }

/* Rooms List */
.rooms-list { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.room-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 12px; background: rgba(6, 16, 31, 0.7);
  border: 1px solid rgba(148,163,184,0.16);
}
.ri-main strong { font-size: 14.5px; display: block; }
.ri-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.tag {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(30, 41, 59, 0.9); border: 1px solid rgba(148,163,184,0.2); color: #cbd5e1;
}
.tag.paulista { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.4); color: #fde047; }
.tag.mineiro  { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.tag.live     { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.tag.open     { background: rgba(34, 197, 94, 0.16); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }
.ri-actions { display: flex; gap: 6px; }

/* Ranking */
.ranking-list { display: flex; flex-direction: column; gap: 7px; max-height: 400px; overflow-y: auto; }
.rank-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; border-radius: 10px; background: rgba(6, 16, 31, 0.65);
  border: 1px solid rgba(148,163,184,0.12); font-size: 13px;
}
.rank-row.me { border-color: var(--gold); background: rgba(245, 158, 11, 0.1); }
.rank-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-pos { width: 24px; font-weight: 900; color: var(--gold-light); text-align: center; }
.rank-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-stat { font-weight: 800; color: var(--gold-light); white-space: nowrap; }

/* Career Card */
.career-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.career-avatar {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.4);
}
.career-meta strong { display: block; font-size: 15px; }
.career-meta small { color: var(--gold-light); font-weight: 700; font-size: 12px; }
.career-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.cs-box {
  background: rgba(6, 16, 31, 0.7); border: 1px solid rgba(148,163,184,0.14);
  border-radius: 10px; padding: 8px 6px; text-align: center;
}
.cs-box strong { display: block; font-size: 15px; color: #fff; }
.cs-box span { font-size: 11px; color: var(--muted); }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.av-opt {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.2);
  background: rgba(6, 16, 31, 0.75); cursor: pointer; font-size: 16px; display: grid; place-items: center;
}
.av-opt.active { border-color: var(--gold); background: rgba(245, 158, 11, 0.22); }
.badges-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge-chip {
  font-size: 11px; padding: 3px 7px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.35); color: #fde68a;
}

/* ---------- WAITING ROOM ---------- */
.room-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.room-panel { width: 100%; max-width: 760px; }
.rm-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.teams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.team-col {
  border-radius: 14px; padding: 12px; border: 1px solid rgba(148,163,184,0.2);
  background: rgba(6, 16, 31, 0.65); display: flex; flex-direction: column; gap: 10px;
}
.team-col.team-0 { border-color: rgba(56, 189, 248, 0.45); background: var(--team-a-bg); }
.team-col.team-1 { border-color: rgba(251, 113, 133, 0.45); background: var(--team-b-bg); }
.team-col h3 { margin: 0; font-size: 14px; letter-spacing: .4px; }
.team-col.team-0 h3 { color: var(--team-a); }
.team-col.team-1 h3 { color: var(--team-b); }

.seat-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px; border-radius: 12px; background: rgba(10, 20, 38, 0.85);
  border: 1px solid rgba(148,163,184,0.2);
}
.seat-card.empty { border-style: dashed; cursor: pointer; opacity: .88; }
.seat-card.empty:hover { border-color: var(--gold); opacity: 1; }
.seat-card.me { border-color: var(--gold); box-shadow: 0 0 12px rgba(245, 158, 11, 0.25); }
.rm-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- GAME HUD & TABLE ---------- */
#scr-game { height: 100vh; overflow: hidden; }
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; background: rgba(6, 16, 31, 0.92);
  border-bottom: 1px solid var(--panel-border); z-index: 25; flex-shrink: 0;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hud-badge {
  padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  background: rgba(30, 41, 59, 0.9); border: 1px solid rgba(148,163,184,0.22);
}
.mode-badge { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.45); color: #fde047; }
.ranked-badge.ranked { background: rgba(34, 197, 94, 0.16); border-color: rgba(34, 197, 94, 0.45); color: #86efac; }

.scoreboard {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 14px; border-radius: 14px;
  background: rgba(15, 23, 42, 0.95); border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.sb-team { display: flex; align-items: center; gap: 8px; }
.sb-label { font-size: 12px; font-weight: 700; max-width: 115px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-a .sb-label, .sb-a .sb-pts { color: var(--team-a); }
.sb-b .sb-label, .sb-b .sb-pts { color: var(--team-b); }
.sb-pts { font-size: 22px; font-weight: 900; min-width: 24px; text-align: center; }
.sb-mid {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 10px; border-left: 1px solid rgba(255,255,255,0.12); border-right: 1px solid rgba(255,255,255,0.12);
}
.sb-val {
  font-size: 12px; font-weight: 900; color: var(--gold-light);
  background: rgba(245, 158, 11, 0.2); padding: 2px 8px; border-radius: 999px;
}
.sb-target { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Stage */
.table-stage {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: 10px 14px 10px; overflow: hidden;
}
.felt-table {
  position: relative; width: min(920px, 96vw); flex: 1; min-height: 290px; max-height: 520px;
  border-radius: 180px;
  background: radial-gradient(ellipse at center, var(--felt-a) 0%, var(--felt-b) 78%);
  border: 12px solid var(--felt-rim);
  box-shadow: inset 0 0 55px rgba(0,0,0,0.65), 0 18px 50px rgba(0,0,0,0.65), 0 0 0 2px rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  margin-top: 10px;
}
.felt-table::after {
  content: ""; position: absolute; inset: 14px; border-radius: 165px;
  border: 1px dashed rgba(255, 255, 255, 0.14); pointer-events: none;
}

/* Center Arena */
.table-center {
  position: relative; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 78%; pointer-events: none;
}
.trick-dots { display: flex; gap: 10px; align-items: center; }
.tdot {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800;
  background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255,255,255,0.16); color: #cbd5e1;
}
.tdot.win-0 { background: rgba(56, 189, 248, 0.25); border-color: var(--team-a); color: #e0f2fe; }
.tdot.win-1 { background: rgba(251, 113, 133, 0.25); border-color: var(--team-b); color: #ffe4e6; }
.tdot.tie   { background: rgba(250, 204, 21, 0.22); border-color: #facc15; color: #fef08a; }
.tdot.cur   { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.35); }

.center-arena { display: flex; align-items: center; justify-content: center; gap: 22px; min-height: 116px; }
.vira-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vira-label {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(0,0,0,0.55); padding: 2px 8px; border-radius: 999px; color: var(--gold-light);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.mineiro-manilhas {
  background: rgba(0,0,0,0.48); border: 1px solid rgba(245,158,11,0.35);
  border-radius: 12px; padding: 7px 10px; text-align: center; font-size: 11px; color: #fde68a;
}
.mineiro-manilhas strong { display: block; font-size: 12px; margin-bottom: 2px; color: var(--gold-light); }

.played-cards { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-width: 140px; }
.played-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; animation: cardDrop .22s ease-out; }
.played-who {
  font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px;
  background: rgba(0,0,0,0.55); max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.played-who.t0 { color: var(--team-a); border: 1px solid rgba(56,189,248,0.4); }
.played-who.t1 { color: var(--team-b); border: 1px solid rgba(251,113,133,0.4); }

.live-feed {
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255,255,255,0.12);
  padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: #f8fafc; max-width: 92%; text-align: center;
}

/* Playing Cards */
.tcard {
  position: relative; width: 72px; height: 104px; border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #0f172a; border: 2px solid #cbd5e1;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; justify-content: space-between; padding: 5px 6px;
  user-select: none; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tcard.red { color: #dc2626; }
.tcard.sm { width: 58px; height: 84px; padding: 4px 5px; border-radius: 8px; }
.tcard.manilha {
  border-color: #f59e0b;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.55), 0 8px 18px rgba(0,0,0,0.45);
}
.tcard-top { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.tcard-rank { font-size: 18px; font-weight: 900; }
.tcard.sm .tcard-rank { font-size: 15px; }
.tcard-suit { font-size: 14px; }
.tcard-mid { text-align: center; font-size: 30px; line-height: 1; }
.tcard.sm .tcard-mid { font-size: 24px; }
.tcard-manilha-tag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #fde047, #d97706); color: #1c1303;
  font-size: 9px; font-weight: 900; padding: 1px 6px; border-radius: 999px;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.tcard.back {
  background: repeating-linear-gradient(135deg, #1e3a8a 0 6px, #172554 6px 12px);
  border: 2px solid #93c5fd; color: #dbeafe; align-items: center; justify-content: center;
}
.tcard.back::after {
  content: "♣"; font-size: 26px; opacity: 0.85;
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid rgba(147,197,253,0.45); display: grid; place-items: center;
}

/* My Hand */
.my-hand-wrap {
  display: flex; justify-content: center; align-items: flex-end; min-height: 112px;
  z-index: 12; margin-top: -12px;
}
.my-hand { display: flex; justify-content: center; gap: 12px; }
.my-hand .tcard { width: 82px; height: 118px; cursor: default; }
.my-hand .tcard.playable { cursor: pointer; }
.my-hand .tcard.playable:hover {
  transform: translateY(-16px) scale(1.05);
  box-shadow: 0 18px 28px rgba(0,0,0,0.55), 0 0 0 2px var(--gold);
  z-index: 5;
}
.my-hand .tcard.dim { opacity: 0.72; }
.my-hand .tcard.cover-mode:hover { box-shadow: 0 18px 28px rgba(99,102,241,0.6), 0 0 0 2px #818cf8; }

/* Seats around felt */
.seats-layer { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.seat-node {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .2s;
}
.seat-node.pos-top    { top: -18px; left: 50%; transform: translateX(-50%); }
.seat-node.pos-left   { left: -16px; top: 50%; transform: translateY(-50%); }
.seat-node.pos-right  { right: -16px; top: 50%; transform: translateY(-50%); }
.seat-node.pos-bottom { bottom: -16px; left: 50%; transform: translateX(-50%); }

.seat-pill {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 14px;
  background: rgba(10, 20, 38, 0.94); border: 2px solid rgba(148,163,184,0.28);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5); min-width: 128px; cursor: pointer;
}
.seat-pill.t0 { border-color: rgba(56, 189, 248, 0.65); }
.seat-pill.t1 { border-color: rgba(251, 113, 133, 0.65); }
.seat-pill.turn {
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.45), 0 0 22px rgba(245, 158, 11, 0.65);
  border-color: var(--gold-light);
}
.seat-av {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,0.08); font-size: 18px; flex-shrink: 0;
}
.seat-info { display: flex; flex-direction: column; min-width: 0; }
.seat-name { font-size: 12.5px; font-weight: 800; max-width: 105px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-sub { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dealer-chip {
  position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: #fde047; color: #1c1303; font-size: 11px; font-weight: 900;
  display: grid; place-items: center; border: 2px solid #0f172a;
}
.mini-cards { display: flex; gap: 3px; }
.mini-card {
  width: 11px; height: 15px; border-radius: 3px;
  background: linear-gradient(135deg, #2563eb, #1e3a8a); border: 1px solid #93c5fd;
}
.turn-bar {
  width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; margin-top: 2px;
}
.turn-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #facc15, #ef4444); transition: width .25s linear; }

.seat-bubble {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96); border: 1px solid var(--gold);
  color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800;
  white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  animation: popFade 3.2s ease forwards; z-index: 30;
}
.seat-bubble.secret {
  background: linear-gradient(135deg, #4f46e5, #7c3aed); border-color: #c4b5fd;
}

/* Partner Peek (Mão de 11 / 10) */
.partner-peek {
  display: none; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 14px;
  background: rgba(15, 23, 42, 0.94); border: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55); z-index: 15; margin-bottom: 4px;
}
.partner-peek.show { display: flex; }
.partner-peek span { font-size: 12px; font-weight: 800; color: var(--gold-light); }
.partner-peek-cards { display: flex; gap: 6px; }

/* Signal Bar (2x2) */
.signal-bar {
  display: none; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap;
  padding: 4px 10px; border-radius: 999px; background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(129, 140, 248, 0.35); margin-bottom: 4px; z-index: 12;
}
.signal-bar.show { display: flex; }
.sig-title { font-size: 11px; font-weight: 800; color: #c7d2fe; margin-right: 2px; }
.sig-btn {
  padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(129,140,248,0.3);
  background: rgba(49, 46, 129, 0.45); color: #e0e7ff; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.sig-btn:hover { background: rgba(79, 70, 229, 0.7); }

/* Bottom Centered Actionbar */
.actionbar-wrap {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; z-index: 15; padding-top: 4px;
}
.actionbar {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  width: fit-content; margin: 0 auto;
  padding: 7px 12px; border-radius: 16px;
  background: rgba(10, 20, 38, 0.9); border: 1px solid rgba(148,163,184,0.22);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.actionbar:empty { display: none; }
.ab-label { font-size: 12.5px; font-weight: 800; color: var(--gold-light); padding: 0 4px; }
.emote-bar {
  display: flex; gap: 4px; padding: 5px 8px; border-radius: 14px;
  background: rgba(10, 20, 38, 0.82); border: 1px solid rgba(148,163,184,0.18);
}
.em-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
  font-size: 17px; cursor: pointer; transition: transform .12s;
}
.em-btn:hover { transform: scale(1.25); background: rgba(255,255,255,0.08); }

/* Shout Overlay */
.shout-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 22;
}
.shout-banner {
  padding: 14px 34px; border-radius: 20px; font-size: clamp(28px, 5vw, 52px); font-weight: 900;
  letter-spacing: 2px; text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border: 3px solid #fde047;
  box-shadow: 0 18px 50px rgba(239, 68, 68, 0.65);
  animation: shoutPop 1.85s ease forwards;
}
.shout-banner.ok { background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 18px 50px rgba(34,197,94,0.55); }
.shout-banner.iron { background: linear-gradient(135deg, #334155, #0f172a); border-color: #94a3b8; box-shadow: 0 18px 50px rgba(0,0,0,0.8); }

/* Throwables */
.throw-popover {
  position: fixed; display: none; gap: 6px; padding: 7px 10px; border-radius: 14px;
  background: rgba(10, 20, 38, 0.96); border: 1px solid var(--gold);
  box-shadow: 0 12px 28px rgba(0,0,0,0.6); z-index: 40;
}
.throw-popover.open { display: flex; }
.throw-btn {
  width: 34px; height: 34px; border-radius: 9px; border: none; background: rgba(255,255,255,0.07);
  font-size: 19px; cursor: pointer;
}
.throw-btn:hover { transform: scale(1.2); background: rgba(245,158,11,0.25); }
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 24; }
.flying-item {
  position: absolute; font-size: 32px; transition: transform .58s cubic-bezier(.22,.9,.36,1), opacity .2s;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.6));
}

/* Chat Drawer */
.chat-drawer {
  position: fixed; top: 54px; right: -340px; bottom: 0; width: 320px; max-width: 90vw;
  background: rgba(8, 17, 32, 0.97); border-left: 1px solid var(--panel-border);
  display: flex; flex-direction: column; transition: right .22s ease; z-index: 35;
}
.chat-drawer.open { right: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--panel-border); }
.chat-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 12px; }
.ctab {
  padding: 6px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.2);
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer;
}
.ctab.active { background: rgba(245,158,11,0.18); border-color: var(--gold); color: var(--gold-light); }
.chat-body { display: none; flex: 1; overflow-y: auto; padding: 10px 12px; font-size: 13px; flex-direction: column; gap: 6px; }
.chat-body.active { display: flex; }
.cmsg { padding: 6px 9px; border-radius: 9px; background: rgba(30,41,59,0.7); line-height: 1.35; }
.cmsg b { color: var(--gold-light); }
.chat-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--panel-border); }

/* Victory Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 8, 18, 0.78); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.victory-card {
  width: 100%; max-width: 440px; padding: 26px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(16, 30, 56, 0.98), rgba(8, 16, 32, 0.98));
  border: 2px solid var(--gold); box-shadow: 0 24px 60px rgba(0,0,0,0.75);
}
.vic-trophy { font-size: 54px; margin-bottom: 4px; }
.victory-card h2 { margin: 0 0 6px; font-size: 26px; color: var(--gold-light); }
.vic-sub { margin: 0 0 12px; color: #cbd5e1; font-size: 14px; }
.vic-score {
  font-size: 28px; font-weight: 900; padding: 10px; border-radius: 14px;
  background: rgba(0,0,0,0.4); margin-bottom: 14px; letter-spacing: 2px;
}
.vic-stats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; text-align: left; }
.vic-stat-row {
  display: flex; justify-content: space-between; font-size: 12.5px;
  padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.05);
}
.vic-actions { display: flex; gap: 10px; justify-content: center; }

/* Toasts */
.toast-box {
  position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60;
}
.toast {
  padding: 10px 15px; border-radius: 12px; background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--gold); color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(0,0,0,0.5); animation: fadeUp .2s ease;
}
.toast.err { border-color: var(--danger); color: #fecaca; }

@keyframes cardDrop {
  from { opacity: 0; transform: translateY(-16px) scale(0.88); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shoutPop {
  0%   { opacity: 0; transform: scale(0.45) rotate(-6deg); }
  16%  { opacity: 1; transform: scale(1.1) rotate(2deg); }
  26%  { transform: scale(1) rotate(0deg); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}
@keyframes popFade {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  12%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  82%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1020px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-split { grid-template-columns: 1fr; }
  .records-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .teams-grid { grid-template-columns: 1fr; }
  .felt-table { border-radius: 72px; border-width: 8px; width: 96vw; }
  .seat-node.pos-left { left: 2px; }
  .seat-node.pos-right { right: 2px; }
  .seat-pill { min-width: 102px; padding: 5px 8px; }
  .my-hand .tcard { width: 70px; height: 102px; }
  .hud { padding: 6px 8px; }
  .sb-label { display: none; }
  .suite-links { display: none; }
}
