/* CloudGames — visual "candy" vibrante, mobile-first */
:root {
  --bg1: #5b3df5; --bg2: #b23cf0; --bg3: #ff5fa2;
  --ink: #1f1640; --muted: #7a6fa3; --card: #ffffff; --soft: #f4f1ff;
  --primary: #5b3df5; --primary-d: #3f25c9; --yellow: #ffc83d; --yellow-d: #e2a400;
  --green: #12c27e; --red: #ff4d6d; --p0: #ff4d6d; --p1: #ffc83d;
  --r: 18px; --shadow: 0 10px 30px rgba(31, 22, 64, .18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Baloo 2', system-ui, sans-serif; color: var(--ink);
  background: radial-gradient(circle at 15% 10%, rgba(255,255,255,.18) 0 120px, transparent 121px),
              radial-gradient(circle at 90% 85%, rgba(255,255,255,.12) 0 160px, transparent 161px),
              linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed; overflow: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
#app { height: 100dvh; max-width: 760px; margin: 0 auto; position: relative; }
.screen { display: none; height: 100%; flex-direction: column; }
.screen.active { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
/* Botões estilo "doce" */
.btn {
  border: 0; border-radius: 14px; padding: 10px 16px; font-weight: 700; color: #fff;
  background: var(--primary); box-shadow: 0 4px 0 var(--primary-d); transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-d); }
.btn:disabled { filter: grayscale(.7) opacity(.6); cursor: not-allowed; }
.btn.yellow { background: var(--yellow); color: var(--ink); box-shadow: 0 4px 0 var(--yellow-d); }
.btn.ghost { background: var(--soft); color: var(--primary); box-shadow: 0 4px 0 #dcd5ff; }
.btn.big { padding: 14px 20px; font-size: 1.1rem; }
.icon-btn { border: 0; background: rgba(255,255,255,.2); color: #fff; width: 42px; height: 42px; border-radius: 14px; font-size: 1.3rem; position: relative; }
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--soft); font-size: 1.4rem; flex: none; position: relative; }
/* Login */
#screen-login { justify-content: center; padding: 20px; }
.login-card { background: var(--card); border-radius: 26px; padding: 26px 22px; box-shadow: var(--shadow); max-width: 440px; width: 100%; margin: 0 auto; }
.logo { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.logo b { color: var(--bg3); }
.logo-cloud { animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.tagline { text-align: center; color: var(--muted); margin: 4px 0 18px; }
.lbl { display: block; font-weight: 700; margin: 10px 0 6px; }
#name-input, .join-form input, .chat-form input {
  width: 100%; border: 2px solid #e6e0ff; border-radius: 14px; padding: 10px 14px; outline: none; background: #fff; color: var(--ink);
}
#name-input:focus, .chat-form input:focus, .join-form input:focus { border-color: var(--primary); }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 18px; }
.avatar-opt { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--soft); font-size: 1.4rem; padding: 0; }
.avatar-opt.sel { border-color: var(--primary); background: #e4dcff; transform: scale(1.08); }
#login-form .btn { width: 100%; }
/* Barra superior */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; color: #fff; }
.me-chip { display: flex; align-items: center; gap: 8px; border: 0; background: rgba(255,255,255,.18); color: #fff; padding: 4px 14px 4px 4px; border-radius: 40px; text-align: left; }
.me-chip .av { background: #fff; }
.me-info { display: flex; flex-direction: column; line-height: 1.1; }
.me-info small { opacity: .85; }
.online { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.18); padding: 4px 12px; border-radius: 20px; font-weight: 600; }
.online i { width: 9px; height: 9px; border-radius: 50%; background: #3dff9e; box-shadow: 0 0 8px #3dff9e; }
.room-title { font-weight: 800; font-size: 1.2rem; text-align: center; flex: 1; }
/* Lobby */
.lobby-main { flex: 1; overflow-y: auto; padding: 0 14px 90px; }
.tab { display: none; }
.tab.active { display: block; }
.tab-title { color: #fff; margin: 4px 0 10px; }
.hero { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: var(--r); padding: 16px; margin-bottom: 14px; display: grid; gap: 12px; }
.hero h1 { margin: 0; font-size: 1.7rem; line-height: 1.1; }
.hero p { margin: 4px 0 0; opacity: .9; }
.join-form { display: flex; gap: 8px; }
.join-form input { text-transform: uppercase; letter-spacing: 3px; font-weight: 800; text-align: center; max-width: 140px; }
.game-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.game-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: grid; grid-template-columns: 74px 1fr; gap: 6px 12px; position: relative; overflow: hidden; }
.game-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--c); }
.gc-icon { grid-row: span 2; display: grid; place-items: center; font-size: 2.6rem; border-radius: 18px; background: color-mix(in srgb, var(--c) 20%, white); height: 74px; }
.gc-body h3 { margin: 0; font-size: 1.2rem; line-height: 1.2; }
.gc-body p { margin: 2px 0 4px; color: var(--muted); font-size: .95rem; line-height: 1.25; }
.gc-tag { font-size: .8rem; font-weight: 700; color: var(--c); filter: brightness(.8); }
.gc-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.gc-actions .btn.primary { background: var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 70%, black); }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ranking li { background: var(--card); border-radius: 16px; padding: 8px 14px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.ranking li.mine { outline: 3px solid var(--yellow); }
.ranking li.empty { justify-content: center; color: var(--muted); padding: 20px; }
.ranking .pos { width: 30px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.rk-name { flex: 1; display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; }
.rk-name small { color: var(--muted); font-weight: 500; }
.bottom-nav { position: absolute; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); background: var(--card); border-radius: 22px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; }
.bottom-nav button { border: 0; background: none; border-radius: 16px; padding: 6px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.bottom-nav button span { font-size: 1.3rem; }
.bottom-nav button.active { background: var(--soft); color: var(--primary); }
/* Chat */
.chat-box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.chat-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; max-height: 220px; }
.chat-box.big .chat-list { max-height: none; height: calc(100dvh - 260px); }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg .av { width: 32px; height: 32px; font-size: 1.1rem; }
.msg b { font-size: .85rem; color: var(--primary); }
.msg p { margin: 0; background: var(--soft); padding: 4px 10px; border-radius: 4px 14px 14px 14px; word-break: break-word; }
.msg.mine p { background: #e4dcff; }
.msg.system { justify-content: center; color: var(--muted); font-size: .85rem; }
.chat-form { display: flex; gap: 8px; padding: 8px; border-top: 1px solid #eee9ff; }
/* Sala de espera */
.room-main { flex: 1; overflow-y: auto; padding: 0 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.code-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.code-card small { color: var(--muted); font-weight: 700; }
.room-code { font-size: 2.6rem; font-weight: 800; letter-spacing: 8px; color: var(--primary); line-height: 1.1; margin: 2px 0 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.slot-card { background: rgba(255,255,255,.2); border: 2px dashed rgba(255,255,255,.5); color: #fff; border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; min-height: 120px; justify-content: center; }
.slot-card.filled { background: var(--card); border: 0; color: var(--ink); box-shadow: var(--shadow); }
.slot-card.me { outline: 3px solid var(--yellow); }
.slot-card .av { width: 54px; height: 54px; font-size: 2rem; }
.slot-card .av.empty { background: rgba(255,255,255,.25); color: #fff; }
.badge { font-size: .75rem; font-weight: 700; background: var(--soft); color: var(--primary); padding: 0 8px; border-radius: 10px; }
.badge.bot { background: #e6fff4; color: #0a8a58; }
.slot-card .x { position: absolute; top: 6px; right: 6px; border: 0; background: var(--soft); border-radius: 50%; width: 26px; height: 26px; color: var(--muted); }
.room-actions { display: grid; gap: 10px; }
.room-actions .muted { color: #fff; opacity: .9; }
/* Partida */
#screen-game { position: relative; }
#chat-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); display: none; }
#chat-dot.on { display: block; }
.players-bar { display: flex; gap: 8px; padding: 0 14px 10px; justify-content: center; flex-wrap: wrap; }
.pchip { background: rgba(255,255,255,.2); color: #fff; border-radius: 40px; padding: 4px 12px 4px 4px; display: flex; align-items: center; gap: 6px; position: relative; transition: all .2s; border: 2px solid transparent; }
.pchip.me { background: rgba(255,255,255,.32); }
.pchip.turn { background: #fff; color: var(--ink); border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255,200,61,.35); }
.pchip.left { opacity: .4; text-decoration: line-through; }
.pchip .av { width: 34px; height: 34px; font-size: 1.2rem; background: #fff; }
.pchip .mark { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: .75rem; background: var(--green); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; }
.pname { font-weight: 700; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname em { font-style: normal; font-size: .65rem; background: #e6fff4; color: #0a8a58; border-radius: 8px; padding: 0 5px; margin-left: 4px; vertical-align: middle; }
.pscore { background: var(--yellow); color: var(--ink); border-radius: 12px; padding: 0 8px; min-width: 26px; text-align: center; }
.piece { font-weight: 800; font-size: 1.1rem; }
.piece.v0 { color: var(--p0); }
.piece.v1 { color: #e2a400; }
.pchip:not(.turn) .piece.v1 { color: var(--p1); }
.pchip:not(.turn) .piece.v0 { color: #ffd0da; }
.bubble { position: absolute; left: 50%; top: -6px; font-size: 2rem; animation: bubble 1.8s ease-out forwards; pointer-events: none; z-index: 5; }
@keyframes bubble { 0% { transform: translate(-50%, 10px) scale(.3); opacity: 0; } 15% { transform: translate(-50%, -30px) scale(1.2); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -70px) scale(1); opacity: 0; } }
.game-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 6px 14px; overflow-y: auto; }
.status { background: rgba(255,255,255,.2); color: #fff; font-weight: 800; padding: 6px 18px; border-radius: 30px; font-size: 1.1rem; text-align: center; }
.status.mine { background: var(--yellow); color: var(--ink); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.reactions { display: flex; justify-content: center; gap: 4px; padding: 6px 8px max(10px, env(safe-area-inset-bottom)); }
.reactions button { border: 0; background: rgba(255,255,255,.2); border-radius: 14px; font-size: 1.3rem; width: 40px; height: 40px; flex: none; padding: 0; transition: transform .1s; }
.reactions button:active { transform: scale(1.3); }
.chat-box.drawer { position: absolute; left: 10px; right: 10px; bottom: 70px; z-index: 20; transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .2s; }
.chat-box.drawer.open { transform: none; opacity: 1; pointer-events: auto; }
@keyframes popin { from { transform: scale(.3); } }
@keyframes winb { to { transform: scale(1.06); } }
.hole { aspect-ratio: 1; border-radius: 50%; background: #1d1260; box-shadow: inset 0 3px 6px rgba(0,0,0,.5); overflow: hidden; display: grid; }
.disc { border-radius: 50%; box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.disc.d0 { background: var(--p0); }
.disc.d1 { background: var(--p1); }
.disc.win { animation: winb .5s infinite alternate; box-shadow: 0 0 0 3px #fff inset; }
@keyframes drop { from { transform: translateY(calc(var(--r) * -110%)); } }
@keyframes shake { 0%, 50% { transform: rotate(-20deg) translateY(-6px); } 25%, 75% { transform: rotate(10deg); } }
.game-area .muted { color: #fff; opacity: .9; }
@keyframes flash { from { filter: brightness(1.6); } }
/* Quiz */
.qhead { width: 100%; max-width: 520px; display: flex; justify-content: space-between; color: #fff; font-weight: 800; }
.qbar { width: 100%; max-width: 520px; height: 10px; background: rgba(0,0,0,.2); border-radius: 10px; overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--green); border-radius: 10px; }
.qbar i.low { background: var(--red); }
.qcard { width: 100%; max-width: 520px; background: var(--card); border-radius: 22px; padding: 22px 18px; box-shadow: var(--shadow); text-align: center; position: relative; }
.qcard p { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
.qgain { position: absolute; top: -14px; right: 14px; background: var(--yellow); font-weight: 800; padding: 2px 12px; border-radius: 14px; animation: popin .3s; }
.qopts { width: 100%; max-width: 520px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qopt { border: 0; background: var(--card); border-radius: 18px; padding: 12px; min-height: 64px; box-shadow: 0 5px 0 #d8d0ff; display: flex; align-items: center; gap: 8px; text-align: left; font-weight: 700; color: var(--ink); position: relative; }
.qopt .ql { width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.qopt .qt { flex: 1; line-height: 1.15; }
.qopt .who { position: absolute; top: -10px; right: 6px; font-size: 1rem; background: #fff; border-radius: 12px; padding: 0 4px; box-shadow: var(--shadow); }
.qopt.sel { outline: 3px solid var(--primary); }
.qopt.ok { background: var(--green); color: #fff; box-shadow: 0 5px 0 #0a8a58; }
.qopt.ok .ql { background: rgba(255,255,255,.3); color: #fff; }
.qopt.bad { background: var(--red); color: #fff; box-shadow: 0 5px 0 #b8304b; }
.qopt:disabled { cursor: default; }
.qopt:disabled:not(.sel):not(.ok) { opacity: .75; }
.quiz-wait { display: grid; place-items: center; gap: 14px; }
/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(20, 10, 50, .55); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 50; padding: 20px; }
.overlay.show { display: grid; animation: fade .2s; }
.modal { background: var(--card); border-radius: 26px; padding: 26px 22px; text-align: center; width: min(92vw, 380px); box-shadow: var(--shadow); }
.modal h2 { margin: 8px 0 2px; }
.queue-icon { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; background: color-mix(in srgb, var(--c, #5b3df5) 22%, white); position: relative; }
.queue-icon::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 5px solid transparent; border-top-color: var(--c, #5b3df5); animation: spin 1s linear infinite; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-emoji { font-size: 4.2rem; line-height: 1; animation: bounce .8s; }
@keyframes bounce { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.modal.result.win h2 { color: var(--green); }
.modal.result.lose h2 { color: var(--red); }
.gain { display: inline-block; margin: 8px 0 14px; background: #fff6d6; color: #8a6400; font-weight: 800; font-size: 1.3rem; padding: 4px 16px; border-radius: 16px; }
.result-actions { display: grid; gap: 10px; }
.toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -120%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 16px; font-weight: 600; z-index: 100; transition: transform .25s; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
@media (min-width: 640px) {
  .hero { grid-template-columns: 1fr auto; align-items: center; }
}
/* Jogos HTML (pasta Games) */
.section-title { color: #fff; margin: 24px 0 10px; font-size: 1.4rem; }
.gc-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; }
.gc-icon:has(img) { overflow: hidden; }
.gc-actions.one { grid-template-columns: 1fr; }
.html-frame-wrap { flex: 1; min-height: 0; padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
#html-frame { width: 100%; height: 100%; border: 0; border-radius: 18px; background: #000; display: block; box-shadow: var(--shadow); }
.html-frame-wrap:fullscreen { padding: 0; background: #000; }
.html-frame-wrap:fullscreen #html-frame { border-radius: 0; }
/* cabeçalho do chat da partida */
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 6px 14px; border-bottom: 1px solid #eee9ff; }
.chat-head b { font-size: .95rem; }
.chat-close { border: 0; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); color: var(--ink); font-size: 1rem; font-weight: 800; }
.chat-close:active { transform: scale(.92); }
/* ===== Xadrez · Damas · Dominó · Cartas ===== */
.tb-head { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.tb-msg { color: #fff; font-weight: 700; font-size: .95rem; background: rgba(31,22,64,.28); padding: 2px 14px; border-radius: 20px; }
.tb-timer { position: relative; width: min(320px, 80%); height: 10px; border-radius: 10px; background: rgba(255,255,255,.22); overflow: visible; }
.tb-timer i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; background: rgba(255,255,255,.85); }
.tb-timer.mine i { background: var(--yellow); }
.tb-timer.low i { background: var(--red); }
.tb-timer b { position: absolute; right: -36px; top: -6px; color: #fff; font-size: .8rem; width: 30px; }
.tb-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.tb-note { color: rgba(255,255,255,.9); font-weight: 600; font-size: .9rem; margin: 0; text-align: center; }
.tb-ctrls { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 40px; }
.tb-pop { position: fixed; inset: 0; background: rgba(20,12,50,.55); display: grid; place-items: center; z-index: 50; animation: fade .15s; }
.tb-pop-box { background: #fff; border-radius: var(--r); padding: 14px 18px; box-shadow: var(--shadow); text-align: center; }
.tb-pop-box p { margin: 0 0 10px; font-weight: 800; }
/* tabuleiros 8x8 */
.cx-board, .dm-board {
  --bw: min(94vw, calc(100dvh - 300px), 520px, var(--fitw, 9999px)); width: var(--bw); height: var(--bw);
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 6px #5a3a22, 0 0 0 9px #3d2615, var(--shadow);
  font-size: calc(var(--bw) / 8 * .74); user-select: none;
}
.sq { position: relative; border: 0; padding: 0; margin: 0; display: grid; place-items: center; line-height: 1; cursor: default; }
.sq.pick, .sq.dot, .sq.cap { cursor: pointer; }
.cx-board .sq.lt { background: #f0d9b5; }
.cx-board .sq.dk { background: #b58863; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255,214,61,.42); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(91,61,245,.45); }
.sq.dot::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(31,22,64,.38); pointer-events: none; }
.sq.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(31,22,64,.38); pointer-events: none; }
.pc { font-family: 'Segoe UI Symbol', 'DejaVu Sans', 'Noto Sans Symbols 2', serif; pointer-events: none; transition: transform .15s; }
.pc.w { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 3px 4px rgba(0,0,0,.35); }
.pc.b { color: #1d1d1d; text-shadow: 0 0 1px #fff3, 0 3px 4px rgba(0,0,0,.35); }
.sq.sel .pc { transform: scale(1.12) translateY(-3px); }
.pc.mini { font-size: 18px; margin-right: -3px; }
/* damas */
.dm-board .sq.lt { background: #f3e2c2; }
.dm-board .sq.dk { background: #3f7d4f; }
.dm { width: 80%; height: 80%; border-radius: 50%; display: grid; place-items: center; font-size: .55em; pointer-events: none; transition: transform .15s; }
.dm.w { background: radial-gradient(circle at 35% 30%, #fff, #e9e1d0 55%, #c9bea6); box-shadow: 0 3px 0 #9d927b, 0 5px 6px rgba(0,0,0,.35), inset 0 0 0 4px rgba(0,0,0,.06); color: #c0392b; }
.dm.b { background: radial-gradient(circle at 35% 30%, #6a6a6a, #2a2a2a 55%, #111); box-shadow: 0 3px 0 #000, 0 5px 6px rgba(0,0,0,.45), inset 0 0 0 4px rgba(255,255,255,.07); color: var(--yellow); }
.dm.ghost { background: rgba(255,80,80,.25); border: 2px dashed rgba(255,255,255,.5); box-shadow: none; }
.sq.sel .dm { transform: scale(1.1) translateY(-3px); }
.sq.pick:not(.sel) .dm { box-shadow: 0 0 0 3px var(--yellow), 0 3px 6px rgba(0,0,0,.35); }
.do-chain { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 3px; max-height: 42dvh; overflow-y: auto; }
.do-chain.empty { color: rgba(255,255,255,.8); font-weight: 700; }
.dt { --u: 15px; display: inline-flex; align-items: center; background: linear-gradient(#fffdf6, #eee5cf); border-radius: 6px; padding: 2px; border: 0; box-shadow: 0 2px 0 #b9ad8e, 0 3px 4px rgba(0,0,0,.3); flex: none; }
.dt.v { flex-direction: column; }
.ds { width: 2px; height: calc(var(--u) * 2.6); background: #c9bfa5; margin: 0 1px; }
.dt.v .ds { width: calc(var(--u) * 2.6); height: 2px; margin: 1px 0; }
.do-chain .dt { --u: 8px; }
.dt.new { box-shadow: 0 0 0 3px var(--yellow), 0 3px 4px rgba(0,0,0,.3); animation: pop .35s; }
.dt.mini { --u: 6px; margin: 2px; }
.dm-end { border: 0; background: var(--yellow); color: var(--ink); font-weight: 800; border-radius: 10px; padding: 6px 10px; box-shadow: 0 3px 0 var(--yellow-d); animation: pulse 1.2s infinite; }
/* cartas */
.cd { --cw: 62px; width: var(--cw); height: calc(var(--cw) * 1.45); border-radius: 10px; border: 3px solid #fff; position: relative; display: grid; place-items: center; color: #fff; flex: none; padding: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,.3); font-family: 'Big Shoulders Display', 'Baloo 2', sans-serif; overflow: hidden; }
.cd::before { content: ''; position: absolute; inset: 14% 8%; border-radius: 50%; background: rgba(255,255,255,.92); transform: rotate(-28deg); }
.cd b { position: relative; font-size: calc(var(--cw) * .5); font-weight: 900; -webkit-text-stroke: 1px rgba(0,0,0,.25); }
.cd .tl, .cd .br { position: absolute; font-style: normal; font-weight: 900; font-size: calc(var(--cw) * .2); line-height: 1; }
.cd .tl { left: 5px; top: 4px; }
.cd .br { right: 5px; bottom: 4px; transform: rotate(180deg); }
.c-r { background: #e8344a; }
.c-r b { color: #e8344a; }
.c-g { background: #1fb36b; }
.c-g b { color: #1fb36b; }
.c-b { background: #2f6fe4; }
.c-b b { color: #2f6fe4; }
.c-y { background: #f5b800; }
.c-y b { color: #e09f00; }
.c-w { background: conic-gradient(#e8344a 0 25%, #2f6fe4 0 50%, #1fb36b 0 75%, #f5b800 0); }
.c-w b { color: #1f1640; }
.cd.back { background: repeating-linear-gradient(45deg, #2a1b6e 0 8px, #3a2690 8px 16px); cursor: pointer; }
.cd.back::before { background: #e8344a; }
.cd.back b { font-size: calc(var(--cw) * .38); -webkit-text-stroke: 0; }
.cd.back.can { box-shadow: 0 0 0 4px var(--yellow), 0 3px 8px rgba(0,0,0,.3); animation: pulse 1.2s infinite; }
.cd.back:disabled { cursor: default; }
@keyframes pop { from { transform: scale(.6); opacity: .3; } }
.players-bar.compact { gap: 6px; padding-bottom: 6px; }
.players-bar.compact .pchip { padding: 2px 9px 2px 2px; gap: 4px; font-size: .9rem; }
.players-bar.compact .av { width: 28px; height: 28px; font-size: 1rem; }
.players-bar.compact .pname { max-width: 66px; }
.players-bar.compact .pname em { font-size: .55rem; padding: 0 3px; margin-left: 2px; }
/* --- v2: mesa estável, peças deslizando, dominó em cobrinha, Uno --- */
.tb-head { min-height: 92px; justify-content: flex-start; }
.tb-msg.empty { visibility: hidden; }
.tb-timer.off { visibility: hidden; }
.pc.moving, .dm.moving { position: relative; z-index: 6; filter: drop-shadow(0 8px 6px rgba(0,0,0,.35)); }
.sq { transition: box-shadow .18s; }
@keyframes tilein { from { transform: scale(1.35); opacity: 0; } }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.game-area.tb-area { justify-content: flex-start; }
.pc.mini { line-height: 26px; }
/* ================= Jogos novos (jogos3.js) ================= */
@font-face { font-family: 'Twemoji Country Flags'; unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2'); font-display: swap; }
.flag { font-family: 'Twemoji Country Flags', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.pq-chip { border: 0; background: rgba(255,255,255,.22); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 20px; font-size: .88rem; }
.pq-chip:active { transform: scale(.96); }
/* quiz: imagem grande, V/F, bandeiras nas opções */
.qcard .qbig { font-size: 4.6rem; line-height: 1.1; margin: 0 0 8px; }
.qcard .qbig.flag { font-size: 5.6rem; }
.qcard .qcat { display: inline-block; background: var(--soft); color: var(--primary); font-weight: 800; padding: 1px 10px; border-radius: 10px; margin-bottom: 6px; }
.qinfo { margin-top: 10px; background: #effcf6; color: #0a7a4e; border-radius: 12px; padding: 8px 10px; font-weight: 600; font-size: .95rem; animation: fade .3s; }
.qopts.vf { grid-template-columns: 1fr 1fr; }
.qopts.vf .qopt { min-height: 92px; flex-direction: column; justify-content: center; font-size: 1.2rem; text-align: center; }
.qopts.vf .qopt.vtrue .ql { background: #e6fff4; color: var(--green); }
.qopts.vf .qopt.vfalse .ql { background: #ffe9ee; color: var(--red); }
.qopts.flags .qopt { justify-content: center; }
.qopt .qt.flag.big { font-size: 3rem; text-align: center; flex: 1; }
/* cartas de baralho */
.pk { --w: 54px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: 8px; background: #fff; border: 1px solid #ddd; position: relative; display: inline-grid; place-items: center;
  color: #1d1d1d; box-shadow: 0 2px 5px rgba(0,0,0,.25); flex: none; padding: 0; font-family: 'Barlow', sans-serif; transition: transform .15s; }
.pk.red { color: #d0263b; }
.pk b { font-size: calc(var(--w) * .55); line-height: 1; }
.pk .pk-c { position: absolute; left: 4px; top: 3px; font-style: normal; font-weight: 800; font-size: calc(var(--w) * .26); line-height: .95; text-align: center; }
.pk.back { background: repeating-linear-gradient(45deg, #2a1b6e 0 6px, #3a2690 6px 12px); border: 3px solid #fff; }
.pk.sm { --w: 34px; }
.pk.big { --w: 64px; }
/* ludo */
.ld-board { --bw: min(94vw, calc(100dvh - 330px), 520px, var(--fitw, 9999px)); width: var(--bw); height: var(--bw); position: relative; background: #fff; border-radius: 12px; box-shadow: 0 0 0 5px #fff, var(--shadow); overflow: hidden; }
@keyframes ldpulse { 50% { transform: translate(-50%, -62%) scale(1.12); } }
@keyframes ldroll { 30% { transform: rotate(-25deg) scale(1.1); } 60% { transform: rotate(20deg); } }
/* batalha naval */
.nv-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; background: #0d4f8b; padding: 4px; border-radius: 10px; box-shadow: var(--shadow); }
.nv-grid.theirs, .nv-grid.setup { width: min(94vw, calc(100dvh - 380px), 420px, var(--fitw, 9999px)); }
.nv-grid.mine { width: min(44vw, 170px); gap: 1px; padding: 3px; }
@keyframes nvboom { 0% { transform: scale(1.8); filter: brightness(2); } }
.pn-field { width: min(94vw, 460px, var(--fitw, 9999px)); aspect-ratio: 1.55; position: relative; background: linear-gradient(#5dade2 0 34%, #3fae49 34%); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.dr-stage { position: relative; width: min(94vw, calc(100dvh - 400px), 480px, var(--fitw, 9999px)); aspect-ratio: 1; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #fff; touch-action: none; }
.dr-stage.can { box-shadow: 0 0 0 4px var(--yellow), var(--shadow); }
.dr-form { display: flex; gap: 6px; width: 100%; max-width: 480px; }
.dr-in { flex: 1; min-width: 0; border: 0; border-radius: 14px; padding: 10px 14px; font-size: 1.05rem; font-weight: 600; box-shadow: inset 0 0 0 2px #dcd5ff; }
.dr-in:disabled { background: rgba(255,255,255,.7); }
.bq-ring { position: relative; width: min(88vw, calc(100dvh - 330px), 360px, var(--fitw, 9999px)); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,.04) 70%); }
@keyframes bqshake { 0%, 100% { transform: translate(-50%, -50%) rotate(-10deg); } 50% { transform: translate(-50%, -54%) rotate(10deg) scale(1.08); } }
/* quem sou eu */
.qs-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; width: min(100%, 520px, var(--fitw, 9999px)); }
/* jogo das facas */
.fk-race { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 4px; }
.fk-row { display: grid; grid-template-columns: 28px 64px 1fr 44px; align-items: center; gap: 6px; color: #fff; background: rgba(255,255,255,.16); border-radius: 12px; padding: 3px 8px; }
.fk-row.me { background: rgba(255,255,255,.3); }
.fk-row .av { width: 26px; height: 26px; font-size: 1rem; background: #fff; }
.fk-row b { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fk-row strong { text-align: right; }
.fk-bar { position: relative; height: 16px; background: rgba(0,0,0,.25); border-radius: 10px; overflow: hidden; }
.fk-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffc83d, #ff7a1a); border-radius: 10px; transition: width .4s; }
.fk-row.me .fk-bar i { background: linear-gradient(90deg, #7dffb3, #12c27e); }
.fk-bar span { position: relative; font-size: .7rem; font-weight: 800; padding-left: 8px; line-height: 16px; }
.fk-stage { position: relative; width: min(94vw, calc((100dvh - 300px) / 1.52), 460px, var(--fitw, 9999px)); aspect-ratio: 500 / 760; border-radius: 22px; overflow: hidden;
  background: radial-gradient(circle at 50% 33%, #4a3b8f, #241a52 70%); box-shadow: var(--shadow); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.fk-toast { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-weight: 800; padding: 4px 14px; border-radius: 20px; white-space: nowrap; animation: fade .2s; font-size: .9rem; }
/* janela de aviso do CloudGames */
.dlg-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(20, 10, 50, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .18s; }
.dlg-wrap.out { opacity: 0; transition: opacity .15s; }
.dlg { background: var(--card); border-radius: 26px; padding: 24px 20px 18px; width: min(92vw, 360px); text-align: center; box-shadow: var(--shadow); animation: dlgin .25s cubic-bezier(.2,1.4,.4,1); }
@keyframes dlgin { from { transform: scale(.8) translateY(10px); opacity: 0; } }
.dlg-ico { width: 64px; height: 64px; margin: -54px auto 6px; border-radius: 50%; background: linear-gradient(140deg, var(--bg1), var(--bg2)); display: grid; place-items: center; font-size: 2rem; box-shadow: 0 6px 16px rgba(91,61,245,.4), 0 0 0 5px #fff; }
.dlg.danger .dlg-ico { background: linear-gradient(140deg, #ff4d6d, #ff8a3d); box-shadow: 0 6px 16px rgba(255,77,109,.4), 0 0 0 5px #fff; }
.dlg h3 { margin: 4px 0 6px; font-size: 1.35rem; color: var(--ink); }
.dlg p { margin: 0 0 14px; color: var(--muted); font-weight: 600; line-height: 1.35; }
.dlg-field { width: 100%; border: 0; border-radius: 14px; background: var(--soft); padding: 10px 12px; font: inherit; font-size: .92rem; resize: none; margin-bottom: 14px; color: var(--ink); }
.dlg-btns { display: flex; gap: 10px; }
.dlg-btns .btn { flex: 1; }
.btn.danger { background: var(--red); box-shadow: 0 4px 0 #c9294a; }
/* ===== conteúdo sempre acessível + aviso de rolagem ===== */
/* centraliza quando cabe; quando não cabe, começa do topo (nada fica cortado sem dar para rolar) */
.game-area { justify-content: flex-start; }
.game-area > :first-child { margin-top: auto; }
.game-area > :last-child { margin-bottom: auto; }
.game-area.tb-area > :first-child { margin-top: 0; }
.game-area, .room-main, .lobby-main { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.55) transparent; }
.game-area::-webkit-scrollbar, .room-main::-webkit-scrollbar, .lobby-main::-webkit-scrollbar { width: 6px; }
.game-area::-webkit-scrollbar-thumb, .room-main::-webkit-scrollbar-thumb, .lobby-main::-webkit-scrollbar-thumb { background: rgba(255,255,255,.55); border-radius: 6px; }
.game-area.more-below { -webkit-mask-image: linear-gradient(#000 calc(100% - 40px), rgba(0,0,0,.25)); mask-image: linear-gradient(#000 calc(100% - 40px), rgba(0,0,0,.25)); }
.game-area.more-above.more-below { -webkit-mask-image: linear-gradient(rgba(0,0,0,.35), #000 24px, #000 calc(100% - 40px), rgba(0,0,0,.25)); mask-image: linear-gradient(rgba(0,0,0,.35), #000 24px, #000 calc(100% - 40px), rgba(0,0,0,.25)); }
.game-area.more-above:not(.more-below) { -webkit-mask-image: linear-gradient(rgba(0,0,0,.35), #000 24px); mask-image: linear-gradient(rgba(0,0,0,.35), #000 24px); }
.scroll-hint { position: absolute; left: 50%; transform: translate(-50%, 8px); z-index: 30; border: 0; border-radius: 30px; padding: 6px 14px 6px 10px;
  background: var(--yellow); color: var(--ink); font-weight: 800; font-size: .88rem; box-shadow: 0 4px 0 var(--yellow-d), 0 8px 18px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap; }
.scroll-hint.on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); animation: hintbob 1.4s ease-in-out infinite; }
.scroll-hint span { display: inline-block; font-size: 1.2rem; line-height: 0; vertical-align: -2px; margin-right: 2px; }
@keyframes hintbob { 50% { transform: translate(-50%, 4px); } }
.screen { position: relative; }
/* caixas com rolagem interna: setinha "mais" quando há conteúdo escondido */
.sbox { position: relative; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.6) transparent; }
.sbox.more { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), rgba(0,0,0,.35)); mask-image: linear-gradient(#000 calc(100% - 26px), rgba(0,0,0,.35)); }
.sbox-wrap { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
.sbox-more { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: var(--yellow); color: var(--ink); font-weight: 800; font-size: .75rem;
  border-radius: 12px; padding: 1px 10px; box-shadow: 0 3px 0 var(--yellow-d); display: none; pointer-events: none; animation: hintbob2 1.4s infinite; }
.sbox.more + .sbox-more { display: block; }
@keyframes hintbob2 { 50% { transform: translate(-50%, 3px); } }
#screen-game.nobar .players-bar { display: none; }
@media (max-height: 760px) {
  .tb-head { min-height: 82px; gap: 3px; }
  .status { font-size: 1rem; padding: 4px 14px; }
  .game-area { gap: 8px; }
  .qcard { padding: 14px 12px; }
  .qcard .qbig { font-size: 3.2rem; margin-bottom: 4px; }
  .qcard .qbig.flag { font-size: 3.8rem; }
  .qcard p { font-size: 1.1rem; }
  .qopt { min-height: 50px; padding: 8px; }
  .qopts.vf .qopt { min-height: 70px; }
}
@media (max-height: 660px) {
  .players-bar.compact .pchip { font-size: .8rem; }
  .players-bar.compact .av { width: 24px; height: 24px; font-size: .85rem; }
  .reactions button { width: 34px; height: 34px; font-size: 1.1rem; }
}
@media (max-height: 660px) {
  .tb-head { min-height: 72px; }
  .tb-timer { height: 8px; }
}
/* ===== tutorial "Como jogar" ===== */
.topbar-r { display: flex; gap: 8px; align-items: center; }
.music-btn { font-size: 1.1rem; }
.music-btn.off { opacity: .6; }
.game-broken { text-align: center; padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--ink, #1f1640); }
.game-broken .big { font-size: 3rem; }
.help-btn { font-size: 1.15rem; }
.game-card { position: relative; }
.gc-help { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--soft); color: var(--primary);
  font-size: .95rem; display: grid; place-items: center; box-shadow: 0 2px 0 #dcd5ff; padding: 0; }
.gc-help:hover { background: #e7e1ff; }
.gc-help:active { transform: translateY(2px); box-shadow: none; }
.gc-body h3 { padding-right: 34px; }
.tut-wrap { position: fixed; inset: 0; z-index: 210; background: rgba(20, 10, 50, .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .18s; }
.tut-wrap.out { opacity: 0; transition: opacity .15s; }
.tut { --c: var(--primary); width: min(94vw, 420px); max-height: calc(100dvh - 32px); background: var(--card); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: dlgin .28s cubic-bezier(.2,1.4,.4,1); touch-action: pan-y; }
.tut-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--c); color: #fff; }
.tut-gi { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.25); display: grid; place-items: center; font-size: 1.5rem; flex: none; overflow: hidden; }
.tut-gi img { width: 100%; height: 100%; object-fit: cover; }
.tut-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.tut-head small { opacity: .85; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.tut-head b { font-size: 1.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tut-skip { border: 0; background: rgba(255,255,255,.22); color: #fff; font-weight: 800; border-radius: 20px; padding: 6px 12px; font-size: .82rem; flex: none; }
.tut-body { padding: 18px 20px 6px; overflow-y: auto; min-height: 220px; display: flex; align-items: center; justify-content: center; }
.tut-step { text-align: center; animation: tutin .25s ease-out; }
@keyframes tutin { from { opacity: 0; transform: translateX(calc(var(--d, 1) * 24px)); } }
.tut-ico { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem;
  background: radial-gradient(circle at 35% 30%, #fff, var(--soft)); box-shadow: inset 0 0 0 4px var(--c), 0 6px 14px rgba(0,0,0,.12); }
.tut-step h3 { margin: 0 0 6px; font-size: 1.35rem; color: var(--ink); }
.tut-step p { margin: 0; color: #4a4170; font-weight: 600; line-height: 1.45; font-size: 1rem; }
.tut-dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 4px; }
.tut-dots button { width: 9px; height: 9px; border-radius: 6px; border: 0; padding: 0; background: #dcd5ff; transition: width .2s, background .2s; }
.tut-dots button.on { width: 24px; background: var(--c); }
.tut-btns { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px 16px; }
.tut-btns .btn { flex: 1; }
@media (max-height: 600px) {
  .tut-ico { width: 60px; height: 60px; font-size: 1.9rem; }
  .tut-body { min-height: 0; padding-top: 12px; }
}
/* ===== jogos de corrida/física (jogos6.js) ===== */
.lg-stage { position: relative; width: min(94vw, calc((100dvh - 290px) / var(--ar, 1.5)), 460px, var(--fitw, 9999px)); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; background: #241a52; }
.lg-cv { width: 100%; height: 100%; display: block; cursor: pointer; }
.lg-extra:empty { display: none; }
.f-vermelha { background: #e74c3c !important; }
.f-azul { background: #2e86de !important; }
.f-branca { background: #ecf0f1 !important; color: #111 !important; }
.f-amarela { background: #f1c40f !important; color: #111 !important; }
