:root {
  --felt: #0f4a33;
  --felt-dark: #0a3324;
  --felt-light: #16603f;
  --ink: #f3efe2;
  --muted: #a9c2b4;
  --gold: #e8b73c;
  --gold-dark: #b98a16;
  --red: #c8352b;
  --card: #fffdf7;
  --card-ink: #1d1d1f;
  --danger: #e2574c;
  --ok: #4cc38a;
  --radius: 12px;
  --cw: clamp(44px, 10.5vw, 72px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 30%, var(--felt-light), var(--felt) 55%, var(--felt-dark));
  background-attachment: fixed;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; }

/* ---------- botões ---------- */
.btn {
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); border-radius: 10px;
  padding: 10px 16px; cursor: pointer; font-weight: 600; transition: transform .08s, background .15s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #2b1d00; }
.btn.primary:hover:not(:disabled) { background: #f3c552; }
.btn.gold { background: linear-gradient(180deg, #f6d36b, var(--gold-dark)); color: #2b1d00; border: 0; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }

/* ---------- login ---------- */
#screen-auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-box { width: 100%; max-width: 360px; text-align: center; }
.logo { font-family: Georgia, "Times New Roman", serif; font-size: 52px; font-weight: 700; letter-spacing: -1px; }
.logo span { color: var(--gold); }
.logo.small { font-size: 26px; }
.tagline { color: var(--muted); margin: 4px 0 24px; }
.tabs { display: flex; background: rgba(0,0,0,.25); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tab.active { background: rgba(255,255,255,.12); color: var(--ink); }
form label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 12px; border-radius: 10px; font: inherit; font-size: 16px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); color: var(--ink);
}
select option { color: #000; }
.form-error { color: #ffb0a8; min-height: 20px; font-size: 14px; margin: 4px 0 8px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- lobby ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: rgba(0,0,0,.2); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.me-info { display: flex; align-items: center; gap: 8px; }
.chips { background: rgba(0,0,0,.35); padding: 6px 12px; border-radius: 99px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.chips::before { content: "● "; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 99px; font-weight: 700; }
.badge.premium { background: var(--gold); color: #2b1d00; }
.lobby { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; }
.hello { font-size: 18px; }
.bonus-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.bonus { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; text-align: left; column-gap: 10px; padding: 12px; }
.btn.bonus span { grid-row: span 2; font-size: 24px; align-self: center; }
.btn.bonus small { color: var(--muted); font-weight: 400; }
.stakes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stake { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stake b { font-size: 20px; }
.stake .meta { color: var(--muted); font-size: 14px; }
.stake .btn { margin-top: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 10px; }
.section-head h2 { margin: 0; }
.rooms { display: grid; gap: 8px; }
.room { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 12px 14px; }
.room.mine { border-color: rgba(232,183,60,.5); }
.room .info { flex: 1; min-width: 0; }
.room .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.room .count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.room.playing { opacity: .55; }
.rooms .empty { color: var(--muted); font-size: 14px; padding: 14px; text-align: center; border: 1px dashed rgba(255,255,255,.2); border-radius: var(--radius); }
.modal form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal .hint { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.premium-card { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(232,183,60,.25), rgba(232,183,60,.05)); border: 1px solid rgba(232,183,60,.4); }
.premium-card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ranking { padding-left: 24px; margin: 0; }
.ranking li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; justify-content: space-between; }
.ranking li span { color: var(--gold); }

/* ---------- anúncios ---------- */
.ad-slot { margin: 24px auto 0; max-width: 728px; min-height: 90px; border: 1px dashed rgba(255,255,255,.25); border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); font-size: 12px; background: rgba(0,0,0,.15); overflow: hidden; }
.ad-slot.slim { min-height: 50px; margin: 8px 16px 12px; }
.ad-slot.slim:empty, .ad-slot:empty { display: none; }
body.premium .ad-only { display: none !important; }

/* ---------- cartas ---------- */
.card {
  width: var(--cw); aspect-ratio: 5 / 7; background: var(--card); color: var(--card-ink); border-radius: calc(var(--cw) * .1);
  box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2); position: relative; user-select: none; flex: none;
  font-family: Georgia, "Times New Roman", serif; display: block;
}
.card .r { position: absolute; top: 4%; left: 9%; font-size: calc(var(--cw) * .3); font-weight: 700; line-height: 1; }
.card .s1 { position: absolute; top: 34%; left: 9%; font-size: calc(var(--cw) * .24); line-height: 1; }
.card .s { position: absolute; bottom: 6%; right: 9%; font-size: calc(var(--cw) * .5); line-height: 1; }
.card.red { color: var(--red); }
.card.wild::after { content: "★"; position: absolute; top: 3%; right: 7%; color: var(--gold-dark); font-size: calc(var(--cw) * .24); }
.card.wild { box-shadow: 0 0 0 2px var(--gold), 0 2px 8px rgba(0,0,0,.3); }
.card.back { background: repeating-linear-gradient(45deg, #8e1f1a 0 6px, #a8281f 6px 12px); border: 3px solid #fff; }
.card.empty { background: transparent; border: 2px dashed rgba(255,255,255,.25); box-shadow: none; }
.card.mini { --cw: 34px; }
.card.mini .s1 { display: none; }

/* ---------- mesa ---------- */
#screen-table { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.tb-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(0,0,0,.25); }
.tb-info { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; flex: 1; font-size: 14px; color: var(--muted); }
.tb-info b { color: var(--ink); }
.tb-wild { font-size: 13px; background: rgba(232,183,60,.18); border: 1px solid rgba(232,183,60,.5); padding: 4px 10px; border-radius: 99px; color: var(--gold); white-space: nowrap; }
.tb-wild:empty { display: none; }

.opponents { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; justify-content: center; flex-wrap: wrap; }
.opp { background: rgba(0,0,0,.25); border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; min-width: 120px; flex: 1; max-width: 200px; transition: border-color .2s; }
.opp.turn { border-color: var(--gold); box-shadow: 0 0 16px rgba(232,183,60,.35); }
.opp.out { opacity: .45; }
.opp .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp .sub { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }
.opp .tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 99px; background: rgba(255,255,255,.12); }
.tag.warn { background: rgba(226,87,76,.35); }
.tag.dealer { background: var(--gold); color: #2b1d00; }
.backs { display: flex; margin-top: 6px; height: 22px; }
.backs i { width: 14px; height: 20px; border-radius: 3px; background: #a8281f; border: 1.5px solid #fff; margin-right: -8px; }

.board { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 10px; }
.piles { display: flex; justify-content: center; gap: 18px; align-items: flex-end; }
.pile { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; border-radius: 12px; padding: 4px; transition: box-shadow .2s; }
.pile.vira { cursor: default; opacity: .9; }
.pile.vira .card { transform: rotate(8deg); }
.pile.hint { box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(232,183,60,.4); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 4px rgba(232,183,60,.2); } }
.pile-label { font-size: 12px; color: var(--muted); }
.melds { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 40px; }
.meld { background: rgba(0,0,0,.18); border-radius: 10px; padding: 6px 8px 6px 20px; border: 2px solid transparent; }
.meld .cards { display: flex; }
.meld .card { --cw: clamp(32px, 7vw, 46px); margin-left: calc(var(--cw) * -.45); }
.meld .card .s1 { display: none; }
.meld .owner { font-size: 10px; color: var(--muted); margin-bottom: 3px; margin-left: -12px; }
.meld.target { border-color: var(--gold); cursor: pointer; }
.meld.target:hover { background: rgba(232,183,60,.15); }
.melds .empty-msg { color: var(--muted); font-size: 13px; align-self: center; }

.me-zone { padding: 6px 12px 10px; background: linear-gradient(0deg, rgba(0,0,0,.3), transparent); }
.status-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; min-height: 20px; }
.status-row #status-text { font-weight: 600; }
.status-row.my-turn #status-text { color: var(--gold); }
.my-score { color: var(--muted); white-space: nowrap; }
.timer { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; margin: 6px 0 10px; overflow: hidden; }
#timer-bar { height: 100%; width: 0; background: var(--gold); transition: width .25s linear; }
#timer-bar.low { background: var(--danger); }
.hand { display: flex; justify-content: center; padding: 12px 0 6px calc(var(--cw) * .32); min-height: calc(var(--cw) * 1.4 + 18px); }
.hand .card { margin-left: calc(var(--cw) * -.32); cursor: grab; transition: transform .12s; touch-action: none; }
.hand .card.placeholder { opacity: .25; }
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; transform: translate(-50%, -60%) rotate(-4deg) scale(1.08); box-shadow: 0 14px 30px rgba(0,0,0,.45); margin: 0 !important; }
.drop-ok { box-shadow: 0 0 0 3px #4aa3ff, 0 0 18px rgba(74,163,255,.5) !important; }
.btn.bater { background: #c8352b; border-color: #c8352b; color: #fff; }
.btn.bater:hover:not(:disabled) { background: #dd4337; }
.tag.furou, .furou-badge { background: #c8352b; color: #fff; font-weight: 700; }
.opp.furou { border-color: #c8352b; }
.furou-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.hand .card:hover { transform: translateY(-4px); }
.hand .card.sel { transform: translateY(-14px); box-shadow: 0 0 0 3px #4aa3ff, 0 6px 14px rgba(0,0,0,.35); }
.hand .card.new { animation: drawIn .35s ease-out; }
@keyframes drawIn { from { transform: translateY(-30px); opacity: 0; } }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.log { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; min-height: 16px; }

/* ---------- sobreposições ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5,25,17,.82); display: grid; place-items: center; z-index: 20; padding: 16px; overflow-y: auto; }
.panel { background: #12402e; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel h3 { margin: 0 0 4px; font-size: 22px; }
.panel .muted { color: var(--muted); font-size: 14px; }
.seat-list { list-style: none; padding: 0; margin: 14px 0; }
.seat-list li { padding: 8px 10px; background: rgba(0,0,0,.2); border-radius: 8px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.seat-list li.empty { color: var(--muted); font-style: italic; }
.code { font-family: ui-monospace, monospace; font-size: 32px; letter-spacing: .2em; color: var(--gold); text-align: center; margin: 8px 0; }
.res-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.res-table td, .res-table th { padding: 6px 4px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
.res-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.res-table .num { text-align: right; }
.res-table tr.win td { color: var(--gold); font-weight: 700; }
.res-table tr.bust td { color: #ffb0a8; }
.res-hand { display: flex; flex-wrap: wrap; gap: 2px; }
.res-hand .card { --cw: 22px; }
.res-hand .card .s1, .res-hand .card .s { display: none; }
.res-hand .card .r { font-size: 10px; }
.panel .row { display: flex; gap: 8px; margin-top: 14px; }
.panel .row .btn { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.check input { width: auto; margin: 0; }
.big-win { font-size: 40px; text-align: center; margin: 10px 0; }
.banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #2b1d00; color: var(--gold); border: 1px solid var(--gold);
  padding: 10px 14px; border-radius: 12px; z-index: 15; display: flex; gap: 10px; align-items: center; font-size: 14px; width: max-content; max-width: calc(100% - 32px); }

.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--danger); text-align: center; padding: 6px; font-size: 14px; z-index: 50; }
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; width: max-content; max-width: calc(100% - 32px); }
.toast { background: #1b1b1b; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.4); font-size: 14px; animation: drawIn .2s; }
.toast.error { background: #6e1d17; }
.toast.ok { background: #165a3a; }
.toast.warn { background: #5b4410; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: #12402e; border-radius: 16px; padding: 22px; max-width: 400px; width: 100%; border: 1px solid rgba(255,255,255,.12); }
.modal h3 { margin-top: 0; }
.modal ul { padding-left: 20px; color: var(--muted); }
.ad-demo { height: 160px; border-radius: 10px; background: repeating-linear-gradient(135deg, #1f5a43 0 14px, #1a4f3b 14px 28px); display: grid; place-items: center; font-size: 40px; font-weight: 700; margin: 12px 0; }

@media (max-width: 560px) {
  .bonus-row { grid-template-columns: 1fr; }
  .opp { min-width: 96px; padding: 6px 8px; }
  .tb-info { gap: 8px; font-size: 13px; }
  .piles { gap: 12px; }
}

/* ---------- chat e voz ---------- */
.btn.icon { padding: 8px 10px; font-size: 18px; line-height: 1; position: relative; }
.btn.icon.on { background: rgba(76,195,138,.25); border-color: var(--ok); }
.btn.icon .count { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.chat-panel { position: fixed; right: 12px; bottom: 12px; width: min(360px, calc(100% - 24px)); height: min(460px, 70vh); z-index: 30;
  background: #10392a; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 14px; line-height: 1.35; word-wrap: break-word; }
.chat-msg .who { font-weight: 700; color: var(--gold); cursor: pointer; margin-right: 6px; }
.chat-msg.mine .who { color: #8fd3ff; }
.chat-msg .time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto; }
.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.chat-quick button { flex: none; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); border-radius: 99px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.chat-form { display: flex; gap: 6px; padding: 8px 10px 10px; }
.chat-form input { margin: 0; padding: 10px; }
.chat-peek { position: fixed; right: 12px; top: 64px; z-index: 25; max-width: min(320px, calc(100% - 24px)); background: rgba(0,0,0,.8);
  padding: 8px 12px; border-radius: 12px; font-size: 14px; cursor: pointer; animation: drawIn .2s; }
.chat-peek b { color: var(--gold); }
.voice-bar { position: fixed; left: 12px; top: 64px; z-index: 25; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.75);
  padding: 6px 8px 6px 12px; border-radius: 99px; font-size: 13px; max-width: calc(100% - 24px); flex-wrap: wrap; }
.voice-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: background .1s, box-shadow .1s; }
.voice-dot.speaking { background: var(--ok); box-shadow: 0 0 0 4px rgba(76,195,138,.3); }
.voice-bar.muted .voice-dot { background: var(--danger); }
.opp.speaking { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok), 0 0 18px rgba(76,195,138,.5); }
.tag.voice { background: rgba(76,195,138,.3); }
.tag.muted { background: rgba(226,87,76,.35); }
/* A barra da mesa (chat, voz, sair) fica acessível também por cima das telas de espera e de resultado */
.tb-top { position: relative; z-index: 22; }
.overlay { padding-top: 64px; }

/* =====================================================================
   Visual da mesa (imersão e acabamento)
   ===================================================================== */

/* ---- cartas: canto com valor e naipe sempre visível ---- */
.card {
  background: linear-gradient(160deg, #fffefa 0%, #f6f1e4 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.35), 0 3px 10px rgba(0,0,0,.22);
}
.card .r { top: 5%; left: 8%; font-size: calc(var(--cw) * .28); letter-spacing: -.02em; }
.card .s1 { top: 30%; left: 9%; font-size: calc(var(--cw) * .22); display: block; }
.card .s { bottom: 7%; right: 9%; font-size: calc(var(--cw) * .46); }
.card.wild { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(232,183,60,.55), 0 3px 10px rgba(0,0,0,.25); }

/* verso: vinho com losangos dourados e moldura */
.card.back {
  background:
    linear-gradient(45deg, rgba(232,183,60,.22) 25%, transparent 25%, transparent 75%, rgba(232,183,60,.22) 75%) 0 0 / 10px 10px,
    linear-gradient(45deg, rgba(232,183,60,.22) 25%, transparent 25%, transparent 75%, rgba(232,183,60,.22) 75%) 5px 5px / 10px 10px,
    radial-gradient(circle at 50% 50%, #8e1c22, #5c0d14);
  border: 3px solid #f4ead2;
  box-shadow: inset 0 0 0 2px #c9a24a, 0 2px 8px rgba(0,0,0,.35);
}

/* ---- mesa de feltro com borda de madeira e filete dourado ---- */
.felt {
  position: relative; margin: 10px 12px 4px; padding: 14px 12px 16px; border-radius: 28px;
  background: radial-gradient(ellipse at 50% 40%, #1f8a5c 0%, #136943 45%, #0b4630 100%);
  box-shadow: 0 0 0 8px #5b3a1f, 0 0 0 10px #c9a24a, 0 0 0 12px #3d2612, inset 0 0 70px rgba(0,0,0,.45), 0 18px 40px rgba(0,0,0,.45);
  display: grid; grid-template-columns: 1fr; grid-template-areas: "opps" "center"; gap: 10px; flex: 1;
}
.felt::after { /* textura sutil do feltro */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .18;
  background: repeating-radial-gradient(circle at 30% 20%, rgba(255,255,255,.06) 0 1px, transparent 1px 3px);
}
.felt .opponents { grid-area: opps; padding: 0; }
.felt .board { grid-area: center; padding: 0; }

/* ---- adversários: avatar, nome e cartas na mão (leque de versos) ---- */
.opp { background: rgba(0,0,0,.28); backdrop-filter: blur(2px); display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.opp .avatar { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(145deg, #f3d27a, #b98a16); color: #2b1d00; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.opp.out .avatar { filter: grayscale(1); }
.opp .fan { grid-column: 1 / -1; position: relative; height: 40px; margin-top: 6px; display: flex; justify-content: center; }
.opp .fan i { width: 22px; height: 31px; margin: 0 -8px; border-radius: 3px; transform-origin: 50% 120%;
  transform: rotate(var(--r)) translateY(var(--y)); border: 1.5px solid #f4ead2; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  background: radial-gradient(circle, #8e1c22, #5c0d14); }
.opp .tags { grid-column: 1 / -1; }
.opp .backs { display: none; }

/* ---- monte com profundidade ---- */
.stock-stack { position: relative; }
.stock-stack .card.back { position: relative; z-index: 2; }

/* ---- lixo: últimas cartas visíveis por baixo, sem poder selecionar ---- */
#discard-card { position: relative; }
#discard-card .recent { position: absolute; left: 0; top: 0; pointer-events: none; filter: blur(.6px) saturate(.8); opacity: .62; }
#discard-card .top { position: relative; z-index: 2; }

/* ---- jogos baixados: menos sobreposição, canto sempre legível ---- */
.meld { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); padding: 6px 10px 8px 22px; }
.meld .card { --cw: clamp(36px, 7.6vw, 50px); margin-left: calc(var(--cw) * -.38); }
.meld .card .s1 { display: block; top: 32%; }
.meld .card .r { font-size: calc(var(--cw) * .3); }

/* ---- sua mão em leque ---- */
.hand { padding-top: 22px; perspective: 800px; }
.hand .card { transform-origin: 50% 130%; transform: translateY(var(--arc, 0px)) rotate(var(--rot, 0deg)); transition: transform .14s ease; }
.hand .card:hover { transform: translateY(calc(var(--arc, 0px) - 8px)) rotate(var(--rot, 0deg)); }
.hand .card.sel { transform: translateY(calc(var(--arc, 0px) - 20px)) rotate(var(--rot, 0deg)); }
.me-zone { background: linear-gradient(0deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }

/* ---- telas largas: adversários sentados ao redor da mesa ---- */
@media (min-width: 820px) {
  .felt { margin: 14px auto 6px; width: min(1100px, calc(100% - 40px)); border-radius: 46% / 32%; padding: 26px 34px 30px;
    grid-template-columns: 180px 1fr 180px; grid-template-areas: "left top right" "left center right"; }
  .felt .opponents { display: contents; }
  .opp { max-width: 180px; min-width: 0; }
  .opp.seat-left { grid-area: left; align-self: center; }
  .opp.seat-top { grid-area: top; justify-self: center; width: 200px; max-width: 200px; }
  .opp.seat-right { grid-area: right; align-self: center; }
  .opp .fan { height: 48px; }
  .opp .fan i { width: 28px; height: 40px; margin: 0 -10px; }
}

/* ---- regras ---- */
.rules { max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.rules h4 { margin: 16px 0 6px; color: var(--gold); font-size: 15px; }
.rules ul { margin: 0; padding-left: 20px; color: var(--ink); }
.rules li { margin: 4px 0; font-size: 14px; line-height: 1.4; }
.modal.wide { max-width: 560px; }

/* ---- ajustes de som ---- */
.sound-opts { display: grid; gap: 8px; margin: 10px 0; }
.sound-opts .check { margin: 0; }

/* ---- barra da mesa compacta no celular ---- */
.tb-top { flex-wrap: nowrap; min-width: 0; }
.tb-info { min-width: 0; overflow: hidden; white-space: nowrap; }
.tb-top .btn { flex: none; }
.pile-label .wild-hint { display: block; color: var(--gold); font-size: 11px; text-align: center; }
@media (max-width: 560px) {
  .tb-top { gap: 4px; padding: 6px 8px; }
  .tb-info { flex-direction: column; gap: 0; font-size: 12px; line-height: 1.25; }
  #tb-round, #tb-wild { display: none; }
  .tb-top .btn.icon { padding: 6px 7px; font-size: 16px; }
  .tb-top #btn-leave { padding: 6px 10px; }
  .felt { margin: 8px 8px 4px; padding: 10px 8px 12px; border-radius: 22px; }
  .opp { padding: 6px; column-gap: 6px; }
  .opp .avatar { width: 26px; height: 26px; font-size: 13px; }
  .opp .name { font-size: 13px; }
  .opp .sub { font-size: 11px; flex-direction: column; margin-top: 0; }
  .opp .fan { height: 34px; }
}

/* ---- lixo: pilha natural, cartas sobrepostas e tortas ---- */
#discard { padding: 4px 14px; }
#discard-card { position: relative; width: var(--cw); aspect-ratio: 5 / 7; }
#discard-card .card { position: absolute; inset: 0; margin: 0; transition: transform .25s ease; }
#discard-card .card.under { pointer-events: none; filter: none; opacity: 1; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
#discard-card .card.top { z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,.35), 0 6px 14px rgba(0,0,0,.3); }
#discard-card .card.empty { position: relative; }

/* ---- ícones em linha ---- */
.ico { width: 20px; height: 20px; display: block; }
.btn.icon:has(.ico) { display: inline-grid; place-items: center; }
.btn.icon:hover .ico { color: var(--gold); }
.title-ico { display: flex; align-items: center; gap: 8px; }
.title-ico .ico { width: 24px; height: 24px; color: var(--gold); }
@media (max-width: 560px) { .tb-top .ico { width: 18px; height: 18px; } }
.tag .ico { display: inline-block; width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; }
#btn-chat .count { z-index: 1; }

/* ---- lobby: perfil, posição, treino e ranking ---- */
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; width: 36px; height: 36px; flex: none; }
.avatar-btn img, .av { width: 100%; height: 100%; border-radius: 50%; display: block; background: #f4ead2; box-shadow: 0 0 0 2px var(--gold); }
.hello-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rank-chip { border: 1px solid rgba(232,183,60,.5); background: rgba(232,183,60,.12); color: var(--ink); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.rank-chip b { color: var(--gold); }
.bot-game { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 16px; }
.bot-game-info { display: flex; flex-direction: column; gap: 4px; align-self: center; }
.bot-game-info b { font-size: 18px; }
.bot-game .meta { color: var(--muted); font-size: 13px; }
.bot-game label { font-size: 13px; color: var(--muted); margin: 0; }
.bot-game select { margin-top: 4px; }
.bot-game .btn.big { width: auto; padding: 12px 26px; }
@media (max-width: 700px) { .bot-game { grid-template-columns: 1fr 1fr; } .bot-game-info, .bot-game .btn.big { grid-column: 1 / -1; } .bot-game .btn.big { width: 100%; } }
.ranking { list-style: none; padding: 0; }
.ranking li { display: grid; grid-template-columns: 34px 30px 1fr auto; align-items: center; gap: 10px; }
.ranking .pos { color: var(--muted); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ranking .av { width: 28px; height: 28px; box-shadow: none; }
.ranking li.me { background: rgba(232,183,60,.12); border-radius: 8px; padding-left: 4px; padding-right: 8px; }
.rank-search { display: flex; gap: 8px; margin: 10px 0; }
.rank-search input { margin: 0; }
.rank-list { max-height: 55vh; overflow-y: auto; }
.rank-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ---- perfil ---- */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.profile-head .big-av { width: 88px; height: 88px; flex: none; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 16px; }
.profile-stats div { background: rgba(0,0,0,.22); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.profile-stats b { display: block; font-size: 18px; color: var(--ink); }
.style-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.style-tabs button { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.style-tabs button.on { background: var(--gold); color: #2b1d00; border-color: var(--gold); }
.av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.av-grid button { border: 2px solid transparent; border-radius: 50%; padding: 0; background: none; cursor: pointer; aspect-ratio: 1; }
.av-grid button.sel { border-color: var(--gold); box-shadow: 0 0 12px rgba(232,183,60,.6); }
.av-grid img { width: 100%; height: 100%; border-radius: 50%; background: #f4ead2; display: block; }
.credit { font-size: 11px; color: var(--muted); margin-top: 10px; }

/* ---- mesa: avatar dos adversários e lugares para até 6 ---- */
.opp .avatar { overflow: hidden; padding: 0; background: #f4ead2; }
.opp .avatar img { width: 100%; height: 100%; display: block; }
.seat-group { display: contents; }
@media (min-width: 820px) {
  .seat-group { display: flex; gap: 10px; }
  .seat-group.g-left { grid-area: left; flex-direction: column; justify-content: center; align-items: stretch; }
  .seat-group.g-top { grid-area: top; justify-content: center; align-items: flex-start; }
  .seat-group.g-right { grid-area: right; flex-direction: column; justify-content: center; align-items: stretch; }
  .seat-group.g-top .opp { width: 170px; max-width: 170px; }
}
/* ---- topo do lobby compacto no celular ---- */
.topbar { gap: 8px; }
.me-info { min-width: 0; }
@media (max-width: 480px) {
  .topbar { padding: 8px 10px; }
  .logo.small { font-size: 20px; }
  .me-info { gap: 4px; }
  .avatar-btn { width: 32px; height: 32px; }
  .me-info .chips { padding: 5px 9px; font-size: 13px; }
  .me-info .btn.icon { padding: 6px; }
  .me-info .btn.icon .ico { width: 18px; height: 18px; }
  #btn-logout { padding: 6px 8px; font-size: 13px; }
}

/* ---- logo ---- */
.brand-logo { display: block; width: min(250px, 66vw); height: auto; margin: 0 auto 4px; filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); }
.brand-mini { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px rgba(232,183,60,.6), 0 2px 8px rgba(0,0,0,.4); }
@media (max-width: 480px) { .brand-mini { width: 36px; height: 36px; } }
.brand-logo { border-radius: 28px; }
.brand-mini { object-position: 50% 22%; } /* no círculo pequeno, mostra o rosto do Denão */

/* ---- logo: tela de entrada ---- */
#screen-auth {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255,170,60,.28), transparent 55%),
    radial-gradient(ellipse at 50% 100%, #1a3d2c, transparent 70%),
    linear-gradient(180deg, #2a160c 0%, #1a0d07 60%, #0f2a1e 100%);
}
#screen-auth .brand-logo {
  width: min(360px, 88vw); border-radius: 0; margin: -10px auto -6px;
  /* esfumaça os cantos do quadrado: só o emblema redondo aparece */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  filter: drop-shadow(0 12px 30px rgba(0,0,0,.55));
}
#screen-auth .tagline { color: #e9d9b8; }
#screen-auth .tabs { background: rgba(0,0,0,.35); }

/* ---- logo: topo do lobby mostra só a placa com o nome ---- */
.brand-sign {
  width: 150px; height: 64px; flex: none;
  background: url('/img/logo.webp') no-repeat;
  background-size: 168px 168px;          /* a imagem inteira em 168 px... */
  background-position: -9px -92px;       /* ...e a janela mostra só a placa "Pontinho do Denão" */
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
}
@media (max-width: 480px) {
  .brand-sign { width: 118px; height: 50px; background-size: 132px 132px; background-position: -7px -73px; }
}

/* =====================================================================
   Mesa sem rolagem: a tela da mesa ocupa exatamente a altura visível
   (100dvh desconta as barras do navegador no celular) e tudo se ajusta a ela.
   ===================================================================== */
#screen-table {
  height: 100vh; height: 100dvh; min-height: 0; overflow: hidden;
  /* tamanho base das cartas: limitado pela largura E pela altura da tela */
  --cw: clamp(32px, min(10.5vw, 6.6dvh), 72px);
}
#screen-table .tb-top { flex: none; }
#screen-table .felt {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}
#screen-table .board { min-height: 0; overflow: hidden; gap: 8px; }
#screen-table .piles { flex: none; }
/* Jogos baixados usam o espaço que sobra; se não couberem, só esta área rola por dentro */
#screen-table .melds { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: flex-start; padding: 2px; }
#screen-table .meld .card { --cw: clamp(28px, min(7.6vw, 5.2dvh), 50px); }
#screen-table .me-zone { flex: none; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
#screen-table .hand { --cw: clamp(36px, min(12vw, 8dvh), 78px); padding-top: 14px; min-height: 0; }
#screen-table .actions .btn { padding: 8px 14px; }
#screen-table .status-row { white-space: nowrap; }
#screen-table #status-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#screen-table .my-score { overflow: hidden; text-overflow: ellipsis; }

/* o anúncio de rodapé sai da mesa em telas que não sejam grandes (fica no lobby e entre partidas) */
@media (max-height: 940px), (max-width: 700px) { #screen-table .ad-slot.slim { display: none !important; } }

/* adversários compactos no celular */
@media (max-width: 819px) {
  #screen-table .felt { margin: 6px 6px 2px; padding: 8px 6px 8px; gap: 6px; }
  #screen-table .opponents { gap: 6px; }
  #screen-table .opp { min-width: 0; padding: 5px 6px; }
  #screen-table .opp .fan { height: calc(var(--cw) * .62); margin-top: 3px; }
  #screen-table .opp .fan i { width: calc(var(--cw) * .36); height: calc(var(--cw) * .5); margin: 0 calc(var(--cw) * -.13); }
  #screen-table .opp .tags:empty { display: none; }
  #screen-table .opp .tags { margin-top: 2px; }
  #screen-table .status-row { font-size: 13px; }
  #screen-table .status-row #status-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* telas baixas: economiza altura em tudo */
@media (max-height: 760px) {
  #screen-table .tb-top { padding-top: 4px; padding-bottom: 4px; }
  #screen-table .log { display: none; }
  #screen-table .timer { margin: 4px 0 6px; }
  #screen-table .hand { padding-top: 10px; }
  #screen-table .opp .avatar { width: 24px; height: 24px; }
  #screen-table .opp .name { font-size: 12px; }
  #screen-table .opp .sub { font-size: 10px; }
  #screen-table .pile-label { font-size: 11px; }
}
@media (max-height: 620px) {
  #screen-table .opp .fan { display: none; }          /* a quantidade de cartas continua escrita */
  #screen-table .actions .btn { padding: 6px 10px; font-size: 14px; }
  #screen-table .felt { box-shadow: 0 0 0 5px #5b3a1f, 0 0 0 6px #c9a24a, inset 0 0 40px rgba(0,0,0,.45); }
}

/* telas largas porém baixas (notebooks): adversários e mesa mais enxutos */
@media (min-width: 820px) and (max-height: 820px) {
  #screen-table .felt { margin-top: 8px; padding: 14px 24px 16px; border-radius: 40% / 26%; }
  #screen-table .opp .fan { height: calc(var(--cw) * .7); }
  #screen-table .opp .fan i { width: calc(var(--cw) * .4); height: calc(var(--cw) * .56); }
}

/* ---- celular deitado (tela baixa): mesa à esquerda, sua mão à direita ---- */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-table {
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
    --cw: clamp(26px, 11dvh, 54px);
  }
  #screen-table .tb-top { grid-column: 1 / -1; padding: 3px 8px; }
  #screen-table .felt {
    grid-column: 1; grid-row: 2; width: auto; margin: 4px 6px 6px; padding: 6px; border-radius: 18px;
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "opps" "center"; grid-template-rows: auto minmax(0, 1fr); gap: 4px;
    box-shadow: 0 0 0 4px #5b3a1f, 0 0 0 5px #c9a24a, inset 0 0 40px rgba(0,0,0,.45);
  }
  #screen-table .felt .opponents { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; justify-content: center; }
  #screen-table .seat-group { display: contents; }
  #screen-table .opp { flex: 1 1 28%; width: auto; max-width: none; min-width: 0; padding: 3px 6px; column-gap: 5px; }
  #screen-table .opp .avatar { width: 20px; height: 20px; }
  #screen-table .opp .name { font-size: 11px; }
  #screen-table .opp .sub { font-size: 10px; flex-direction: row; gap: 6px; }
  #screen-table .opp .fan, #screen-table .opp .tags { display: none; }
  #screen-table .board { gap: 4px; }
  #screen-table .piles { gap: 10px; }
  #screen-table .pile { padding: 2px; }
  #screen-table .meld .card { --cw: clamp(22px, 7.5dvh, 36px); }
  #screen-table .me-zone { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; overflow: hidden; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
  #screen-table .hand { --cw: clamp(28px, min(5.6vw, 15dvh), 64px); padding-top: 8px; }
  #screen-table .actions { gap: 4px; }
  #screen-table .actions .btn { padding: 5px 8px; font-size: 13px; }
  #screen-table .log { display: none; }
}
/* celular em pé: avatar em cima do nome, para o nome usar a largura toda do cartão */
@media (max-width: 819px) and (orientation: portrait) {
  #screen-table .opp { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; row-gap: 1px; }
  #screen-table .opp .avatar { grid-row: auto; }
  #screen-table .opp .name { max-width: 100%; }
  #screen-table .opp .sub { justify-content: center; gap: 4px; flex-direction: column; align-items: center; }
}

/* ---- topo do lobby: nome escrito (nítido em qualquer tela) ---- */
.wordmark { display: flex; flex-direction: column; line-height: .9; flex: none; user-select: none; transform: rotate(-3deg); }
.wordmark .wm-top { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700; font-size: 13px; color: #f4ead2; letter-spacing: -.01em;
  text-shadow: 0 1px 0 #5b3a1f, 0 2px 4px rgba(0,0,0,.6); }
.wordmark .wm-main { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 900; font-size: 25px; letter-spacing: -.02em;
  background: linear-gradient(180deg, #ffe27a 0%, #f1b51f 55%, #c9810a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 #5b3a1f) drop-shadow(0 2px 3px rgba(0,0,0,.6)); margin-left: 10px; }

/* topo do lobby no celular: só o essencial (o "Sair" fica no perfil) */
.topbar { flex-wrap: nowrap; min-width: 0; }
.me-info { flex-wrap: nowrap; }
@media (max-width: 480px) {
  .badge.premium .badge-txt { display: none; }
  .badge.premium { padding: 3px 7px; }
  #btn-logout { display: none; }
  .wordmark .wm-top { font-size: 11px; }
  .wordmark .wm-main { font-size: 21px; }
}
@media (max-width: 340px) { .me-info .btn.icon { padding: 5px; } .me-info .chips { font-size: 12px; padding: 4px 7px; } }

/* ---- tela de entrada: logo e formulário cabem na altura da tela ---- */
#screen-auth { min-height: 100vh; min-height: 100dvh; padding: 8px 16px; }
#screen-auth .brand-logo { width: min(340px, 86vw, 44dvh); margin: -8px auto -10px; }
#screen-auth .tagline { margin: 0 0 14px; }
#screen-auth form label { margin-bottom: 8px; }
#screen-auth .fine { margin-top: 10px; }
@media (max-height: 640px) {
  #screen-auth .brand-logo { width: min(300px, 80vw, 38dvh); }
  #screen-auth .tabs { margin-bottom: 10px; }
  #screen-auth input { padding: 10px; }
  #screen-auth .btn.big { padding: 11px; }
}
/* tela de entrada: o logo usa só a altura que sobra depois do formulário (~400px) */
#screen-auth .brand-logo { width: clamp(110px, min(340px, 86vw, calc(100dvh - 400px)), 340px); }
#screen-auth .fine { margin-bottom: 0; }
#screen-auth .auth-box > *:last-child { margin-bottom: 0; }
/* celular deitado: logo à esquerda, formulário à direita */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-auth .auth-box { max-width: 760px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 24px; align-items: center;
    grid-template-areas: "logo tabs" "logo form" "tagline fine"; }
  #screen-auth .brand-logo { grid-area: logo; width: min(42vw, calc(100dvh - 70px)); margin: 0 auto; }
  #screen-auth .tagline { grid-area: tagline; margin: 0; font-size: 13px; }
  #screen-auth .tabs { grid-area: tabs; }
  #screen-auth form { grid-area: form; }
  #screen-auth .fine { grid-area: fine; margin: 4px 0 0; font-size: 11px; }
  #screen-auth .form-error { min-height: 0; margin: 2px 0 6px; }
}

.btn.timebank { background: rgba(74,163,255,.18); border-color: #4aa3ff; color: #cfe6ff; font-variant-numeric: tabular-nums; }
.btn.timebank:hover:not(:disabled) { background: rgba(74,163,255,.3); }

/* tempo extra na ponta da barra do relógio */
.timer-row { display: flex; align-items: center; gap: 8px; }
.timer-row .timer { flex: 1; margin: 6px 0 10px; }
.timer-row .btn.timebank { flex: none; padding: 3px 9px; font-size: 12px; border-radius: 99px; margin: 0 0 4px; }
#screen-table .timer-row .timer { margin: 4px 0 6px; }

/* ---- roubar o coringa: carta no lugar e coringa flutuando ---- */
.meld { position: relative; }
.meld.stealing { border-color: var(--gold); box-shadow: 0 0 16px rgba(232,183,60,.35); padding-top: 14px; }
.card.steal-in { box-shadow: 0 0 0 2px #4aa3ff, 0 0 10px rgba(74,163,255,.6); }
.steal-float { border: 0; background: none; padding: 0; margin-left: 12px; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  animation: wildFloat 1.3s ease-in-out infinite; position: relative; z-index: 3; }
.steal-float .card { margin-left: 0 !important; box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(232,183,60,.8), 0 10px 18px rgba(0,0,0,.45); }
.steal-float span { font-size: 9px; color: #2b1d00; background: var(--gold); border-radius: 99px; padding: 1px 6px; white-space: nowrap; font-weight: 700; }
@keyframes wildFloat { 0%, 100% { transform: translateY(-2px) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

/* ---------- cenários de teste (só admin) ---------- */
.admin-tests h2 small { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.08); padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.scenario-form { grid-template-columns: 1fr auto; border: 1px dashed rgba(255,255,255,.22); }
.scenario-form .scenario-desc { grid-column: 1 / -1; margin: 0; line-height: 1.45; }
.scenario-form select { width: 100%; }
@media (max-width: 700px) { .scenario-form { grid-template-columns: 1fr; } }
.scenario-btn { font-size: 13px; padding: 6px 10px; border: 1px dashed rgba(255,255,255,.35); }
.scenario-help { line-height: 1.5; }

/* ==============================================================   Modelos de cartas (escolhidos na mesa; ficam salvos no aparelho)
   [data-deck] = frente das cartas · [data-back] = verso
   ===================================================================== */

/* ---- frente: quatro cores (♠ preto, ♥ vermelho, ♦ azul, ♣ verde) ---- */
[data-deck="quatro"] .card.suit-D { color: #1f5fd1; }
[data-deck="quatro"] .card.suit-C { color: #16833a; }

/* ---- frente: índice grande (mais fácil de ler no celular) ---- */
[data-deck="grande"] .card { font-family: "Arial Narrow", Arial, system-ui, sans-serif; }
[data-deck="grande"] .card .r { top: 3%; left: 7%; font-size: calc(var(--cw) * .44); font-weight: 800; letter-spacing: -.05em; }
[data-deck="grande"] .card .s1 { top: 38%; left: 8%; font-size: calc(var(--cw) * .3); }
[data-deck="grande"] .card .s { bottom: 4%; right: 6%; font-size: calc(var(--cw) * .52); }
[data-deck="grande"] .meld .card .r { font-size: calc(var(--cw) * .42); }

/* ---- frente: noturno (carta escura) ---- */
[data-deck="noturno"] .card:not(.back):not(.empty) {
  background: linear-gradient(160deg, #2b3038 0%, #1b1f25 100%); color: #eef0f3;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 1px 2px rgba(0,0,0,.5), 0 3px 10px rgba(0,0,0,.35);
}
[data-deck="noturno"] .card.red { color: #ff6b62; }
[data-deck="noturno"] .card.wild { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(232,183,60,.55), 0 3px 10px rgba(0,0,0,.35); }
[data-deck="noturno"] .card.wild::after { color: var(--gold); }

/* ---- frente: vintage (papel envelhecido, tinta sépia) ---- */
[data-deck="vintage"] .card:not(.back):not(.empty) {
  background: radial-gradient(ellipse at 30% 20%, #fbf3dc 0%, #efe0b9 70%, #e3cf9f 100%); color: #3b2a1a;
  box-shadow: inset 0 0 0 1px rgba(90,60,20,.35), inset 0 0 0 3px #fbf3dc, inset 0 0 0 4px rgba(90,60,20,.25), 0 1px 2px rgba(0,0,0,.35), 0 3px 10px rgba(0,0,0,.22);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
[data-deck="vintage"] .card.red { color: #9b2c1f; }
[data-deck="vintage"] .card.wild { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(232,183,60,.55), 0 3px 10px rgba(0,0,0,.25); }

/* ---- versos (monte, leque dos adversários) ---- */
[data-back="azul"] .card.back, [data-back="azul"] .opp .fan i {
  background:
    linear-gradient(45deg, rgba(255,255,255,.14) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.14) 75%) 0 0 / 10px 10px,
    linear-gradient(45deg, rgba(255,255,255,.14) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.14) 75%) 5px 5px / 10px 10px,
    radial-gradient(circle at 50% 50%, #2459b8, #10306e);
}
[data-back="azul"] .card.back { box-shadow: inset 0 0 0 2px #9fc0ff, 0 2px 8px rgba(0,0,0,.35); }

[data-back="verde"] .card.back, [data-back="verde"] .opp .fan i {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.1) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 2px, transparent 2px 7px),
    radial-gradient(circle at 50% 50%, #1f7a4a, #0c4127);
}
[data-back="verde"] .card.back { box-shadow: inset 0 0 0 2px #c9a24a, 0 2px 8px rgba(0,0,0,.35); }

[data-back="preto"] .card.back, [data-back="preto"] .opp .fan i {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 28%, rgba(232,183,60,.55) 29% 31%, transparent 32%),
    repeating-linear-gradient(90deg, rgba(232,183,60,.16) 0 1px, transparent 1px 6px),
    linear-gradient(160deg, #22201c, #0d0c0a);
}
[data-back="preto"] .card.back { border-color: #c9a24a; box-shadow: inset 0 0 0 2px #0d0c0a, inset 0 0 0 3px #c9a24a, 0 2px 8px rgba(0,0,0,.45); }
[data-back="preto"] .opp .fan i { border-color: #c9a24a; }

[data-back="denao"] .card.back, [data-back="denao"] .opp .fan i {
  background: url(/img/logo.webp) center / 92% auto no-repeat, radial-gradient(circle at 50% 45%, #7a1a20, #3a0a0e 75%);
}
[data-back="denao"] .card.back { box-shadow: inset 0 0 0 2px #c9a24a, 0 2px 8px rgba(0,0,0,.35); }

/* ---- janela de escolha ---- */
.deck-section h4 { margin: 4px 0 8px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin-bottom: 12px; }
.deck-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 12px; cursor: pointer;
  background: rgba(0,0,0,.25); border: 2px solid transparent; color: inherit; font: inherit; }
.deck-opt:hover { background: rgba(0,0,0,.35); }
.deck-opt.on { border-color: var(--gold); background: rgba(232,183,60,.12); }
.deck-opt .sample { display: flex; justify-content: center; height: 56px; align-items: center; }
.deck-opt .sample .card { --cw: 34px; margin: 0 -6px; }
.deck-opt .sample .card:nth-child(1) { transform: rotate(-9deg) translateY(3px); }
.deck-opt .sample .card:nth-child(3) { transform: rotate(9deg) translateY(3px); }
.deck-opt small { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }

/* velocidade dos bots */
.speed-seg { display: flex; background: rgba(0,0,0,.28); border-radius: 12px; padding: 4px; gap: 4px; }
.speed-seg button { flex: 1; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; padding: 8px 6px; border-radius: 9px; cursor: pointer; }
.speed-seg button.on { background: var(--gold); color: #2b1d00; }
.speed-seg button:disabled { cursor: default; opacity: .55; }
.speed-seg button.on:disabled { opacity: .8; }
/* barra de tempo na vez do bot */
#timer-bar.bot { background: linear-gradient(90deg, #7fa8d8, #a9c7ec); }

/* =====================================================================
   Batida: como o jogador bateu (painel do fim da rodada)
   ===================================================================== */
.round-panel { max-width: 480px; }
.go-out { margin-bottom: 6px; }
.go-banner { text-align: center; margin: -4px 0 6px; }
.go-banner span { display: inline-block; font-size: 26px; font-weight: 900; letter-spacing: .02em; color: var(--gold);
  text-shadow: 0 2px 0 #7a5a10, 0 4px 14px rgba(232,183,60,.45); }
.go-how { text-align: center; margin: 0 0 12px; font-size: 14px; line-height: 1.4; }
.go-how b { color: #fff; }
.go-melds { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; }
.go-meld { background: rgba(0,0,0,.25); border-radius: 12px; padding: 6px 10px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.go-tag { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.go-cards { display: flex; padding-left: 14px; }
.go-cards .go-slot { display: block; margin-left: -14px; }
.go-cards .card { --cw: 38px; }
.go-cards .card.go-old { filter: brightness(.72) saturate(.7); }
.go-cards .card.go-added { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(232,183,60,.6), 0 3px 8px rgba(0,0,0,.35); }
.go-cards .card.go-lixo { box-shadow: 0 0 0 3px #4aa3ff, 0 0 14px rgba(74,163,255,.7), 0 3px 8px rgba(0,0,0,.35); }
.go-cards .card.go-lixo::before { content: "lixo"; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font: 700 9px/1 system-ui, sans-serif;
  background: #4aa3ff; color: #06223f; padding: 2px 5px; border-radius: 99px; white-space: nowrap; z-index: 2; }
.go-discard .card { transform: rotate(-6deg); }
.go-legend { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin: 10px 0 0; flex-wrap: wrap; }
.go-legend .lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.go-legend .lg-added { box-shadow: 0 0 0 2px var(--gold); background: #fffdf7; }
.go-legend .lg-lixo { box-shadow: 0 0 0 2px #4aa3ff; background: #fffdf7; }

/* animação: o letreiro "bateu!" salta e as cartas descem uma a uma */
.go-out.animate .go-banner span { animation: goPop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.go-out.animate .go-how { animation: goFade .4s ease .35s both; }
.go-out.animate .go-slot { animation: goDeal .42s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(.45s + var(--i) * 90ms); }
.go-out.animate .go-meld { animation: goFade .3s ease .4s both; }
.go-out.animate .go-legend { animation: goFade .4s ease 1.2s both; }
@keyframes goPop { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 70% { transform: scale(1.12) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes goFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes goDeal { from { opacity: 0; transform: translateY(-46px) rotate(-14deg) scale(1.15); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .go-out.animate * { animation: none !important; } }
@media (max-width: 420px) { .go-cards .card { --cw: 32px; } .go-banner span { font-size: 22px; } }

/* ---------- fim da rodada: Continuar ---------- */
.continue-row { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 10px; }
.continue-row .btn { min-width: 220px; }
.continue-row #next-round { margin: 0; }

/* ---------- pausa ---------- */
.btn.pausebtn { flex: none; padding: 3px 9px; font-size: 12px; border-radius: 99px; margin: 0 0 4px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); }
#screen-table .timer-row .btn.pausebtn { margin: 0 0 4px; }

/* votação: faixa no topo da mesa, sem cobrir as cartas */
.pause-vote { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 30; width: min(440px, calc(100vw - 24px));
  background: #183f30; border: 2px solid var(--gold); border-radius: 14px; padding: 12px 14px 10px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 8px; text-align: center; animation: pvIn .25s ease-out; }
.pause-vote .pv-title { font-size: 15px; }
.pause-vote .pv-actions { display: flex; gap: 8px; } .pause-vote .pv-actions .btn { flex: 1; }
.pause-vote .pv-note { font-size: 12px; color: var(--muted); }
.pause-vote .pv-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.pause-vote .pv-bar i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width .25s linear; }
@keyframes pvIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* jogo em pausa: cronômetro em destaque */
.pause-ov { z-index: 25; background: rgba(4, 18, 12, .88); backdrop-filter: blur(3px); }
.pause-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; padding: 10px; }
.pause-label { font-size: 13px; font-weight: 800; letter-spacing: .25em; color: var(--gold); }
.pause-clock { font-size: clamp(64px, 22vw, 120px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #fff;
  text-shadow: 0 0 30px rgba(232,183,60,.35), 0 4px 0 rgba(0,0,0,.4); animation: pauseBeat 2s ease-in-out infinite; }
.pause-msg { font-size: clamp(18px, 5vw, 24px); line-height: 1.3; }
.pause-msg b { color: var(--gold); }
@keyframes pauseBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .pause-clock { animation: none; } }
.pause-opts { display: flex; gap: 10px; margin: 12px 0; } .pause-opts .btn { flex: 1; }

/* DenisCoin: moedinha dourada com "D" no saldo */
.chips::before {
  content: "D"; display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-right: 6px; vertical-align: -0.2em;
  border-radius: 50%; font-size: .85em; font-weight: 900; line-height: 1; color: #5b3c00;
  background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, #f5c542 45%, #b8860b 100%);
  box-shadow: inset 0 0 0 1.5px rgba(120, 80, 0, .55), 0 1px 2px rgba(0,0,0,.4);
}

/* Anúncio de teste (sem rede de anúncios configurada) */
.ad-demo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; }
.ad-demo b { font-size: 48px; line-height: 1; }
.ad-demo small { font-size: 13px; font-weight: 500; color: var(--muted); }
.ad-demo-tag { position: absolute; top: 8px; left: 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: rgba(0,0,0,.35); padding: 2px 8px; border-radius: 99px; }

/* ---------- login: 2 etapas e login social ---------- */
#twofa-form { display: flex; flex-direction: column; gap: 8px; }
#twofa-form .twofa-title { font-weight: 700; font-size: 17px; margin: 0; text-align: center; }
#twofa-form .twofa-hint { font-size: 12px; margin: 0; }
#twofa-form input[name=code] { font-size: 22px; letter-spacing: .25em; text-align: center; }
#twofa-form .row { display: flex; gap: 8px; } #twofa-form .row .btn { flex: 1; }
.social-login { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.social-login .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.social-login .or::before, .social-login .or::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.18); }
.btn.social { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; font-weight: 600; padding: 10px 14px; }
.btn.social .social-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; font-family: Arial, sans-serif; }
.btn.social.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.social.google .social-ico { color: #4285f4; border: 1px solid #dadce0; }
.btn.social.facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.btn.social.facebook .social-ico { background: #fff; color: #1877f2; }
@media (max-height: 700px) { .social-login { margin-top: 4px; gap: 6px; } .btn.social { padding: 7px 12px; } }

/* ---------- perfil: segurança ---------- */
.profile-security { margin: 10px 0 2px; }
.profile-security .btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.profile-security .ico { width: 18px; height: 18px; }
.tf-steps { margin: 0 0 6px; padding-left: 20px; line-height: 1.5; }
.tf-qr { width: 200px; max-width: 70vw; margin: 4px auto 8px; background: #fff; padding: 8px; border-radius: 10px; }
.tf-qr svg { display: block; width: 100%; height: auto; }
.tf-secret { font-size: 12px; text-align: center; word-break: break-all; }
.tf-secret code, .tf-codes code { font-family: ui-monospace, Consolas, monospace; }
.tf-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.tf-codes code { background: rgba(0,0,0,.3); padding: 6px; border-radius: 6px; text-align: center; font-size: 15px; letter-spacing: .05em; }
.profile-security { display: flex; flex-direction: column; gap: 8px; }
.linked-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; padding: 4px 2px; }
/* login social em uma linha; com ele visível, o logo cede ~70px de altura */
.social-login { margin-top: 8px; gap: 6px; }
.social-row { display: flex; gap: 8px; }
.social-row .btn.social { flex: 1; padding: 8px 10px; }
#screen-auth.has-social .brand-logo { width: clamp(96px, min(340px, 86vw, calc(100dvh - 470px)), 340px); }
#screen-auth.has-social .fine { margin-top: 6px; }
@media (max-height: 500px) and (orientation: landscape) {
  #screen-auth .auth-box { grid-template-areas: "logo tabs" "logo form" "logo social" "tagline fine"; }
  #screen-auth .social-login { grid-area: social; margin-top: 2px; gap: 4px; }
  #screen-auth .social-row .btn.social { padding: 6px 10px; }
  #screen-auth #twofa-form { grid-area: form; }
  #screen-auth.has-social .brand-logo { width: min(40vw, calc(100dvh - 90px)); }
}
