/* Tokens compartilhados: página pública, placar flutuante e console. */
/* Paleta "ficha": papel claro e grafite escuro. Nenhuma cor de partido; veredito = cor + forma. */
:root {
  --bg: #f4f2ec;
  --surface: #fbfaf6;
  --ink: #1b1a17;
  --ink-2: #5e5a52;
  --ink-3: #8b867c;
  --rule: #e0dbcf;
  --focus: #2b59c3;

  --v-true: #1f7a63;
  --v-mixed: #9a6a0c;
  --v-false: #8c2f6f;
  --v-unsup: #4b5578;
  --v-nv: #858b93;
  --v-w40: #b65f16;
  --v-w25: #b8432b;

  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-quote: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316;
    --surface: #1b1d21;
    --ink: #ecebe6;
    --ink-2: #aaa69d;
    --ink-3: #7c786f;
    --rule: #2d2f34;
    --focus: #8fb0ff;
    --v-true: #4bb896;
    --v-mixed: #e2ab3f;
    --v-false: #d978b8;
    --v-unsup: #95a1cf;
    --v-nv: #8d939c;
    --v-w40: #f0954a;
    --v-w25: #f0735a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121316;
  --surface: #1b1d21;
  --ink: #ecebe6;
  --ink-2: #aaa69d;
  --ink-3: #7c786f;
  --rule: #2d2f34;
  --focus: #8fb0ff;
  --v-true: #4bb896;
  --v-mixed: #e2ab3f;
  --v-false: #d978b8;
  --v-unsup: #95a1cf;
  --v-nv: #8d939c;
  --v-w40: #f0954a;
  --v-w25: #f0735a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.45;
  font-variation-settings: "wdth" 100;
}
a { color: inherit; text-underline-offset: 0.18em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* Contas do placar: forma codifica a família do veredito */
.bead {
  --c: var(--v-nv);
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  flex: none;
  vertical-align: -0.06em;
}
.bead[data-f="true"] { --c: var(--v-true); background: var(--c); border-radius: 50%; }
.bead[data-f="mixed"] {
  --c: var(--v-mixed);
  border-radius: 50%;
  border: 0.13em solid var(--c);
  background: linear-gradient(90deg, var(--c) 50%, transparent 50%);
}
.bead[data-f="false"] { --c: var(--v-false); background: var(--c); border-radius: 0.1em; }
.bead[data-f="unsup"] {
  --c: var(--v-unsup);
  background: var(--c);
  transform: rotate(45deg) scale(0.86);
  border-radius: 0.06em;
}
.bead[data-f="nv"] { --c: var(--v-nv); border-radius: 50%; border: 0.13em solid var(--c); }
/* Com ressalvas: o preenchimento distingue o tipo (falta contexto, exagerado/subestimado, impreciso);
   no índice os três valem 50% */
.bead[data-w="w50"], .bead[data-w="w40"], .bead[data-w="w25"] {
  border-radius: 50%; border: 0.13em solid var(--c);
  background: conic-gradient(var(--c) 0 var(--fill), transparent 0);
}
.bead[data-w="w50"] { --c: var(--v-mixed); --fill: 50%; }
.bead[data-w="w40"] { --c: var(--v-w40); --fill: 40%; }
.bead[data-w="w25"] { --c: var(--v-w25); --fill: 25%; }

.verdict-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 700;
  font-variation-settings: "wdth" 88;
  color: var(--chip, var(--ink));
}
.verdict-chip[data-f="true"] { --chip: var(--v-true); }
.verdict-chip[data-f="mixed"] { --chip: var(--v-mixed); }
.verdict-chip[data-f="false"] { --chip: var(--v-false); }
.verdict-chip[data-f="unsup"] { --chip: var(--v-unsup); }
.verdict-chip[data-f="nv"] { --chip: var(--v-nv); }

.live-dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--ink-3);
}
.live-dot[data-live="1"] { background: #d23c3c; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Carimbo do veredito (ficha) */
.stamp {
  --c: var(--v-nv);
  display: inline-flex; align-items: center; gap: 0.4em;
  color: var(--c); border: 2px solid var(--c); border-radius: 3px;
  padding: 0.05em 0.5em 0;
  font: 700 0.8rem/1.45 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.stamp[data-f="true"] { --c: var(--v-true); }
.stamp[data-f="mixed"] { --c: var(--v-mixed); }
.stamp[data-f="false"] { --c: var(--v-false); }
.stamp[data-f="unsup"] { --c: var(--v-unsup); }
.stamp[data-w="w40"] { --c: var(--v-w40); }
.stamp[data-w="w25"] { --c: var(--v-w25); }

/* Linhas fixas da ficha: porquê, dado, fontes, busque */
.sheet { display: grid; grid-template-columns: 4.8rem 1fr; gap: 0.3rem 0.75rem; margin: 0; border-top: 1px solid var(--rule); padding-top: 0.5rem; font-size: 0.9rem; line-height: 1.4; }
.sheet dt { color: var(--ink-2); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 0.2rem; }
.sheet dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sheet .key { font-weight: 600; color: var(--ink); font-size: 1.04em; }
.sheet .val { font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); padding: 0.05em 0.3em; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sheet .ctx { color: var(--ink-2); font-size: 0.95em; }
.num-hl { text-decoration: underline; text-decoration-thickness: 0.12em; text-underline-offset: 0.16em; text-decoration-color: var(--hl, var(--ink-3)); font-weight: 650; }
[data-f="true"] { --hl: var(--v-true); } [data-f="mixed"] { --hl: var(--v-mixed); } [data-f="false"] { --hl: var(--v-false); }
[data-f="unsup"] { --hl: var(--v-unsup); } [data-f="nv"] { --hl: var(--v-nv); }

.sheet .src { display: flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; }
.sheet .src a::after { content: " ↗"; color: var(--ink-3); }

.gbtn {
  display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap;
  margin-top: 0.7rem; padding: 0.5em 0.85em; width: fit-content; max-width: 100%;
  border: 1.5px solid var(--ink); border-radius: 10px; color: var(--ink); text-decoration: none;
  font-size: 0.92rem; line-height: 1.25;
}
.gbtn:hover { background: var(--ink); color: var(--surface); }
.gbtn svg { width: 1em; height: 1em; flex: none; }
.gbtn-cta { font-weight: 600; }
.gbtn-q { font-family: var(--font-mono); font-size: 0.92em; }
.gq { display: inline-flex; align-items: center; gap: 0.4em; color: var(--ink); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; font-family: var(--font-mono); font-size: 0.86em; }
.gq:hover { color: var(--focus); }
.gq svg { width: 1em; height: 1em; flex: none; }

.theme-btn {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: none;
  border: 1px solid var(--rule); border-radius: 50%; background: var(--surface); color: var(--ink);
  cursor: pointer; padding: 0;
}
.theme-btn:hover { border-color: var(--ink); }
.theme-btn svg { width: 1rem; height: 1rem; }

/* Formas agrupadas por tipo */
.string.grouped .grp { display: contents; }
.string.grouped .grp + .grp > :first-child { margin-left: 0.5em; }

/* Barra de distribuição do índice de verdade */
.dist { display: flex; gap: 2px; height: 0.42rem; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, currentColor 12%, transparent); }
.dist span { display: block; flex-basis: 0; min-width: 3px; }
.dist [data-f="true"] { background: var(--v-true); }
.dist [data-f="mixed"] { background: var(--v-mixed); }
.dist [data-f="unsup"] { background: var(--v-unsup); }
.dist [data-f="false"] { background: var(--v-false); }
.dist [data-f="nv"] { background: var(--v-nv); opacity: 0.6; }
