/* Factiverse Arena - light Factiverse look (white, ink, warm yellow). */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-2: #faf9f5;
  --panel: #ffffff;
  --panel-2: #f5f4ef;
  --line: #e8e6df;
  --line-2: #d8d5cc;
  --text: #111111;
  --muted: #555555;
  --dim: #707070;
  --answer: #1f1f1f;

  /* Brand: black ink + warm yellow glow. */
  --ink: #111111;
  --on-ink: #ffffff;
  --accent: #f6c945;
  --accent-2: #fbe38a;
  --accent-strong: #d9a514;
  --accent-soft: #fdf4d3;
  --accent-ink: #5c4300;
  --glow: rgba(246, 201, 69, 0.55);
  --grad: linear-gradient(90deg, #f6c945 0%, #fbe38a 100%);

  --a: #111111;
  --a-ink: #ffffff;
  --b: #f6c945;
  --b-ink: #111111;

  /* Verdicts (MUI-style semantic palette). *-ink are text-safe shades. */
  --ref: #d32f2f;
  --ref-ink: #c62828;
  --ref-bg: #fdecea;
  --ref-bg-2: #f9d4d0;
  --mix: #ff9800;
  --mix-ink: #a35f00;
  --mix-bg: #fff3e0;
  --sup: #43a047;
  --sup-ink: #2e7d32;
  --sup-bg: #f1f8f1;
  --nei: #9e9e9e;
  --nei-ink: #616161;
  --nei-bg: #f2f2f2;
  --skip: #bdbdbd;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 28px rgba(17, 17, 17, 0.07);
  --shadow-lg: 0 18px 50px rgba(17, 17, 17, 0.16);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --scrim: rgba(17, 17, 17, 0.35);

  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --display: var(--font);
  --nav-h: 60px;
  /* Kept in sync with the real vote bar height by app.js (ResizeObserver). */
  --vote-h: 132px;
}

/* Dark theme, opt-in via the OS setting. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121212;
    --bg-2: #171717;
    --panel: #1b1b1b;
    --panel-2: #242424;
    --line: #2e2e2e;
    --line-2: #3d3d3d;
    --text: #f2f2f2;
    --muted: #b8b8b8;
    --dim: #9a9a9a;
    --answer: #e6e6e6;

    --ink: #f2f2f2;
    --on-ink: #111111;
    --accent-soft: rgba(246, 201, 69, 0.14);
    --accent-ink: #fbe38a;
    --glow: rgba(246, 201, 69, 0.45);

    --a: #f2f2f2;
    --a-ink: #111111;

    --ref: #ef5350;
    --ref-ink: #ff8a80;
    --ref-bg: rgba(239, 83, 80, 0.18);
    --ref-bg-2: rgba(239, 83, 80, 0.32);
    --mix-ink: #ffb74d;
    --mix-bg: rgba(255, 152, 0, 0.16);
    --sup: #66bb6a;
    --sup-ink: #81c784;
    --sup-bg: rgba(102, 187, 106, 0.10);
    --nei: #8a8a8a;
    --nei-ink: #bdbdbd;
    --nei-bg: rgba(255, 255, 255, 0.07);
    --skip: #6a6a6a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
    --nav-bg: rgba(18, 18, 18, 0.82);
    --scrim: rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -160px, rgba(251, 227, 138, 0.32), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

#confetti {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 90;
}

/* ------------------------------------------------------------------ nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1240px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: flex; align-items: baseline; gap: 0;
  text-decoration: none; white-space: nowrap; color: var(--text);
}
.brand-word {
  font-family: var(--serif); font-weight: 400; font-size: 24px;
  letter-spacing: -0.005em; line-height: 1;
}
/* Small yellow "sun" dot echoing the FactiSearch logo. */
.brand-dot {
  display: inline-block; width: 8px; height: 8px; margin: 0 9px 0 3px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #f6c945 0%, #f6c945 45%, #fbe38a 100%);
  box-shadow: 0 0 6px 2px rgba(246, 201, 69, 0.7), 0 0 14px 5px rgba(251, 227, 138, 0.45);
  align-self: center; transform: translateY(3px);
}
.brand-tag {
  font-family: var(--font); font-weight: 500; font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft);
  align-self: center;
}
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tab {
  text-decoration: none; padding: 6px 16px; border-radius: 999px;
  color: var(--muted); font-weight: 500; font-size: 14px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }

.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-loading { color: var(--dim); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 4px 6px 4px 4px; border-radius: 999px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  background: var(--accent); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #111111; flex: none;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-stats { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.user-stats b { color: var(--text); font-weight: 600; }
.logout {
  font-size: 12px; color: var(--muted); text-decoration: none;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2);
}
.logout:hover { color: var(--text); border-color: var(--text); }
.stat-pop { animation: statPop 0.6s ease; }
@keyframes statPop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--ink); border: 1px solid var(--ink); color: var(--on-ink);
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { box-shadow: 0 0 0 4px var(--glow), 0 8px 26px var(--glow); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.kbd {
  font-size: 11px; font-weight: 600; opacity: 0.7;
  border: 1px solid currentColor; border-radius: 5px; padding: 0 5px;
}
.icon-btn {
  background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 2px 8px; border-radius: 8px;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* ---------------------------------------------------------------- views */
main { max-width: 1240px; margin: 0 auto; padding: 0 20px 40px; }
.view { display: none; }
.view.is-active { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
  padding: 5px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px 2px var(--glow); }
h1 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em;
  font-size: clamp(32px, 5vw, 54px); line-height: 1.08; margin: 0 0 12px;
}
/* Highlighter stroke instead of a gradient fill: keeps full text contrast. */
h1 em {
  font-style: normal; padding: 0 0.08em;
  background: linear-gradient(transparent 58%, var(--accent-2) 58%, var(--accent-2) 92%, transparent 92%);
}
@media (prefers-color-scheme: dark) {
  h1 em { background: linear-gradient(transparent 58%, rgba(246, 201, 69, 0.45) 58%, rgba(246, 201, 69, 0.45) 92%, transparent 92%); }
}
.sub { color: var(--muted); font-size: 16px; max-width: 620px; margin: 0 auto; }

/* ------------------------------------------------------------- composer */
.composer { max-width: 820px; margin: 0 auto; padding-top: clamp(32px, 8vh, 90px); }
.hero { text-align: center; margin-bottom: 28px; }
.prompt-box {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px;
  padding: 14px 14px 10px; box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.prompt-box:focus-within {
  border-color: var(--accent-strong);
  box-shadow: var(--shadow), 0 0 0 4px var(--glow);
}
.prompt-box textarea {
  width: 100%; resize: none; border: none; outline: none; background: transparent;
  color: var(--text); font: inherit; font-size: 17px; line-height: 1.5;
  min-height: 84px; max-height: 260px; padding: 4px 6px;
}
.prompt-box textarea::placeholder { color: var(--dim); }
.prompt-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.char-count { margin-left: auto; color: var(--dim); font-size: 12px; }

.suggest-panel {
  margin-top: 16px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px 16px;
  animation: fadeUp 0.25s ease;
}
.suggest-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row.sub { margin-top: 10px; }
.chip-row.sub:empty { display: none; }
.chip {
  border: 1px solid var(--line-2); background: var(--panel); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--accent-strong); background: var(--accent-soft); }
.chip.is-active { color: var(--text); background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.chip.surprise { border-style: dashed; }

.suggest-results { margin-top: 14px; display: grid; gap: 8px; }
.suggest-results:empty { display: none; }
.sugg {
  text-align: left; display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  animation: fadeUp 0.3s ease both;
}
.sugg:hover { border-color: var(--accent-strong); transform: translateX(3px); box-shadow: 0 0 0 3px var(--accent-soft); }
.sugg-text { flex: 1; font-size: 14px; }
.sugg-src { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.pill {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.muted { color: var(--muted); font-size: 13.5px; }
.err { color: var(--ref-ink); font-size: 13.5px; }
.skeleton {
  height: 44px; border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--line) 50%, var(--panel-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- arena */
/* Bottom padding = measured vote bar height, so the bar never covers text. */
.arena { padding-top: 24px; padding-bottom: calc(var(--vote-h) + 20px); animation: fadeUp 0.4s ease; }
.arena-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.prompt-echo { flex: 1; min-width: 260px; }
.prompt-echo .label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.prompt-echo p { margin: 2px 0 0; font-size: 17px; font-weight: 500; white-space: pre-wrap; word-break: break-word; }
.meta-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft);
  border: 1px solid transparent; color: var(--muted);
}
.tag b { color: var(--text); font-weight: 600; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 18px; height: 10px; border-radius: 3px; }
.lg-ref::before { background: var(--ref-bg); border-bottom: 2px solid var(--ref); }
.lg-mix::before { background: var(--mix-bg); border-bottom: 2px solid var(--mix); }
.lg-sup::before { background: var(--sup-bg); border-bottom: 2px solid var(--sup); }
.lg-nei::before { border-bottom: 2px dotted var(--nei); }
.lg-hint { margin-left: auto; color: var(--dim); }

/* Live status strip: fixed height so message changes never shift the cards. */
.live {
  position: relative; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px 12px; margin-bottom: 14px; overflow: hidden; min-height: 60px;
  box-shadow: var(--shadow-sm);
}
.live-icon {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--sup); position: relative; transition: background 0.3s;
}
.live-icon::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px;
  border: solid #ffffff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.live.is-busy .live-icon { background: none; border: 2px solid var(--accent-strong); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.live.is-busy .live-icon::after, .live.is-failed .live-icon::after { display: none; }
.live.is-failed .live-icon { background: var(--ref); }
.live-text { flex: 1; min-width: 0; }
.live-msg, .live-tip { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-msg { font-weight: 600; font-size: 14.5px; }
.live-tip { color: var(--dim); font-size: 12.5px; }
.live:not(.is-busy) .live-tip { visibility: hidden; }
.live-time { flex: none; color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.live:not(.is-busy) .live-time { opacity: 0.6; }
.live-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--panel-2); }
.live-bar { height: 100%; width: 0; background: var(--grad); transition: width 0.6s ease; }
.live.is-failed .live-bar { background: var(--ref); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 20px; min-width: 0;
  box-shadow: var(--shadow);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.4s, opacity 0.4s;
  animation: cardIn 0.5s cubic-bezier(.2, .8, .2, 1) both;
}
.card[data-side="b"] { animation-delay: 0.08s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--a);
}
.card[data-side="b"]::before { background: var(--b); }
.card.is-winner { border-color: var(--sup); box-shadow: 0 0 0 1px var(--sup), 0 10px 36px rgba(67, 160, 71, 0.18); }
.card.is-loser { opacity: 0.7; }
.card.is-bad { border-color: var(--ref); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.model-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-badge {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-weight: 700; color: var(--a-ink); background: var(--a);
}
.card[data-side="b"] .side-badge { background: var(--b); color: var(--b-ink); box-shadow: 0 0 10px 1px var(--glow); }
.name-slot { font-weight: 600; font-size: 17px; min-width: 0; perspective: 400px; }
.anon { color: var(--text); }
.revealed { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; animation: flipIn 0.7s cubic-bezier(.2, .9, .3, 1.3) both; transform-origin: left center; }
.revealed .model-id { word-break: break-all; }
@keyframes flipIn {
  0% { opacity: 0; transform: rotateX(-90deg) translateY(6px); filter: blur(4px); }
  100% { opacity: 1; transform: none; filter: none; }
}
.win-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--sup-bg); color: var(--sup-ink);
  border: 1px solid var(--sup);
}
.latency { font-size: 12px; color: var(--dim); white-space: nowrap; }

.counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.count {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--muted);
}
.count.ref { color: #ffffff; background: var(--ref); border-color: var(--ref); }
.count.mix { color: var(--mix-ink); background: var(--mix-bg); border-color: var(--mix); }
.count.sup { color: var(--sup-ink); background: var(--sup-bg); border-color: var(--sup); }
.count.nei { color: var(--nei-ink); border-style: dashed; }
.count.none { border-style: dashed; color: var(--dim); }
.count.det { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.count.checking { display: inline-flex; align-items: center; gap: 6px; border-style: dashed; color: var(--muted); }
.count-meta { font-size: 12px; color: var(--dim); margin-left: auto; white-space: nowrap; }
.count-note { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--dim); }
.count-bar { flex-basis: 100%; display: flex; height: 4px; border-radius: 999px; overflow: hidden; background: var(--panel-2); margin-top: 2px; }
.count-bar span { height: 100%; transition: width 0.8s ease; }

/* "N detected claims not verified" disclosure under the counts bar. */
.skipped { flex-basis: 100%; margin-top: 2px; font-size: 12.5px; color: var(--dim); }
.skipped summary { cursor: pointer; width: fit-content; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.skipped summary::-webkit-details-marker { display: none; }
.skipped summary::before { content: "\25B8"; font-size: 10px; transition: transform 0.15s; }
.skipped[open] summary::before { transform: rotate(90deg); }
.skipped summary:hover { color: var(--muted); }
.skipped ul { margin: 6px 0 0; padding: 0 0 0 16px; display: grid; gap: 4px; list-style: none; }
.skipped li { color: var(--dim); line-height: 1.45; }
.skipped .cw { white-space: nowrap; font-size: 11.5px; color: var(--dim); margin-left: 6px; font-variant-numeric: tabular-nums; }

.answer { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.7; color: var(--answer); }
.answer.error { color: var(--ref-ink); font-family: ui-monospace, monospace; font-size: 13px; }
.fc-error { margin-top: 10px; font-size: 12.5px; color: var(--mix-ink); }
.fc-note { margin: 10px 0 0; font-size: 12.5px; color: var(--dim); }

/* Streaming answers. */
.card.is-streaming .answer { min-height: 6.8em; }
.caret {
  display: inline-block; width: 0.55em; height: 1.1em; margin-left: 2px; vertical-align: text-bottom;
  border-radius: 2px; background: var(--a); animation: caretBlink 1s steps(1) infinite;
}
.card[data-side="b"] .caret { background: var(--accent-strong); }
@keyframes caretBlink { 50% { opacity: 0; } }
.count.pending { border-style: dashed; color: var(--dim); }
.count.verifying {
  display: inline-flex; align-items: center; gap: 7px; color: var(--accent-ink); border-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft) 0%, rgba(246, 201, 69, 0.45) 50%, var(--accent-soft) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
.mini-spin {
  flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--accent-strong); border-top-color: transparent; animation: spin 0.8s linear infinite;
}
.card.just-checked { animation: checkedFlash 1.1s ease; }
@keyframes checkedFlash { 0% { box-shadow: var(--shadow), 0 0 0 0 var(--glow); } 100% { box-shadow: var(--shadow), 0 0 0 14px rgba(246, 201, 69, 0); } }

mark.claim {
  color: inherit; cursor: pointer; border-radius: 3px; padding: 0 1px;
  background: transparent; transition: background 0.2s, box-shadow 0.2s;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
mark.claim.REFUTES {
  background: var(--ref-bg);
  border-bottom: 2px solid var(--ref);
  animation: refPulse 2.4s ease-in-out 0.6s 2;
}
mark.claim.MIXED { background: var(--mix-bg); border-bottom: 2px solid var(--mix); }
mark.claim.SUPPORTS { background: var(--sup-bg); border-bottom: 1.5px solid var(--sup); }
mark.claim.NOT_ENOUGH_INFO { border-bottom: 2px dotted var(--nei); }
mark.claim:hover, mark.claim.is-open { box-shadow: 0 0 0 2px var(--line-2); }
mark.claim.REFUTES:hover, mark.claim.REFUTES.is-open { background: var(--ref-bg-2); }
mark.claim.flash { animation: verdictFlash 1s ease; }
@keyframes refPulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.22); } }
@keyframes verdictFlash { 0% { box-shadow: 0 0 0 0 var(--glow); filter: brightness(1.08); } 100% { box-shadow: 0 0 0 8px rgba(246, 201, 69, 0); filter: none; } }

/* Detected by the claim detector, verification pending. */
mark.mark-detected {
  color: inherit; background: var(--accent-soft); border-radius: 3px; padding: 0 1px;
  border-bottom: 1.5px dotted var(--accent-strong); cursor: help;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* Detected but not selected for verification: same shape as NEI, fainter. */
mark.mark-skipped {
  color: inherit; background: transparent; padding: 0 1px; cursor: help;
  border-bottom: 1.5px dotted var(--skip);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

.unmatched:empty { display: none; }
.unmatched { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.unmatched h4 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.unmatched ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.unmatched li { font-size: 13.5px; line-height: 1.5; }
.more-claims { margin-top: 8px; font-size: 13px; color: var(--muted); }
.more-claims summary { cursor: pointer; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.more-claims ul { margin-top: 8px; }

/* --------------------------------------------------------------- result */
.result {
  margin-top: 20px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  animation: resultIn 0.6s cubic-bezier(.2, .9, .3, 1.2) both;
}
.result.agreed { border-color: var(--sup); background: linear-gradient(135deg, var(--sup-bg), var(--panel) 60%); }
.result.unverified { border-color: var(--line-2); background: linear-gradient(135deg, var(--nei-bg), var(--panel) 60%); }
.result.disagreed { border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--panel) 60%); }
@keyframes resultIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.result-icon { font-size: 34px; line-height: 1; }
.result-body { flex: 1; min-width: 220px; }
.result-title { font-family: var(--serif); font-weight: 400; font-size: 23px; margin: 0 0 2px; }
.result-text { color: var(--muted); margin: 0; font-size: 14px; }
.result-stats { display: flex; gap: 18px; }
.rs { text-align: center; }
.rs b { display: block; font-size: 22px; font-weight: 700; }
.rs span { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ------------------------------------------------------------- vote bar */
/* Two rows inside one panel:
   row 1 (.vote-top)  status pill | verify CTA | elapsed timer
   row 2 (.vote-inner) A | Tie | Both bad | B  - one non-wrapping flex row. */
.vote-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, rgba(255, 255, 255, 0));
  transition: transform 0.4s ease, opacity 0.4s ease;
}
@media (prefers-color-scheme: dark) {
  .vote-bar { background: linear-gradient(to top, var(--bg) 62%, rgba(18, 18, 18, 0)); }
}
.vote-bar.is-hidden { transform: translateY(110%); opacity: 0; pointer-events: none; }
.vote-panel {
  max-width: 980px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 8px 10px 10px; box-shadow: var(--shadow-lg);
}
.vote-top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 10px; min-height: 30px; margin-bottom: 8px;
  font-size: 12.5px; color: var(--muted);
}
.vote-status {
  grid-column: 1; justify-self: start; min-width: 0; max-width: 100%;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
}
.vote-status:empty { display: none; }
.vote-status .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-status .mini-spin { width: 11px; height: 11px; }
.vote-status.ok { background: var(--sup-bg); border-color: var(--sup); color: var(--sup-ink); }
.vote-status.bad { background: var(--ref-bg); border-color: var(--ref); color: var(--ref-ink); }
.vote-time {
  grid-column: 3; justify-self: end; color: var(--dim);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.vote-inner {
  display: flex; flex-wrap: nowrap; align-items: stretch; gap: 10px;
}
.vote-bar.is-ready .vote-panel { animation: readyGlow 1.2s ease; }
@keyframes readyGlow { 0% { box-shadow: var(--shadow-lg), 0 0 0 0 var(--glow); } 100% { box-shadow: var(--shadow-lg), 0 0 0 16px rgba(246, 201, 69, 0); } }

.verify-box { grid-column: 2; display: flex; justify-content: center; min-width: 0; animation: fadeUp 0.35s ease both; }
.verify-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
  max-width: 100%; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--accent-strong); color: #111111; background: var(--accent);
  box-shadow: 0 2px 10px var(--glow);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.verify-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 0 4px var(--glow), 0 6px 20px var(--glow); }
.verify-btn:active:not(:disabled) { transform: scale(0.97); }
.verify-btn:disabled { cursor: progress; opacity: 0.9; }
.verify-btn .mini-spin { border-color: #111111; border-top-color: transparent; }
.verify-icon { font-size: 14px; line-height: 1; }
.verify-text { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.verify-text b { font-size: 13.5px; }
.verify-text small { font-size: 12px; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; }

.vote-btn {
  min-width: 0; border-radius: 12px; padding: 12px 12px;
  font-weight: 600; font-size: 14.5px; line-height: 1.2; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.12s, background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}
/* A / B: primary, filled. Tie / Both bad: secondary, outline. */
.vote-btn.side { flex: 1.5 1 0; background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); }
.vote-btn.mid { flex: 1 1 0; background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.vote-btn:hover:not(:disabled) { transform: translateY(-2px); }
.vote-btn:active:not(:disabled) { transform: scale(0.97); }
.vote-btn.side:hover:not(:disabled) { box-shadow: 0 0 0 4px var(--glow), 0 8px 24px var(--glow); }
.vote-btn.mid:hover:not(:disabled) { border-color: var(--text); background: var(--panel-2); }
.vote-btn.bad:hover:not(:disabled) { border-color: var(--ref); color: var(--ref-ink); background: var(--ref-bg); }
.vote-btn:disabled { opacity: 0.45; cursor: progress; }
.vote-btn .arrow { opacity: 0.7; }
.next-wrap { flex: 1; grid-column: 1 / -1; display: flex; gap: 10px; }
.next-wrap .btn { flex: 1; padding: 13px; font-size: 15px; border-radius: 12px; }

/* -------------------------------------------------------------- popover */
.popover {
  position: absolute; z-index: 60; width: min(380px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px 16px;
  animation: popIn 0.16s ease;
  font-size: 13.5px;
}
@keyframes popIn { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.verdict {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.verdict.REFUTES { background: var(--ref); color: #ffffff; }
.verdict.SUPPORTS { background: var(--sup-bg); color: var(--sup-ink); box-shadow: inset 0 0 0 1px var(--sup); }
.verdict.MIXED { background: var(--mix-bg); color: var(--mix-ink); box-shadow: inset 0 0 0 1px var(--mix); }
.verdict.NOT_ENOUGH_INFO { background: var(--nei-bg); color: var(--nei-ink); }
.pop-score { color: var(--dim); font-size: 12px; margin-left: auto; }
.pop-claim { color: var(--text); font-weight: 500; margin: 0 0 8px; }
.pop-summary { color: var(--muted); margin: 0 0 10px; }
.pop-ev { display: grid; gap: 6px; }
.pop-ev a {
  display: block; text-decoration: none; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.pop-ev a:hover { border-color: var(--accent-strong); }
.ev-title { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-meta { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.ev-snip { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-lbl { font-weight: 700; }
.ev-lbl.SUPPORTS { color: var(--sup-ink); }
.ev-lbl.REFUTES { color: var(--ref-ink); }
.ev-lbl.MIXED { color: var(--mix-ink); }

/* ---------------------------------------------------------- leaderboard */
.lb-head { padding-top: clamp(28px, 6vh, 64px); margin-bottom: 22px; }
.lb-head .sub { margin: 0; }
.lb-filters { display: grid; gap: 12px; margin-bottom: 20px; }
.filter-group { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: start; }
.filter-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); padding-top: 6px; }
.lb-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dim); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.lb-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lb-table tbody tr { animation: fadeUp 0.35s ease both; transition: background 0.15s; }
.lb-table tbody tr:hover { background: var(--bg-2); }
.lb-table tbody tr:last-child td { border-bottom: none; }
.c-rank { width: 56px; }
.c-num { text-align: right !important; white-space: nowrap; }
.rank {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; background: var(--panel-2); color: var(--muted);
}
.rank.r1 { background: radial-gradient(circle at 35% 30%, #fbe38a, #f6c945 60%, #e0ad14); color: #3b2a00; box-shadow: 0 0 10px 1px var(--glow); }
.rank.r2 { background: linear-gradient(135deg, #eeeeee, #bdbdbd); color: #212121; }
.rank.r3 { background: linear-gradient(135deg, #ffcc80, #e08a2c); color: #3a1d00; }
.model-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prov {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #ffffff;
}
.model-text { min-width: 0; }
.model-text b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-text span { display: block; font-size: 12px; color: var(--dim); }
.elo { font-weight: 700; font-size: 16px; }
.elo-bar { display: block; height: 3px; border-radius: 999px; background: var(--grad); margin-top: 4px; margin-left: auto; }
.wlt .w { color: var(--sup-ink); }
.wlt .l { color: var(--ref-ink); }
.wlt .t { color: var(--muted); }
.empty-row td { text-align: center; color: var(--muted); padding: 40px 16px; }

/* --------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; text-align: center; box-shadow: var(--shadow-lg);
  animation: resultIn 0.35s ease both;
}
.modal-icon { font-size: 34px; }
.modal-card h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 8px 0 6px; }
.modal-card p { color: var(--muted); margin: 0 0 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; top: calc(var(--nav-h) + 12px); right: 16px; z-index: 95; display: grid; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 340px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow-lg); animation: toastIn 0.45s cubic-bezier(.2, .9, .3, 1.3) both;
  pointer-events: auto;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast-icon { font-size: 26px; line-height: 1; }
.toast b { display: block; font-size: 14px; }
.toast span { font-size: 12.5px; color: var(--muted); }
.toast.error { border-color: var(--ref); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ----------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr; }
  .lg-hint { margin-left: 0; flex-basis: 100%; }
  /* Vote buttons: 2x2 grid, A and B on the first row. */
  .vote-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .vote-btn.side { grid-row: 1; }
  .vote-btn { padding: 11px 8px; font-size: 13.5px; white-space: normal; }
  .verify-text small { display: none; }
}
@media (max-width: 640px) {
  .vote-bar { padding: 14px 10px calc(10px + env(safe-area-inset-bottom)); }
  .vote-panel { padding: 8px; }
  /* The verify CTA takes the status pill's place when it is shown. */
  .vote-bar.has-verify .vote-status { display: none; }
  .vote-bar.has-verify .vote-top { grid-template-columns: minmax(0, 1fr) auto; }
  .vote-bar.has-verify .verify-box { grid-column: 1; justify-content: flex-start; }
  .vote-bar.has-verify .vote-time { grid-column: 2; }
  .live { padding: 9px 12px 11px; }
  .nav-inner { padding: 0 12px; gap: 10px; }
  .brand-tag { display: none; }
  .brand-word { font-size: 21px; }
  .brand-dot { margin-right: 0; }
  .tab { padding: 6px 12px; font-size: 13px; }
  .user-meta { display: none; }
  .logout { padding: 4px 8px; }
  main { padding: 0 14px 30px; }
  .prompt-box textarea { font-size: 16px; }
  .prompt-actions .kbd { display: none; }
  .char-count { display: none; }
  .prompt-actions .btn { flex: 1; }
  .card { padding: 16px; }
  .filter-group { grid-template-columns: 1fr; gap: 6px; }
  .filter-label { padding-top: 0; }
  .lb-table th, .lb-table td { padding: 10px 10px; }
  .c-wlt { display: none; }
  .lb-table td.c-wlt { display: none; }
  .result-stats { width: 100%; justify-content: space-around; }
  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
}
@media (max-width: 400px) {
  .brand-word { font-size: 0; }
  .brand-word::before { content: "F"; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
