/* Tema base (mobile first, alto contraste). Sem estilos inline: compatível com a CSP. */
:root {
  --bg: #12102b;
  --bg2: #1c1945;
  --card: #25225a;
  --line: #3a3680;
  --text: #ffffff;
  --muted: #b9b6e6;
  --primary: #7c5cff;
  --primary-d: #5b3de0;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 16px;
  --opt-a: #e21b3c;
  --opt-b: #1368ce;
  --opt-c: #d89e00;
  --opt-d: #26890c;
  --opt-e: #8a3ffc;
  --opt-f: #e06b00;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #2a2570 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

.wrap { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.center { text-align: center; }
.grow { flex: 1; }
.brand { font-weight: 800; letter-spacing: .5px; color: var(--muted); text-align: center; margin: 8px 0 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }

.input {
  width: 100%; padding: 18px 16px; font-size: 1.4rem; text-align: center; font-weight: 700;
  border-radius: 14px; border: 2px solid var(--line); background: #15133a; outline: none;
}
.input:focus { border-color: var(--primary); }
.input.code { text-transform: uppercase; letter-spacing: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 22px; min-height: 56px; border: 0; border-radius: 14px; cursor: pointer;
  font-weight: 800; font-size: 1.1rem; background: var(--primary); color: #fff; width: 100%;
  box-shadow: 0 4px 0 var(--primary-d); transition: transform .05s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; box-shadow: none; border: 2px solid var(--line); }
.btn.ok { background: var(--ok); box-shadow: 0 4px 0 #15803d; }
.btn.bad { background: var(--bad); box-shadow: 0 4px 0 #b91c1c; }
.btn.warn { background: var(--warn); color: #222; box-shadow: 0 4px 0 #b45309; }
.stack > * + * { margin-top: 14px; }
.error { color: #ffb4b4; background: rgba(239, 68, 68, .15); border: 1px solid var(--bad); padding: 10px 14px; border-radius: 12px; }

/* Lobby */
.pulse { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); margin-right: 8px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.7); } 70% { box-shadow: 0 0 0 12px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.big-emoji { font-size: 4rem; }

/* Pergunta */
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.timer { font-size: 2.4rem; font-weight: 900; min-width: 64px; text-align: center; background: var(--bg2); border-radius: 14px; padding: 4px 12px; }
.timer.low { color: var(--bad); }
.bar { height: 10px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.bar > i { display: block; height: 100%; width: 100%; background: var(--primary); transition: width .1s linear; }
.q-text { font-size: 1.5rem; font-weight: 800; margin: 8px 0 20px; overflow-wrap: anywhere; }
.options { display: grid; gap: 12px; grid-template-columns: 1fr; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; min-height: 78px; padding: 14px 18px;
  border: 0; border-radius: 14px; color: #fff; font-weight: 800; font-size: 1.25rem; cursor: pointer; width: 100%;
  box-shadow: 0 5px 0 rgba(0,0,0,.35); overflow-wrap: anywhere;
}
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.opt .ico { font-size: 1.6rem; width: 34px; text-align: center; flex: none; }
.opt:disabled { cursor: default; }
.opt.dim { opacity: .35; }
.opt.chosen { outline: 5px solid #fff; }
.opt.correct { outline: 5px solid var(--ok); opacity: 1; }
.opt-a { background: var(--opt-a); } .opt-b { background: var(--opt-b); } .opt-c { background: var(--opt-c); }
.opt-d { background: var(--opt-d); } .opt-e { background: var(--opt-e); } .opt-f { background: var(--opt-f); }

/* Resultado */
.result { padding: 28px 20px; border-radius: var(--radius); text-align: center; }
.result.ok { background: rgba(34,197,94,.18); border: 2px solid var(--ok); }
.result.bad { background: rgba(239,68,68,.18); border: 2px solid var(--bad); }
.result.none { background: rgba(245,158,11,.15); border: 2px solid var(--warn); }
.result h2 { font-size: 2.2rem; }
.points { font-size: 3rem; font-weight: 900; }

/* Ranking */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.board li.me { border-color: var(--primary); background: #3a2f93; }
.board .pos { width: 40px; font-weight: 900; color: var(--muted); }
.board .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .pt { font-variant-numeric: tabular-nums; }
.board li:nth-child(1) .pos { color: #ffd54a; } .board li:nth-child(2) .pos { color: #cfd8dc; } .board li:nth-child(3) .pos { color: #ffab70; }

.overlay { position: fixed; inset: 0; background: rgba(10,8,30,.85); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; z-index: 50; text-align: center; padding: 20px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { background: #2b2870; border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.error { border-color: var(--bad); }
.toast.ok { border-color: var(--ok); }

@media (min-width: 640px) {
  .options.two { grid-template-columns: 1fr 1fr; }
}

.winner-me { text-align: center; font-size: 1.6rem; font-weight: 900; color: #2a1a00; background: linear-gradient(135deg, #ffd54a, #ff9f1c); border-radius: 16px; padding: 16px; margin-bottom: 14px; animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
