:root {
  --bg: #0f1226;
  --bg2: #1a1f3d;
  --card: #21274d;
  --card2: #2b3463;
  --txt: #eef1ff;
  --muted: #9aa3d4;
  --accent: #ffd23f;
  --accent2: #6c5ce7;
  --ok: #2ecc71;
  --danger: #e74c3c;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg2), var(--bg));
  color: var(--txt);
  min-height: 100vh;
  padding: 16px;
}

.wrap { max-width: 920px; margin: 0 auto; }
.narrow { max-width: 460px; }

h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; }
h1 { font-size: 1.7rem; }
.logo { font-weight: 800; letter-spacing: .5px; }
.logo .a { color: var(--accent); }
.logo .b { color: var(--accent2); }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  background: var(--accent2); color: #fff;
  font-size: 1rem; font-weight: 700;
  padding: 14px 18px; border-radius: 12px;
  width: 100%; transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent); color: #1a1f3d; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.18); }
.btn.sm { width: auto; padding: 8px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, textarea, select {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--bg2); color: var(--txt); font-size: 1rem;
  outline: none; font-family: inherit;
}
.input:focus, textarea:focus, select:focus { border-color: var(--accent2); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

.code-badge {
  font-size: 2.4rem; font-weight: 900; letter-spacing: 6px;
  color: var(--accent); text-align: center;
}
.qr-box { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; }
.qr-box img { display: block; width: 200px; height: 200px; }
.join-url {
  word-break: break-all; font-size: .85rem; color: var(--muted);
  background: var(--bg2); padding: 8px 10px; border-radius: 8px;
}

.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--bg2); border-radius: 12px; padding: 12px; text-align: center;
}
.stat .n { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat .l { font-size: .75rem; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: var(--card2); margin: 4px;
}
.chip.off { opacity: .45; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.chip.off .dot { background: var(--muted); }

.teams-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .teams-grid { grid-template-columns: 1fr 1fr; } }
.team {
  border-radius: 14px; padding: 12px; background: var(--bg2);
  border-top: 4px solid var(--accent2);
}
.team h3 { font-size: 1rem; margin-bottom: 8px; }
.team .members { display: flex; flex-wrap: wrap; }
.member {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card2); border-radius: 999px; padding: 6px 10px;
  margin: 4px; font-size: .88rem;
}
.member select {
  width: auto; padding: 3px 6px; font-size: .75rem; border-radius: 8px;
  background: var(--card); border-color: rgba(255,255,255,.12);
}

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #000a; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: .9rem; opacity: 0; transition: opacity .25s ease; pointer-events: none;
  max-width: 90%; text-align: center; z-index: 50;
}
.toast.show { opacity: 1; }

.big-name { font-size: 1.5rem; font-weight: 800; }
.word-box {
  font-size: 2.1rem; font-weight: 900; text-align: center;
  padding: 26px 16px; margin: 12px 0;
  background: var(--bg2); border: 2px dashed var(--accent);
  border-radius: 16px; color: var(--accent); word-break: break-word;
  line-height: 1.1;
}
/* modo online */
.io-row { display: flex; gap: 8px; margin-top: 12px; }
.io-row .input { flex: 1; }
.feed {
  text-align: left; background: var(--bg2); border-radius: 10px;
  padding: 9px 12px; margin-top: 10px; max-height: 170px; overflow-y: auto;
  font-size: .92rem;
}
.feed:empty { display: none; }
.feed .clue { color: var(--accent); font-weight: 600; margin: 4px 0; }
.feed .gw { color: var(--muted); margin: 3px 0; }
.feed .gok { color: var(--ok); font-weight: 800; margin: 3px 0; }
canvas.draw {
  width: 100%; height: 360px; background: #fff; border-radius: 12px;
  touch-action: none; display: block; margin-top: 10px; cursor: crosshair;
}
/* barra de ferramentas do desenho */
.dtools { margin-top: 8px; }
.dsw-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dsw {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset;
}
.dsw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.dtool-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dsz-row { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 6px 12px; }
.dsz { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; cursor: pointer; opacity: .55; }
.dsz.on { opacity: 1; }
.dsz i { display: block; background: var(--txt); border-radius: 50%; }
.dbtn {
  background: var(--card2); border: none; color: var(--txt); cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px; line-height: 1;
}
.dbtn.on { background: var(--accent2); }
.dbtn.ddanger { color: var(--danger); }
.dtool-row .dbtn:last-child { margin-left: auto; }

.ranking { margin: 14px 0 6px; text-align: left; }
.rank-row {
  background: var(--bg2); border-radius: 10px; padding: 11px 14px;
  margin: 7px 0; font-size: 1.05rem; display: flex; align-items: center; gap: 10px;
}
.rank-row .pos { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.rank-row .pts { margin-left: auto; font-weight: 800; }
.rank-row.top { box-shadow: 0 0 0 2px var(--accent); }
.round-badge {
  background: var(--accent2); color: #fff; border-radius: 10px;
  padding: 8px 12px; margin: 0 0 12px; font-size: .9rem; line-height: 1.3;
}
.round-badge:empty { display: none; }
.round-badge b { font-size: 1rem; }
.round-badge span { opacity: .9; font-size: .85rem; }
.hint {
  background: var(--card2); border-radius: 12px; padding: 11px 13px;
  margin: 0 0 14px; font-size: .92rem; color: var(--muted); text-align: left;
}
.hint b { color: var(--txt); }
.hint div { margin: 3px 0; }
.hint div:empty { display: none; }
.timer-big { font-size: 3rem; font-weight: 900; color: var(--txt); line-height: 1; }
.timer-big.low { color: var(--danger); animation: pulse 1s ease-in-out infinite; }
.score-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.score-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem;
}
.score-pill .pts { font-size: 1.1rem; }
.waiting-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.spacer { height: 8px; }
.hidden { display: none !important; }

/* ============================ TEMA CARTOON / LÚDICO ============================ */
:root { --fun: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif; }
body {
  font-family: var(--fun);
  background:
    radial-gradient(700px 360px at 12% 0%, rgba(108,92,231,.20), transparent 70%),
    radial-gradient(700px 360px at 92% 8%, rgba(255,210,63,.14), transparent 70%),
    radial-gradient(1200px 600px at 50% -10%, var(--bg2), var(--bg));
}
h1, h2, h3, .logo, .big-name, .btn, .word-box, .code-badge, .round-badge b { font-family: var(--fun); }
h1, h2, .big-name, .logo { font-weight: 600; letter-spacing: .3px; }

/* botões "de brinquedo" com pulo */
.btn {
  border-radius: 16px; font-weight: 600; letter-spacing: .2px;
  box-shadow: 0 4px 0 rgba(0,0,0,.30); transition: transform .07s ease, box-shadow .07s ease, filter .15s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.30); }
.btn.accent { box-shadow: 0 4px 0 #c79a00; }
.btn.ok { box-shadow: 0 4px 0 #1f9b52; }
.btn.danger { box-shadow: 0 4px 0 #a8322a; }
.btn.sm { border-radius: 12px; box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.btn.sm:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.28); }
.btn.ghost { box-shadow: 0 3px 0 rgba(0,0,0,.20); }

/* cards mais redondos */
.card { border-radius: 22px; }
.card.setup, .card { animation: cardIn .35s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* caixa da palavra com "pop" */
.word-box { border-radius: 20px; border-width: 3px; animation: wbPop .42s cubic-bezier(.2,1.35,.4,1); }
@keyframes wbPop { 0% { transform: scale(.55); opacity: 0; } 60% { transform: scale(1.09); } 100% { transform: scale(1); opacity: 1; } }

.round-badge { border-radius: 16px; }
.score-pill { border-radius: 999px; transition: transform .12s ease; }
.score-pill.bump { animation: pillBump .45s ease; }
@keyframes pillBump { 0%,100% { transform: scale(1); } 40% { transform: scale(1.28) rotate(-3deg); } }

/* mascote */
.mascot { display: flex; justify-content: center; margin: 2px 0 6px; }
.mascot svg { width: 92px; height: 92px; }

/* cronômetro circular */
.ring { position: relative; width: 106px; height: 106px; margin: 6px auto; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--fun); font-weight: 600; font-size: 2.1rem; color: var(--txt); }
.ring.low { animation: ringPulse .8s ease-in-out infinite; }
.ring.low .ring-num { color: var(--danger); }
@keyframes ringPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* botão de mudo */
.mute-btn {
  position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--card2); border: none; color: var(--txt); font-size: 20px; cursor: pointer;
  z-index: 60; box-shadow: 0 3px 0 rgba(0,0,0,.30); display: flex; align-items: center; justify-content: center;
}
.mute-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.30); }

/* feed/dica um tantinho mais redondo */
.feed, .hint, .dtools, .io-row .input { border-radius: 14px; }
