:root {
  --ink: #0b1020;
  --ink-2: #131a33;
  --ink-3: #1c2547;
  --line: #2a3561;
  --text: #f3f5ff;
  --muted: #9aa5cf;
  --accent: #ff6a3d;
  --accent-2: #ffb547;
  --ok: #22c55e;
  --bad: #ef4444;
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-2); }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .75em 1.2em; border-radius: 12px; border: 1px solid var(--line);
  background: var(--ink-3); cursor: pointer; font-weight: 600; text-decoration: none;
  color: var(--text); transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--bad); color: #ffb4b4; background: transparent; }
.btn.small { padding: .45em .8em; font-size: .9em; border-radius: 10px; }
.btn.on { background: var(--accent-2); border-color: var(--accent-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%; background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  padding: .8em 1em; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); display: inline-block; }
.dot.on { background: var(--ok); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: #fff; color: var(--ink); padding: .8em 1.2em; border-radius: 12px; font-weight: 600;
  transition: transform .25s; z-index: 99; max-width: calc(100% - 32px);
}
#toast.show { transform: translate(-50%, 0); }

/* ---------- barras de resultados ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7em; }
.bar {
  position: relative; overflow: hidden; border-radius: 12px; background: var(--ink-3);
  padding: .9em 1em; display: flex; align-items: center; gap: 1em; border: 2px solid transparent;
}
.bar-fill {
  position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .35; transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.bar-label { position: relative; flex: 1; }
.bar-label b { color: var(--accent-2); margin-right: .4em; }
.bar-pct { position: relative; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar.correct { border-color: var(--ok); }
.bar.correct .bar-fill { background: var(--ok); opacity: .45; }
.bar.dim { opacity: .55; }
.bar.mine { border-color: var(--accent-2); }

.leaders { list-style: none; padding: 0; margin: 0; display: grid; gap: .5em; }
.leaders li { display: flex; align-items: center; gap: 1em; background: var(--ink-3); border-radius: 12px; padding: .7em 1em; }
.leaders .pos { width: 2em; height: 2em; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 700; }
.leaders li:nth-child(1) .pos { background: #f5c542; color: var(--ink); }
.leaders li:nth-child(2) .pos { background: #c9d1e8; color: var(--ink); }
.leaders li:nth-child(3) .pos { background: #d9915c; color: var(--ink); }
.leaders .who { flex: 1; font-weight: 600; }
.leaders .pts { font-weight: 700; color: var(--ok); }

/* ---------- respuestas abiertas ---------- */
.answers { list-style: none; padding: 0; margin: 0; display: grid; gap: .6em; }
.answer { background: var(--ink-3); border-radius: 12px; padding: .8em 1em; display: flex; gap: .8em; align-items: flex-start; }
.answer .txt { flex: 1; white-space: pre-wrap; word-break: break-word; }
.answer .by { display: block; color: var(--muted); font-size: .8em; margin-top: .2em; }
.like {
  border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: .3em .8em;
  cursor: pointer; white-space: nowrap; font-weight: 600;
}
.like.on { background: var(--accent-2); color: var(--ink); border-color: var(--accent-2); }
