/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }

/* === VARIABLES === */
:root {
  --bg-primary: #0f0f11;
  --bg-secondary: #1a1a1f;
  --bg-tertiary: #22222a;
  --border: #2e2e38;
  --border-accent: #3d3d4d;
  --text-primary: #e8e6f0;
  --text-secondary: #9896a8;
  --text-muted: #5a5868;
  --color-A: #7eb8d4;
  --color-A-dim: #7eb8d420;
  --color-B: #d4937e;
  --color-B-dim: #d4937e20;
  --color-conflict: #c47a7a;
  --color-neutral: #7a9cc4;
  --color-repair: #7ac4a0;
  --color-warm: #c4a87a;
  --confidence-high: #7ac4a0;
  --confidence-medium: #c4a87a;
  --confidence-low: #c47a7a;
  --confidence-blind: #5a5868;
  --tension-low: #4a9e7a;
  --tension-mid: #c4a060;
  --tension-high: #c45a5a;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 200ms ease;
}

/* === BASE === */
body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1, h2, h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: 1.75rem; letter-spacing: 0.02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.font-data, code, .chat-quote, .metric-value {
  font-family: 'DM Mono', 'Consolas', monospace;
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }

/* === CARD === */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* === BADGE === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge.--high {
  color: var(--confidence-high);
  background: rgba(122, 196, 160, 0.1);
  border-color: rgba(122, 196, 160, 0.2);
}

.badge.--medium {
  color: var(--confidence-medium);
  background: rgba(196, 168, 122, 0.1);
  border-color: rgba(196, 168, 122, 0.2);
}

.badge.--low {
  color: var(--confidence-low);
  background: rgba(196, 122, 122, 0.1);
  border-color: rgba(196, 122, 122, 0.2);
}

.badge.--blind {
  color: var(--confidence-blind);
  background: rgba(90, 88, 104, 0.15);
  border-color: rgba(90, 88, 104, 0.25);
}

/* === PARTICIPANT === */
.participant {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
}

.participant.--A { color: var(--color-A); }
.participant.--B { color: var(--color-B); }

/* === CHAT QUOTE === */
.chat-quote {
  position: relative;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0.5rem 0;
}

.chat-quote.--A {
  background: var(--color-A-dim);
  border-left: 3px solid var(--color-A);
}

.chat-quote.--B {
  background: var(--color-B-dim);
  border-left: 3px solid var(--color-B);
}

.chat-quote__author {
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  opacity: 0.7;
}

/* === TENSION BAR === */
.tension-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.tension-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tension-bar__fill.--low { background: var(--tension-low); }
.tension-bar__fill.--mid { background: var(--tension-mid); }
.tension-bar__fill.--high { background: var(--tension-high); }

/* === STATES === */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.loading__spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading__text {
  font-size: 0.85rem;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-state__icon {
  font-size: 2rem;
  opacity: 0.5;
}

.error {
  padding: 1rem 1.25rem;
  background: rgba(196, 122, 122, 0.08);
  border: 1px solid rgba(196, 122, 122, 0.2);
  border-radius: var(--radius);
  color: var(--color-conflict);
  font-size: 0.85rem;
}

.fatal-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.fatal-error__icon {
  font-size: 2.5rem;
  color: var(--color-conflict);
}

.fatal-error__title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
}

.fatal-error__message {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 360px;
}

.fatal-error__retry {
  margin-top: 0.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.fatal-error__retry:hover {
  background: var(--border);
}

/* === STAGGERED FADE-IN === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-in > * {
  opacity: 0;
  animation: fadeInUp 400ms ease forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 60ms; }
.stagger-in > *:nth-child(3) { animation-delay: 120ms; }
.stagger-in > *:nth-child(4) { animation-delay: 180ms; }
.stagger-in > *:nth-child(5) { animation-delay: 240ms; }
.stagger-in > *:nth-child(6) { animation-delay: 300ms; }
.stagger-in > *:nth-child(7) { animation-delay: 360ms; }
.stagger-in > *:nth-child(8) { animation-delay: 420ms; }
.stagger-in > *:nth-child(9) { animation-delay: 480ms; }
.stagger-in > *:nth-child(10) { animation-delay: 540ms; }
.stagger-in > *:nth-child(n+11) { animation-delay: 600ms; }

/* === UTILITY === */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

/* === BUTTON === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn:hover {
  border-color: var(--border-accent);
  background: var(--border);
}

.btn.--ghost {
  background: transparent;
  border-color: transparent;
}

.btn.--ghost:hover {
  background: var(--bg-tertiary);
}
