:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #5b6474;
  --line: #e5e7eb;
  --accent: #be123c;
  --accent-2: #9f1239;
  --accent-soft: #fff1f2;
  --accent-blue: #1e40af;
  --accent-blue-soft: #eff6ff;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.10);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --max: 1120px;
  --speaker-a: #fff7ed;
  --speaker-a-border: #fdba74;
  --speaker-b: #eff6ff;
  --speaker-b-border: #93c5fd;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.container {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  flex-shrink: 0;
}

.brand-viewer,
.brand-viewer-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #fecdd3;
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
  color: #9f1239;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(190, 18, 60, 0.10);
  white-space: nowrap;
}

.brand-viewer {
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.brand-viewer:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(190, 18, 60, 0.18);
  color: #9f1239;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero {
  padding: 86px 0 56px;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin: 0 0 24px;
}

.subtitle {
  max-width: 820px;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  color: var(--muted);
  margin: 0 0 26px;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #374151;
  font-weight: 700;
  margin-bottom: 8px;
}

.affiliations {
  color: var(--muted);
  margin-bottom: 28px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.10);
  border-color: #fecdd3;
}

.button.primary {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #e11d48);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 42px;
}

.stat {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: #f9fafb;
  border: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat span {
  color: var(--muted);
  font-size: 0.93rem;
}

section {
  padding: 46px 0;
}

.section-title {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.section-title h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0;
}

.section-title p {
  max-width: 1005px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.05);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mini-card {
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.mini-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  counter-reset: step;
}

.step {
  padding: 22px;
  min-height: 180px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 850;
  margin-bottom: 18px;
}

.step h3 {
  margin: 0 0 8px;
  line-height: 1.18;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.placeholder-card {
  border: 1px dashed #d1d5db;
  border-radius: 22px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: #fafafa;
}

.failure-explorer {
  display: grid;
  gap: 18px;
}

.failure-example-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.05);
  min-height: 120px;
}

.failure-panel {
  display: grid;
  gap: 14px;
}

.failure-panel[hidden] {
  display: none !important;
}

.failure-panel-title {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.failure-panel p {
  margin: 0;
  color: var(--muted);
}

.failure-panel strong {
  color: var(--ink);
}

.failure-dialogue-label {
  color: var(--ink) !important;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-verdict {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px solid var(--line);
}

.result-verdict p {
  margin: 0;
  color: #374151;
  font-size: 0.94rem;
}

.failure-note {
  font-size: 0.95rem !important;
}

.error-dist-card {
  margin-top: 8px;
  padding: 28px;
}

.error-dist-caption {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.98rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.chart-click-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chart-click-hint::before {
  content: "↖";
  font-size: 0.9rem;
}

.chart-select-hint {
  margin: 0;
  text-align: center;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 700;
}

.error-dist-caption strong {
  color: var(--ink);
}

.stacked-chart {
  display: grid;
  gap: 16px;
  padding: 4px 0 0;
}

.stacked-axis-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
}

.stacked-axis-ticks {
  display: flex;
  justify-content: space-between;
}

.stacked-axis-ticks span {
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
}

.stacked-axis-label-row {
  margin-top: -8px;
}

.stacked-axis-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.stacked-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
}

.stacked-lang {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stacked-bar {
  display: flex;
  width: 100%;
  height: 44px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stacked-seg {
  display: block;
  height: 100%;
  padding: 0;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.stacked-seg:last-child {
  border-right: none;
}

.stacked-seg:hover {
  filter: brightness(1.06);
  z-index: 1;
  cursor: pointer;
}

.stacked-seg.active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95), 0 0 0 2px #334155;
  z-index: 2;
}

.seg-terms {
  background: linear-gradient(180deg, #8ee7de 0%, #5fd9cc 100%);
}

.seg-aggregate {
  background: linear-gradient(180deg, #ffc48a 0%, #f7a35b 100%);
}

.seg-atypical {
  background: linear-gradient(180deg, #f5a8c6 0%, #e97aaa 100%);
}

.seg-culture {
  background: linear-gradient(180deg, #c4b5fd 0%, #a78bfa 100%);
}

.seg-others {
  background: linear-gradient(180deg, #d7dee8 0%, #b8c4d4 100%);
}

.stacked-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.legend-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.legend-btn:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.legend-btn.active {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 10px 14px;
  text-align: left;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d1d5db;
  background: #0b1120;
  border-radius: 18px;
  padding: 20px;
  overflow: auto;
  border: 1px solid #1f2937;
}

.example-language-block + .example-language-block {
  margin-top: 28px;
}

.examples-board {
  display: grid;
  gap: 16px;
}

.examples-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.examples-lang-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 220px;
}

.examples-lang-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.examples-lang-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.examples-slot-tabs {
  display: flex;
  gap: 6px;
}

.examples-slot-tab {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: lowercase;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.examples-slot-tab:hover:not(:disabled) {
  border-color: #fecdd3;
  color: var(--accent);
}

.examples-slot-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.examples-slot-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.example-viewer-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  min-height: 280px;
  padding: 22px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.05);
}

.example-viewer {
  display: grid;
  gap: 16px;
}

.example-viewer-empty {
  margin: 0;
  color: var(--muted);
  text-align: center;
  padding: 48px 16px;
}

.example-preview {
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.example-label-row {
  display: grid;
  gap: 8px;
}

.example-label-title {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.example-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.example-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f9fafb;
  font-size: 0.84rem;
  font-weight: 600;
}

.example-tag.likely {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.example-tag.unlikely {
  color: #6b7280;
}

.example-tag.empty {
  color: var(--muted);
}

.dialogue-transcript {
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #eff6ff 48%, #ecfdf5 100%);
  border: 1px solid #e7d9cf;
  display: grid;
  gap: 6px;
}

.dialogue-line {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  line-height: 1.6;
  border-radius: 10px;
  border: 1px solid transparent;
}

.dialogue-line.speaker-a {
  background: rgba(255, 247, 237, 0.95);
  border-color: #fed7aa;
}

.dialogue-line.speaker-b {
  background: rgba(239, 246, 255, 0.95);
  border-color: #bfdbfe;
}

.dialogue-line.speaker-c {
  background: rgba(236, 253, 245, 0.95);
  border-color: #a7f3d0;
}

.dialogue-line.speaker-other {
  background: rgba(249, 250, 251, 0.95);
  border-color: var(--line);
}

.dialogue-line + .dialogue-line {
  border-top: none;
}

.dialogue-line.speaker-a .dialogue-speaker {
  color: #c2410c;
}

.dialogue-line.speaker-b .dialogue-speaker {
  color: #1d4ed8;
}

.dialogue-line.speaker-c .dialogue-speaker {
  color: #047857;
}

.dialogue-line.speaker-other .dialogue-speaker {
  color: var(--muted);
}

.dialogue-speaker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.dialogue-text {
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.example-error {
  color: var(--muted);
}

footer {
  padding: 44px 0 70px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .stats-row,
  .grid-3,
  .pipeline {
    grid-template-columns: 1fr;
  }

  .stacked-row,
  .stacked-axis-row {
    grid-template-columns: 72px 1fr;
    gap: 10px;
  }

  .stacked-bar {
    height: 34px;
  }

  .legend-item {
    font-size: 0.76rem;
  }

  .examples-board-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding-top: 56px;
  }
}
