:root {
  --bg: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #e5e7eb;
  --soft: #f6f8fb;
  --tint: #eef4ff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #dc2626;
  --red-soft: #fff1f2;
  --green: #16a34a;
  --green-soft: #ecfdf5;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body::selection { background: #bfdbfe; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.hero {
  min-height: 720px;
  color: white;
  background:
    radial-gradient(circle at 10% 10%, rgba(96, 165, 250, 0.35), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(167, 139, 250, 0.28), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #172554 55%, #1e1b4b 100%);
}

.topnav {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: white;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.navlinks { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.navlinks a { color: rgba(255, 255, 255, 0.82); font-size: 0.95rem; }
.navlinks a:hover { color: white; }

.hero-inner {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 7rem 0 5rem;
  text-align: center;
}

h1, h2, h3 { line-height: 1.14; margin: 0 0 1rem; }

h1.paper-title {
  margin-bottom: 1.25rem;
  letter-spacing: -0.055em;
}

.title-prefix,
.title-main {
  display: block;
}

.title-prefix {
  font-size: clamp(2.05rem, 4.8vw, 4.3rem);
  line-height: 1.06;
  color: rgba(255, 255, 255, 0.94);
}

.title-main {
  margin-top: 0.35rem;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 1;
  color: #ffffff;
}

h2 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.04em; }
h3 { font-size: 1.28rem; }

.subtitle {
  font-size: clamp(1.12rem, 2vw, 1.35rem);
  max-width: 820px;
  margin: 0 auto 1.75rem;
  color: rgba(255, 255, 255, 0.86);
}

.authors {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 2rem;
}
.authors span { color: rgba(255, 255, 255, 0.64); }

.button-row { display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.button:hover { text-decoration: none; background: rgba(255, 255, 255, 0.16); }
.button.primary { background: white; color: #172554; border-color: white; }
.button.primary:hover { background: #dbeafe; }

.section { padding: 5.5rem 0; }
.section.tinted { background: var(--soft); }
.container { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.container.narrow { width: min(860px, calc(100% - 2rem)); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.section-header { text-align: center; max-width: 850px; margin: 0 auto 2.5rem; }
.section-header.compact { margin-bottom: 2rem; }
.section-header p, .two-col p { color: var(--muted); font-size: 1.04rem; }

.concept-card, .note-card, .dataset-card, .stat-card, .prompt-card, .answer-card,
.probe-card, .mini-example, .criteria-card, .placeholder-figure, .trap-analysis-card, .system-prompt-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.concept-card { padding: 1.25rem; }
.path { padding: 1.25rem; border-radius: 16px; border: 1px solid var(--line); }
.path + .path { margin-top: 1rem; }
.path.bad { background: var(--red-soft); border-color: #fecdd3; }
.path.good { background: var(--green-soft); border-color: #bbf7d0; }
.pill, .badge, .probe-label {
  display: inline-flex;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.path.bad .pill { background: #fee2e2; color: #991b1b; }
.path.good .pill { background: #dcfce7; color: #166534; }

.trap-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.95fr);
  gap: 1rem;
  align-items: stretch;
}
.trap-prompt {
  display: flex;
  flex-direction: column;
}
.trap-prompt pre {
  flex: 1;
  min-height: 385px;
  margin-bottom: 0;
}
.trap-analysis-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.analysis-head {
  padding: 0.95rem;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.analysis-head h3 {
  margin: 0.6rem 0 0.35rem;
}
.analysis-head p {
  color: var(--muted);
  margin: 0;
}
.analysis-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.trap-side { display: grid; gap: 0.75rem; }
.observed-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 0.75rem auto 0;
  padding: 0.42rem 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a !important;
  font-size: 0.95rem !important;
}
.mini-label {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 850;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.68);
  color: #334155;
}
.badge.light { background: #e0e7ff; color: #3730a3; }
.compact-card {
  padding: 0.95rem;
}
.compact-card p {
  margin: 0.5rem 0 0;
  line-height: 1.35;
}
.observed-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.compact-line {
  margin-top: 0.75rem !important;
  padding-top: 0.7rem !important;
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.5rem;
}
.compact-line strong { text-align: right; }
.prompt-card { padding: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.card-head h3 { margin: 0.45rem 0 0; }
.badge { background: #dbeafe; color: #1d4ed8; }
.copy-button {
  border: 0;
  background: #172554;
  color: white;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-weight: 700;
}
.copy-button.copied { background: var(--green); }
.answer-card { padding: 1.25rem; }
.answer-card.wrong { background: var(--red-soft); border-color: #fecdd3; }
.answer-card.correct { background: var(--green-soft); border-color: #bbf7d0; }
.answer-line {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.answer-line span { color: var(--muted); font-size: 0.9rem; }
.answer-card.wrong strong { color: var(--red); }
.answer-card.correct strong { color: var(--green); }

.probe-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.probe-card { padding: 1rem; }
.probe-label { background: #f1f5f9; color: #334155; }
.probe-card.emphasis { background: #eff6ff; border-color: #bfdbfe; }

.dataset-grid, .stats-row, .gallery-grid, .try-grid, .criteria-grid, .placeholder-grid {
  display: grid;
  gap: 1rem;
}
.dataset-grid { grid-template-columns: 1fr 1fr; }
.dataset-card { padding: 1.4rem; }
.big-number { font-size: 3rem; line-height: 1; font-weight: 900; color: var(--blue); margin: 0 0 0.5rem; }
ul, ol { padding-left: 1.2rem; }
li + li { margin-top: 0.35rem; }

.stats-row { grid-template-columns: repeat(3, 1fr); margin-bottom: 1rem; }
.stat-card { padding: 1.25rem; }
.stat { display: block; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 900; color: var(--blue); letter-spacing: -0.05em; }
.placeholder-grid { grid-template-columns: 1fr 1fr; }
.chart-grid { align-items: stretch; }
.placeholder-figure { margin: 0; padding: 1rem; }
.chart-figure {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}
.placeholder-figure img { width: 100%; display: block; border-radius: 14px; border: 1px solid var(--line); }
.chart-figure img {
  border: 0;
  border-radius: 16px;
  aspect-ratio: 900 / 620;
  object-fit: contain;
  background: #f8fafc;
}
figcaption { color: var(--muted); font-size: 0.95rem; margin-top: 0.75rem; }

.try-grid { grid-template-columns: repeat(3, 1fr); }
.try-group + .try-group {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.system-prompt-card {
  padding: 1rem;
  margin-bottom: 1rem;
}
.system-prompt-card pre {
  margin: 0;
  background: #111827;
}
.mini-example, .criteria-card, .note-card { padding: 1rem; }
.criteria-grid { grid-template-columns: 1fr 1fr 1fr; }
.criteria-card.warning { background: #fffbeb; border-color: #fde68a; }
.bibtex { margin-top: 1rem; }

.footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 2rem 0;
}
.footer a { color: #bfdbfe; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 920px) {
  .two-col, .trap-grid, .dataset-grid, .stats-row, .placeholder-grid, .gallery-grid, .try-grid, .criteria-grid, .probe-row, .analysis-pair {
    grid-template-columns: 1fr;
  }
  .hero { min-height: auto; }
  .hero-inner { padding: 5rem 0 4rem; }
  .navlinks { display: none; }
  .trap-prompt pre { min-height: auto; }
}


/* Primary-trap evidence layout and copyable examples */
.failure-screenshot,
.screenshot-note {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.failure-screenshot {
  margin: 0;
  padding: 0.8rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.failure-screenshot img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
  object-position: top center;
  border-radius: 16px;
  background: #ffffff;
}

.screenshot-note {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.screenshot-note h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.65rem;
}

.screenshot-note p {
  color: var(--muted);
  margin: 0;
}

.screenshot-note p + p {
  margin-top: 0.85rem;
}

.screenshot-note code {
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.08rem 0.25rem;
}

.small-note {
  font-size: 0.95rem;
}

.evidence-layout {
  margin-top: 1.15rem;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 1.15rem;
  align-items: stretch;
}

.evidence-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}

.evidence-stack .screenshot-note {
  flex: 0 0 auto;
}

.probe-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.probe-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.evidence-stack .probe-card {
  min-height: 0;
  padding: 1rem;
}

.evidence-stack .probe-card p {
  font-size: 0.98rem;
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

.diagnosis-card {
  flex: 1 1 auto;
  justify-content: center;
}

.diagnosis-card p {
  font-size: 1.05rem;
}

.mini-example {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mini-example p {
  margin: 0;
}

.mini-example p + p {
  margin-top: auto;
}

.mini-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.mini-card-head h3 {
  margin: 0;
}

.copy-button.small {
  flex: 0 0 auto;
  padding: 0.36rem 0.62rem;
  font-size: 0.78rem;
  box-shadow: none;
}

.copy-source {
  display: none;
}

@media (max-width: 1000px) {
  .evidence-layout {
    grid-template-columns: 1fr;
  }

  .failure-screenshot img {
    max-height: none;
    width: 100%;
  }

  .diagnosis-card {
    flex: 0 0 auto;
  }
}

@media (max-width: 620px) {
  .probe-mini-grid {
    grid-template-columns: 1fr;
  }

  .mini-card-head {
    align-items: center;
  }
}

/* v9: simplified primary trap, mechanism figure, and expandable images */
.trap-prompt-only {
  width: min(860px, 100%);
  margin: 0 auto;
  grid-template-columns: 1fr !important;
}

.trap-prompt-only .trap-prompt pre {
  min-height: 0;
}

.mechanism-showcase {
  position: relative;
  margin: 1.25rem auto 1.2rem;
  padding: 0.8rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mechanism-showcase img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: #020617;
}

.mechanism-showcase figcaption {
  max-width: 960px;
  margin: 0.85rem auto 0.1rem;
  text-align: center;
}

.expandable-figure {
  position: relative;
}

.image-expand-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(8px);
}

.image-expand-button:hover {
  background: rgba(37, 99, 235, 0.95);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(2, 6, 23, 0.84);
  backdrop-filter: blur(6px);
}

.image-modal.open {
  display: flex;
}

.modal-figure {
  width: min(1280px, 100%);
  max-height: calc(100vh - 4rem);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.modal-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  margin: 0 auto;
  border-radius: 16px;
  background: white;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.modal-figure figcaption {
  color: #e2e8f0;
  text-align: center;
  margin: 0;
}

.modal-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 1001;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 920px) {
  .mechanism-showcase {
    padding: 0.55rem;
  }
  .image-modal {
    padding: 1rem;
  }
  .image-expand-button {
    top: 0.75rem;
    right: 0.75rem;
  }
}
