/* Alucard Game — tokens de UI derivados da logo institucional (não é manual de marca aprovado).
   Contraste medido (WCAG 2.x): texto/bg 17.4, muted/surface 8.8, branco/primary 5.2, bg/accent 13.4.
   #D71920 NÃO é usado como cor de texto sobre fundo escuro (3.67:1); para texto vermelho usa-se --primary-ink. */
:root {
  color-scheme: dark;
  --bg: #0e1014;
  --surface: #1b1d24;
  --surface-2: #262933;
  --line: #3a3d48;
  --primary: #d71920;
  --primary-strong: #b3121a;
  --primary-ink: #ff6b70;
  --accent: #ffd52a;
  --text: #f7f4f0;
  --muted: #b9bbc3;
  --ok: #7ce3a8;
  --err: #ff8a8f;
  --radius: 14px;
  --tap: 48px;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(120% 60% at 50% -10%, rgb(215 25 32 / 0.22), transparent 60%),
    radial-gradient(80% 40% at 100% 100%, rgb(255 213 42 / 0.06), transparent 60%),
    var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--accent); }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.1; letter-spacing: 0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.wrap.wide { max-width: 1180px; }

/* Cabeçalho compacto (arena/admin): logo íntegra pequena + título textual separado. */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 0 14px; }
.topbar img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.topbar .title { font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; font-size: 1rem; }
.topbar .title small { display: block; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--muted); font-size: 0.78rem; }
.topbar .spacer { flex: 1; }

/* Hero (inscrição/credencial): logo central com área de respiro, título do produto separado. */
.hero { text-align: center; padding: 12px 0 8px; }
.hero .logo { display: block; width: min(220px, 62vw); height: auto; aspect-ratio: 1; object-fit: contain; margin: 0 auto 8px; }
.hero .product { font-size: clamp(1.9rem, 9vw, 2.6rem); font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; margin: 4px 0 2px; }
.hero .product span { color: var(--accent); }
.hero .tagline { color: var(--muted); margin: 0 0 6px; }

.card { background: linear-gradient(160deg, var(--surface), #15171d); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 14px; }
.eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

label { display: block; font-weight: 700; font-size: 0.9rem; margin: 14px 0 6px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
input, select, button { font: inherit; color: inherit; }
input[type='text'], input[type='password'], input[type='search'], select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px;
  background: #101218; border: 1px solid #4a4e5c;
}
input[aria-invalid='true'] { border-color: var(--err); }
.field-error { color: var(--err); font-size: 0.85rem; margin-top: 4px; min-height: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: 0.9rem; margin: 14px 0 6px; padding: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: var(--tap);
  padding: 6px; border-radius: 10px; border: 1px solid #4a4e5c; background: #101218; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.segmented input:checked + span { border-color: var(--accent); background: #2a2610; color: var(--accent); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

button, .btn {
  min-height: var(--tap); padding: 10px 16px; border-radius: 12px; border: 1px solid #4a4e5c;
  background: var(--surface-2); font-weight: 700; cursor: pointer; touch-action: manipulation;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--primary-strong); }
button.gold { background: var(--accent); border-color: var(--accent); color: #111; }
button.ghost { background: transparent; }
button.danger { border-color: var(--primary-ink); color: var(--primary-ink); background: transparent; }
button.block { width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.banner { border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-size: 0.92rem; border: 1px solid; }
.banner.test { border-color: #6b5a12; background: #241f08; color: #ffe57a; }
.banner.offline { border-color: var(--primary-ink); background: #2a1114; color: #ffd1d3; }
.banner.info { border-color: #3f5a7a; background: #111b26; color: #cfe4ff; }
.banner.error { border-color: var(--err); background: #2a1114; color: #ffd1d3; }
.banner.ok { border-color: #2f7a52; background: #0f241a; color: #c8f5db; }
.hidden { display: none !important; }

/* Credencial */
.credential { text-align: center; }
.credential .code { font: 900 0.85rem/1 var(--font); letter-spacing: 0.2em; color: var(--accent); }
.credential .who { font-size: 1.5rem; font-weight: 900; margin: 6px 0 2px; overflow-wrap: anywhere; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; border: 1px solid var(--line); background: #101218; }

/* Clãs: nome + símbolo + cor (nunca só cor). */
.clan { --team: var(--muted); display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #111318; border: 1px solid var(--line); border-left: 5px solid var(--team); }
.clan.slot-0 { --team: #ff5c63; } .clan.slot-1 { --team: #b9a2ff; } .clan.slot-2 { --team: #4fc8ff; } .clan.slot-3 { --team: #ffb648; }
.clan svg { width: 28px; height: 28px; color: var(--team); flex: none; }
.clan .name { font-weight: 900; color: var(--team); }
.members { list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.9rem; }
.members li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #262833; }
.members li:last-child { border: 0; }
.tag { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #2a2610; color: var(--accent); white-space: nowrap; }
.tag.me { background: #1b2433; color: #cfe4ff; }

/* Arena */
.arena-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.timer { font: 900 1.6rem/1 var(--font); font-variant-numeric: tabular-nums; color: var(--accent); min-width: 3.2ch; text-align: right; }
.timer.low { color: var(--primary-ink); }
.meter { height: 6px; background: #2b2e38; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.meter i { display: block; height: 100%; background: var(--accent); width: 100%; transition: width 0.25s linear; }
.prompt { font-size: 1.2rem; font-weight: 800; line-height: 1.3; margin: 4px 0 14px; overflow-wrap: anywhere; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; text-align: left; padding: 10px 14px;
  border-radius: 12px; border: 2px solid #4a4e5c; background: #121419; font-weight: 700;
}
.option .key { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #262933; font-weight: 900; }
.option[aria-pressed='true'] { border-color: var(--accent); background: #2a2610; }
.option[aria-pressed='true'] .key { background: var(--accent); color: #111; }
.option.correct { border-color: var(--ok); background: #0f241a; }
.option.correct .key { background: var(--ok); color: #0b1a12; }
.option.wrong { border-color: var(--primary-ink); background: #2a1114; }
.option:disabled { opacity: 1; cursor: default; }
.option .mark { margin-left: auto; font-size: 0.8rem; font-weight: 900; }
.result-big { font-size: 1.4rem; font-weight: 900; text-align: center; margin: 12px 0 4px; }
.result-big.ok { color: var(--ok); }
.result-big.err { color: var(--primary-ink); }

.ranking { list-style: none; padding: 0; margin: 0; }
.ranking li { display: grid; grid-template-columns: 2.2ch 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #262833; }
.ranking li:last-child { border: 0; }
.ranking .pos { font-weight: 900; color: var(--muted); }
.ranking .pts { font: 900 1.3rem/1 var(--font); font-variant-numeric: tabular-nums; }

/* Diálogo de confirmação */
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 20px; width: min(92vw, 420px); }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }
dialog::backdrop { background: rgb(0 0 0 / 0.6); }

/* Admin */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cmds button { min-height: 56px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ptable th, .ptable td { text-align: left; padding: 6px 6px; border-bottom: 1px solid #262833; vertical-align: middle; }
.ptable th { color: var(--muted); font-weight: 700; }
.ptable select { min-height: 40px; padding: 6px; }
.ptable button { min-height: 40px; padding: 6px 10px; }
.table-scroll { overflow-x: auto; }
.blockers { margin: 0; padding-left: 18px; color: #ffe0a3; font-size: 0.9rem; }
.answer-chip { display: inline-block; padding: 2px 8px; border-radius: 8px; background: #262933; font-weight: 800; font-size: 0.8rem; }

@media (prefers-reduced-motion: no-preference) {
  .card { animation: arrive 0.24s ease-out; }
  .reveal-burst { animation: pop 0.45s ease-out; }
  @keyframes arrive { from { opacity: 0.6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  @keyframes pop { from { transform: scale(0.96); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .meter i { transition: none; } }
.spacer-8 { height: 8px; }

/* Correções da inspeção visual M1 */
/* Desabilitado sempre neutro: botão colorido "apagado" parecia ativo para o operador. */
button:disabled, button.primary:disabled, button.gold:disabled, button.danger:disabled {
  background: #16181e; border-color: #2c2f38; color: #7d8090; opacity: 1;
}
.option:disabled { color: var(--text); background: #121419; }
.option.correct:disabled { background: #0f241a; }
.option.wrong:disabled { background: #2a1114; }
.option[aria-pressed='true']:disabled { background: #2a2610; }
.status-pill { white-space: nowrap; }
.segmented span { font-size: 0.82rem; line-height: 1.15; overflow-wrap: anywhere; }
