[hidden] { display: none !important; }
body.audio-only .app { display: none; }
.audio-box { padding: 18px; font: 15px/1.6 'Nunito', sans-serif; color: #ecebf7; }
.audio-box small { color: #8f8bb0; }
:root {
  --bg: #0d0b16; --panel: #15122a; --panel2: #1c1838; --line: #2c2650; --text: #ecebf7; --muted: #8f8bb0;
  --gold: #ffd23f; --green: #2ecc71; --yellow: #f5c518; --red: #e8457c; --blue: #3b6fd8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 'Nunito', system-ui, sans-serif; }
button, input, select { font: inherit; }

.app { display: grid; grid-template-columns: minmax(360px, 560px) minmax(380px, 1fr) minmax(320px, 520px); gap: 16px; padding: 16px; min-height: 100%; }
body.only-game .app { display: block; padding: 0; height: 100%; }
body.only-game .side { display: none; }

/* ---------- Jogo ---------- */
.stage-wrap { position: relative; width: 100%; aspect-ratio: 9 / 16; align-self: start; }
body.only-game .stage-wrap { height: 100%; width: auto; max-width: 100%; margin: 0 auto; }
.stage {
  position: absolute; top: 0; left: 0; width: 540px; height: 960px; transform-origin: 0 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 10%, #3a2f8c 0%, #241c62 45%, #17123f 100%);
  border-radius: 14px; font-family: 'Fredoka', 'Nunito', sans-serif; color: #fff;
}
.tiles { position: absolute; inset: 0; opacity: .13; pointer-events: none; }
.tiles span { position: absolute; width: 34px; height: 34px; border-radius: 8px; background: #6c63c9; color: #c9c3ff;
  display: grid; place-items: center; font-weight: 700; font-size: 17px; }

.top { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 22px 18px 0; }
.pill { background: rgba(10, 8, 30, .75); border-radius: 99px; padding: 6px 16px; font-weight: 700; font-size: 19px; }
.secret { min-width: 64px; height: 64px; padding: 0 14px; border-radius: 14px; background: var(--gold); color: #1d1640;
  display: grid; place-items: center; font-size: 34px; font-weight: 700; letter-spacing: .12em; box-shadow: 0 0 28px rgba(255, 210, 63, .5); }
.secret.mask { font-size: 26px; }
.counts { position: relative; display: flex; justify-content: center; gap: 22px; margin: 10px auto 0; width: max-content;
  background: rgba(10, 8, 30, .75); border-radius: 99px; padding: 4px 18px; font-size: 17px; }

.last { position: relative; margin: 16px 16px 10px; min-height: 100px; border: 3px solid var(--gold); border-radius: 20px;
  background: rgba(10, 8, 30, .55); display: flex; align-items: center; gap: 14px; padding: 14px 18px; box-shadow: 0 0 30px rgba(255, 210, 63, .2); }
.last .empty { width: 100%; text-align: center; color: #cfc8ff; font-size: 20px; }
.last .avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; flex: none; border: 3px solid #fff; }
.last .who { flex: 1; min-width: 0; }
.last .word { font-size: 34px; font-weight: 700; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last .user { font-size: 15px; color: #cfc8ff; }
.last .rank { font-size: 46px; font-weight: 700; color: var(--gold); }
.last.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }

.list { position: relative; display: flex; flex-direction: column; gap: 7px; padding: 0 16px; }
.item { position: relative; height: 44px; border-radius: 12px; background: rgba(10, 8, 30, .55); overflow: hidden;
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 0 14px; }
.item .bar { position: absolute; inset: 0 auto 0 0; opacity: .85; border-radius: 12px; }
.item > span { position: relative; }
.item .w { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .u { font-size: 13px; color: #d9d4ff; max-width: 170px; }
.item .r { font-size: 21px; font-weight: 700; min-width: 64px; text-align: right; }
.item.lastmark { outline: 2px solid rgba(255, 255, 255, .6); }

.foot { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ticker { background: rgba(10, 8, 30, .88); border: 2px solid rgba(255, 210, 63, .55); border-radius: 99px; padding: 7px 20px;
  font-size: 19px; min-width: 380px; text-align: center; transition: opacity .35s; }
.ticker b { color: var(--gold); }
.ticker.fade { opacity: 0; }
.howto { width: 100%; text-align: left; }
.howto .h { font-size: 22px; font-weight: 700; color: var(--gold); margin-bottom: 6px; text-align: center; }
.howto ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 19px; }
.howto ol b { color: var(--gold); }
.howto .ex { margin-top: 8px; text-align: center; font-size: 17px; color: #cfc8ff; }
.howto .ex span { background: rgba(255,255,255,.12); border-radius: 8px; padding: 1px 9px; color: #fff; }
.howto .ex b { color: var(--yellow); }
.heat { font-weight: 700; }
/* barras de meta (compactas) + widget de ranking lado a lado */
/* coluna à direita: o chat do TikTok cobre o canto inferior esquerdo */
.bottom { position: absolute; right: 14px; bottom: 72px; width: 214px; display: flex; flex-direction: column; gap: 6px; }
.goals { display: flex; flex-direction: column; gap: 6px; }
.goal { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; background: rgba(10, 8, 30, .82); border-radius: 11px; padding: 6px 10px 7px; font-size: 13.5px; }
.goal b { color: var(--gold); }
.goal .gbar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.goal .gbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffb703, #ffd23f); transition: width .5s; }
.goal.like .gbar i { background: linear-gradient(90deg, #ff4d8d, #ff8fb8); }
.goal .gv { font-weight: 700; color: var(--gold); font-size: 13px; }
.rank-box { background: rgba(10, 8, 30, .85); border: 2px solid rgba(255, 210, 63, .5); border-radius: 12px; padding: 6px 8px 7px; }
.rank-title { text-align: center; font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: .06em; margin-bottom: 4px; }
.rk { display: grid; grid-template-columns: 18px 22px 1fr auto; align-items: center; gap: 5px; font-size: 13px; height: 23px; }
.rk .rn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk b { color: var(--gold); }
.rk-empty { font-size: 12.5px; color: #cfc8ff; text-align: center; padding: 6px 2px; }

/* foto de perfil com a inicial por baixo (aparece se a foto não carregar) */
.avw { position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 700; flex: none; line-height: 1; }
.avw img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.last .avw { border: 3px solid #fff; }
.item .u { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.item .u .un { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* destaque de quem acertou */
.champ { position: relative; margin: 14px 0 6px; }
.champ .avw { border: 5px solid var(--gold); box-shadow: 0 0 40px rgba(255, 210, 63, .8); animation: pop .5s ease-out; }
.champ .crown { position: absolute; top: -38px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 46px; z-index: 1; }
.champ-name { font-size: 34px; font-weight: 700; color: var(--gold); text-shadow: 0 2px 0 #120d33; }
.champ-wins { font-size: 18px; color: #cfc8ff; margin-top: 2px; }
.result.win .t3 { margin-top: 10px; }
.win-word { color: var(--green); }

.flash { position: absolute; left: 30px; right: 30px; top: 300px; text-align: center; background: linear-gradient(135deg, #ffd23f, #ff9f1c);
  color: #1d1640; border-radius: 22px; padding: 18px; font-size: 30px; font-weight: 700; box-shadow: 0 0 40px rgba(255, 210, 63, .8);
  animation: pop .4s ease-out; z-index: 4; }
.flash small { display: block; font-size: 20px; }

.result { position: absolute; inset: 0; background: rgba(8, 6, 24, .86); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.result .t1 { font-size: 30px; color: #cfc8ff; }
.result .t2 { font-size: 64px; font-weight: 700; color: var(--gold); line-height: 1.1; margin: 10px 0; word-break: break-word; }
.result .t3 { font-size: 26px; }
.result .t4 { font-size: 18px; color: var(--muted); margin-top: 26px; }
.result.win .t2 { color: var(--green); }

.speech { position: absolute; left: 24px; right: 24px; bottom: 232px; background: rgba(10, 8, 30, .88); border: 2px solid var(--gold);
  border-radius: 16px; padding: 10px 14px; font-size: 19px; text-align: center; animation: pop .3s ease-out; }
.unlock { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 18px; padding: 12px 18px; z-index: 5; }
.gifts { max-height: 230px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; align-items: center; margin-top: 6px; }
.gifts span { font-size: 13px; color: #cbc7e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gifts input { margin: 0; padding: 5px 8px; }
.new { color: #1d1640; background: var(--gold); border-radius: 99px; padding: 0 7px; font-size: 11px; font-weight: 800; margin-left: 4px; }
details { margin-top: 8px; font-size: 13px; } summary { cursor: pointer; color: #cbc7e8; }
details label { margin-top: 6px; }

/* ---------- Painéis ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; align-self: start; }
h1 { font: 700 18px 'Fredoka', sans-serif; color: var(--gold); margin: 0 0 6px; }
h2 { font: 700 12px 'Nunito', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #bdb8e0; margin: 14px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.warn { border-left: 3px solid #ff8a1f; background: rgba(255, 138, 31, .08); padding: 6px 10px; font-size: 12.5px; border-radius: 4px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0 0; padding: 10px 12px 12px; background: var(--panel2); }
legend { font: 800 12px 'Nunito'; letter-spacing: .08em; text-transform: uppercase; padding: 0 6px; }
label { display: block; font-size: 12.5px; color: #cbc7e8; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.span2 { grid-column: span 2; }
input, select { width: 100%; margin-top: 3px; background: #0b0918; color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; }
input:focus, select:focus { outline: 2px solid var(--blue); border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.check input { width: auto; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; margin: 0; }
button { border: 1px solid var(--line); background: var(--gold); color: #1d1640; border-radius: 8px; padding: 7px 12px; font-weight: 800; cursor: pointer; }
button.ghost { background: #241f47; color: var(--text); }
button.green { background: #24883f; color: #fff; border-color: #2fa34d; }
button.gold { background: #6b5514; color: #ffe9a6; border-color: #8d7020; }
button.blue { background: #1d3f7c; color: #fff; border-color: #2d5bb0; }
button.danger { background: #7a1f3d; color: #fff; border-color: #a02a52; }
button:hover { filter: brightness(1.12); }
.status { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #7a7596; }
.dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.connecting, .dot.reconnecting { background: var(--yellow); }
.dot.error, .dot.offline, .dot.blocked, .dot.auth { background: var(--red); }
.console { height: 150px; overflow: auto; background: #0b0918; border-radius: 7px; padding: 6px 8px; font: 12px/1.5 ui-monospace, Consolas, monospace; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.stats div { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 6px; text-align: center; }
.stats b { display: block; color: var(--gold); font: 700 18px 'Fredoka'; }
.stats span { font-size: 11px; color: var(--muted); }
.box { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; height: 170px; overflow: auto; padding: 6px 10px; font-size: 13px; }
.box.tall { height: 260px; }
.box div { padding: 1.5px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box .u { color: var(--gold); font-weight: 800; }
.box .ok { color: var(--green); font-weight: 800; }
.box .dim { color: var(--muted); }
.box .r { float: right; color: #cbc7e8; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-right: 4px; }

@media (max-width: 1100px) { .app { grid-template-columns: 1fr; } .stage-wrap { max-width: 480px; margin: 0 auto; width: 100%; } }
