:root {
  --bg: #0b1424; --panel: #12203a; --panel2: #172a4b; --line: #26406a; --ink: #eef2f8; --muted: #a9c7e8;
  --gold: #f0b94a; --gold2: #ffd36a; --coral: #ff9f8a; --teal: #6fe0d4; --red: #ff6e64;
  --serif: Georgia, 'Times New Roman', serif; --ui: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
:root { color-scheme: dark; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--serif); }
body { min-height: 100vh; background: radial-gradient(ellipse at 50% -10%, #17315c 0%, var(--bg) 60%) fixed; }
a { color: var(--gold2); }
[hidden] { display: none !important; }
button { font-family: var(--ui); }

.gbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: rgba(11,20,36,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.gbar .sp { flex: 1; }
.gbar .btn { white-space: nowrap; padding: 7px 14px; }
.gbar .chip { white-space: nowrap; }
.brandmini { display: flex; align-items: center; gap: 8px; font-weight: bold; letter-spacing: .2em; color: var(--gold2); }
.brandmini img { width: 28px; height: 28px; }
.chip { font: 700 .85rem var(--ui); padding: 4px 12px; border: 1px solid var(--gold); border-radius: 99px; color: var(--gold2); }
.btn { font: 700 .92rem var(--ui); padding: 9px 18px; border-radius: 10px; border: 1px solid var(--gold); background: var(--gold); color: #1b1305; cursor: pointer; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--gold2); }
.btn.big { padding: 13px 22px; font-size: 1.02rem; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { background: var(--red); border-color: var(--red); color: #2a0a07; }

/* ---------- menu e sala ---------- */
.menu { max-width: 760px; margin: 0 auto; padding: 22px 18px 60px; text-align: center; }
.menu .logo { width: min(460px, 90%); margin-bottom: 6px; filter: drop-shadow(0 8px 24px rgba(0,0,0,.6)); }
.fld { display: block; text-align: left; font: 600 .85rem var(--ui); color: var(--muted); margin: 10px 0; }
.fld input, .share input { display: block; width: 100%; margin-top: 4px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 1.05rem var(--serif); }
.fld input.code { text-transform: uppercase; letter-spacing: .4em; text-align: center; font-size: 1.4rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.box { background: rgba(18,32,58,.85); border: 1px solid var(--line); border-radius: 16px; padding: 16px; text-align: left; }
.box h3 { margin: 0 0 6px; color: var(--gold2); }
.box p { font-size: .92rem; color: #dbe6f5; margin: 0 0 12px; }
.err { color: #ffd2cc; background: rgba(255,110,100,.14); border: 1px solid rgba(255,110,100,.5); border-radius: 10px; padding: 9px 14px; font: .92rem var(--ui); margin: 10px 0; }
.warn { background: rgba(240,185,74,.12); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 16px; text-align: left; font: .92rem/1.5 var(--ui); margin: 10px 0; }
.warn code { background: #0b1424; padding: 2px 6px; border-radius: 5px; }
.resume { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; background: rgba(111,224,212,.1); border: 1px solid var(--teal); border-radius: 12px; padding: 12px; margin: 10px 0; font: .95rem var(--ui); }
.links { color: var(--muted); font: .9rem var(--ui); margin-top: 22px; }
.bigcode { font: 800 2.2rem var(--ui); letter-spacing: .3em; color: var(--gold2); margin-left: 8px; }
.share { display: flex; gap: 8px; align-items: end; }
.share input { flex: 1; font-size: .85rem; }
.plist { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; text-align: left; }
.plist .av { flex: none; }
.plist small { margin-left: auto; color: var(--muted); font-family: var(--ui); }
.hint { color: var(--muted); font: .92rem var(--ui); }

.av { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 1.1rem var(--serif); color: #1b1305; background: var(--c, var(--gold)); border: 2px solid rgba(255,255,255,.35); }

/* ---------- mesa ---------- */
.board { max-width: 1180px; margin: 0 auto; padding: 14px 12px 0; }
.opps { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.seat { position: relative; width: 196px; padding: 10px 10px 12px; background: rgba(18,32,58,.88); border: 2px solid var(--line); border-radius: 16px; text-align: center; transition: border-color .2s, box-shadow .2s, transform .2s; }
.seat .who { display: flex; align-items: center; gap: 8px; justify-content: center; }
.seat .who b { font-size: 1.05rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .pl { display: inline-flex; align-items: center; gap: 4px; margin: 6px 0; font: 700 1.05rem var(--ui); color: var(--gold2); }
.seat .pl img { width: 22px; height: 22px; }
.hand { display: flex; justify-content: center; gap: 8px; }
.hand img { width: 66px; border-radius: 6px; box-shadow: 0 4px 10px rgba(0,0,0,.5); }
.mine .hand img { width: 100px; border-radius: 8px; }
.hand img.dead { filter: grayscale(1) brightness(.5); }
.hand .cw { position: relative; display: inline-block; }
.hand .cw.dead::after { content: ''; position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%), linear-gradient(-45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%); }
.hand .cw.sel { cursor: pointer; outline: 3px solid var(--gold2); outline-offset: 3px; border-radius: 8px; animation: pulse 1.2s infinite; }
.hand .cw.chosen { outline-color: var(--teal); }
@keyframes pulse { 50% { outline-offset: 7px; } }
.seat .tag { min-height: 20px; margin-top: 7px; font: 700 .72rem var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--teal); }
.seat.turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,185,74,.25), 0 0 24px rgba(240,185,74,.25); }
.seat.target { border-color: var(--red); }
.seat.out { opacity: .5; }
.seat.pick { cursor: pointer; border-color: var(--teal); animation: pickp 1.1s infinite; }
@keyframes pickp { 50% { transform: translateY(-4px); } }
.seat.off .who b::after { content: ' (offline)'; font: .7rem var(--ui); color: var(--muted); }

.center { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; min-height: 100px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 8px; border: 2px solid var(--gold); border-radius: 99px; background: rgba(11,20,36,.9); font: 600 .78rem var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pill b { font: 800 1.2rem var(--ui); color: var(--gold2); letter-spacing: 0; }
.pill img { width: 24px; height: 24px; } .pill img.mini { width: 18px; height: 26px; }
.curbox { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-radius: 14px; background: rgba(18,32,58,.7); border: 1px dashed var(--line); font-size: 1.05rem; text-align: center; max-width: 720px; }
.curbox .ghost { width: 44px; border-radius: 4px; opacity: .85; outline: 2px dashed var(--gold2); outline-offset: 2px; }
.curbox b { color: var(--gold2); }
.timer { width: min(420px, 90%); height: 6px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: 0 50%; }
.mine { display: flex; flex-direction: column; align-items: center; padding: 6px 0 10px; }
.mine .seat { width: 250px; padding: 10px 12px; }
.mine .hand img { width: 96px; }

/* ---------- painel de ação e registro ---------- */
.dock { position: sticky; bottom: 0; z-index: 20; background: linear-gradient(transparent, var(--bg) 18px); padding-top: 14px !important; max-width: 1180px; margin: 0 auto; padding: 0 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.panel { background: rgba(18,32,58,.92); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-height: 130px; }
.panel h3 { margin: 0 0 4px; color: var(--gold2); font-size: 1.15rem; }
.panel p { margin: 0 0 10px; color: #dbe6f5; font-size: .98rem; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.act { display: grid; grid-template-columns: 38px 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); cursor: pointer; }
.act:hover:not(:disabled) { border-color: var(--gold); }
.act:disabled { opacity: .4; cursor: not-allowed; }
.act img { width: 38px; height: 38px; grid-row: span 2; }
.act b { font: 700 .95rem var(--serif); }
.act small { font: .72rem var(--ui); color: var(--muted); }
.act.sel { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(111,224,212,.4); }
.poolrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.logbox { background: rgba(11,20,36,.7); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.logbox h4 { margin: 0 0 6px; font: 700 .72rem var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.log { max-height: 220px; overflow: auto; font: .85rem/1.4 var(--ui); color: #dbe6f5; }
.log div { padding: 3px 0; border-bottom: 1px solid rgba(38,64,106,.5); }
.log .reveal, .log .effect { color: var(--gold2); } .log .challenge, .log .block { color: var(--teal); } .log .out { color: var(--red); } .log .win { color: #fff; font-weight: 700; }

/* ---------- avisos ---------- */
.toasts { position: fixed; top: 58px; right: 12px; z-index: 200; display: grid; gap: 8px; width: min(320px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; background: rgba(18,32,58,.96); border: 1px solid var(--gold); border-left: 5px solid var(--gold); border-radius: 12px; padding: 10px 12px; font: .9rem/1.35 var(--ui); box-shadow: 0 10px 26px rgba(0,0,0,.5); animation: tin .3s ease-out; display: flex; gap: 10px; align-items: center; }
.toast.alert { border-color: var(--red); border-left-color: var(--red); }
.toast button { margin-left: auto; font: 700 .75rem var(--ui); border: 1px solid var(--gold); background: transparent; color: var(--gold2); border-radius: 8px; padding: 5px 9px; cursor: pointer; white-space: nowrap; }
@keyframes tin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.flash { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 250; background: #2a0f0c; color: #ffd2cc; border: 1px solid var(--red); padding: 10px 18px; border-radius: 12px; font: .92rem var(--ui); }
.overlay { position: fixed; inset: 0; z-index: 100; background: var(--bg); }
.overlay iframe { width: 100%; height: 100%; border: 0; display: block; }
.confirm { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(5,10,22,.7); }
.cbox { background: var(--panel); border: 1px solid var(--gold); border-radius: 16px; padding: 22px; max-width: 420px; text-align: center; }
.cbox .btn { margin: 6px; }
.over { text-align: center; }
.over h3 { font-size: 1.5rem; }

@media (max-width: 520px) { .brandmini { display: none; } }
@media (max-width: 860px) {
  .dock { grid-template-columns: 1fr; position: static; }
  .mine .seat { width: 100%; }
  .two { grid-template-columns: 1fr; }
  .seat { width: calc(50% - 8px); min-width: 150px; }
  .hand img { width: 52px; }
  .mine .hand img { width: 96px; }
}

/* ---------- cartas maiores, zoom e animações ---------- */
.hand img { width: 78px; }
.mine .hand img { width: 132px; }
.mine .seat { width: 316px; }
.hand .cw:not(.sel) img { cursor: zoom-in; }
.dock { grid-template-columns: auto minmax(0, 1fr) 280px; }
.curbox .ghost { width: 62px; cursor: zoom-in; }
.fld select { display: block; width: 100%; margin-top: 4px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 1rem var(--serif); }
.overlay { top: 57px; }
.zoom { position: fixed; inset: 0; z-index: 260; background: rgba(5,10,22,.86); display: grid; place-items: center; cursor: zoom-out; }
.zoom img { height: min(88vh, 660px); max-width: 94vw; border-radius: 16px; box-shadow: 0 24px 70px #000; }
.fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.fx .dim { position: absolute; inset: 0; background: rgba(5,10,22,.5); }
.fx .shout { position: absolute; display: flex; align-items: center; gap: 10px; padding: 8px 24px 8px 10px; background: #0b1424; border: 3px solid var(--c); border-radius: 99px; font: 800 1.7rem var(--ui); letter-spacing: .05em; color: var(--c); white-space: nowrap; box-shadow: 0 0 40px rgba(0,0,0,.6), 0 0 28px color-mix(in srgb, var(--c) 45%, transparent); }
.fx .shout img { width: 46px; height: 46px; }
.fx .bub { position: absolute; max-width: 260px; padding: 9px 16px; background: #fff; color: #14203a; border-radius: 16px; border-bottom: 5px solid var(--c); font: 600 1.02rem/1.3 var(--serif); text-align: center; box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.fx .bub.below { border-bottom: 0; border-top: 5px solid var(--c); }
.fx .flyp { position: absolute; width: 26px; height: 26px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.6)); }
.fx .rev { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; perspective: 1100px; }
.fx .rev .card { position: relative; width: min(250px, 52vw); aspect-ratio: 300 / 440; margin: 0 auto; transform-style: preserve-3d; }
.fx .rev .card img { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 14px; box-shadow: 0 26px 60px #000; }
.fx .rev .card .f { transform: rotateY(180deg); }
.fx .rev .cap { display: inline-block; margin-top: 14px; padding: 9px 18px; max-width: 86vw; font: 700 1.1rem/1.3 var(--ui); color: #fff; background: rgba(11,20,36,.94); border: 1px solid var(--gold); border-radius: 12px; }
.fx .rev.lost .card .f { filter: grayscale(1) brightness(.55); transition: filter .5s; }
.fx .rev.lost .card::after { content: ''; position: absolute; inset: 0; border-radius: 14px; transform: rotateY(180deg) translateZ(1px);
  background: linear-gradient(45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%), linear-gradient(-45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%); }
@media (max-width: 860px) {
  .hand img { width: 62px; }
  .mine .hand img { width: 124px; }
  .mine .seat { width: 100%; }
  .dock { grid-template-columns: 1fr; }
}

/* virar carta sem 3D (compatível com todos os navegadores) */
.fx .rev .card img { backface-visibility: visible; }
.fx .rev .card .f { transform: none; }
.fx .rev.lost .card::after { content: none; }
.fx .rev .card .x { display: none; position: absolute; inset: 0; border-radius: 14px;
  background: linear-gradient(45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%), linear-gradient(-45deg, transparent 47.5%, rgba(255,110,100,.95) 48%, rgba(255,110,100,.95) 52%, transparent 52.5%); }
.fx .rev.lost .card .x { display: block; }

/* telas baixas: o painel de ações deixa de ser fixo para não cobrir o centro da mesa */
@media (max-height: 780px) and (min-width: 861px) { .dock { position: static; } }

/* cartas do Redesenhar: quatro cabem numa fileira */
.poolrow .cw img { display: block; width: 104px; border-radius: 8px; }

/* variação de pérolas nas ações: paga em amarelo (−7), ganha em verde (+2) */
.pr { display: inline-flex; align-items: center; gap: 3px; margin-right: 5px; padding: 1px 8px 1px 4px; border-radius: 99px; font: 800 .82rem var(--ui); vertical-align: 1px; border: 1px solid var(--gold); background: rgba(240,185,74,.16); color: var(--gold2); }
.pr.gain { border-color: #5fd07a; background: rgba(95,208,122,.16); color: #8ef0a6; }
.pr img { width: 15px; height: 15px; grid-row: auto; }

/* painel de custos sempre à vista */
.costs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; max-width: 1040px; }
.ci { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 5px; border: 1px solid var(--line); border-radius: 99px; background: rgba(11,20,36,.72); font: 600 .8rem var(--ui); color: #dbe6f5; cursor: help; white-space: nowrap; }
.ci .ic { width: 22px; height: 22px; }
.ci b { font: 700 .85rem var(--serif); color: var(--ink); }
.ci em { font-style: normal; font-size: .72rem; color: var(--muted); }
.ci .pr { margin-right: 0; }
@media (max-width: 860px) { .costs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; width: 100%; padding-bottom: 4px; } }
