/* =====================================================================
 * Copas — estilos. Estética: veludo bordeaux, ouro envelhecido, marfim.
 * ===================================================================== */
:root {
  --bg: #120708;
  --bg-2: #1e0b0d;
  --velvet: #5c0d13;
  --velvet-deep: #2a0507;
  --red: #b8141c;
  --red-hi: #e2353b;
  --gold: #d4a94a;
  --gold-hi: #f6e3a0;
  --gold-lo: #8f6420;
  --ivory: #f6ecd6;
  --ink: #1a1110;
  --text: #f4e9d2;
  --muted: #c9b48c;
  --ok: #6fbf73;
  --warn: #e7b14a;
  --danger: #e2353b;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .55);
  --gold-grad: linear-gradient(135deg, #f7e7a1 0%, #d4a94a 30%, #8f6420 58%, #e3bf62 82%, #9a6d22 100%);
  --cw: 92px;           /* largura das cartas da mão (JS ajusta) */
  --tw: 84px;           /* largura das cartas na vaza */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-ui);
  font-size: 18px; line-height: 1.35;
  -webkit-font-smoothing: antialiased; overflow: hidden;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
input, textarea, select { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: .04em; }

.screen { position: fixed; inset: 0; overflow: hidden; }
.screen-hero { overflow-y: auto; }
.hero-bg { position: fixed; inset: 0; background-size: cover; background-position: center; z-index: 0; }
.hero-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(18,7,8,.25), rgba(18,7,8,.85) 75%), linear-gradient(180deg, rgba(18,7,8,.3), rgba(18,7,8,.9)); }
.hero-bg.dim::after { background: radial-gradient(ellipse at 50% 35%, rgba(18,7,8,.55), rgba(18,7,8,.94) 70%); }

/* ------------------------------------------------------------ marca */
.brand { text-align: center; position: relative; z-index: 1; }
.brand-small { font-family: var(--font-ui); font-weight: 700; letter-spacing: .32em; font-size: 15px; text-transform: uppercase;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-title { font-size: clamp(54px, 13vw, 104px); font-weight: 900; line-height: .95; letter-spacing: .06em;
  background: linear-gradient(180deg, #ff5a5f 0%, #c3141d 45%, #6f070c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.5px #e6c063; filter: drop-shadow(0 4px 10px rgba(0,0,0,.7)); }
.brand-rule { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--red-hi); margin-top: 6px; }
.brand-rule::before, .brand-rule::after { content: ''; height: 1px; width: 90px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.brand-compact .brand-title { font-size: clamp(44px, 9vw, 72px); }

/* ------------------------------------------------------------ painéis e botões */
.panel { background: linear-gradient(180deg, rgba(36,14,15,.92), rgba(20,8,9,.95)); border: 1px solid rgba(212,169,74,.45);
  border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 1px rgba(246,227,160,.06); padding: 22px; position: relative; }
.panel::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(212,169,74,.18); border-radius: calc(var(--radius) - 4px); pointer-events: none; }

.btn { border: 0; border-radius: 10px; padding: 12px 20px; font-family: var(--font-ui); font-weight: 700; font-size: 15px; letter-spacing: .08em;
  text-transform: uppercase; transition: transform .12s, filter .15s, box-shadow .15s; position: relative; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { filter: grayscale(.7) brightness(.6); cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-gold { background: var(--gold-grad); color: #2a1606; box-shadow: 0 6px 18px rgba(212,169,74,.25), inset 0 1px 0 rgba(255,255,255,.5); text-shadow: 0 1px 0 rgba(255,240,200,.5); }
.btn-gold:hover { filter: brightness(1.08); }
.btn-red { background: linear-gradient(180deg, #e2353b, #9c0f16); color: #fff3df; box-shadow: 0 6px 18px rgba(184,20,28,.35), inset 0 1px 0 rgba(255,255,255,.25); border: 1px solid #e6c063; }
.btn-red:hover { filter: brightness(1.1); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--gold-hi); border: 1px solid rgba(212,169,74,.5); }
.btn-ghost:hover { background: rgba(212,169,74,.12); }
.btn-small { padding: 7px 12px; font-size: 12px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(212,169,74,.5); background: rgba(20,8,9,.7);
  display: grid; place-items: center; font-size: 18px; position: relative; backdrop-filter: blur(4px); }
.icon-btn:hover { background: rgba(212,169,74,.15); }
.badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red-hi);
  color: #fff; font: 700 11px/18px system-ui, sans-serif; padding: 0 5px; border: 1px solid var(--gold-hi); }
.chip { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 13px; font-family: var(--font-ui); font-weight: 700;
  border: 1px solid rgba(212,169,74,.45); color: var(--muted); letter-spacing: .04em; }
.chip-gold { color: #2a1606; background: var(--gold-grad); border-color: transparent; }
.chip-pending { color: var(--warn); border-color: var(--warn); }
.chip-active { color: var(--ok); border-color: var(--ok); }

/* ------------------------------------------------------------ autenticação */
.auth-wrap { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.auth-panel { width: min(420px, 100%); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: rgba(0,0,0,.3); padding: 4px; border-radius: 10px; }
.tab { flex: 1; background: none; border: 0; padding: 9px; border-radius: 8px; font-family: var(--font-ui); font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.tab.active { background: var(--gold-grad); color: #2a1606; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: 600 17px var(--font-ui); color: var(--text); background: rgba(0,0,0,.35);
  border: 1px solid rgba(212,169,74,.4); border-radius: 9px; padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(212,169,74,.2); }
.hint { font-size: 14px; color: var(--muted); margin: 0; font-style: italic; }
.form-error { color: #ff8a8e; min-height: 1.3em; margin: 12px 0 0; text-align: center; font-weight: 600; }

/* ------------------------------------------------------------ lobby */
.topbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) 12px calc(16px + var(--safe-l)); }
.me-box { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 700 20px var(--font-ui);
  background: radial-gradient(circle at 35% 30%, #e2353b, #6f070c); color: var(--gold-hi); border: 2px solid var(--gold); box-shadow: 0 4px 12px rgba(0,0,0,.5); flex: none; }
.avatar.bot { background: radial-gradient(circle at 35% 30%, #4a4340, #151110); }
.me-name { font-family: var(--font-ui); font-weight: 700; font-size: 17px; }
.me-sub { display: flex; gap: 6px; margin-top: 3px; }
.topbar-actions { display: flex; gap: 10px; }
.lobby { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 8px 16px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 22px; }
.banner { border: 1px solid var(--warn); color: #ffe2a8; background: rgba(231,177,74,.1); padding: 12px 16px; border-radius: 10px; text-align: center; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.mode-card { composes: panel; background: linear-gradient(170deg, rgba(40,16,17,.92), rgba(16,7,8,.96)); border: 1px solid rgba(212,169,74,.5);
  border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.mode-card::after { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(212,169,74,.18); border-radius: 13px; pointer-events: none; }
.mode-card-red { background: linear-gradient(170deg, rgba(110,14,20,.92), rgba(40,6,9,.96)); }
.mode-card h2 { font-size: 26px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mode-card p { margin: 0; color: var(--muted); flex: 1; }
.mode-icon { position: absolute; right: 18px; top: 8px; font-size: 72px; opacity: .14; color: var(--gold-hi); font-family: var(--font-ui); }
.seg { display: flex; background: rgba(0,0,0,.35); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 8px; font: 700 13px var(--font-ui); color: var(--muted); letter-spacing: .04em; }
.seg button.active { background: rgba(212,169,74,.22); color: var(--gold-hi); box-shadow: inset 0 0 0 1px rgba(212,169,74,.6); }
.lobby-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fair { text-align: center; color: var(--muted); font-style: italic; font-size: 15px; margin: 0; opacity: .8; }

/* ------------------------------------------------------------ fila */
.queue { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 16px; }
.queue h2 { font-size: 26px; color: var(--gold-hi); }
.queue p { color: var(--muted); margin: 0; }
.queue-fan { position: relative; width: 220px; height: 170px; }
.queue-fan .card { position: absolute; left: 75px; top: 10px; width: 80px; transform-origin: 50% 130%; animation: fan 2.4s ease-in-out infinite; }
@keyframes fan { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(var(--r)); } }

/* ------------------------------------------------------------ cartas */
.card { width: var(--cw); aspect-ratio: 5 / 7; position: relative; border-radius: 6.4% / 4.6%; box-shadow: 0 3px 7px rgba(0,0,0,.45); }
/* Sem filtros CSS nas cartas: o Safari (iPhone) corta ou não desenha elementos rodados com filtros. */
.card .card-svg { width: 100%; height: 100%; display: block; pointer-events: none; }

/* ------------------------------------------------------------ mesa */
.table-bg { position: absolute; inset: 0; background:
  radial-gradient(ellipse 80% 70% at 50% 45%, rgba(90,12,18,.0), rgba(10,3,4,.85) 80%),
  url('../img/hero.jpg') center / cover no-repeat; filter: saturate(.9); }
.table-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(40,6,9,.55), rgba(10,3,4,.92) 70%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.table-top { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l)); pointer-events: none; }
.table-top > * { pointer-events: auto; }
.table-top-actions { display: flex; gap: 8px; }
.table-info { font: 700 14px var(--font-ui); letter-spacing: .06em; color: var(--gold-hi); background: rgba(20,8,9,.7); border: 1px solid rgba(212,169,74,.4);
  border-radius: 99px; padding: 7px 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; backdrop-filter: blur(4px); }
.table-info .sep { opacity: .5; }
.hearts-flag { color: #5a4a40; font-size: 16px; transition: color .3s, text-shadow .3s; }
.hearts-flag.on { color: var(--red-hi); text-shadow: 0 0 10px rgba(226,53,59,.8); }

.felt { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); width: min(64vw, 820px); height: min(46vh, 420px);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255,90,90,.16), transparent 55%),
    repeating-radial-gradient(ellipse at 50% 50%, rgba(0,0,0,.05) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 45%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  box-shadow:
    0 0 0 9px var(--rim-1), 0 0 0 11px var(--rim-2), 0 0 0 13px var(--rim-3), 0 0 0 15px var(--rim-4), 0 0 0 17px #0a0605, 0 0 var(--glow, 0) var(--glow-c, transparent),
    0 34px 80px rgba(0,0,0,.75), inset 0 0 70px rgba(0,0,0,.65), inset 0 0 0 2px rgba(227,191,98,.35); }
.felt::before { content: ''; position: absolute; inset: 20px; border-radius: 50%; border: 1px dashed rgba(227,191,98,.35); }
.felt::after { content: '♥'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: min(12vw, 140px); color: rgba(0,0,0,.22); text-shadow: 0 1px 0 rgba(227,191,98,.12); pointer-events: none; }
.felt-rim { display: none; }
.center-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; text-align: center; pointer-events: none;
  font: 700 18px var(--font-ui); color: var(--gold-hi); text-shadow: 0 2px 8px #000; width: 80%; }

.trick { position: absolute; inset: 0; z-index: 2; }
.trick .card { position: absolute; left: 50%; top: 50%; width: var(--tw); margin-left: calc(var(--tw) / -2); margin-top: calc(var(--tw) * -.7);
  --tx: 0%; --ty: 0%; --tr: 0deg;
  transform: translate(var(--tx), var(--ty)) rotate(var(--tr));
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .45s; }
.trick .card[data-rel="0"] { --tx: 0%;   --ty: 46%;  --tr: -2deg; }
.trick .card[data-rel="1"] { --tx: -96%; --ty: -2%;  --tr: -12deg; }
.trick .card[data-rel="2"] { --tx: 0%;   --ty: -50%; --tr: 3deg; }
.trick .card[data-rel="3"] { --tx: 96%;  --ty: -2%;  --tr: 10deg; }
.trick .card.fly { animation: fly-in .46s cubic-bezier(.22,.61,.36,1) both; }
@keyframes fly-in {
  from { transform: translate(calc(var(--tx) + var(--fx)), calc(var(--ty) + var(--fy))) rotate(var(--tr)) scale(.8); opacity: .3; }
  to   { transform: translate(var(--tx), var(--ty)) rotate(var(--tr)); opacity: 1; } }
.trick .card.collect { transition: transform .55s ease-in, opacity .55s ease-in;
  transform: translate(calc(var(--tx) + var(--cx)), calc(var(--ty) + var(--cy))) rotate(var(--tr)) scale(.45); opacity: 0; }
.trick .card.winner { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 22px rgba(246,227,160,.85); }

/* lugares */
.seat { position: absolute; z-index: 4; display: flex; align-items: center; gap: 10px; }
.seat-1 { left: calc(14px + var(--safe-l)); top: 46%; transform: translateY(-50%); flex-direction: column; }
.seat-3 { right: calc(14px + var(--safe-r)); top: 46%; transform: translateY(-50%); flex-direction: column; }
.seat-2 { left: 50%; top: calc(58px + var(--safe-t)); transform: translateX(-50%); }
.plate { display: flex; align-items: center; gap: 9px; background: linear-gradient(180deg, rgba(36,14,15,.92), rgba(16,7,8,.95)); border: 1px solid rgba(212,169,74,.5);
  border-radius: 99px; padding: 5px 14px 5px 5px; box-shadow: 0 8px 20px rgba(0,0,0,.5); cursor: pointer; transition: box-shadow .2s; min-width: 0; }
.plate.turn { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 24px rgba(246,227,160,.45); }
.plate .avatar { width: 42px; height: 42px; font-size: 17px; position: relative; }
.plate .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.plate .ring circle { fill: none; stroke: var(--gold-hi); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .3s linear, stroke .3s; }
.plate .ring.low circle { stroke: var(--red-hi); }
.plate-name { font: 700 14px var(--font-ui); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-sub { display: flex; gap: 5px; margin-top: 2px; font-size: 13px; color: var(--muted); align-items: center; }
.plate-score { font: 700 13px var(--font-ui); color: var(--gold-hi); }
.plate-pts { color: #ff9a9e; font: 700 12px var(--font-ui); }
.plate-tag { font: 700 10px system-ui, sans-serif; letter-spacing: .05em; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--muted); text-transform: uppercase; }
.plate-tag.away { background: rgba(231,177,74,.18); color: var(--warn); }
.plate-tag.ok { background: rgba(111,191,115,.18); color: var(--ok); }
.minifan { position: relative; height: calc(var(--cw) * .5 * 1.4); width: calc(var(--cw) * .5 + 40px); }
.minifan .card { position: absolute; top: 0; width: calc(var(--cw) * .5); }
.seat-1 .minifan, .seat-3 .minifan { display: block; }

/* área do jogador */
.my-area { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-direction: column; align-items: center;
  padding: 0 calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); pointer-events: none; }
.my-area > * { pointer-events: auto; }
.seat-0 { position: relative; align-self: flex-start; margin-left: 4px; margin-bottom: 6px; }
.action-bar { min-height: 0; display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 8px; text-align: center;
  font: 700 15px var(--font-ui); color: var(--gold-hi); text-shadow: 0 2px 6px #000; }
.action-bar:empty { display: none; }
.hand { position: relative; width: 100%; height: calc(var(--cw) * 1.4 + 34px); margin-bottom: 4px; }
.hand .card { position: absolute; bottom: 0; cursor: pointer; touch-action: none; --lift: 0px; --rot: 0deg;
  transform: translateY(var(--lift)) rotate(var(--rot));
  transition: transform .22s cubic-bezier(.2,.8,.2,1), left .3s, bottom .3s, box-shadow .2s;
  box-shadow: -5px 0 10px -2px rgba(0,0,0,.45), 0 3px 6px rgba(0,0,0,.35); }
@media (hover: hover) { .hand .card:hover { --lift: -10px; } }
/* cartas jogáveis sobem um pouco e ganham contorno dourado */
.hand .card.can { --lift: -8px; box-shadow: 0 0 0 1.5px rgba(246,227,160,.85), 0 0 12px rgba(246,227,160,.45), -5px 0 10px -2px rgba(0,0,0,.45); }
.hand .card.sel { --lift: -26px; box-shadow: 0 0 0 2px var(--gold-hi), 0 0 16px rgba(246,227,160,.8), 0 6px 12px rgba(0,0,0,.55); }
/* cartas que não se podem jogar: sombra por cima (a carta continua visível em qualquer tema) */
.hand .card.off { cursor: not-allowed; --lift: 6px; }
.hand .card.off::before { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: 6.4% / 4.6%; background: rgba(14,5,6,.55); pointer-events: none; }
@media (hover: hover) { .hand .card.off:hover { --lift: 6px; } }
.hand .card.recv::after { content: ''; position: absolute; inset: -3px; z-index: 3; border-radius: 7% / 5%; box-shadow: 0 0 0 2px var(--gold-hi), 0 0 18px rgba(246,227,160,.7); animation: pulse 1.4s ease-in-out 3; pointer-events: none; }
.hand .card.dragging { transition: none; }
.hand .card.deal { animation: deal .45s cubic-bezier(.2,.8,.2,1) both; }
.hand .card.shake { animation: shake .35s; }
@keyframes deal { from { opacity: 0; transform: translate(0, -60vh) rotate(-20deg) scale(.6); } to { opacity: 1; transform: translateY(var(--lift)) rotate(var(--rot)); } }
@keyframes shake { 0%, 100% { transform: translateY(var(--lift)) rotate(var(--rot)); } 25% { transform: translate(-6px, var(--lift)) rotate(var(--rot)); }
  50% { transform: translate(6px, var(--lift)) rotate(var(--rot)); } 75% { transform: translate(-3px, var(--lift)) rotate(var(--rot)); } }

/* ------------------------------------------------------------ Dama de Espadas: brilho próprio */
.card[data-card="QS"] { box-shadow: 0 0 0 2px #b98cff, 0 0 14px 2px rgba(150,90,255,.75), 0 0 28px 4px rgba(90,20,160,.45) !important; animation: qs-glow 2.2s ease-in-out infinite; }
.card[data-card="QS"]::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: 6.4% / 4.6%; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(214,180,255,.45) 45%, rgba(255,255,255,.55) 50%, rgba(214,180,255,.45) 55%, transparent 70%);
  background-size: 250% 100%; animation: qs-shine 2.8s ease-in-out infinite; }
.trick .card[data-card="QS"] { box-shadow: 0 0 0 3px #d2b0ff, 0 0 26px 6px rgba(150,90,255,.9), 0 0 60px 12px rgba(90,20,160,.55) !important; animation: qs-glow-strong 1.3s ease-in-out infinite; }
.hand .card.off[data-card="QS"] { animation: none; box-shadow: 0 0 0 1.5px rgba(185,140,255,.7), 0 0 10px rgba(150,90,255,.45) !important; }
.trick .card.fly[data-card="QS"] { animation: fly-in .46s cubic-bezier(.22,.61,.36,1) both, qs-glow-strong 1.3s .46s ease-in-out infinite; }
@keyframes qs-glow { 50% { box-shadow: 0 0 0 2px #d9c2ff, 0 0 22px 5px rgba(170,110,255,.9), 0 0 40px 8px rgba(90,20,160,.55); } }
@keyframes qs-glow-strong { 50% { box-shadow: 0 0 0 3px #efe2ff, 0 0 40px 12px rgba(180,120,255,1), 0 0 90px 20px rgba(110,30,190,.6); } }
@keyframes qs-shine { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------ modais */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8,3,4,.72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: linear-gradient(180deg, #2a0f11, #140809); border: 1px solid rgba(212,169,74,.55);
  border-radius: 18px; box-shadow: var(--shadow); padding: 30px 22px 22px; position: relative; animation: pop .25s cubic-bezier(.2,.8,.2,1); }
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal-x { position: absolute; top: 12px; right: 12px; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(212,169,74,.6);
  background: rgba(0,0,0,.4); padding: 0; display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .15s; }
.modal-x::before, .modal-x::after { content: ''; grid-area: 1 / 1; width: 22px; height: 2.5px; border-radius: 2px; background: var(--gold-hi); transform: rotate(45deg); }
.modal-x::after { transform: rotate(-45deg); }
.modal-x:hover { background: rgba(212,169,74,.2); transform: scale(1.05); }
.modal h2 { font-size: 24px; text-align: center; margin: 4px 56px 16px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modal p { color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
table.score { width: 100%; border-collapse: collapse; font-size: 16px; }
table.score th, table.score td { padding: 8px 6px; text-align: center; border-bottom: 1px solid rgba(212,169,74,.18); }
table.score th { font: 700 12px var(--font-ui); color: var(--muted); letter-spacing: .06em; }
table.score td:first-child, table.score th:first-child { text-align: left; }
table.score tr.me td { color: var(--gold-hi); font-weight: 700; }
.podium { display: flex; flex-direction: column; gap: 10px; }
.podium-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(212,169,74,.2); }
.podium-row.me { border-color: var(--gold); background: rgba(212,169,74,.1); }
.medal { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 900 17px var(--font-ui); color: #2a1606; flex: none; }
.medal.p1 { background: var(--gold-grad); box-shadow: 0 0 16px rgba(246,227,160,.6); }
.medal.p2 { background: linear-gradient(135deg, #f2f2f2, #9ea3a8); }
.medal.p3 { background: linear-gradient(135deg, #e7a46b, #8a4b1f); }
.medal.p4 { background: #3a2a28; color: var(--muted); }
.podium-name { flex: 1; font: 700 16px var(--font-ui); }
.podium-score { font: 700 18px var(--font-ui); color: var(--gold-hi); }
.delta { font: 700 13px var(--font-ui); padding: 2px 8px; border-radius: 99px; }
.delta.up { color: var(--ok); background: rgba(111,191,115,.12); }
.delta.down { color: #ff8a8e; background: rgba(226,53,59,.12); }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(212,169,74,.2); }
.list-item .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list-item small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); font-style: italic; padding: 24px 0; }
.rules h3 { font-size: 15px; color: var(--gold-hi); margin: 16px 0 4px; }
.rules p { margin: 0 0 6px; color: var(--text); }

/* ------------------------------------------------------------ chat */
.chat { position: fixed; z-index: 40; right: calc(12px + var(--safe-r)); top: calc(64px + var(--safe-t)); bottom: calc(12px + var(--safe-b)); width: min(360px, calc(100vw - 24px));
  display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(36,14,15,.97), rgba(16,7,8,.98)); border: 1px solid rgba(212,169,74,.5); border-radius: 16px; box-shadow: var(--shadow); animation: slide .25s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.chat header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid rgba(212,169,74,.25); font-family: var(--font-ui); color: var(--gold-hi); }
.chat header .modal-x { position: static; width: 40px; height: 40px; flex: none; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 16px; }
.chat-msg b { font-family: var(--font-ui); font-size: 13px; color: var(--gold-hi); margin-right: 6px; }
.chat-msg.me b { color: #ff9a9e; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid rgba(212,169,74,.15); }
.quick button { border: 1px solid rgba(212,169,74,.4); background: rgba(0,0,0,.25); border-radius: 99px; padding: 4px 10px; font-size: 14px; color: var(--gold-hi); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; }
.chat-form input { flex: 1; min-width: 0; padding: 9px 11px; }
.chat-form .btn { padding: 9px 12px; font-size: 12px; }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 70; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: linear-gradient(180deg, #2f1214, #170809); border: 1px solid var(--gold); color: var(--gold-hi); padding: 10px 18px; border-radius: 12px; font: 700 14px var(--font-ui); letter-spacing: .03em; text-align: center;
  box-shadow: var(--shadow); animation: toast 3.2s forwards; }
.toast.err { border-color: var(--red-hi); color: #ffc7c9; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ------------------------------------------------------------ lua */
.moon { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(40,20,0,.55), rgba(5,2,2,.92)); animation: fade .4s; pointer-events: none; }
.moon-disc { position: absolute; width: min(60vw, 360px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fffbe6, #f2d88a 40%, #b98a2c 75%, #6d4a12); box-shadow: 0 0 80px 20px rgba(246,227,160,.55), 0 0 200px 60px rgba(212,169,74,.3);
  animation: moonrise 2.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes moonrise { from { transform: translateY(40vh) scale(.4); opacity: 0; } 60% { opacity: 1; } to { transform: none; } }
.moon-text { position: relative; text-align: center; display: flex; flex-direction: column; gap: 6px; animation: pop .6s .8s both; }
.moon-text small { font: 900 20px var(--font-ui); letter-spacing: .25em; color: #3a2206; text-transform: uppercase; }
.moon-text b { font: 900 clamp(30px, 7vw, 54px) var(--font-ui); color: #6f070c; text-shadow: 0 1px 0 rgba(255,240,200,.7); }
.moon-text span { color: #3a2206; font-weight: 700; font-size: 17px; }

/* ------------------------------------------------------------ responsivo */
@media (orientation: portrait) {
  .felt { width: 84vw; height: 36vh; top: 34%; }
  .seat-1, .seat-3 { top: 31%; }
  .seat-1 .minifan, .seat-3 .minifan { display: none; }
  .seat-2 .minifan { display: none; }
  .plate { flex-direction: column; border-radius: 16px; padding: 6px 8px; gap: 4px; text-align: center; }
  .plate-name { max-width: 84px; font-size: 12px; }
  .plate-sub { justify-content: center; }
  .seat-2 .plate { flex-direction: row; border-radius: 99px; padding: 5px 12px 5px 5px; text-align: left; }
  .seat-0 .plate { flex-direction: row; border-radius: 99px; padding: 4px 12px 4px 4px; text-align: left; }
  .table-info { font-size: 12px; padding: 6px 12px; }
  .trick .card[data-rel="1"] { --tx: -62%; }
  .trick .card[data-rel="3"] { --tx: 62%; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .seat-2 { top: calc(8px + var(--safe-t)); }
  .felt { top: 42%; height: 54vh; }
  .table-info { display: none; }
  .seat-0 { position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(var(--hand-h, calc(var(--cw) * 1.4 + 34px)) - 4px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ temas de mesa */
body { --felt-1: #84141c; --felt-2: #5a0b11; --felt-3: #30050a; --rim-1: #2c1709; --rim-2: #c9973a; --rim-3: #4a2e0f; --rim-4: #e3bf62; --tbl-tint: rgba(40,6,9,.55); }
body[data-table-theme="vegas"]  { --felt-1: #1f8a52; --felt-2: #12633a; --felt-3: #073820; --rim-1: #3b1f0e; --rim-2: #d4a94a; --rim-3: #2a1508; --rim-4: #f0cf75; --tbl-tint: rgba(4,30,16,.55); }
body[data-table-theme="monaco"] { --felt-1: #2a4f9c; --felt-2: #183470; --felt-3: #0a1838; --rim-1: #e8e4dc; --rim-2: #b9a26a; --rim-3: #f4f1ea; --rim-4: #d8c48a; --tbl-tint: rgba(6,14,36,.55); }
body[data-table-theme="noir"]   { --felt-1: #2b2b2e; --felt-2: #18181a; --felt-3: #0a0a0b; --rim-1: #111; --rim-2: #d4a94a; --rim-3: #1c1c1c; --rim-4: #8f6420; --tbl-tint: rgba(5,5,6,.65); }
body[data-table-theme="saloon"] { --felt-1: #7a4a26; --felt-2: #5a3418; --felt-3: #2e1a0b; --rim-1: #4a2a12; --rim-2: #b07a3a; --rim-3: #2c170a; --rim-4: #d39a52; --tbl-tint: rgba(30,16,6,.55); }
body[data-table-theme="cyber"]  { --felt-1: #10264a; --felt-2: #0a1530; --felt-3: #050a18; --rim-1: #0a1020; --rim-2: #18e7ff; --rim-3: #0a1020; --rim-4: #ff2bd6; --tbl-tint: rgba(3,6,20,.6); --glow: 30px; --glow-c: rgba(24,231,255,.35); }
body[data-table-theme="noir"] .felt::before { border-color: rgba(212,169,74,.4); }
body[data-table-theme="cyber"] .felt::before { border: 1px solid rgba(24,231,255,.5); box-shadow: inset 0 0 20px rgba(24,231,255,.25); }
body[data-table-theme="saloon"] .felt { background-image: repeating-linear-gradient(92deg, rgba(0,0,0,.08) 0 3px, transparent 3px 11px), radial-gradient(ellipse at 50% 45%, var(--felt-1), var(--felt-2) 55%, var(--felt-3)); }
.table-bg::after { background: radial-gradient(ellipse at 50% 45%, var(--tbl-tint), rgba(10,3,4,.92) 70%); }

/* ------------------------------------------------------------ definições */
.set-title { font-size: 15px; color: var(--gold-hi); margin: 14px 0 10px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-opt { background: rgba(255,255,255,.04); border: 1.5px solid rgba(212,169,74,.25); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); }
.theme-opt b { font: 700 13px var(--font-ui); letter-spacing: .03em; }
.theme-opt.active { border-color: var(--gold-hi); background: rgba(212,169,74,.14); box-shadow: 0 0 0 3px rgba(212,169,74,.15); }
.theme-cards { display: flex; gap: 6px; height: 74px; }
.theme-cards .card.mini { --cw: 52px; width: 52px; border-radius: 5px; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 5px; font: 700 15px var(--font-ui); overflow: hidden; }
.theme-cards .card.mini .card-svg { position: absolute; inset: 0; }
.theme-felt { width: 100%; height: 60px; border-radius: 50%; display: block; background: radial-gradient(ellipse, var(--a), var(--b) 70%); box-shadow: 0 0 0 3px var(--c), 0 0 0 5px var(--d); }
.felt-prev-bordeaux { --a: #84141c; --b: #30050a; --c: #c9973a; --d: #2c1709; }
.felt-prev-vegas    { --a: #1f8a52; --b: #073820; --c: #d4a94a; --d: #3b1f0e; }
.felt-prev-monaco   { --a: #2a4f9c; --b: #0a1838; --c: #e8e4dc; --d: #b9a26a; }
.felt-prev-noir     { --a: #2b2b2e; --b: #0a0a0b; --c: #d4a94a; --d: #111; }
.felt-prev-saloon   { --a: #7a4a26; --b: #2e1a0b; --c: #b07a3a; --d: #4a2a12; }
.felt-prev-cyber    { --a: #10264a; --b: #050a18; --c: #18e7ff; --d: #ff2bd6; }

/* ------------------------------------------------------------ histórico de jogadas */
.plays-sec h4 { font: 700 13px var(--font-ui); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 8px; }
.plays-sec + .plays-sec { margin-top: 14px; border-top: 1px solid rgba(212,169,74,.2); padding-top: 8px; opacity: .8; }
.play-row { display: grid; grid-template-columns: 22px 1fr; gap: 4px 8px; padding: 7px 0; border-bottom: 1px solid rgba(212,169,74,.12); }
.play-row.cur { background: rgba(212,169,74,.06); border-radius: 8px; padding: 7px 6px; }
.play-n { font: 700 13px var(--font-ui); color: var(--gold); grid-row: span 2; padding-top: 2px; }
.play-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pc { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,.25); border-radius: 6px; padding: 2px 3px; min-width: 0; }
.pc small { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc.win { box-shadow: inset 0 0 0 1.5px var(--gold-hi); }
.ct { font: 700 16px var(--font-ui); background: #f6ecd6; border-radius: 4px; padding: 0 5px; line-height: 1.35; }
.ct.r { color: #b8141c; } .ct.k { color: #1a1110; }
.play-res { font-size: 14px; color: var(--gold-hi); text-align: right; }
.play-res b { color: #ff9a9e; }

/* ------------------------------------------------------------ cartas reveladas (fim antecipado) */
.reveal { margin: 0 0 14px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid rgba(212,169,74,.25); }
.reveal-title { text-align: center; margin: 0 0 10px; color: var(--text) !important; }
.reveal-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; }
.reveal-row.win { background: rgba(212,169,74,.12); box-shadow: inset 0 0 0 1px rgba(246,227,160,.5); }
.reveal-row > b { font: 700 13px var(--font-ui); width: 92px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal-cards { display: flex; flex-wrap: wrap; gap: 0; }
.rc { width: 44px; aspect-ratio: 5/7; margin-right: -12px; border-radius: 6.4% / 4.6%; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.rc svg { width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------ avatares e perfil */
.avatar { overflow: visible; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; border-width: 1.5px; }
.avatar.xs { width: 24px; height: 24px; font-size: 11px; border-width: 1px; box-shadow: none; }
.avatar.xl { width: 116px; height: 116px; font-size: 46px; border-width: 3px; }
.avatar.loading { opacity: .5; animation: pulse 1s infinite; }
.me-box { cursor: pointer; border-radius: 99px; padding: 2px 10px 2px 2px; transition: background .15s; }
.me-box:hover { background: rgba(212,169,74,.1); }
.lb-name { display: inline-flex; align-items: center; gap: 8px; }
.profile { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pf-photo-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pf-photo-btns label.btn { cursor: pointer; }
.profile .form { width: 100%; }
.pf-stats { margin: 0; color: var(--muted); font-family: var(--font-ui); font-size: 14px; }

/* ------------------------------------------------------------ ícones vetoriais */
.ico { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
.icon-btn { color: var(--gold-hi); }
.icon-btn:hover { color: #fff3c9; }

/* ------------------------------------------------------------ sala com amigos */
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .2em; font-family: var(--font-ui); text-align: center; padding: 9px 10px; }
.join-row .btn { padding: 9px 14px; }
.room { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: calc(28px + var(--safe-t)) 16px calc(28px + var(--safe-b)); text-align: center; }
.room h2 { font-size: 30px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.room-sub { margin: -10px 0 0; color: var(--muted); font-style: italic; }
.room-code-box { display: flex; flex-direction: column; gap: 2px; padding: 12px 26px; border-radius: 14px; border: 1px solid rgba(212,169,74,.5); background: rgba(0,0,0,.35); }
.room-code-box span { font-size: 13px; color: var(--muted); }
.room-code-box b { font: 900 38px var(--font-ui); letter-spacing: .28em; color: var(--gold-hi); padding-left: .28em; user-select: all; -webkit-user-select: all; }
.room-share { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.room-share a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.room-seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
.room-seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px 14px; border-radius: 14px;
  background: linear-gradient(170deg, rgba(40,16,17,.92), rgba(16,7,8,.96)); border: 1px solid rgba(212,169,74,.45); }
.room-seat.empty { border-style: dashed; opacity: .75; }
.room-seat.offline { opacity: .55; }
.room-seat .avatar { width: 58px; height: 58px; font-size: 24px; }
.rs-name { font: 700 15px var(--font-ui); display: flex; align-items: center; gap: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-name small { font-family: var(--font-ui); color: var(--muted); }
.rs-sub { font-size: 14px; color: var(--muted); }
.rs-kick { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.35); border: 1px solid rgba(226,53,59,.5); color: #ffb3b6; border-radius: 99px; font-size: 12px; padding: 2px 9px; }
.ico.crown { width: 16px; height: 16px; color: var(--gold-hi); flex: none; }
.room-host { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.room-label { font-size: 14px; color: var(--muted); }
.room-wait { color: var(--gold-hi); font-family: var(--font-ui); margin: 0; }

/* ------------------------------------------------------------ password com olho */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; border-radius: 8px; cursor: pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--gold-hi); background: rgba(212,169,74,.1); outline: none; }
.pw-eye .ico { width: 20px; height: 20px; }

/* ------------------------------------------------------------ menu (telemóvel) */
.mob-only { display: none !important; }
@media (max-width: 680px) {
  .desk-only { display: none !important; }
  .mob-only { display: grid !important; }
}
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; border-radius: 12px; text-align: left; text-decoration: none;
  background: rgba(255,255,255,.04); border: 1px solid rgba(212,169,74,.22); color: var(--text); font: 600 18px var(--font-ui); cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(212,169,74,.12); border-color: rgba(212,169,74,.55); outline: none; }
.menu-item > .ico { color: var(--gold-hi); width: 22px; height: 22px; flex: none; }
.menu-item span { flex: 1; }
.menu-item .ico-ext { width: 16px; height: 16px; color: var(--muted); }
.menu-item.danger, .btn.account-delete { color: #ffb3b6; border-color: rgba(226,53,59,.4); }
.menu-item.danger > .ico { color: #ff8a8e; }
.menu-badge { background: var(--red-hi); color: #fff; border-radius: 99px; padding: 0 8px; font: 700 12px/20px system-ui, sans-serif; }
.ico-inline { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; margin-left: 4px; }
.lobby-links a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ------------------------------------------------------------ temporizador a piscar */
.turn-count { font: 900 17px var(--font-ui); color: var(--gold-hi); min-width: 34px; padding: 2px 9px; border-radius: 99px;
  border: 1px solid rgba(212,169,74,.5); background: rgba(0,0,0,.35); }
.turn-count:empty { display: none; }
.turn-count.hurry { color: #fff; background: var(--red-hi); border-color: #ffd0d2; animation: blink .5s steps(2, jump-none) infinite alternate; }
.plate.hurry { animation: hurry-plate .5s ease-in-out infinite alternate; }
.plate.hurry .avatar { border-color: var(--red-hi); }
.my-area.hurry::before { content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: 38vh; pointer-events: none; z-index: -1;
  background: linear-gradient(0deg, rgba(226,53,59,.35), transparent); animation: blink .5s ease-in-out infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: .35; } }
@keyframes hurry-plate { from { box-shadow: 0 0 0 2px var(--red-hi), 0 0 18px rgba(226,53,59,.6); } to { box-shadow: 0 0 0 3px #ffd0d2, 0 0 34px rgba(226,53,59,.95); } }
#btn-menu .badge { z-index: 1; }

.banner-continue { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; border-color: var(--gold); color: var(--gold-hi); background: rgba(212,169,74,.1); }

.next-in { text-align: center; margin: 14px 0 0; font: 700 17px var(--font-ui); color: var(--gold-hi) !important; }
.next-in b { display: inline-block; min-width: 30px; padding: 0 8px; border-radius: 99px; background: rgba(212,169,74,.18); border: 1px solid rgba(212,169,74,.5); }

/* ------------------------------------------------------------ arranque (splash) */
.splash { display: grid; place-items: center; background: #0b0506; z-index: 100; }
.splash-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(24px) brightness(.45); }
.splash-img { position: relative; width: min(92vw, 980px); max-height: 78vh; object-fit: contain; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.7);
  animation: splash-in .8s cubic-bezier(.2,.8,.2,1) both; }
.splash-load { position: absolute; bottom: calc(70px + var(--safe-b)); display: flex; gap: 10px; }
.splash-load span { width: 10px; height: 10px; border-radius: 50%; background: var(--gold-hi); animation: dots 1s infinite ease-in-out; }
.splash-load span:nth-child(2) { animation-delay: .15s; } .splash-load span:nth-child(3) { animation-delay: .3s; }
.splash-by { position: absolute; bottom: calc(28px + var(--safe-b)); font: 700 13px var(--font-ui); letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
@keyframes splash-in { from { opacity: 0; transform: scale(.96); } }
@keyframes dots { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }

/* ------------------------------------------------------------ entrada com a imagem */
.entry-cover { width: min(640px, 100%); height: auto; border-radius: 16px; border: 1px solid rgba(212,169,74,.55);
  box-shadow: 0 24px 60px rgba(0,0,0,.65), 0 0 0 6px rgba(20,8,9,.55); }
@media (min-width: 1000px) and (orientation: landscape) {
  .auth-wrap { flex-direction: row; gap: 40px; }
  .entry-cover { width: min(52vw, 760px); }
}
.chip-danger { color: #ff9a9e; border-color: #ff9a9e; }

/* ------------------------------------------------------------ menu principal */
.lobby-hero { border-radius: 18px; overflow: hidden; border: 1px solid rgba(212,169,74,.5); box-shadow: 0 24px 60px rgba(0,0,0,.6); position: relative; }
.lobby-hero img { display: block; width: 100%; height: auto; }
.lobby-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 65%, rgba(18,7,8,.6)); pointer-events: none; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 16px 22px; border-radius: 20px; text-align: center;
  background: linear-gradient(165deg, rgba(48,19,20,.95), rgba(18,8,9,.97)); border: 1px solid rgba(212,169,74,.55); color: var(--text);
  box-shadow: 0 16px 36px rgba(0,0,0,.5), inset 0 1px 0 rgba(246,227,160,.08); transition: transform .18s, box-shadow .18s, border-color .18s; overflow: hidden; }
.tile::after { content: ''; position: absolute; inset: 6px; border-radius: 15px; border: 1px solid rgba(212,169,74,.16); pointer-events: none; }
.tile:hover { transform: translateY(-3px); border-color: var(--gold-hi); box-shadow: 0 22px 44px rgba(0,0,0,.6), 0 0 0 1px rgba(246,227,160,.3); }
.tile:active { transform: scale(.98); }
.tile-red { background: linear-gradient(165deg, rgba(128,16,23,.96), rgba(46,6,9,.97)); }
.tile-ico { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(246,227,160,.22), rgba(212,169,74,.06) 70%); border: 1.5px solid rgba(212,169,74,.6);
  box-shadow: inset 0 0 18px rgba(0,0,0,.35), 0 6px 16px rgba(0,0,0,.4); color: var(--gold-hi); }
.tico { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tile-txt { display: flex; flex-direction: column; gap: 4px; }
.tile-txt b { font: 700 24px var(--font-ui); letter-spacing: .03em; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile-txt small { font-size: 16px; color: var(--muted); }
.quick-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.qlink { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; text-decoration: none;
  background: rgba(20,8,9,.6); border: 1px solid rgba(212,169,74,.3); color: var(--gold-hi); font: 700 13px var(--font-ui); letter-spacing: .03em; }
.qlink:hover { background: rgba(212,169,74,.12); border-color: rgba(212,169,74,.6); }
.qlink .ico { width: 24px; height: 24px; }
@media (max-width: 680px) {
  .tiles { grid-template-columns: 1fr; gap: 12px; }
  .tile { flex-direction: row; text-align: left; padding: 16px 18px; gap: 16px; }
  .tile-ico { width: 66px; height: 66px; }
  .tico { width: 38px; height: 38px; }
  .tile-txt b { font-size: 21px; }
  .tile-txt small { font-size: 15px; }
  .qlink { font-size: 11px; padding: 10px 4px; }
}

/* ------------------------------------------------------------ painéis de opções */
.sheet-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(8,3,4,.7); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
.sheet { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: linear-gradient(180deg, #2c1012, #140809); border: 1px solid rgba(212,169,74,.55); border-radius: 22px; padding: 30px 22px 24px; box-shadow: var(--shadow); animation: pop .25s cubic-bezier(.2,.8,.2,1); }
.sheet h2 { font-size: 28px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sheet p { margin: 0; color: var(--muted); }
.sheet-ico { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-hi); border: 1.5px solid rgba(212,169,74,.6);
  background: radial-gradient(circle at 35% 30%, rgba(246,227,160,.22), rgba(212,169,74,.06) 70%); }
.sheet-ico .tico { width: 44px; height: 44px; }
.level-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.level-cards button { display: flex; flex-direction: column; gap: 4px; padding: 12px 6px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1.5px solid rgba(212,169,74,.25); color: var(--text); }
.level-cards button b { font: 700 15px var(--font-ui); color: var(--gold-hi); }
.level-cards button small { font-size: 13px; color: var(--muted); line-height: 1.2; }
.level-cards button.active { border-color: var(--gold-hi); background: rgba(212,169,74,.16); box-shadow: 0 0 0 3px rgba(212,169,74,.15); }
.sheet .join-row { width: 100%; }
.sheet-sep { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.sheet-sep::before, .sheet-sep::after { content: ''; flex: 1; height: 1px; background: rgba(212,169,74,.3); }
@media (max-width: 680px) {
  .sheet-overlay { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; padding-bottom: calc(24px + var(--safe-b)); animation: sheet-up .28s cubic-bezier(.2,.8,.2,1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* Altura explícita (além de aspect-ratio) para Safari antigos */
.hand .card { height: calc(var(--cw) * 1.4); }
.trick .card { height: calc(var(--tw) * 1.4); }

.link-btn { background: none; border: 0; color: var(--gold-hi); font: 600 16px var(--font-ui); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; align-self: center; }
.form-title { font-size: 18px; color: var(--gold-hi); text-align: center; }
.form-error.ok { color: #a8e6b0; }

/* Dama de Espadas: ainda mais destaque quando é uma das cartas que podes jogar */
.hand .card.can[data-card="QS"] { --lift: -16px; animation: qs-glow-strong 1s ease-in-out infinite; }
.hand .card.can[data-card="QS"]::before { content: 'Q♠'; position: absolute; top: -26px; left: 50%; transform: translateX(-50%); z-index: 4;
  font: 900 13px var(--font-ui); color: #fff; background: linear-gradient(180deg, #a06bff, #5b20b5); padding: 2px 8px; border-radius: 99px;
  box-shadow: 0 0 12px rgba(160,107,255,.9); white-space: nowrap; pointer-events: none; }
.felt.qs-flash::before { animation: qs-felt 1.6s ease-out; }
@keyframes qs-felt { 0% { box-shadow: inset 0 0 0 0 rgba(160,107,255,0); } 20% { box-shadow: inset 0 0 120px 30px rgba(160,107,255,.75); border-color: #d2b0ff; } 100% { box-shadow: inset 0 0 0 0 rgba(160,107,255,0); } }

/* Telemóvel deitado / ecrãs baixos: imagem e login lado a lado */
@media (orientation: landscape) and (max-height: 700px) {
  .auth-wrap { flex-direction: row; align-items: center; gap: 22px; padding-top: calc(12px + var(--safe-t)); padding-bottom: calc(12px + var(--safe-b)); }
  .entry-cover { width: auto; max-width: 50vw; max-height: calc(100vh - 32px); object-fit: contain; }
  .auth-panel { padding: 14px 16px; max-height: calc(100vh - 24px); overflow-y: auto; }
  .auth-panel .form { gap: 8px; }
  .auth-panel .tabs { margin-bottom: 10px; }
  .auth-panel input { padding: 8px 11px; }
  .splash-img { max-height: 70vh; }
}
/* A imagem do menu nunca ocupa mais de ~45% da altura do ecrã */
.lobby-hero { width: 100%; max-width: calc(45vh * 16 / 9); margin: 0 auto; }

@media (max-width: 520px) { .table-info { padding: 6px 10px; gap: 6px; } .table-top { gap: 6px; } .table-top-actions { gap: 6px; } .table-top .icon-btn { width: 40px; height: 40px; } }
.trick { cursor: pointer; }

/* ------------------------------------------------------------ social: amigos, mensagens, presença */
.social { z-index: 46; }
.social header { gap: 8px; }
.social header b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.sm { width: 36px; height: 36px; position: relative; flex: none; }
.icon-btn.sm .ico { width: 19px; height: 19px; }
.icon-btn.sm .badge { top: -5px; right: -5px; }
.social-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.social-view[hidden] { display: none; }
.add-friend { border-bottom: 1px solid rgba(212,169,74,.18); padding-top: 12px; }
.soc-h { font: 700 12px var(--font-ui); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 10px 0 2px; display: flex; justify-content: space-between; gap: 8px; }
.soc-h span { text-transform: none; letter-spacing: 0; font: italic 14px var(--font-ui); }
.soc-h:first-child { margin-top: 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(212,169,74,.15); }
.person .avatar { position: relative; flex: none; }
.person-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.person-txt b { font: 700 14px var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-txt small { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-act { display: flex; gap: 6px; align-items: center; flex: none; }
.person-act .btn-small { padding: 6px 10px; font-size: 11px; }
.dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #1a0a0b; background: #6b5f55; }
.dot.on { background: var(--ok); }
.dot.game { background: var(--warn); }
.pres.on { color: #9fe0a2; }
.pres.game { color: var(--warn); }
.pres.queue { color: #ffc98a; }
.muted { color: var(--muted); font-style: italic; }
.empty-sm { color: var(--muted); font-style: italic; text-align: center; margin: 8px 0; font-size: 15px; }
.dm { align-self: flex-start; max-width: 82%; background: rgba(255,255,255,.07); border: 1px solid rgba(212,169,74,.2); border-radius: 14px 14px 14px 4px; padding: 7px 11px; display: flex; flex-direction: column; font-size: 16px; overflow-wrap: anywhere; }
.dm time { font-size: 11px; color: var(--muted); align-self: flex-end; margin-top: 2px; }
.dm.mine { align-self: flex-end; background: linear-gradient(180deg, rgba(184,20,28,.45), rgba(92,13,19,.5)); border-color: rgba(226,53,59,.45); border-radius: 14px 14px 4px 14px; }
.dm.invite { align-self: stretch; max-width: none; flex-direction: row; align-items: center; gap: 10px; border-style: dashed; border-color: var(--gold); border-radius: 12px; }
.dm.invite span { flex: 1; }
.dm.invite .ico { width: 20px; height: 20px; color: var(--gold-hi); flex: none; }
.toast.notify { pointer-events: auto; animation: toast-in .25s; display: flex; flex-direction: column; gap: 8px; font: 500 16px var(--font-ui); color: var(--text); text-align: left; width: 100%; }
.toast.notify b { font-family: var(--font-ui); font-size: 13px; color: var(--gold-hi); }
.toast.notify .ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; color: var(--gold-hi); }
.nt-act { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.nt-x { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; padding: 0 4px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
#btn-friends { position: relative; }

/* sala: chat + amigos online */
.room-panels { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; width: 100%; text-align: left; }
.room-panels .panel { position: relative; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.room-panels h3 { font: 700 14px var(--font-ui); color: var(--gold-hi); margin: 0; letter-spacing: .04em; }
.room-chat .chat-list { height: 190px; flex: none; padding: 4px 2px; }
.room-chat .chat-form { padding: 0; }
.online-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.room-panels .link-btn { align-self: center; }
@media (max-width: 620px) { .room-panels { grid-template-columns: 1fr; } }

/* fila: jogadores online */
.online-box { width: min(440px, 100%); text-align: left; background: rgba(16,7,8,.75); border: 1px solid rgba(212,169,74,.35); border-radius: 14px; padding: 10px 12px; }
.online-box .online-list { max-height: 34vh; }

/* resultado: ranking antes → depois */
.rank-change { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px auto 14px; padding: 8px 16px; width: fit-content;
  border-radius: 99px; background: rgba(0,0,0,.3); border: 1px solid rgba(212,169,74,.4); font-family: var(--font-ui); }
.rank-change span { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.rank-change b { font-size: 18px; color: var(--text); }
.rank-change i { font-style: normal; font-weight: 700; font-size: 18px; }
.rank-change.up i, .rank-change.up .rc-new { color: #9fe0a2; }
.rank-change.down i, .rank-change.down .rc-new { color: #ff9a9e; }
.rank-change .rc-new { animation: pop .6s .3s both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } }

/* ------------------------------------------------------------ mesa "Simples" */
body[data-table-theme="minimal"] { --felt-1: #3f6f63; --felt-2: #3f6f63; --felt-3: #3f6f63; --rim-1: #e8e4da; --rim-2: #e8e4da; --rim-3: #e8e4da; --rim-4: #e8e4da; --tbl-tint: rgba(22,26,31,1); }
body[data-table-theme="minimal"] .table-bg { background: #1c2127; filter: none; }
body[data-table-theme="minimal"] .table-bg::after { background: radial-gradient(ellipse at 50% 45%, #262c33, #16191d 75%); backdrop-filter: none; -webkit-backdrop-filter: none; }
body[data-table-theme="minimal"] .felt { background: #3f6f63;
  box-shadow: 0 0 0 8px #e8e4da, 0 20px 50px rgba(0,0,0,.45); }
body[data-table-theme="minimal"] .felt::before { border: 2px solid rgba(255,255,255,.18); inset: 18px; }
body[data-table-theme="minimal"] .felt::after { content: none; }
.felt-prev-minimal { --a: #3f6f63; --b: #3f6f63; --c: #e8e4da; --d: #e8e4da; }

/* ------------------------------------------------------------ escolha de tema: selecionado bem visível */
.theme-opt { position: relative; cursor: pointer; transition: border-color .15s, background .15s, transform .12s; }
.theme-opt:hover { border-color: rgba(212,169,74,.6); }
.theme-opt.active { border: 2.5px solid var(--gold-hi); background: rgba(212,169,74,.2); box-shadow: 0 0 0 4px rgba(246,227,160,.22), 0 6px 18px rgba(0,0,0,.4); transform: translateY(-2px); }
.theme-opt.active b { color: var(--gold-hi); }
.theme-check { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center;
  background: var(--gold-grad); color: #2a1206; font: 900 15px/1 system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.5); border: 2px solid #1a0a0b; }
.theme-opt.active .theme-check { display: grid; }
.theme-opt.active::after { content: 'Selecionado'; font: 700 10px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: #2a1206;
  background: var(--gold-hi); padding: 2px 8px; border-radius: 99px; margin-top: -2px; }
.theme-cards .card.mini.mini-simple { font: 800 16px system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; border-radius: 6px; }

/* ------------------------------------------------------------ notificações */
#btn-notifs { position: relative; }
.notif-list { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; }
.notif { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 10px 12px; border-radius: 12px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(212,169,74,.18); color: var(--text); cursor: pointer; }
.notif:hover { border-color: rgba(212,169,74,.5); }
.notif.new { border-color: rgba(212,169,74,.6); background: rgba(212,169,74,.1); }
.notif.new .notif-txt b::after { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red-hi); margin-left: 8px; vertical-align: middle; }
.notif-ico { font-size: 22px; line-height: 1.2; flex: none; }
.notif-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-txt b { font: 700 14px var(--font-ui); color: var(--gold-hi); }
.notif-txt span { font-size: 16px; overflow-wrap: anywhere; }
.notif-txt time { font-size: 12px; color: var(--muted); }
@media (max-width: 420px) { .topbar-actions { gap: 6px; } .topbar-actions .icon-btn { width: 38px; height: 38px; } }

/* ------------------------------------------------------------ convites por email */
.invite-banner { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; background: rgba(212,169,74,.14); border: 1px solid rgba(212,169,74,.5); text-align: center; font-size: 16px; }
.invite-banner b { color: var(--gold-hi); font-family: var(--font-ui); }
.invite-email-btn { display: flex; align-items: center; gap: 12px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 12px; text-align: left; color: var(--text);
  background: linear-gradient(170deg, rgba(212,169,74,.16), rgba(0,0,0,.2)); border: 1px dashed rgba(212,169,74,.6); cursor: pointer; }
.invite-email-btn > span:first-child { font-size: 24px; }
.invite-email-btn b { display: block; font: 700 14px var(--font-ui); color: var(--gold-hi); }
.invite-email-btn small { color: var(--muted); font-size: 14px; }
.invite-form { padding: 6px 0 4px; }
.inv-sum { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 8px; font-size: 15px; color: var(--muted); }
.inv-sum b { color: var(--gold-hi); font-family: var(--font-ui); font-size: 14px; }
.inv-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.inv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(212,169,74,.18); }
.inv-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.inv-main b { font-size: 16px; overflow-wrap: anywhere; }
.inv-main small { color: var(--muted); font-size: 13px; }
.inv-chip { font: 700 11px var(--font-ui); letter-spacing: .03em; padding: 4px 10px; border-radius: 99px; border: 1px solid; white-space: nowrap; }
.inv-chip.muted { color: var(--muted); border-color: rgba(201,180,140,.4); }
.inv-chip.mid { color: var(--warn); border-color: rgba(231,177,74,.6); }
.inv-chip.ok { color: #9fe0a2; border-color: rgba(111,191,115,.7); background: rgba(111,191,115,.12); }
.inv-chip.bad { color: #ff9a9e; border-color: rgba(226,53,59,.6); }
.mi-emoji { width: 22px; text-align: center; font-size: 18px; flex: none; }

/* ------------------------------------------------------------ resumo do fim da mão (compacto) */
.modal.hand-summary { padding: 16px 14px 0; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.overlay:has(.hand-summary) { padding: 12px; }
.modal.hand-summary #modal-body { display: flex; flex-direction: column; min-height: 0; }
.modal.hand-summary h2 { font-size: 20px; margin: 2px 52px 10px; }
.modal.hand-summary .modal-x { width: 40px; height: 40px; top: 8px; right: 8px; }
.hand-summary .hs-moon { text-align: center; margin: 0 0 8px; color: var(--gold-hi) !important; }
.hand-summary .reveal { margin: 0 0 10px; padding: 8px; }
.hand-summary .reveal-title { font-size: 15px; margin: 0 0 6px; line-height: 1.3; }
.hand-summary .reveal-row { padding: 3px 2px; gap: 8px; }
.hand-summary .reveal-row > b { width: 74px; font-size: 12px; }
.hand-summary .rc { width: clamp(26px, 6.2vw, 40px); margin-right: calc(clamp(26px, 6.2vw, 40px) * -.32); }
.hand-summary table.score { font-size: 15px; }
.hand-summary table.score th, .hand-summary table.score td { padding: 5px 6px; }
.hand-summary .hs-target { text-align: center; margin: 6px 0 0; font-size: 14px; }
.hs-actions { position: sticky; bottom: 0; margin: 10px -14px 0; padding: 10px 14px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px;
  background: linear-gradient(180deg, rgba(20,8,9,0), #140809 30%); border-top: 1px solid rgba(212,169,74,.2); }
.hs-actions .btn-block { flex-basis: 100%; padding: 14px; font-size: 16px; }
.hs-actions .next-in { margin: 0; font-size: 15px; }
.hs-actions .next-in:empty, .hs-actions .ready-info:empty { display: none; }
.ready-info { font: 700 13px var(--font-ui); color: var(--muted); letter-spacing: .04em; }
@media (max-height: 560px) {
  .hand-summary .hs-target { display: none; }
  .hand-summary table.score th, .hand-summary table.score td { padding: 3px 6px; }
  .hand-summary .rc { width: 26px; margin-right: -8px; }
}
/* ecrã baixo e largo (telemóvel deitado): cartas reveladas e pontuação lado a lado */
@media (max-height: 560px) and (min-width: 600px) {
  .hs-body.has-reveal { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .hs-body.has-reveal .reveal { margin: 0; }
  .hand-summary h2 { margin-bottom: 6px; }
  .hs-actions { padding: 8px 14px 10px; }
  .hs-actions .btn-block { padding: 11px; }
}

/* ------------------------------------------------------------ sem zoom */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, .card, .tile, .qlink { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }   /* o iPhone faz zoom ao escrever em campos com letra < 16 px */

/* ------------------------------------------------------------ classificação animada (fim da mão) */
.hb-head, .hb-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 34%) 44px 50px; align-items: center; gap: 8px; }
.hb-head { font: 700 11px var(--font-ui); color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 0 8px 4px; }
.hb-head span:first-child { grid-column: 1 / 3; }
.hb-head span:not(:first-child) { text-align: center; }
.hboard { --rh: 44px; position: relative; height: calc(4 * var(--rh)); }
.hb-row { position: absolute; left: 0; right: 0; height: calc(var(--rh) - 4px); padding: 0 8px; border-radius: 10px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(212,169,74,.16); transform: translateY(calc(var(--y) * var(--rh))); transition: transform .75s cubic-bezier(.25,.8,.25,1), border-color .4s, background .4s; }
.hb-row.me { border-color: rgba(246,227,160,.55); }
.hb-row.me .hb-name { color: var(--gold-hi); }
.hb-name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: baseline; gap: 6px; }
.hb-name small { font: 600 11px var(--font-ui); color: #ff9a9e; letter-spacing: .03em; opacity: 0; transition: opacity .4s; }
.hb-ico { opacity: 0; transition: opacity .4s; }
.hb-row.show-tag .hb-ico, .hb-row.show-tag small { opacity: 1; }
.hb-row.danger.show-tag { background: rgba(226,53,59,.14); border-color: rgba(226,53,59,.55); }
.hb-row.lead.show-tag { background: rgba(111,191,115,.12); border-color: rgba(111,191,115,.5); }
.hb-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6fbf73, #e7b14a 60%, #e2353b); transition: width .9s cubic-bezier(.25,.8,.25,1); }
.hb-add { text-align: center; font-size: 15px; color: var(--muted); }
.hb-add.pos { color: #ff9a9e; font-weight: 700; }
.hb-total { text-align: center; font: 700 18px var(--font-ui); color: var(--text); }
.hb-foot { text-align: right; font: 700 11px var(--font-ui); color: #9fe0a2; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px 0; }
@media (max-height: 560px) { .hboard { --rh: 36px; } .hb-name { font-size: 14px; } .hb-total { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .hb-row, .hb-bar i { transition: none; } }

/* ------------------------------------------------------------ idioma */
.lang-seg { margin-bottom: 4px; }
.auth-lang { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.auth-lang button { background: none; border: 0; color: var(--muted); font: 600 15px var(--font-ui); cursor: pointer; padding: 4px 6px; }
.auth-lang button.active { color: var(--gold-hi); text-decoration: underline; text-underline-offset: 3px; }
.hb-name { overflow: visible; min-width: 0; }
.hb-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hb-name small, .hb-ico { flex: none; }

/* ------------------------------------------------------------ quem está a jogar: brilho */
.plate.turn { border-color: var(--gold-hi) !important; animation: turn-glow 1.4s ease-in-out infinite; }
.plate.turn .avatar { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px 3px rgba(246,227,160,.8); }
@keyframes turn-glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px 2px rgba(246,227,160,.45); }
  50%      { box-shadow: 0 0 0 3px #fff3c9, 0 0 30px 8px rgba(246,227,160,.85); }
}
.seat-0 .plate.turn { animation-name: turn-glow-me; }
@keyframes turn-glow-me {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 16px 3px rgba(246,227,160,.55); }
  50%      { box-shadow: 0 0 0 3px #fff3c9, 0 0 38px 12px rgba(246,227,160,.95); }
}
.plate.turn.hurry { animation-name: turn-glow-hurry; }
@keyframes turn-glow-hurry {
  0%, 100% { box-shadow: 0 0 0 2px var(--red-hi), 0 0 14px 2px rgba(226,53,59,.5); }
  50%      { box-shadow: 0 0 0 3px #ff9a9e, 0 0 30px 8px rgba(226,53,59,.9); }
}
@media (prefers-reduced-motion: reduce) { .plate.turn { animation: none; box-shadow: 0 0 0 3px var(--gold-hi), 0 0 24px 6px rgba(246,227,160,.7); } }

/* ------------------------------------------------------------ a minha carta vai para a mesa ao dobro da velocidade */
.trick .card.fly.fast { animation-duration: .21s; }
.trick .card.fly.fast[data-card="QS"] { animation: fly-in .21s cubic-bezier(.2,.8,.2,1) both, qs-glow-strong 1.3s .21s ease-in-out infinite; }
.hand .card.gone { opacity: 0 !important; pointer-events: none; transition: opacity .08s; }

/* ------------------------------------------------------------ tamanho das cartas (definições) */
.size-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.size-prev { display: flex; align-items: flex-end; justify-content: center; height: 64px; }
.size-prev i { display: block; aspect-ratio: 5/7; border-radius: 4px; background: linear-gradient(160deg, #fffaf0, #e6d3ad); border: 1.5px solid #c7ab73; margin: 0 -6px; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.size-prev i:nth-child(1) { transform: rotate(-10deg); } .size-prev i:nth-child(3) { transform: rotate(10deg); }
.size-small i { width: 26px; } .size-medium i { width: 32px; } .size-large i { width: 40px; }

/* ------------------------------------------------------------ ranking: abas */
.lb-tabs { max-width: 320px; margin: -6px auto 14px; }

/* ------------------------------------------------------------ menu principal no telemóvel: cabe no ecrã, sem scroll */
@media (max-width: 680px) and (orientation: portrait) {
  #screen-lobby:not([hidden]) { display: flex; flex-direction: column; overflow: hidden; }
  #screen-lobby .topbar { flex: none; padding-top: calc(8px + var(--safe-t)); padding-bottom: 6px; }
  #screen-lobby .lobby { flex: 1 1 auto; min-height: 0; width: 100%; gap: clamp(8px, 1.6vh, 18px);
    padding: 4px 14px calc(10px + var(--safe-b)); }
  #screen-lobby .lobby > * { flex: none; }
  /* A imagem encolhe para dar lugar aos botões (nunca maior que o tamanho natural). */
  #screen-lobby .lobby-hero { flex: 0 1 auto; min-height: 0; max-width: none; max-height: calc((100vw - 28px) * 9 / 16); border-radius: 14px; }
  #screen-lobby .lobby-hero img { height: 100%; object-fit: cover; }
  #screen-lobby .banner { padding: 8px 12px; font-size: 14px; }
  #screen-lobby .tiles { gap: clamp(8px, 1.3vh, 12px); }
  #screen-lobby .tile { padding: clamp(10px, 1.6vh, 16px) 16px; gap: 14px; border-radius: 16px; }
  #screen-lobby .tile-ico { width: clamp(48px, 7vh, 66px); height: clamp(48px, 7vh, 66px); }
  #screen-lobby .tico { width: 60%; height: 60%; }
  #screen-lobby .tile-txt b { font-size: clamp(18px, 2.5vh, 21px); }
  #screen-lobby .tile-txt small { font-size: clamp(13px, 1.8vh, 15px); }
  #screen-lobby .qlink { padding: clamp(6px, 1.1vh, 10px) 4px; gap: 4px; }
  #screen-lobby .qlink .ico { width: 21px; height: 21px; }
  #screen-lobby .fair { font-size: 13px; line-height: 1.3; margin-top: auto; }
}
@media (max-width: 680px) and (orientation: portrait) and (max-height: 600px) {
  #screen-lobby .fair { display: none; }
  #screen-lobby .lobby:has(.banner:not([hidden])) .lobby-hero { display: none; }
}

/* ------------------------------------------------------------ estatísticas do jogador */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; width: 100%; margin: 4px 0 10px; }
.st-box { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 9px; border-radius: 12px; text-align: center;
  background: rgba(20,8,9,.55); border: 1px solid rgba(212,169,74,.3); }
.st-ico { font-size: 18px; line-height: 1; }
.st-box b { font: 700 22px var(--font-ui); color: var(--gold-hi); line-height: 1.15; }
.st-box small { font-size: 12.5px; color: var(--muted); line-height: 1.2; }
.st-box em { font-style: normal; font-size: 12px; color: var(--gold); }

/* ------------------------------------------------------------ definições: traseira e ambiente */
.back-pick { display: flex; gap: 16px; align-items: center; }
.back-prev { width: 78px; flex: none; }
.back-prev.loading { opacity: .5; }
.back-pick-txt { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.back-pick-txt .hint { font-size: 14px; }
.back-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ambient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.amb-prev { display: grid; place-items: center; height: 64px; border-radius: 10px; width: 100%; border: 1px solid rgba(212,169,74,.3); }
.amb-prev i { width: 58%; height: 58%; border-radius: 50%; background: radial-gradient(ellipse at 50% 45%, var(--felt-1), var(--felt-3)); box-shadow: 0 0 0 3px var(--rim-2); }
.amb-dark { background: radial-gradient(ellipse at 50% 45%, #3a1418, #0d0405 80%); }
.amb-light { background: radial-gradient(ellipse at 50% 45%, #fffaf0, #e3d6bf 85%); }

/* ------------------------------------------------------------ ambiente claro na sala de jogo */
body[data-ambient="light"] .table-bg { background: radial-gradient(ellipse 80% 70% at 50% 45%, #fffaf1, #eadfca 70%, #d9c9ab); filter: none; }
body[data-ambient="light"] .table-bg::after { background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.5), rgba(214,199,170,.35) 75%); backdrop-filter: none; -webkit-backdrop-filter: none; }
body[data-ambient="light"] #screen-table .felt { box-shadow:
  0 0 0 9px var(--rim-1), 0 0 0 11px var(--rim-2), 0 0 0 13px var(--rim-3), 0 0 0 15px var(--rim-4), 0 0 0 17px rgba(60,40,20,.55), 0 0 var(--glow, 0) var(--glow-c, transparent),
  0 26px 50px rgba(70,45,20,.35), inset 0 0 60px rgba(0,0,0,.45), inset 0 0 0 2px rgba(227,191,98,.35); }
body[data-ambient="light"] #screen-table .plate { background: linear-gradient(180deg, #fffdf8, #f1e8d6); border-color: rgba(160,120,50,.55); box-shadow: 0 6px 16px rgba(80,55,25,.22); }
body[data-ambient="light"] #screen-table .plate-name { color: #2a1a12; }
body[data-ambient="light"] #screen-table .plate-sub { color: #7a6448; }
body[data-ambient="light"] #screen-table .plate-score { color: #8a5d12; }
body[data-ambient="light"] #screen-table .plate-pts { color: #b3262d; }
body[data-ambient="light"] #screen-table .plate-tag { background: rgba(60,40,20,.08); color: #7a6448; }
body[data-ambient="light"] #screen-table .plate.turn { box-shadow: 0 0 0 2px #c9971f, 0 0 22px rgba(201,151,31,.55); }
body[data-ambient="light"] #screen-table .table-info { background: rgba(255,252,245,.85); border-color: rgba(160,120,50,.5); color: #6e4a0e; }
body[data-ambient="light"] #screen-table .icon-btn { background: rgba(255,252,245,.85); border-color: rgba(160,120,50,.5); color: #6e4a0e; }
body[data-ambient="light"] #screen-table .icon-btn:hover { background: #fff; }
body[data-ambient="light"] #screen-table .action-bar { color: #5a3c0c; text-shadow: none; }
body[data-ambient="light"] #screen-table .action-bar .btn-ghost { color: #5a3c0c; border-color: rgba(160,120,50,.6); background: rgba(255,252,245,.7); }
body[data-ambient="light"] .hand .card { box-shadow: -4px 0 9px -2px rgba(60,40,20,.35), 0 3px 6px rgba(60,40,20,.25); }
body[data-ambient="light"] .minifan .card { box-shadow: 0 2px 5px rgba(60,40,20,.3); }

/* ------------------------------------------------------------ modos de jogo (Tradicional/Crazy · Normal/Rápido) */
.mode-pick { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.mode-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode-row button { display: flex; flex-direction: column; gap: 3px; padding: 10px 8px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1.5px solid rgba(212,169,74,.25); color: var(--text); text-align: center; cursor: pointer; }
.mode-row button b { font: 700 15px var(--font-ui); color: var(--gold-hi); }
.mode-row button small { font-size: 12.5px; color: var(--muted); line-height: 1.2; }
.mode-row button.active { border-color: var(--gold-hi); background: rgba(212,169,74,.16); box-shadow: 0 0 0 3px rgba(212,169,74,.15); }
.sheet-label { align-self: flex-start; font: 700 12px var(--font-ui); letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.room-host .mode-pick { margin-bottom: 4px; }
.room-mode, .queue-mode { margin: 0; color: var(--gold-hi); font: 700 15px var(--font-ui); letter-spacing: .03em; }
.mode-tag { font: 700 11px system-ui, sans-serif; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: rgba(212,169,74,.18); color: var(--gold-hi); border: 1px solid rgba(212,169,74,.45); white-space: nowrap; }
body[data-ambient="light"] #screen-table .mode-tag { background: rgba(160,120,50,.12); color: #6e4a0e; }
.rules-tabs { margin: 0 0 6px; }

/* Shoot the Moon: o texto fica sempre dentro do disco da lua */
.moon { --md: min(60vw, 360px); }
.moon-disc { width: var(--md); }
.moon-text { width: calc(var(--md) * .74); max-height: calc(var(--md) * .74); gap: calc(var(--md) * .02); justify-content: center; overflow: hidden; }
.moon-text small { font-size: calc(var(--md) * .052); letter-spacing: .12em; line-height: 1.1; }
.moon-text b { font-size: calc(var(--md) * .13); line-height: 1.05; overflow-wrap: anywhere; }
.moon-text b.long { font-size: calc(var(--md) * .085); }
.moon-text span { font-size: calc(var(--md) * .048); line-height: 1.25; }

/* Resumo da mão: o nome aparece todo (sem o "faltam X") */
.hb-head, .hb-row { grid-template-columns: minmax(0, 1fr) minmax(36px, 22%) 40px 46px; }
.hb-name .nm { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.1; }
.hb-name { align-items: center; font-size: 15px; }
.hb-add.neg { color: #8fe39a; }

/* ------------------------------------------------------------ Crazy: pontos da mão no lugar do jogador */
.plate-crazy { display: inline-flex; gap: 3px; align-items: baseline; font: 700 11.5px var(--font-ui); }
.plate-crazy i { font-style: normal; }
.plate-crazy .cz-pos { color: #ff9a9e; }
.plate-crazy .cz-neg { color: #8fe39a; }
.plate-crazy .cz-net { color: var(--gold-hi); opacity: .9; }
body[data-ambient="light"] #screen-table .plate-crazy .cz-pos { color: #b3262d; }
body[data-ambient="light"] #screen-table .plate-crazy .cz-neg { color: #1f7a33; }
body[data-ambient="light"] #screen-table .plate-crazy .cz-net { color: #6e4a0e; }

/* ------------------------------------------------------------ badges: pódio na foto, conquistas */
.avatar { position: relative; }
.av-top { position: absolute; right: -6px; bottom: -6px; width: 46%; min-width: 16px; max-width: 26px; aspect-ratio: 1; z-index: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); pointer-events: auto; }
.av-top svg, .lb-medal svg, .pm-top svg { width: 100%; height: 100%; display: block; }
.avatar.xs .av-top { display: none; }
.lb-medal { display: inline-block; width: 22px; height: 22px; vertical-align: middle; }
.lb-cats { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.lb-seg button { font-size: 12.5px; padding: 6px 8px; }
.lb-hint, .lb-foot { text-align: center; font-size: 14px; color: var(--muted); margin: 4px 0; }
.lb-table { table-layout: fixed; }
.lb-table td, .lb-table th { overflow-wrap: anywhere; }
.lb-table td:first-child, .lb-table th:first-child { width: 32px; }
.lb-table td:nth-child(2), .lb-table th:nth-child(2) { width: 34%; }
.lb-table td:last-child, .lb-table th:last-child { width: 34px; }
.lb-table .lb-name { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.lb-table .lb-nickname { min-width: 0; overflow-wrap: anywhere; }
.lb-seg { flex-wrap: wrap; }
.lb-seg button { min-width: 0; flex: 1 1 70px; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  table.lb-table { font-size: 12px; }
  table.lb-table th, table.lb-table td { padding: 8px 3px; }
  table.lb-table th { font-size: 10px; letter-spacing: 0; }
  table.lb-table td:first-child, table.lb-table th:first-child { width: 26px; }
  table.lb-table td:last-child, table.lb-table th:last-child { width: 24px; }
  .lb-table .lb-name { flex-direction: column; align-items: flex-start; gap: 4px; }
}
.pm-tops { display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 4px 0 8px; }
.pm-top { display: inline-flex; align-items: center; gap: 8px; font: 700 13px var(--font-ui); color: var(--gold-hi); }
.pm-top svg { width: 22px; height: 22px; flex: none; }
.badge-sum { text-align: center; font: 700 15px var(--font-ui); color: var(--gold-hi); margin: 0 0 6px; }
.badge-tabs { margin: 0 0 10px; flex-wrap: wrap; }
.badge-tabs button { font-size: 12.5px; padding: 6px 8px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; padding: 8px 4px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid rgba(212,169,74,.18); }
.badge-cell.earned { border-color: rgba(212,169,74,.5); background: rgba(212,169,74,.08); }
.badge-cell .badge-svg { width: 58px; height: 66px; }
.badge-cell b { font: 700 12px var(--font-ui); color: var(--gold-hi); line-height: 1.15; }
.badge-cell small { font-size: 11.5px; color: var(--muted); }
.badge-svg.locked { filter: grayscale(1) brightness(.55); opacity: .7; }
.badge-bar { width: 80%; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.badge-bar i { display: block; height: 100%; background: var(--gold-grad); }
.badge-grid.tops .badge-svg { width: 62px; height: 70px; }
.res-badges { text-align: center; margin: 4px 0 10px; animation: pop .6s .3s both; }
.res-badges > b { font: 700 15px var(--font-ui); color: var(--gold-hi); }
.res-badges-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.res-badge { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 110px; }
.res-badge .badge-svg { width: 64px; height: 72px; filter: drop-shadow(0 0 12px rgba(246,227,160,.45)); }
.res-badge small { font-size: 12px; color: var(--muted); line-height: 1.2; }
.rc-note { text-align: center; font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.plays-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plays-nav h4 { margin: 0; text-align: center; }
.plays-nav button { min-width: 44px; min-height: 44px; }
.plays-nav button:disabled { opacity: .3; cursor: default; }
.plays-detail { padding: 20px 0; text-align: center; }
.plays-detail .play-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plays-detail .ct { font-size: 36px; }
.plays-detail .pc small { white-space: normal; overflow-wrap: anywhere; }

/* Atalho de personalização abaixo dos controlos da mesa. */
.table-top-actions { position: relative; }
#btn-themes { position: absolute; top: calc(100% + 8px); right: 0; }
.modal, .sheet { animation: fade .18s ease-out; }

/* Cartas completas, sem recortes nem sobreposição, no histórico. */
.plays-detail .pc { padding: 8px; gap: 6px; }
.plays-detail .card { position: relative; width: min(100%, 104px); height: auto; aspect-ratio: 5 / 7; flex: none; margin: 0; transform: none; pointer-events: none; }
.plays-detail .card-svg { display: block; width: 100%; height: 100%; }
.plays-detail .card[data-card="QS"] { animation: none; }
.plays-detail .card::after { animation: none; }

/* O ambiente claro acompanha todos os ecrãs e painéis. */
body[data-ambient="light"] {
  color-scheme: light;
  --bg: #f5eddf; --bg-2: #fffaf2;
  --text: #302419; --muted: #715e46;
  --gold: #967021; --gold-hi: #765110; --gold-lo: #6e4a0e;
  --ok: #287637; --warn: #8a5b08;
  --shadow: 0 12px 32px rgba(80,55,25,.18);
}
body[data-ambient="light"] .hero-bg::after,
body[data-ambient="light"] .hero-bg.dim::after { background: rgba(250,244,232,.92); }
body[data-ambient="light"] :is(.panel, .modal, .sheet, .chat, .toast, .online-box) {
  background: linear-gradient(180deg, #fffdf8, #f3e9d7);
  color: var(--text); border-color: #cdb992;
}
body[data-ambient="light"] :is(.overlay, .sheet-overlay) { background: rgba(83,67,45,.25); }
body[data-ambient="light"] :is(.menu-item, .theme-opt, .mode-row button, .list-item, .room-seat, .room-code-box, .st-box, .notif, .inv-row, .badge-cell, .hb-row, .pc, .dm, .seg, .quick button, .modal-x, .icon-btn) {
  background: #f7efdf; color: var(--text); border-color: #cdb992;
}
body[data-ambient="light"] :is(.menu-item:hover, .theme-opt.active, .mode-row button.active, .seg button.active, .notif.new) {
  background: #e9d8b6; color: #513a12;
}
body[data-ambient="light"] :is(input, textarea, select) { background: #fffdf8; color: var(--text); border-color: #bda77f; }
body[data-ambient="light"] :is(input, textarea)::placeholder { color: #806e55; }
body[data-ambient="light"] :is(.modal h2, .sheet h2, .room h2, .brand-small) { background: none; color: #765110; -webkit-text-fill-color: currentColor; }
body[data-ambient="light"] :is(.menu-item.danger, .btn.account-delete, .form-error, .delta.down, .chat-msg.me b) { color: #a62028; }
body[data-ambient="light"] .form-error.ok { color: var(--ok); }
body[data-ambient="light"] .dm.mine { background: #eedbc1; border-color: #c9ab77; }
body[data-ambient="light"] .theme-opt.active::after { background: #e4c985; color: #392508; }
body[data-ambient="light"] .hs-actions { background: #f3e9d7; }

/* Identidade: títulos clássicos, interface sem serifas e símbolos dourados. */
:root { --font-ui: "Trebuchet MS", Arial, sans-serif; --font-display: var(--font-ui); --ui-icon-gold: url(#ui-gold); }
body { font-family: var(--font-ui); font-size: 16px; }
h1, h2, h3 { font-family: var(--font-display); }
button, input, textarea, select { font-family: var(--font-ui); }
.btn { letter-spacing: .025em; text-transform: none; }
.ico, .tico { stroke: var(--ui-icon-gold); stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 1px rgba(80,30,0,.25)); }
.ico { stroke-width: 1.8; }
.tico { stroke-width: 2.4; }
.st-ico .ico, .notif-ico .ico { width: 28px; height: 28px; }
.btn .ico { width: 20px; height: 20px; vertical-align: middle; margin-right: 5px; }
body[data-ambient="light"] { --ui-icon-gold: url(#ui-gold-light); }

/* Marca integrada no fundo, sem imagem retangular. */
.brand-scene, .lobby-hero.brand-scene {
  width: 100%; max-width: 850px; margin: 8px auto 16px;
  display: flex; align-items: center; justify-content: center; gap: clamp(12px, 4vw, 52px);
  padding: 28px 12px; min-height: 260px;
  border: 0; border-radius: 0; box-shadow: none; overflow: visible;
  background: radial-gradient(ellipse at 32% 55%, rgba(181,39,33,.18), transparent 65%);
}
.lobby-hero.brand-scene::after { content: none; }
.brand-fan { position: relative; flex: 0 0 38%; height: clamp(190px, 23vw, 280px); pointer-events: none; }
.brand-playing-card { position: absolute; width: 56%; max-width: 165px; aspect-ratio: 5/7; left: 22%; bottom: 12px; transform-origin: 50% 95%; filter: drop-shadow(0 12px 12px rgba(0,0,0,.25)); }
.brand-playing-card .card-svg { display: block; width: 100%; height: 100%; }
.brand-playing-card:nth-child(1) { transform: translateX(-43%) rotate(-24deg); }
.brand-playing-card:nth-child(2) { transform: translateY(-9%) rotate(-5deg); }
.brand-playing-card:nth-child(3) { transform: translateX(43%) rotate(17deg); }
.brand-wordmark { text-align: center; color: #f7e2b5; }
.brand-kicker { display: block; font: 600 clamp(12px, 2.3vw, 25px) var(--font-ui); text-transform: uppercase; letter-spacing: .24em; }
.brand-wordmark h1 { font: 900 clamp(44px, 8vw, 92px)/1.1 var(--font-display); letter-spacing: .025em; text-transform: uppercase; margin: 8px 0; }
.brand-ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: #c92029; font-size: 38px; line-height: 1; text-shadow: 0 1px 0 #dca842; }
.brand-ornament::before, .brand-ornament::after { content: ""; height: 2px; width: 28%; background: var(--gold-grad); }
body[data-ambient="light"] .brand-scene { background: radial-gradient(ellipse at 32% 55%, rgba(202,162,83,.15), transparent 65%); }
body[data-ambient="light"] .brand-wordmark { color: #61251c; }
#screen-lobby .hero-bg, #screen-auth .hero-bg { background-image: none !important; background: radial-gradient(ellipse at 25% 15%, #631219, #260609 52%, #120708); }
#screen-lobby .hero-bg::after, #screen-auth .hero-bg::after { background: linear-gradient(125deg, transparent 35%, rgba(0,0,0,.22) 50%, transparent 70%); }
body[data-ambient="light"] #screen-lobby .hero-bg, body[data-ambient="light"] #screen-auth .hero-bg { background: radial-gradient(ellipse at 30% 15%, #fffdf7, #f1e5cf 60%, #e4d1ae); }
body[data-ambient="light"] #screen-lobby .hero-bg::after, body[data-ambient="light"] #screen-auth .hero-bg::after { background: linear-gradient(125deg, transparent, rgba(255,255,255,.3), transparent); }
.tile-ico { border: 0; background: none; box-shadow: none; border-radius: 0; width: 64px; height: 64px; }
.tile-txt b { font: 700 clamp(18px, 2.5vw, 24px) var(--font-ui); background: none; color: var(--text); letter-spacing: 0; }
.tile-txt small { font-size: 13px; line-height: 1.5; }
body[data-ambient="light"] .tile { background: linear-gradient(155deg, #fffcf5, #efdfc2); color: var(--text); box-shadow: 0 8px 22px rgba(90,62,20,.12); }
body[data-ambient="light"] .tile-red { background: linear-gradient(155deg, #f9ecd5, #e8cea3); }
body[data-ambient="light"] .tile:hover { box-shadow: 0 10px 24px rgba(90,62,20,.2); }
@media (max-width: 520px) {
  .brand-scene, .lobby-hero.brand-scene { min-height: 200px; gap: 12px; padding: 18px 0; }
  .brand-fan { flex-basis: 40%; height: 180px; }
  .brand-wordmark h1 { font-size: clamp(32px, 9vw, 47px); }
  .brand-kicker { font-size: 11px; }
  .brand-ornament { font-size: 28px; }
}
@media (min-width: 1000px) and (orientation: landscape) { .entry-cover.brand-scene { max-width: 52vw; } }
@media (orientation: landscape) and (max-height: 500px) { .brand-scene, .lobby-hero.brand-scene { min-height: 160px; padding: 10px 0; } .brand-fan { height: 160px; max-width: 220px; } }

@media (max-width: 680px) and (orientation: portrait) {
  #screen-lobby:not([hidden]) { overflow-y: auto; }
  #screen-lobby .lobby { flex: 1 0 auto; }
  #screen-lobby .lobby-hero.brand-scene { flex: none; min-height: 190px; max-height: none; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .modal, .sheet { animation: none; } }

/* O leque ocupa uma caixa própria: as transformações não invadem o título. */
.brand-scene, .lobby-hero.brand-scene {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 36px);
}
.brand-fan { width: 100%; min-width: 0; max-width: none; height: clamp(170px, 25vw, 280px); }
.brand-playing-card { width: 40%; max-width: 150px; left: 30%; bottom: 12%; }
.brand-playing-card:nth-child(1) { transform: translateX(-46%) rotate(-18deg); }
.brand-playing-card:nth-child(2) { transform: translateY(-15%) rotate(-3deg); }
.brand-playing-card:nth-child(3) { transform: translateX(46%) rotate(16deg); }
.brand-wordmark { min-width: 0; }
.brand-wordmark h1 { font-size: clamp(32px, 6.5vw, 78px); letter-spacing: 0; }
@media (max-width: 520px) {
  .brand-scene, .lobby-hero.brand-scene { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
  .brand-fan { width: min(270px, 85%); height: 210px; margin: 0 auto; }
  .brand-wordmark h1 { font-size: 40px; margin: 4px 0; }
  .brand-kicker { font-size: 12px; }
  .brand-ornament { font-size: 24px; }
}
/* Contraste independente da cor do feltro escolhido. */
body[data-ambient="light"] .center-msg:not(:empty) {
  width: max-content; max-width: 62%; padding: 10px 14px;
  color: #302419; background: #fff8e9; border: 1px solid #b59a64;
  border-radius: 12px; text-shadow: none; line-height: 1.4;
  font-size: clamp(13px, 3.8vw, 18px); box-shadow: 0 3px 12px rgba(40,30,15,.15);
}
body[data-ambient="light"] .avatar,
body[data-ambient="light"] .avatar.bot {
  background: radial-gradient(circle at 35% 30%, #fffdf7, #ead8b2);
  color: #624611; border-color: #a17a2b; box-shadow: 0 3px 10px rgba(80,55,25,.18);
}
body[data-ambient="light"] .qlink { background: #fff8e9; color: #624611; border-color: #cdb992; }
body[data-ambient="light"] .qlink:hover { background: #eedebf; }
body[data-ambient="light"] .btn:disabled {
  filter: none; opacity: 1; background: #e6dcc8; color: #73654e;
  border: 1px solid #c1b394; box-shadow: none; text-shadow: none;
}

/* Mesas claras: paletas e pré-visualizações correspondentes. */

body[data-table-theme="pearl"] { --felt-1: #fffefa; --felt-2: #eee8dc; --felt-3: #eee8dc; --rim-1: #eee8dc; --rim-2: #6d7891; --rim-3: #eee8dc; --rim-4: #6d7891; --tbl-tint: #6d789155; }
.felt-prev-pearl { --a: #fffefa; --b: #eee8dc; --c: #6d7891; --d: #eee8dc; }
body[data-table-theme="pearl"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="linen"] { --felt-1: #fffaf0; --felt-2: #e7d8bd; --felt-3: #e7d8bd; --rim-1: #e7d8bd; --rim-2: #8f7956; --rim-3: #e7d8bd; --rim-4: #8f7956; --tbl-tint: #8f795655; }
.felt-prev-linen { --a: #fffaf0; --b: #e7d8bd; --c: #8f7956; --d: #e7d8bd; }
body[data-table-theme="linen"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="sage"] { --felt-1: #f6fbf1; --felt-2: #dce7d2; --felt-3: #dce7d2; --rim-1: #dce7d2; --rim-2: #527b61; --rim-3: #dce7d2; --rim-4: #527b61; --tbl-tint: #527b6155; }
.felt-prev-sage { --a: #f6fbf1; --b: #dce7d2; --c: #527b61; --d: #dce7d2; }
body[data-table-theme="sage"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="mint"] { --felt-1: #f2fff9; --felt-2: #d4eee2; --felt-3: #d4eee2; --rim-1: #d4eee2; --rim-2: #237e71; --rim-3: #d4eee2; --rim-4: #237e71; --tbl-tint: #237e7155; }
.felt-prev-mint { --a: #f2fff9; --b: #d4eee2; --c: #237e71; --d: #d4eee2; }
body[data-table-theme="mint"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="seafoam"] { --felt-1: #f4fffc; --felt-2: #cce6df; --felt-3: #cce6df; --rim-1: #cce6df; --rim-2: #388c94; --rim-3: #cce6df; --rim-4: #388c94; --tbl-tint: #388c9455; }
.felt-prev-seafoam { --a: #f4fffc; --b: #cce6df; --c: #388c94; --d: #cce6df; }
body[data-table-theme="seafoam"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="sky"] { --felt-1: #f7fcff; --felt-2: #d9eaf7; --felt-3: #d9eaf7; --rim-1: #d9eaf7; --rim-2: #3b78af; --rim-3: #d9eaf7; --rim-4: #3b78af; --tbl-tint: #3b78af55; }
.felt-prev-sky { --a: #f7fcff; --b: #d9eaf7; --c: #3b78af; --d: #d9eaf7; }
body[data-table-theme="sky"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="ice"] { --felt-1: #ffffff; --felt-2: #e1edf0; --felt-3: #e1edf0; --rim-1: #e1edf0; --rim-2: #648c9b; --rim-3: #e1edf0; --rim-4: #648c9b; --tbl-tint: #648c9b55; }
.felt-prev-ice { --a: #ffffff; --b: #e1edf0; --c: #648c9b; --d: #e1edf0; }
body[data-table-theme="ice"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="lavender"] { --felt-1: #fcf8ff; --felt-2: #e6dcf2; --felt-3: #e6dcf2; --rim-1: #e6dcf2; --rim-2: #8465a6; --rim-3: #e6dcf2; --rim-4: #8465a6; --tbl-tint: #8465a655; }
.felt-prev-lavender { --a: #fcf8ff; --b: #e6dcf2; --c: #8465a6; --d: #e6dcf2; }
body[data-table-theme="lavender"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="rose"] { --felt-1: #fff8fa; --felt-2: #f1dce3; --felt-3: #f1dce3; --rim-1: #f1dce3; --rim-2: #a44d72; --rim-3: #f1dce3; --rim-4: #a44d72; --tbl-tint: #a44d7255; }
.felt-prev-rose { --a: #fff8fa; --b: #f1dce3; --c: #a44d72; --d: #f1dce3; }
body[data-table-theme="rose"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="peach"] { --felt-1: #fffaf5; --felt-2: #f4dfc9; --felt-3: #f4dfc9; --rim-1: #f4dfc9; --rim-2: #af6e43; --rim-3: #f4dfc9; --rim-4: #af6e43; --tbl-tint: #af6e4355; }
.felt-prev-peach { --a: #fffaf5; --b: #f4dfc9; --c: #af6e43; --d: #f4dfc9; }
body[data-table-theme="peach"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="sand"] { --felt-1: #fff9eb; --felt-2: #e8d4ab; --felt-3: #e8d4ab; --rim-1: #e8d4ab; --rim-2: #96732b; --rim-3: #e8d4ab; --rim-4: #96732b; --tbl-tint: #96732b55; }
.felt-prev-sand { --a: #fff9eb; --b: #e8d4ab; --c: #96732b; --d: #e8d4ab; }
body[data-table-theme="sand"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="champagne"] { --felt-1: #fffcef; --felt-2: #eee0b9; --felt-3: #eee0b9; --rim-1: #eee0b9; --rim-2: #ac8737; --rim-3: #eee0b9; --rim-4: #ac8737; --tbl-tint: #ac873755; }
.felt-prev-champagne { --a: #fffcef; --b: #eee0b9; --c: #ac8737; --d: #eee0b9; }
body[data-table-theme="champagne"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="olive"] { --felt-1: #fcfcee; --felt-2: #e4e4c6; --felt-3: #e4e4c6; --rim-1: #e4e4c6; --rim-2: #777c35; --rim-3: #e4e4c6; --rim-4: #777c35; --tbl-tint: #777c3555; }
.felt-prev-olive { --a: #fcfcee; --b: #e4e4c6; --c: #777c35; --d: #e4e4c6; }
body[data-table-theme="olive"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="pistachio"] { --felt-1: #faffee; --felt-2: #dfeac2; --felt-3: #dfeac2; --rim-1: #dfeac2; --rim-2: #65853b; --rim-3: #dfeac2; --rim-4: #65853b; --tbl-tint: #65853b55; }
.felt-prev-pistachio { --a: #faffee; --b: #dfeac2; --c: #65853b; --d: #dfeac2; }
body[data-table-theme="pistachio"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="aqua"] { --felt-1: #f3ffff; --felt-2: #d2ecec; --felt-3: #d2ecec; --rim-1: #d2ecec; --rim-2: #287b87; --rim-3: #d2ecec; --rim-4: #287b87; --tbl-tint: #287b8755; }
.felt-prev-aqua { --a: #f3ffff; --b: #d2ecec; --c: #287b87; --d: #d2ecec; }
body[data-table-theme="aqua"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="azure"] { --felt-1: #f8fbff; --felt-2: #d9e3f4; --felt-3: #d9e3f4; --rim-1: #d9e3f4; --rim-2: #355a9a; --rim-3: #d9e3f4; --rim-4: #355a9a; --tbl-tint: #355a9a55; }
.felt-prev-azure { --a: #f8fbff; --b: #d9e3f4; --c: #355a9a; --d: #d9e3f4; }
body[data-table-theme="azure"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="lilac"] { --felt-1: #fff9ff; --felt-2: #edddf0; --felt-3: #edddf0; --rim-1: #edddf0; --rim-2: #995ca0; --rim-3: #edddf0; --rim-4: #995ca0; --tbl-tint: #995ca055; }
.felt-prev-lilac { --a: #fff9ff; --b: #edddf0; --c: #995ca0; --d: #edddf0; }
body[data-table-theme="lilac"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="coral"] { --felt-1: #fff9f4; --felt-2: #f3dbd0; --felt-3: #f3dbd0; --rim-1: #f3dbd0; --rim-2: #b55646; --rim-3: #f3dbd0; --rim-4: #b55646; --tbl-tint: #b5564655; }
.felt-prev-coral { --a: #fff9f4; --b: #f3dbd0; --c: #b55646; --d: #f3dbd0; }
body[data-table-theme="coral"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="apricot"] { --felt-1: #fffaf0; --felt-2: #f3dfbd; --felt-3: #f3dfbd; --rim-1: #f3dfbd; --rim-2: #ad7832; --rim-3: #f3dfbd; --rim-4: #ad7832; --tbl-tint: #ad783255; }
.felt-prev-apricot { --a: #fffaf0; --b: #f3dfbd; --c: #ad7832; --d: #f3dfbd; }
body[data-table-theme="apricot"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="silver"] { --felt-1: #ffffff; --felt-2: #e1e4e8; --felt-3: #e1e4e8; --rim-1: #e1e4e8; --rim-2: #737e8c; --rim-3: #e1e4e8; --rim-4: #737e8c; --tbl-tint: #737e8c55; }
.felt-prev-silver { --a: #ffffff; --b: #e1e4e8; --c: #737e8c; --d: #e1e4e8; }
body[data-table-theme="silver"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="copper"] { --felt-1: #fff8f1; --felt-2: #e9d3bd; --felt-3: #e9d3bd; --rim-1: #e9d3bd; --rim-2: #a2693d; --rim-3: #e9d3bd; --rim-4: #a2693d; --tbl-tint: #a2693d55; }
.felt-prev-copper { --a: #fff8f1; --b: #e9d3bd; --c: #a2693d; --d: #e9d3bd; }
body[data-table-theme="copper"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="jade"] { --felt-1: #f7fff8; --felt-2: #d2e6d5; --felt-3: #d2e6d5; --rim-1: #d2e6d5; --rim-2: #367653; --rim-3: #d2e6d5; --rim-4: #367653; --tbl-tint: #36765355; }
.felt-prev-jade { --a: #f7fff8; --b: #d2e6d5; --c: #367653; --d: #d2e6d5; }
body[data-table-theme="jade"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }


body[data-table-theme="porcelain"] { --felt-1: #fffefd; --felt-2: #e7e3dc; --felt-3: #e7e3dc; --rim-1: #e7e3dc; --rim-2: #536d8d; --rim-3: #e7e3dc; --rim-4: #536d8d; --tbl-tint: #536d8d55; }
.felt-prev-porcelain { --a: #fffefd; --b: #e7e3dc; --c: #536d8d; --d: #e7e3dc; }
body[data-table-theme="porcelain"] .center-msg:not(:empty) { color: #302419; background: #fff8e9; text-shadow: none; padding: 10px 14px; border-radius: 12px; width: max-content; max-width: 62%; }

.theme-grid.theme-carousel {
  display: flex; overflow-x: auto; overflow-y: hidden; gap: 14px;
  padding: 12px 8px 18px; scroll-snap-type: x proximity;
  overscroll-behavior-x: contain; touch-action: pan-x;
  scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
}
.theme-carousel .theme-opt { flex: 0 0 154px; min-width: 0; scroll-snap-align: start; }
.theme-carousel .theme-opt b { white-space: normal; }
.theme-carousel:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Lobby de altura fixa; apenas os seletores nas definições têm scroll. */
#screen-lobby:not([hidden]) {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}
#screen-lobby .topbar { flex: 0 0 auto; }
#screen-lobby .lobby {
  flex: 1 1 0; min-height: 0; width: 100%;
  display: block; overflow: hidden;
}
#screen-lobby .lobby-content {
  display: flex; flex-direction: column; gap: clamp(8px, 1.5vh, 18px);
  width: 100%; transform-origin: top center;
}
#screen-lobby .lobby-content > * { flex: none; }
#screen-lobby .lobby-hero.brand-scene { margin-top: 0; margin-bottom: 0; }
@media (max-height: 740px) {
  #screen-lobby .brand-fan { height: 140px; width: min(210px, 85%); }
  #screen-lobby .brand-playing-card { max-height: 120px; width: 38%; }
  #screen-lobby .lobby-hero.brand-scene { min-height: 0; padding: 4px 0; }
  #screen-lobby .brand-wordmark h1 { font-size: 32px; }
  #screen-lobby .brand-ornament { display: none; }
  #screen-lobby .tile { padding-top: 10px; padding-bottom: 10px; }
  #screen-lobby .tile-ico { width: 42px; height: 42px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  #screen-lobby .lobby-hero.brand-scene { grid-template-columns: 1fr 1fr; }
  #screen-lobby .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #screen-lobby .tile { flex-direction: row; gap: 8px; padding: 10px; }
  #screen-lobby .tile-txt b { font-size: 16px; }
  #screen-lobby .tile-txt small { font-size: 11px; }
  #screen-lobby .brand-fan { height: 110px; }
}

/* Espaço entre ações principais e atalhos, inclusive no layout compacto. */
#screen-lobby .quick-links { margin-top: clamp(12px, 2vh, 20px); }
#screen-lobby .fair { margin-top: 10px; }
.lb-profile { border: 0; background: none; color: inherit; font: inherit; padding: 4px 0; width: 100%; min-height: 44px; text-align: left; cursor: pointer; }
.lb-profile:hover .lb-nickname { text-decoration: underline; }
.lb-profile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* Duas opções completas e metade da terceira, em qualquer largura. */
.theme-grid.theme-carousel { gap: 12px; padding: 12px 0 18px; position: relative; touch-action: pan-x pan-y; }
.theme-carousel .theme-opt { box-sizing: border-box; flex: 0 0 calc(40% - 9.6px); width: calc(40% - 9.6px); min-width: 0; padding: 10px 5px; position: relative; touch-action: pan-x pan-y; }
.theme-carousel .theme-opt > * { pointer-events: none; }
.theme-carousel .theme-cards { width: 100%; justify-content: center; gap: 3px; height: auto; }
.theme-carousel .theme-cards .card.mini { width: 44%; flex: 0 0 44%; padding: 0; height: auto; aspect-ratio: 5 / 7; }
.theme-carousel .theme-cards > svg { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.theme-carousel .theme-check { top: 0; right: 0; }
.theme-carousel .theme-opt b { font-size: 12px; overflow-wrap: anywhere; }
.table-line-field { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.table-line-field input { padding: 3px; width: 64px; height: 42px; }
.surface-preview { display: block; width: 100%; height: 64px; border-radius: 50%; background-color: var(--felt-2); }
body[data-table-surface] #screen-table .felt::before { border-color: var(--table-line); border-style: solid; }
body[data-table-surface] #screen-table .felt { --rim-2: var(--table-line); --rim-4: var(--table-line); }
body[data-table-surface="solid"] #screen-table .felt, .surface-solid { background: var(--felt-2); }
body[data-table-surface="gradient"] #screen-table .felt, .surface-gradient, .surface-theme { background: radial-gradient(ellipse, var(--felt-1), var(--felt-3)); }
body[data-table-surface="linen"] #screen-table .felt, .surface-linen { background: repeating-linear-gradient(0deg, #ffffff18 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, #00000012 0 1px, transparent 1px 4px), var(--felt-2); }
body[data-table-surface="diamonds"] #screen-table .felt, .surface-diamonds { background: repeating-linear-gradient(45deg, #ffffff20 0 2px, transparent 2px 18px), repeating-linear-gradient(-45deg, #ffffff20 0 2px, transparent 2px 18px), var(--felt-2); }
body[data-table-surface="dots"] #screen-table .felt, .surface-dots { background: radial-gradient(circle, #ffffff50 1px, transparent 2px) 0 0 / 12px 12px, var(--felt-2); }
body[data-table-surface="wood"] #screen-table .felt, .surface-wood { background: repeating-linear-gradient(94deg, #00000018 0 2px, transparent 2px 9px, #ffffff15 9px 11px, transparent 11px 24px), var(--felt-2); }
body[data-table-surface="solid"] #screen-table .felt::after { content: none; }

.theme-section { min-width: 0; margin: 14px 0; border: 1px solid var(--gold); border-radius: 12px; padding: 0 12px; }
.theme-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; padding: 16px 0; min-height: 48px; list-style: none; font-weight: 700; color: var(--gold-hi); }
.theme-section > summary::-webkit-details-marker { display: none; }
.theme-section > summary::after { content: '+'; font-size: 24px; }
.theme-section[open] > summary::after { content: '−'; }
.theme-section > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
#modal-body .theme-carousel { width: 100%; max-width: 100%; min-width: 0; scroll-snap-type: x mandatory; }
.theme-carousel .theme-opt { transform: none; }
