/* Sinuca — clima de salão: madeira, feltro verde, luz quente de luminária, detalhes em latão.
   Fontes servidas pelo próprio site (sem CDN), nenhum estilo inline (CSP). */
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/inter-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #060d09;
  --bg2: #0b1711;
  --surface: rgba(255, 244, 222, .05);
  --surface2: rgba(255, 244, 222, .09);
  --line: rgba(255, 226, 170, .13);
  --line2: rgba(255, 226, 170, .24);
  --text: #f6f0e2;
  --muted: #b9ad94;
  --gold: #e9c46a;
  --gold2: #f6dc96;
  --brass: linear-gradient(180deg, #f8e2a2 0%, #d8a944 48%, #a8781e 100%);
  --felt: #12894a;
  --felt2: #0a5e31;
  --danger: #ff8a7a;
  --good: #6ee7a0;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .5);
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --b1: #d0160f; --b2: #f2c200; --b3: #0f9a3f; --b4: #7a3d18; --b5: #1a4fd6; --b6: #ec5c9f; --b7: #16161b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); color: var(--text); line-height: 1.45; font-size: 15px;
  background:
    radial-gradient(900px 520px at 50% -140px, rgba(255, 196, 110, .20) 0%, rgba(255, 170, 80, .06) 45%, transparent 70%),
    radial-gradient(1400px 900px at 50% 120%, #0d2a1a 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  display: flex; flex-direction: column;
}
a { color: var(--gold); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- topo ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); background: rgba(6, 13, 9, .82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: .5px; text-transform: uppercase; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 34% 30%, #6a6a74 0%, #16161b 55%, #000 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .6), inset -2px -3px 6px rgba(0, 0, 0, .6);
}
.brand-mark::after { content: "7"; position: absolute; inset: 7px; border-radius: 50%; background: #fbf7ec; color: #111; font: 800 11px/16px var(--font); text-align: center; }
.topbar-right { display: inline-flex; align-items: center; gap: 10px; }
.toplink { color: var(--text); text-decoration: none; font-weight: 700; padding: 8px 12px; border-radius: 10px; }
.toplink:hover { background: var(--surface2); }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; }
.iconbtn:hover { background: var(--surface2); }
.i-sound { width: 20px; height: 20px; display: block; background: currentColor; color: var(--text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center/contain no-repeat; }
.iconbtn.muted .i-sound {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zm12.6 3 2.7-2.7-1.4-1.4-2.7 2.7-2.7-2.7-1.4 1.4 2.7 2.7-2.7 2.7 1.4 1.4 2.7-2.7 2.7 2.7 1.4-1.4z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zm12.6 3 2.7-2.7-1.4-1.4-2.7 2.7-2.7-2.7-1.4 1.4 2.7 2.7-2.7 2.7 1.4 1.4 2.7-2.7 2.7 2.7 1.4-1.4z'/%3E%3C/svg%3E");
  opacity: .6;
}

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line2);
  background: var(--surface2); color: var(--text); font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  border: 0; color: #2b1a02; background: var(--brass);
  box-shadow: 0 8px 22px rgba(216, 169, 68, .32), inset 0 1px 0 rgba(255, 255, 255, .55);
  font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .6px; text-transform: uppercase;
}
.btn-felt {
  border: 1px solid rgba(110, 231, 160, .35); color: #eafff1;
  background: linear-gradient(180deg, #19a85c, #0b6b37);
  box-shadow: 0 8px 20px rgba(10, 110, 55, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-gold { border: 1px solid rgba(233, 196, 106, .55); background: rgba(233, 196, 106, .14); color: var(--gold2); }
.btn-ghost { background: transparent; }
.btn-round { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; user-select: none; -webkit-user-select: none; touch-action: none; }
.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; text-decoration: underline; text-underline-offset: 2px; }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line2);
  background: rgba(0, 0, 0, .35); color: var(--text); font-size: 16px;
}
.input[readonly] { color: var(--gold2); font-weight: 700; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.hint { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.hint.warn { color: var(--danger); }

/* ---------- avisos ---------- */
.messages { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); z-index: 15; width: min(520px, calc(100% - 24px)); pointer-events: none; }
.alert {
  padding: 12px 16px; border-radius: 14px; background: rgba(20, 14, 8, .94); border: 1px solid var(--line2);
  box-shadow: var(--shadow); font-weight: 600; text-align: center; animation: drop .25s ease;
}
.alert.good { border-color: rgba(110, 231, 160, .5); color: #d8ffe7; }
.alert.bad { border-color: rgba(255, 138, 122, .55); color: #ffe0da; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.notice { max-width: 760px; margin: 0 auto 14px; padding: 12px 16px; border-radius: 12px; background: rgba(255, 138, 122, .12); border: 1px solid rgba(255, 138, 122, .4); }

/* =================== PARTIDA =================== */
.game { width: 100%; max-width: 1240px; margin: 0 auto; padding: 14px max(14px, env(safe-area-inset-left)) 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }

.players { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.players.n3 { grid-template-columns: repeat(3, 1fr); }
.players.n4 { grid-template-columns: repeat(4, 1fr); }
.pcard {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px 12px 12px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 244, 222, .07), rgba(255, 244, 222, .03));
  border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.pcard.me { background: linear-gradient(180deg, rgba(233, 196, 106, .12), rgba(233, 196, 106, .04)); }
.pcard.active { border-color: rgba(233, 196, 106, .8); box-shadow: 0 0 0 1px rgba(233, 196, 106, .5), 0 0 26px rgba(233, 196, 106, .22); }
.pcard.winner { border-color: var(--good); box-shadow: 0 0 26px rgba(110, 231, 160, .25); }
.pcard.out, .pcard.offline { opacity: .5; }
.avatar { position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a6b45, #0b3a21); border: 2px solid rgba(255, 226, 170, .3); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar .initial { font-family: var(--display); font-size: 20px; color: var(--gold2); }
.pcard.active .avatar { border-color: var(--gold); }
.pinfo { display: grid; min-width: 0; flex: 1; }
.pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 15px; }
.psub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.active .psub { color: var(--gold2); font-weight: 600; }
.pscore { font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1; color: var(--text); min-width: 1.4ch; text-align: right; font-variant-numeric: tabular-nums; }
.pcard.bump .pscore { animation: bump .5s ease; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); color: var(--gold2); } 100% { transform: scale(1); } }
.ptimer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .06); font-size: 0; }
.ptimer::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct, 0%); background: linear-gradient(90deg, #d8a944, #f6dc96); transition: width .25s linear; }
.pcard.active .ptimer { font-size: 11px; }
.pcard.urgent .ptimer::before { background: linear-gradient(90deg, #ff6b57, #ffb199); }
.pcard.active.urgent .pscore { color: var(--text); }

.inforow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 34px; }
.status { margin: 0; font-weight: 600; color: var(--muted); flex: 1 1 320px; }
.status.mine { color: var(--gold2); }
.rackline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rb {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; position: relative;
  font: 800 10px/1 var(--font); color: #111; box-shadow: inset -3px -4px 6px rgba(0, 0, 0, .45), inset 2px 2px 4px rgba(255, 255, 255, .35), 0 2px 4px rgba(0, 0, 0, .5);
}
.rb { isolation: isolate; background: var(--c); }
.rb::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fbf7ec; z-index: -1; }
.rb.b7 { color: #111; }
.rb.gone { opacity: .2; filter: grayscale(.7); }
.rb.vez { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(233, 196, 106, .7), inset -3px -4px 6px rgba(0, 0, 0, .45); }
.b1 { --c: var(--b1); } .b2 { --c: var(--b2); } .b3 { --c: var(--b3); } .b4 { --c: var(--b4); } .b5 { --c: var(--b5); } .b6 { --c: var(--b6); } .b7 { --c: var(--b7); }
.rtot { margin-left: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* mesa */
.stage { position: relative; width: 100%; }
.stage canvas {
  display: block; width: 100%; aspect-ratio: 1.86; max-height: calc(100dvh - 350px); min-height: 300px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.stage canvas.my-turn { cursor: crosshair; }
.stage canvas.my-turn.locked { cursor: default; }
.stage canvas.in-hand { cursor: grab; }
.stage-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: var(--gold2); font-size: 13px; font-weight: 600; pointer-events: none; white-space: nowrap; }

/* painel da tacada */
.dock {
  display: grid; grid-template-columns: minmax(0, 1.7fr) auto minmax(180px, 1.3fr) auto auto; align-items: center; gap: 14px 20px;
  padding: 14px 18px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(60, 30, 12, .55), rgba(30, 14, 6, .55));
  border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 226, 170, .08), var(--shadow);
}
.dock.off .dock-col:not(.dock-actions) { opacity: .42; pointer-events: none; filter: saturate(.6); }
.dock-col { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.dock-label { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.dock-label b { color: var(--gold2); font-weight: 800; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .25); cursor: pointer; font-size: 13px; font-weight: 600;
}
.chip i {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55), transparent 40%), var(--c);
  box-shadow: inset -2px -3px 4px rgba(0, 0, 0, .45);
}
.chip.sel { border-color: var(--gold); background: rgba(233, 196, 106, .16); color: var(--gold2); }
.chip.cast { border-style: dashed; }
.chip.cast span::after { content: " · 7"; color: var(--danger); font-weight: 800; }
.chip:disabled { cursor: default; }
.kind { margin: 0; font-size: 12px; color: var(--muted); min-height: 18px; }
.kind.cast { color: var(--danger); font-weight: 600; }

.spin {
  width: 64px; height: 64px; border-radius: 50%; position: relative; cursor: pointer; touch-action: none;
  background: radial-gradient(circle at 36% 30%, #fff 0%, #f4efe0 40%, #cfc6ad 80%, #9e957c 100%);
  box-shadow: inset -4px -6px 10px rgba(0, 0, 0, .25), 0 6px 14px rgba(0, 0, 0, .5);
}
.spin::before, .spin::after { content: ""; position: absolute; background: rgba(0, 0, 0, .12); }
.spin::before { left: 50%; top: 8px; bottom: 8px; width: 1px; }
.spin::after { top: 50%; left: 8px; right: 8px; height: 1px; }
.spin-dot { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #d0160f; box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0, 0, 0, .5); z-index: 1; }
.dock-spin { justify-items: center; }

.dock-power { justify-items: stretch; }
.power {
  position: relative; height: 40px; border-radius: 12px; cursor: ew-resize; touch-action: none; overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, .3)); border: 1px solid var(--line2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
}
.power-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #12894a 0%, #d8c040 60%, #ff6b3d 100%); background-size: 100vw 100%; box-shadow: 0 0 14px rgba(255, 180, 80, .4); }
.power-fill { background-size: 600px 100%; }
.power-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255, 255, 255, .14) calc(10% - 1px) 10%); pointer-events: none; }
.power.hot { border-color: rgba(255, 120, 80, .6); }
.power.drag { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 0 0 2px rgba(233, 196, 106, .4); }
.power-help { color: var(--muted); font-size: 11.5px; }

.fine { display: flex; gap: 8px; }
.mobile-actions { display: none; text-align: center; }
.dock-actions { justify-items: stretch; gap: 8px; }

/* convite */
.invite { text-align: center; padding: 16px; border-radius: 16px; border: 1px dashed var(--line2); background: var(--surface); }
.invite p { margin: 0 0 8px; color: var(--muted); }
.code-row { display: inline-flex; align-items: center; gap: 10px; }
.code-row code { font: 800 26px/1 var(--display); letter-spacing: 3px; color: var(--gold2); padding: 8px 14px; border-radius: 10px; background: rgba(0, 0, 0, .35); }
.copy-ghost { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* regras */
.rules { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 16px; }
.rules summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.rules summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line2); color: var(--gold); font-weight: 800; }
.rules[open] summary::before { content: "–"; }
.rules summary::-webkit-details-marker { display: none; }
.rules ul { margin: 0 0 16px; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.rules li b { color: var(--text); }

/* diálogos */
.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(3, 7, 5, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: min(440px, 100%); padding: 26px 24px 22px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #1e140b, #120c07); border: 1px solid var(--line2); box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.dialog-icon { font-size: 48px; line-height: 1; margin-bottom: 8px; }
.dialog-title { margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-size: 36px; letter-spacing: .5px; text-transform: uppercase; }
.dialog-title.win { background: var(--brass); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dialog-title.lose { color: var(--muted); }
.dialog-text { margin: 0 0 14px; color: var(--muted); }
.over-scores { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; text-align: left; }
.over-scores li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.over-scores li.win { border-color: rgba(233, 196, 106, .6); background: rgba(233, 196, 106, .1); }
.over-scores li b { font-family: var(--display); font-size: 20px; font-weight: 800; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dialog-actions .btn { flex: 1 1 140px; }

.site-footer { text-align: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.site-footer p { margin: 2px 0; }

@media (max-width: 980px) {
  .dock { grid-template-columns: 1fr auto; }
  .dock-target { grid-column: 1 / -1; }
  .dock-power { grid-column: 1 / 2; grid-row: 2; }
  .dock-spin { grid-column: 2; grid-row: 2 / 4; align-self: start; }
  .dock-fine { grid-column: 1; grid-row: 3; }
  .dock-actions { grid-column: 1 / -1; grid-auto-flow: column; }
}
@media (max-width: 700px) {
  body { font-size: 14px; }
  .game-page .topbar { position: static; }
  .game { padding: 8px 8px 12px; gap: 8px; }
  .pcard { padding: 7px 9px 9px; gap: 8px; border-radius: 12px; }
  /* 3 ou 4 jogadores: uma fileira só de cartões compactos (inicial/foto + pontos em cima, nome embaixo) */
  .players.n3, .players.n4 { gap: 6px; }
  .players.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .players.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .players.n3 .pcard, .players.n4 .pcard { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; gap: 2px 6px; padding: 6px 7px 8px; }
  .players.n3 .avatar, .players.n4 .avatar { width: 26px; height: 26px; grid-row: 1; grid-column: 1; border-width: 1.5px; }
  .players.n3 .avatar .initial, .players.n4 .avatar .initial { font-size: 14px; }
  .players.n3 .pscore, .players.n4 .pscore { grid-row: 1; grid-column: 2; font-size: 24px; }
  .players.n3 .pinfo, .players.n4 .pinfo { grid-row: 2; grid-column: 1 / -1; }
  .players.n3 .pname, .players.n4 .pname { font-size: 12.5px; }
  .players.n3 .psub, .players.n4 .psub { display: none; }
  .players.n3 .pcard.me .pname, .players.n4 .pcard.me .pname { color: var(--gold2); }
  .avatar { width: 30px; height: 30px; }
  .avatar .initial { font-size: 16px; }
  .pname { font-size: 14px; }
  .psub { font-size: 11px; }
  .pscore { font-size: 28px; }
  .inforow { gap: 6px; min-height: 0; }
  .status { flex-basis: 100%; font-size: 13px; line-height: 1.35; }
  .rb { width: 20px; height: 20px; font-size: 9px; }
  .rb::before { inset: 5px; }
  .stage canvas { aspect-ratio: auto; width: 100%; height: min(170vw, calc(100svh - 150px)); min-height: 420px; max-height: none; }
  .stage-hint { font-size: 12px; }
  /* painel compacto, preso no rodapé da tela */
  .dock {
    position: sticky; bottom: 0; z-index: 30;
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto auto; gap: 8px 10px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; margin: 0 -8px;
    background: linear-gradient(180deg, rgba(42, 22, 10, .97), rgba(22, 11, 5, .98));
    box-shadow: 0 -10px 28px rgba(0, 0, 0, .55);
  }
  .dock.off { position: static; }   /* fora da sua vez o painel não cobre a mesa */
  .dock-label { display: none; }
  /* no celular só o número da força, dentro da barra */
  .dock-power .dock-label { display: block; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 2; font-size: 0; pointer-events: none; }
  .dock-power .dock-label b { font-size: 17px; color: #fff; text-shadow: 0 1px 3px #000; }
  .dock-target { grid-column: 1 / -1; grid-row: 1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 1px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 3px 9px 3px 3px; font-size: 12px; }
  .chip i { width: 20px; height: 20px; }
  .kind { display: none; }
  .dock-spin { grid-column: 1; grid-row: 2; align-self: center; gap: 0; }
  .spin { width: 50px; height: 50px; }
  .spin-dot { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
  #spin-reset { display: none; }
  .dock-power { grid-column: 2; grid-row: 2; position: relative; }
  .power { height: 50px; border-radius: 14px; }
  .power-help { display: none; }
  .dock-fine { grid-column: 3; grid-row: 2; }
  .fine { gap: 6px; }
  .fine .btn-round { width: 46px; height: 46px; font-size: 24px; }
  .dock-actions { grid-column: 1 / -1; grid-row: 3; grid-auto-flow: column; }
  .dock-actions #forfeit { display: none; }
  .dock-actions:not(:has(#refuse:not([hidden]))) { display: none; }
  .mobile-actions { display: block; }
  .brand { font-size: 22px; }
  .messages { top: 9%; }
  .alert { padding: 10px 12px; font-size: 13px; }
}
/* =================== CAPA / LOBBY =================== */
.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-left)) 28px; flex: 1; }
.hero { margin: 6px 0 20px; }
.hero:not(.hero-split) h1 { font-size: clamp(40px, 6vw, 64px); }
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 28px; align-items: center; margin: 8px 0 22px; }
.hero h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(46px, 7vw, 82px); line-height: .92; letter-spacing: .5px; text-transform: uppercase; }
.hero h1 .o { display: block; background: var(--brass); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 14px 0 0; color: var(--muted); font-size: 17px; max-width: 46ch; }
.hero .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text); }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.demo { position: relative; border-radius: 18px; }
.demo canvas { display: block; width: 100%; aspect-ratio: 1.86; }
.demo-glow { position: absolute; inset: 10% 6% -6%; z-index: -1; background: radial-gradient(closest-side, rgba(20, 160, 82, .35), transparent); filter: blur(30px); }

.nickbox { max-width: 520px; margin: 0 0 18px; }
.card { padding: 20px; border-radius: 18px; background: linear-gradient(180deg, rgba(255, 244, 222, .07), rgba(255, 244, 222, .025)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .4px; text-transform: uppercase; }
.card .sub { margin: 0 0 14px; color: var(--muted); }
.play-card { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; position: relative; overflow: hidden;
  background: linear-gradient(110deg, rgba(18, 137, 74, .35), rgba(10, 60, 32, .25) 55%, rgba(233, 196, 106, .08)); border-color: rgba(110, 231, 160, .25); }
.play-card .txt { flex: 1; min-width: 0; }
.play-card .btn-primary { min-width: 200px; min-height: 56px; font-size: 24px; }
.mini-balls { display: flex; flex: none; }
.mini-balls i { width: 40px; height: 40px; border-radius: 50%; margin-left: -10px; display: block; background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .7), transparent 32%), var(--c); box-shadow: inset -4px -6px 8px rgba(0, 0, 0, .45), 0 6px 10px rgba(0, 0, 0, .5); }
.mini-balls i:first-child { margin-left: 0; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pl-row { display: flex; gap: 8px; margin: 0 0 12px; }
.pl-opt { flex: 1; cursor: pointer; }
.pl-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pl-opt span { display: grid; place-items: center; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(0, 0, 0, .25); font: 800 30px/1 var(--display); }
.pl-opt small { font: 600 11px/1.3 var(--font); color: var(--muted); margin-top: 4px; }
.pl-opt input:checked + span { border-color: var(--gold); background: rgba(233, 196, 106, .14); color: var(--gold2); box-shadow: 0 0 0 1px rgba(233, 196, 106, .4); }
.pl-opt input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; accent-color: #d8a944; width: 18px; height: 18px; }
#f-join .btn { margin-top: 14px; }
.page .rules { margin-top: 18px; }
.links { text-align: center; margin-top: 18px; }

/* ranking */
.tabs { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.tabs .btn[aria-pressed="true"] { border-color: var(--gold); background: rgba(233, 196, 106, .16); color: var(--gold2); }
.table-wrap { border-radius: 16px; border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.rank { width: 100%; border-collapse: collapse; }
.rank th, .rank td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.rank th { font-family: var(--display); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-size: 14px; }
.rank tr:last-child td { border-bottom: 0; }
.rank .num { text-align: right; font-variant-numeric: tabular-nums; }
.rank .pts { font-weight: 800; color: var(--gold2); }
.rank .placar { font-family: var(--display); font-weight: 700; font-size: 17px; white-space: nowrap; }
.medal { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; color: #2b1a02; background: var(--brass); }
.medal.m2 { background: linear-gradient(180deg, #f4f4f4, #a9adb3); }
.medal.m3 { background: linear-gradient(180deg, #f0b58a, #9a5a2e); }
.who { font-weight: 700; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* compartilhar */
.share { position: relative; display: inline-block; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; flex: none; width: max-content; white-space: nowrap; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; min-height: 40px; }
.share-btn:hover { background: var(--surface2); }
.share-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 250px; margin: 0; padding: 8px; list-style: none; background: #1b120a; border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); }
.share-title { display: none; font-weight: 800; padding: 6px 10px 10px; }
.share-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; background: transparent; color: var(--text); text-decoration: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; }
.share-item:hover { background: var(--surface2); }
.share-ico { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; }
.share-backdrop { display: none; }

@media (max-width: 820px) {
  .hero-split { grid-template-columns: 1fr; gap: 16px; }
  .hero p { font-size: 15px; }
  .cards { grid-template-columns: 1fr; }
  .play-card { flex-wrap: wrap; }
  .play-card .btn-primary { width: 100%; }
  .mini-balls { display: none; }
}
@media (max-width: 700px) {
  /* o desfoque do topo prenderia o menu de compartilhar dentro dele: no celular o topo fica sólido */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .share-menu { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; border-radius: 20px 20px 0 0; padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); z-index: 70; }
  .share-title { display: block; }
  .share-backdrop { display: block; position: fixed; inset: 0; background: rgba(3, 7, 5, .6); z-index: 65; }
  .share-backdrop[hidden] { display: none; }
  .share-btn-txt { display: none; }
  .share-btn { padding: 8px 10px; }
  .hide-sm { display: none; }
  .rank th, .rank td { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
