/* ─── reset + base ──────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #1c1c1c;
  background: #fafafa;
}

body {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

a { color: #0a5ec7; text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #ececec;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.92em;
}

/* ─── header ────────────────────────────────────────── */
header {
  border-bottom: 1px solid #e2e2e2;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.65rem;
}

.model-tag {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  background: #1c1c1c;
  color: #fff;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  vertical-align: 0.18em;
  margin-left: 0.4em;
}

nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.98rem;
}

nav a {
  color: #555;
  font-weight: 500;
  padding: 0.2em 0;
  border-bottom: 2px solid transparent;
}

nav a.active {
  color: #1c1c1c;
  border-bottom-color: #1c1c1c;
}

/* ─── sections ───────────────────────────────────────── */
.page {
  display: block;
}
.page.hidden {
  display: none;
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}
h3 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.5rem;
  font-weight: 700;
}
p {
  margin-bottom: 1rem;
}
ul {
  margin: 0 0 1rem 1.4rem;
}

.section-help, .chart-help {
  color: #555;
  font-size: 0.94rem;
  margin-bottom: 1rem;
}

/* ─── status card ────────────────────────────────────── */
.status-card {
  text-align: center;
  padding: 2.4rem 1rem 2rem;
  border-radius: 14px;
  border: 2px solid;
  margin-bottom: 1.5rem;
  transition: background 0.25s, border-color 0.25s;
}

.status-card.status-loading { background: #f0f0f0; border-color: #d4d4d4; }
.status-card.status-green   { background: #ddf5dc; border-color: #4ca449; }
.status-card.status-yellow  { background: #fff5ce; border-color: #d4a708; }
.status-card.status-red     { background: #fde0de; border-color: #c8392d; }

.status-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.status-label {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.status-detail {
  font-size: 1.02rem;
  color: #555;
}

.meta-line {
  font-size: 0.88rem;
  color: #666;
  text-align: center;
  margin-bottom: 2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── chart ──────────────────────────────────────────── */
.chart-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.chart-empty {
  text-align: center;
  color: #888;
  padding: 1.5rem 0;
  font-style: italic;
}

.links-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.link-button {
  display: inline-block;
  padding: 0.65em 1.1em;
  background: #1c1c1c;
  color: #fff;
  border-radius: 6px;
  font-weight: 500;
}
.link-button:hover { background: #333; text-decoration: none; }

/* ─── evidence table ─────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.94rem;
  table-layout: fixed;
}

/* Column widths for the 6-column evidence table */
table col.col-id       { width: 10%; }
table col.col-category { width: 16%; }
table col.col-drift    { width: 14%; }
table col.col-noise    { width: 24%; }
table col.col-zscore   { width: 14%; }
table col.col-status   { width: 22%; }

th, td {
  text-align: left;
  padding: 0.7em 0.9em;
  border-bottom: 1px solid #efefef;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  background: #f3f3f3;
  font-weight: 600;
  font-size: 0.85rem;
  color: #555;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}
tbody tr:hover { background: #f7f9fc; }
tbody tr.expanded { background: #f0f4fa; }

td.numeric {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.verdict-cell {
  font-weight: 600;
  white-space: nowrap;
}
.v-green   { color: #4ca449; }
.v-yellow  { color: #b88c00; }
.v-red     { color: #c8392d; }

.evidence-empty {
  text-align: center;
  color: #888;
  padding: 2rem 0;
  font-style: italic;
}

/* ─── drilldown row ──────────────────────────────────── */
tr.drilldown td {
  padding: 0;
}
.drilldown-content {
  padding: 1.2rem 1.4rem;
  background: #fdfdfd;
  border-bottom: 1px solid #e2e2e2;
}

.drilldown-content h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  margin: 0.8rem 0 0.4rem;
}

.diff-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.diff-pane {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow-y: auto;
}

.diff-pane .diff-add {
  background: #cff0c8;
  color: #1c4019;
}
.diff-pane .diff-del {
  background: #f8c5c0;
  color: #5e1d18;
  text-decoration: line-through;
}

.replay-button {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.45em 0.85em;
  background: #efefef;
  color: #1c1c1c;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.replay-button:hover { background: #e2e2e2; }

.interpretation {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.raw-stats {
  margin-bottom: 1rem;
}
.raw-stats summary {
  font-size: 0.82rem;
  color: #888;
  cursor: pointer;
  user-select: none;
}
.raw-stats summary:hover { color: #555; }

.prompt-text {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* ─── footer ─────────────────────────────────────────── */
footer {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid #e2e2e2;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── small screens ──────────────────────────────────── */
@media (max-width: 700px) {
  body { padding: 1.2rem 1rem 3rem; }
  header h1 { font-size: 1.4rem; }
  nav { flex-wrap: wrap; gap: 1rem; }
  .status-emoji { font-size: 3rem; }
  .status-label { font-size: 1.4rem; }
  .diff-pair { grid-template-columns: 1fr; }
}
