:root {
  --bg: #0f1512;
  --panel: #18211c;
  --panel2: #202b25;
  --line: #2e3d34;
  --text: #e8efe9;
  --muted: #8fa597;
  --felt: #1d5c3a;
  --felt2: #134429;
  --accent: #f2b632;
  --teamA: #4aa3ff;
  --teamB: #ff6b6b;
  --red: #d62f3a;
  --radius: 12px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); color: #1b1300; border-color: var(--accent); font-weight: 700; }
button.danger { border-color: #7a2a2a; }
button.big { padding: 12px 20px; font-size: 1.05rem; }
input, select {
  background: #0c120f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 12px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
  gap: 12px; flex-wrap: wrap;
}
.brand { font-size: 1.15rem; }
#topinfo { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.layout { display: flex; min-height: calc(100vh - 52px); }
main { flex: 1; padding: 18px; min-width: 0; }
aside {
  width: 300px; border-left: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; max-height: calc(100vh - 52px); position: sticky; top: 0;
}
.tabs { display: flex; }
.tab { flex: 1; border-radius: 0; border: none; border-bottom: 2px solid transparent; background: none; }
.tab.active { border-bottom-color: var(--accent); }
.feed { flex: 1; overflow-y: auto; padding: 10px; font-size: 0.88rem; display: flex; flex-direction: column; gap: 4px; }
.feed .hand { color: var(--accent); margin-top: 6px; }
.feed .bet { color: #ffd27a; font-weight: 600; }
.feed .trick { color: var(--muted); }
.feed .win { color: #7dff9b; font-weight: 700; }
.feed .sys { color: var(--muted); font-style: italic; }
#chatform { padding: 8px; border-top: 1px solid var(--line); }
#chatform input { width: 100%; }

.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.home { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 1100px; margin: 0 auto; }
.form { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; }
.variant-desc { font-size: 0.85rem; color: var(--muted); min-height: 2.4em; }
.roomlist { display: flex; flex-direction: column; gap: 8px; }
.roomitem { display: flex; justify-content: space-between; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); gap: 8px; }
.pill { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: #0c120f; border: 1px solid var(--line); white-space: nowrap; }
.pill.a { border-color: var(--teamA); color: var(--teamA); }
.pill.b { border-color: var(--teamB); color: var(--teamB); }

/* sala */
.roomhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.code { font-size: 1.8rem; letter-spacing: 6px; font-weight: 800; color: var(--accent); }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.team h3 { font-size: 1rem; }
.team.a h3 { color: var(--teamA); }
.team.b h3 { color: var(--teamB); }
.seat { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; margin-bottom: 8px; gap: 8px; min-height: 50px; }
.seat.human { border-style: solid; background: var(--panel2); }
.seat.bot { border-style: solid; }
.seat.me { border-color: var(--accent); }
.seat .who { display: flex; gap: 8px; align-items: center; }
.seat .acts { display: flex; gap: 6px; }
.seat .acts button { padding: 4px 10px; font-size: 0.8rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3c4; display: inline-block; }
.dot.off { background: #a33; }

/* mesa */
.table-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.table {
  position: relative; width: 100%; max-width: 900px; aspect-ratio: 16 / 10;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt2) 75%);
  border-radius: 48% / 42%; border: 10px solid #3b2a17; box-shadow: inset 0 0 50px #0008, 0 10px 30px #0009;
}
.seatpos { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
.nameplate { background: #0009; padding: 4px 10px; border-radius: 99px; font-size: 0.85rem; border: 2px solid transparent; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.nameplate.ta { border-color: var(--teamA); }
.nameplate.tb { border-color: var(--teamB); }
.nameplate.turn { box-shadow: 0 0 0 3px var(--accent), 0 0 18px var(--accent); }
.badge { font-size: 0.68rem; background: var(--accent); color: #000; border-radius: 4px; padding: 0 4px; font-weight: 700; }
.backs { display: flex; }
.backs .card { margin-left: -22px; }
.backs .card:first-child { margin-left: 0; }

.played { position: absolute; transform: translate(-50%, -50%); z-index: 1; transition: all 0.25s; }
.played.win .card { box-shadow: 0 0 0 3px var(--accent), 0 0 18px var(--accent); }
.handinfo { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 6px 16px; }
.handinfo .label { font-size: 0.75rem; color: var(--muted); }
.center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 0; pointer-events: none; }
.center .label { font-size: 0.75rem; color: #cfe; opacity: 0.8; }
.value { font-weight: 800; font-size: 1.1rem; background: #0008; padding: 3px 12px; border-radius: 99px; }
.tricks { display: flex; gap: 6px; }
.tricks span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff6; }
.tricks .ta { background: var(--teamA); }
.tricks .tb { background: var(--teamB); }
.tricks .tie { background: #bbb; }

.card {
  width: 62px; height: 90px; border-radius: 8px; background: #fffdf7; color: #111;
  display: flex; flex-direction: column; justify-content: space-between; padding: 4px 6px;
  box-shadow: 0 2px 6px #0007; font-weight: 800; user-select: none; position: relative; flex-shrink: 0;
}
.card.red { color: var(--red); }
.card .r { font-size: 1.1rem; line-height: 1; }
.card .s { font-size: 1.7rem; align-self: center; line-height: 1; }
.card .r2 { transform: rotate(180deg); font-size: 1.1rem; line-height: 1; }
.card.manilha::after { content: '★'; position: absolute; top: 3px; right: 5px; color: var(--accent); font-size: 0.8rem; text-shadow: 0 0 2px #000; }
.card.back { background: repeating-linear-gradient(45deg, #7a1d2a, #7a1d2a 6px, #93283a 6px, #93283a 12px); border: 3px solid #fff; }
.card.small { width: 40px; height: 58px; padding: 2px 4px; }
.card.small .r, .card.small .r2 { font-size: 0.8rem; }
.card.small .s { font-size: 1.1rem; }
.card.tiny { width: 30px; height: 44px; border-width: 2px; }

.myhand { display: flex; gap: 12px; justify-content: center; min-height: 130px; align-items: flex-end; }
.myhand .card { width: 84px; height: 122px; cursor: default; transition: transform 0.12s; }
.myhand .card .r, .myhand .card .r2 { font-size: 1.4rem; }
.myhand .card .s { font-size: 2.4rem; }
.myhand .card.playable { cursor: pointer; }
.myhand .card.playable:hover { transform: translateY(-14px); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 44px; align-items: center; }
.actions .bet { background: #5a1414; border-color: #b33; font-weight: 800; }
.actions .accept { background: #16522d; border-color: #2c9; font-weight: 700; }
.status { text-align: center; min-height: 1.5em; color: #ffd27a; font-weight: 600; }
.partners { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.partners .who { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.partners .cards { display: flex; gap: 4px; }

.scores { display: flex; gap: 8px; align-items: center; font-weight: 800; }
.score { padding: 4px 12px; border-radius: 8px; background: var(--panel2); border: 2px solid; }
.score.a { border-color: var(--teamA); }
.score.b { border-color: var(--teamB); }

.overlay { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay .card-panel { max-width: 520px; text-align: center; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #7a1d2a; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 40; }
#toast.show { opacity: 1; }
#shout { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.5); font-size: 4.5rem; font-weight: 900; color: var(--accent); text-shadow: 0 4px 0 #6b0f17, 0 0 30px #000; opacity: 0; pointer-events: none; z-index: 30; transition: all 0.25s; white-space: nowrap; }
#shout.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  aside { width: 100%; max-height: 260px; position: static; border-left: none; border-top: 1px solid var(--line); }
  .card { width: 44px; height: 64px; }
  .card .s { font-size: 1.2rem; }
  .card .r, .card .r2 { font-size: 0.85rem; }
  .myhand .card { width: 70px; height: 100px; }
  .nameplate { font-size: 0.72rem; }
  .teams { grid-template-columns: 1fr; }
  #shout { font-size: 3rem; }
}

/* ---------- v2: parceiros, zueira, sinais, dicas ---------- */
:root { --ally: #4aa3ff; --enemy: #ff6b6b; }
button.icon { padding: 6px 10px; }
.pill.zueira { border-color: #f2b632; color: #f2b632; }
.score.ally { border-color: var(--ally); }
.score.enemy { border-color: var(--enemy); }
.nameplate.ally { border-color: var(--ally); background: #0b2a4acc; }
.nameplate.enemy { border-color: var(--enemy); background: #4a0b0bcc; }
.role { font-size: 0.7rem; padding: 0 6px; border-radius: 99px; }
.role.ally { background: var(--ally); color: #001; font-weight: 700; }
.role.enemy { opacity: 0.8; }
.tricks .ally { background: var(--ally); }
.tricks .enemy { background: var(--enemy); }
.teamline { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 0.9rem; }
.teamline .ally { color: var(--ally); }
.teamline .enemy { color: var(--enemy); }

.bubble {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #fff; color: #111; padding: 6px 12px; border-radius: 14px; font-weight: 700; font-size: 0.85rem;
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 12px #000a;
  animation: pop 0.25s ease-out; z-index: 5;
}
.bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
.bubble.grito, .bubble.truco { background: var(--accent); font-size: 1rem; }
.bubble.sinal { background: #d9f0ff; }
.seatpos { position: absolute; }
@keyframes pop { from { transform: translateX(-50%) scale(0.4); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.table.shake { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px) rotate(-0.4deg); }
  40% { transform: translate(6px, -3px) rotate(0.4deg); }
  60% { transform: translate(-4px, 2px); }
  80% { transform: translate(3px, -1px); }
}

.card.hint { box-shadow: 0 0 0 3px #5df28a, 0 0 22px #5df28a; transform: translateY(-8px); }
.actions button.hint { box-shadow: 0 0 0 3px #5df28a, 0 0 14px #5df28a; }
.hintbox { background: #123d22; border: 1px solid #2c9; border-radius: 10px; padding: 8px 14px; max-width: 720px; text-align: center; }
.ranking { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; font-size: 0.85rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
.ranking .label { color: var(--muted); margin-right: 4px; }
.card.mini { width: 26px; height: 36px; padding: 1px 3px; border-radius: 4px; }
.card.mini .r { font-size: 0.65rem; }
.card.mini .s { font-size: 0.8rem; }
.card.mini .r2 { display: none; }
.card.mini.manilha::after { display: none; }
.rk { font-weight: 800; padding: 0 2px; }
.gt { color: var(--muted); }

.reactions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.react { padding: 5px 10px; font-size: 0.82rem; border-radius: 99px; }
.react.tapa { background: #6b3b10; border-color: #f2b632; font-weight: 800; }
.signals { width: 100%; max-width: 900px; padding: 12px; }
.sighead { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.sigbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.sig { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sig small { color: var(--muted); font-size: 0.7rem; }
.siglist { margin: 10px 0 0; padding-left: 18px; font-size: 0.88rem; }
.siglist .ally { color: var(--ally); }
.siglist .enemy { color: var(--enemy); }

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.optgroup { display: flex; flex-direction: column; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.optgroup h4 { margin: 0; font-size: 0.85rem; color: var(--accent); }
details summary { cursor: pointer; color: var(--accent); margin-bottom: 8px; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.level { text-align: left; padding: 10px; }
.level.on { border-color: var(--accent); background: #3a2d0b; }
.home > section { align-self: start; }
.table { width: min(100%, 900px, calc(46vh * 1.6)); }

/* ---------- v3: IA por bot, microfone, falas gravadas ---------- */
.role.ai { background: #3a2a5c; color: #d8c8ff; }
.ptt { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pttbtn { font-weight: 800; padding: 10px 18px; border-radius: 99px; background: #2b1d4a; border-color: #8a6cff; user-select: none; touch-action: none; }
.pttbtn.rec, .recbtn.rec { background: #8a1020; border-color: #ff4d5e; animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #ff4d5e33; } }
.recbtn { user-select: none; touch-action: none; }
.voices { max-width: 620px; width: 95vw; text-align: left !important; max-height: 90vh; overflow-y: auto; }
.voices table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.voices td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.vacts { display: flex; gap: 6px; justify-content: flex-end; }
.warn { color: #ffb36b; }
#cfg { gap: 10px; }
.autoinfo { background: #1b2a3a; border: 1px solid #2f5a80; border-radius: 10px; padding: 8px 12px; margin: 0; }
#cfg.form { display: flex; flex-direction: column; justify-content: flex-start; }

/* ---------- v4: mesa cabe na tela (notebook e celular) ---------- */
body.ingame { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.ingame .topbar { padding: 6px 12px; flex: none; }
body.ingame .layout { flex: 1; min-height: 0; flex-direction: row; }
body.ingame main { padding: 6px 10px; display: flex; min-height: 0; }
body.ingame aside { max-height: none; height: 100%; position: static; }
.table-wrap { width: 100%; height: 100%; gap: 6px; min-height: 0; }
.inforow { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center; font-size: 0.85rem; flex: none; }
.inforow .teamtxt { color: var(--ally); font-weight: 600; }
.inforow .handinfo { padding: 2px 10px; gap: 8px; }
.inforow .value { font-size: 0.95rem; padding: 1px 10px; }
.inforow .tricks span { width: 11px; height: 11px; }
.inforow .ranking { padding: 2px 10px; gap: 3px; font-size: 0.8rem; margin: 0; }
.tablebox { flex: 1; min-height: 120px; width: 100%; display: flex; align-items: center; justify-content: center; container-type: size; }
.tablebox .table { width: min(100cqw, 160cqh, 900px); max-width: none; aspect-ratio: 16 / 10; border-width: 8px; }
@container (max-aspect-ratio: 1/1) {
  .tablebox .table { aspect-ratio: 4 / 5; width: min(100cqw, 80cqh); border-radius: 44% / 34%; }
}
.bottom { position: relative; flex: none; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.statusrow { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: center; }
.statusrow .status { margin: 0; }
.statusrow .hintbox { margin: 0; padding: 4px 12px; font-size: 0.85rem; }
.actions { margin: 0; min-height: 0; }
.handrow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; width: 100%; max-width: 900px; }
.handrow .tools { display: flex; gap: 6px; align-items: flex-end; }
.handrow .tools:first-child { justify-content: flex-end; }
.myhand { min-height: 0; gap: 10px; }
.myhand .card { height: clamp(74px, 14dvh, 122px); width: auto; aspect-ratio: 84 / 122; }
.myhand .card .s { font-size: clamp(1.4rem, 3.2dvh, 2.4rem); }
.myhand .card .r, .myhand .card .r2 { font-size: clamp(0.95rem, 2dvh, 1.4rem); }
.tool { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; font-size: 1.3rem; line-height: 1; border-radius: 12px; min-width: 54px; user-select: none; touch-action: none; }
.tool .lbl { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.tool.on { border-color: var(--accent); background: #3a2d0b; }
.tool.tapa { border-color: #f2b632; }
.tool.pttbtn { background: #2b1d4a; border-color: #8a6cff; }
.dotbadge { position: absolute; top: -6px; right: -6px; background: var(--ally); color: #001; font-style: normal; font-size: 0.7rem; font-weight: 800; border-radius: 99px; padding: 1px 6px; }
.pop { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: min(560px, 96vw); max-height: 55dvh; overflow-y: auto; z-index: 15; background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 12px; box-shadow: 0 10px 40px #000c; display: flex; flex-direction: column; gap: 8px; }
.pophead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.pop .reactions { justify-content: flex-start; }
.pop .sigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pop .siglist { margin: 0; padding-left: 18px; font-size: 0.85rem; }
.drawerbtn { display: none; }

/* telas baixas (notebook): cartas da mesa menores */
@media (max-height: 820px) {
  body.ingame .card { width: 40px; height: 58px; padding: 2px 4px; }
  body.ingame .card .s { font-size: 1.1rem; }
  body.ingame .card .r, body.ingame .card .r2 { font-size: 0.8rem; }
  body.ingame .card.tiny { width: 24px; height: 34px; }
  body.ingame .card.mini { width: 22px; height: 30px; }
  body.ingame .played .card { width: 52px; height: 76px; }
  body.ingame .played .card .s { font-size: 1.5rem; }
  body.ingame .nameplate { font-size: 0.75rem; padding: 2px 8px; }
}

/* painel lateral vira gaveta em telas estreitas */
@media (max-width: 1100px) {
  body.ingame .drawerbtn { display: inline-flex; }
  body.ingame aside { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 90vw); z-index: 25; transform: translateX(100%); transition: transform 0.2s; border-left: 1px solid var(--line); border-top: none; box-shadow: -10px 0 30px #000a; }
  body.ingame.drawer-open aside { transform: none; }
}

/* celular */
@media (max-width: 640px) {
  .topbar .brand .muted, #topinfo .lbl, #topinfo .pill { display: none; }
  .brand { font-size: 1rem; }
  #topinfo { gap: 4px; }
  #topinfo button { padding: 4px 8px; }
  .score { padding: 2px 8px; }
  body.ingame main { padding: 4px; }
  .inforow { font-size: 0.75rem; gap: 4px 8px; }
  .inforow .teamtxt { display: none; }
  .inforow .ranking .commons { display: none; }
  .handrow { grid-template-columns: auto 1fr auto; gap: 4px; }
  .tool { min-width: 42px; padding: 5px 6px; font-size: 1.15rem; }
  .tool .lbl { display: none; }
  .myhand { gap: 6px; }
  .myhand .card { height: clamp(70px, 13dvh, 100px); }
  .statusrow .hintbox { font-size: 0.78rem; }
  .actions button { padding: 6px 10px; }
  body.ingame .nameplate { font-size: 0.68rem; }
  .role.ai { display: none; }
  #shout { font-size: 2.4rem; }
}
/* v4 ajustes: mão sempre grande o bastante; celular sem rolagem lateral */
body.ingame { overflow-x: hidden; }
body.ingame .myhand .card { width: auto; height: clamp(74px, 14dvh, 122px); padding: 4px 6px; }
body.ingame .myhand .card .s { font-size: clamp(1.4rem, 3.2dvh, 2.4rem); }
body.ingame .myhand .card .r, body.ingame .myhand .card .r2 { font-size: clamp(0.95rem, 2dvh, 1.4rem); }
@media (max-width: 640px) {
  body.ingame .brand { display: none; }
  body.ingame .topbar { justify-content: center; }
  .handrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .handrow .myhand { order: -1; width: 100%; }
  body.ingame .myhand .card { height: clamp(70px, 12dvh, 100px); }
  .handrow .tools:first-child { justify-content: center; }
  .pop { width: calc(100vw - 16px); }
}
.seatpos.up .bubble { bottom: auto; top: calc(100% + 8px); }
.seatpos.up .bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #fff; }
.seatpos.up .bubble.grito::after, .seatpos.up .bubble.truco::after { border-bottom-color: var(--accent); }
.drawerclose { display: none; flex: 0 0 44px; }
@media (max-width: 1100px) { body.ingame .drawerclose { display: block; } }

/* falas: várias gravações e modo sequência */
.small { font-size: 0.75rem; }
.voices td { vertical-align: middle; padding: 6px 4px; }
.voices .vacts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.take { display: inline-flex; }
.take button { padding: 4px 8px; font-size: 0.8rem; }
.take button:first-child { border-radius: 8px 0 0 8px; }
.take button:last-child { border-radius: 0 8px 8px 0; border-left: none; color: var(--muted); }
.voices.seq { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; width: min(520px, 94vw); }
.seqphrase { font-size: 2.6rem; font-weight: 900; color: var(--accent); }
.bigrec { font-size: 1.3rem; font-weight: 800; padding: 22px 34px; border-radius: 99px; background: #2b1d4a; border-color: #8a6cff; user-select: none; touch-action: none; }
.bigrec.rec { background: #8a1020; border-color: #ff4d5e; animation: pulse 0.9s infinite; }
.react.myvoice { border-color: #8a6cff; }
.voices { max-height: 90dvh; overflow-y: auto; width: min(640px, 96vw); }
.voices.seq .row button { white-space: nowrap; }

/* gravador de falas v2: microfone, medidor, ouvir antes de salvar */
.micpanel { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; justify-content: center; width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.micpanel label { flex: 1 1 220px; }
.micpanel select { width: 100%; }
.meter { flex: 1 1 160px; height: 14px; border-radius: 99px; background: #0006; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; width: 0; transition: width 0.06s; }
.meter i.low { background: #666; }
.meter i.ok { background: #3ccf6b; }
.meter i.hot { background: #ff4d5e; }
.voices .warn { background: #4a1d0b; border: 1px solid #ff9a4d; border-radius: 10px; padding: 8px 12px; color: #ffd2b0; text-align: left; }
.okmsg { color: #7dff9b; margin: 0; }
.row.rowc { justify-content: center; flex-wrap: wrap; }
.take.mute button { border-color: #ff9a4d; color: #ffb27a; }
.takes { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; font-size: 0.85rem; color: var(--muted); }
.voices.seq > * { flex-shrink: 0; }
.voices .row.rowc > * { flex: 0 0 auto; }
.voices.seq .micpanel { text-align: left; }

/* v5: nomes das laterais não saem da tela */
.seatpos.edge-l { transform: translate(-6px, -50%); align-items: flex-start; }
.seatpos.edge-r { transform: translate(calc(-100% + 6px), -50%); align-items: flex-end; }
body.ingame .nameplate { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* v5: celular deitado (tela baixa e larga): mesa à esquerda, mão e botões à direita */
@media (max-height: 540px) and (min-aspect-ratio: 4/3) {
  body.ingame .brand, body.ingame #topinfo .lbl, body.ingame #topinfo .pill { display: none; }
  body.ingame .topbar { padding: 2px 6px; flex-wrap: nowrap; justify-content: center; }
  body.ingame #topinfo { flex-wrap: nowrap; gap: 4px; }
  body.ingame #topinfo button { padding: 3px 8px; }
  body.ingame .score { padding: 1px 8px; }
  body.ingame main { padding: 2px 4px; }
  body.ingame .table-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 42%); grid-template-rows: auto minmax(0, 1fr); gap: 2px 8px; align-items: stretch; }
  .inforow { grid-column: 1; grid-row: 1; font-size: 0.72rem; gap: 2px 8px; }
  .inforow .teamtxt, .inforow .ranking .commons { display: none; }
  .tablebox { grid-column: 1; grid-row: 2; min-height: 0; height: 100%; }
  .bottom { grid-column: 2; grid-row: 1 / 3; justify-content: center; gap: 4px; min-height: 0; overflow-y: auto; }
  .statusrow .hintbox { font-size: 0.72rem; padding: 2px 8px; }
  .actions button { padding: 5px 10px; }
  .handrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .handrow .myhand { order: -1; width: 100%; justify-content: center; gap: 6px; }
  body.ingame .myhand .card { height: clamp(60px, 30dvh, 110px); }
  .handrow .tools:first-child { justify-content: center; }
  .tool { min-width: 40px; padding: 4px 6px; font-size: 1.1rem; }
  .tool .lbl { display: none; }
  .pop { position: fixed; bottom: 8px; left: auto; right: 8px; transform: none; width: min(420px, 60vw); max-height: 85dvh; }
}

/* v6: altura medida pelo JS (Samsung Internet esconde o fim da página atrás da barra de baixo) */
body.ingame { height: var(--app-h, 100dvh); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
