:root {
  --bg: #ffffff;
  --fg: #111418;
  --fg-muted: #5b6470;
  --border: #e4e7eb;
  --surface: #f7f8fa;
  --surface-alt: #eef1f4;
  --accent: #1a5ce8;
  --error: #c83a3a;
  --error-bg: #fdecec;
  --applied: #1e3a8a;        /* dark blue for applied suggestions */
  --applied-bg: #e6edfa;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --font-body: 'Charter', 'Georgia', 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* Header */
.site-header {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
}
.site-title {
  font-family: var(--font-body);
  font-size: 2.25rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.site-tagline {
  color: var(--fg-muted);
  margin: 0.25rem 0 0;
  max-width: 32rem;
}

/* Form */
.tjek-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tjek-form input[type="url"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}
.tjek-form input[type="url"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--bg);
}
.tjek-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  background: var(--fg);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.tjek-form button:hover:not(:disabled) { background: #000; }
.tjek-form button:disabled {
  background: var(--fg-muted);
  cursor: wait;
}

/* Status */
.status {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.status--loading {
  background: var(--surface);
  color: var(--fg-muted);
}
.status--error {
  background: var(--error-bg);
  color: var(--error);
}

/* Summary */
.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.summary-legend { display: inline-flex; gap: 0.75rem; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}
.legend-chip::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.legend-chip--consensus::before { background: var(--error); }
.legend-chip--single::before    { background: #d4a60c; }
.legend-chip--applied::before   { background: var(--applied); }
/* Legacy: some snapshots (e.g. /test1) still use the old class name. */
.legend-chip--error::before     { background: var(--error); }

/* Article */
.article {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
}
.article .block-title {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
.article .block-summary {
  font-size: 1.25rem;
  color: var(--fg-muted);
  margin: 0 0 1.75rem;
  line-height: 1.4;
}
.article .block-paragraph { margin: 0 0 1rem; }
.article .block-caption {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--fg-muted);
  background: var(--surface);
  border-left: 3px solid var(--border);
  padding: 0.6rem 0.8rem;
  margin: 1rem 0;
  border-radius: 4px;
}
.article .block-quote {
  font-style: italic;
  font-size: 1.2rem;
  border-left: 3px solid var(--fg);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1.25rem 0;
  color: var(--fg);
}

/* Flagged span — red by default (= AI consensus) */
.flag {
  background: var(--error-bg);
  border-bottom: 2px solid var(--error);
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 2px;
  transition: background-color 120ms ease;
}
.flag:hover { background: #fbd7d7; }

/* Single-AI (only one model flagged it) — yellow */
.flag--single {
  background: #fff6d7;
  border-bottom: 2px solid #d4a60c;
}
.flag--single:hover { background: #ffe9a3; }

.flag--applied {
  background: var(--applied-bg);
  border-bottom: 2px solid var(--applied);
  color: var(--applied);
  cursor: default;
}
.flag--applied:hover { background: var(--applied-bg); }

/* Popover */
.popover-host { position: relative; display: inline; }
.popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: min(22rem, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 0.9rem 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--fg);
}
.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.popover-source {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--fg-muted);
  font-family: var(--font-ui);
}
/* Consensus = at least two AIs agreed → red tint */
.popover-source--consensus { background: #fde0e0; color: #8a1f1f; }
/* Single-AI → yellow tint */
.popover-source--single    { background: #fff4cc; color: #7a5900; }

.popover-type {
  flex: 1;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--error);
}
.popover-close {
  background: transparent;
  border: 0;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0 0.2rem;
}
.popover-close:hover { color: var(--fg); }
.popover-explanation { margin: 0 0 0.7rem; }
.popover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.popover-apply,
.popover-ignore,
.popover-goto {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
}
.popover-apply {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-align: left;
}
.popover-apply:hover { background: #1348bd; }
.popover-ignore:hover { background: var(--surface-alt); }
.popover-goto:hover { background: var(--surface-alt); }

/* Brief pulse when a contradiction's related block is scrolled into view. */
.block--highlight { animation: block-highlight-pulse 2s ease-out; }
@keyframes block-highlight-pulse {
  0%   { background-color: #fff6d7; }
  100% { background-color: transparent; }
}

@media (max-width: 32rem) {
  .tjek-form { flex-direction: column; }
  .tjek-form button { width: 100%; }
  .article .block-title { font-size: 1.6rem; }
}
