/* DeepNeo-CL v4.2 — publication-quality UI */
:root {
  --deepneo: #0072B2;
  --deepneo-dark: #005a94;
  --deepneo-light: #56B4E9;
  --deepneo-bg: #eff6ff;
  --nmhcp: #D55E00;
  --nmhcp-dark: #a04600;
  --hla-a: #009E73;
  --hla-b: #CC79A7;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f8fafc;
  --card: #ffffff;
  --win-bg: #ecfdf5;
  --win: #059669;
  --lose-bg: #fef2f2;
  --lose: #dc2626;
  --tie: #64748b;
  --serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Palatino", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- header ---------- */
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(10px);
  background: rgba(255,255,255,0.92);
}
header.site .wrap {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
header.site .brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
header.site .brand .name { font-size: 18px; font-weight: 700; color: var(--deepneo); letter-spacing: -0.01em; }
header.site .brand .ver { color: var(--muted); font-weight: 500; font-size: 13px; }
header.site nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
header.site nav a {
  color: var(--ink); text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 6px;
  transition: background 120ms;
}
header.site nav a:hover { background: var(--bg); }
header.site nav a.active { color: var(--deepneo); font-weight: 600; background: var(--deepneo-bg); }
header.site nav a.external::after { content: " ↗"; font-size: 11px; opacity: 0.6; }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }
main.narrow { max-width: 900px; }
section { margin-bottom: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 32px 32px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.hero h1 {
  margin: 0 0 8px; font-size: 28px; font-weight: 700;
  color: var(--deepneo-dark); letter-spacing: -0.02em; line-height: 1.15;
}
.hero .subtitle { color: var(--ink); font-size: 15px; margin: 0 0 20px; max-width: 680px; }
.hero .win-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.hero .headline {
  background: rgba(255,255,255,0.7); border-left: 3px solid var(--deepneo); padding: 12px 16px;
  border-radius: 6px; font-size: 15px; max-width: 900px;
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 18px; font-weight: 600; color: var(--ink);
  display: flex; align-items: baseline; gap: 12px;
}
.card > h2 .subtitle { font-size: 13px; color: var(--muted); font-weight: normal; }
.card > p.desc { color: var(--muted); margin: 4px 0 20px; font-size: 14px; }

/* metric card */
.metric {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 18px; box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--deepneo);
}
.metric.win { border-top-color: var(--win); }
.metric.tie { border-top-color: var(--tie); }
.metric .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.metric .value {
  font: 700 30px/1.1 var(--serif); color: var(--ink); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.metric .delta { font-size: 13px; margin-top: 4px; }
.metric .delta.win { color: var(--win); font-weight: 600; }
.metric .delta.lose { color: var(--lose); font-weight: 600; }
.metric .delta.tie { color: var(--tie); }
.metric .sub { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- badges + pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.win { background: var(--win-bg); color: var(--win); }
.badge.lose { background: var(--lose-bg); color: var(--lose); }
.badge.info { background: var(--deepneo-bg); color: var(--deepneo-dark); }
.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.pill.deepneo { background: rgba(0,114,178,0.1); color: var(--deepneo-dark); }
.pill.nmhcp { background: rgba(213,94,0,0.1); color: var(--nmhcp-dark); }
.pill.hla-a { background: rgba(0,158,115,0.1); color: var(--hla-a); }
.pill.hla-b { background: rgba(204,121,167,0.15); color: var(--hla-b); }

/* ---------- forms ---------- */
form.predict {
  display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end;
}
form.predict label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
form.predict input, form.predict select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 6px;
  font: 14px var(--mono); background: #fff; transition: border-color 120ms, box-shadow 120ms;
}
form.predict input:focus, form.predict select:focus {
  outline: none; border-color: var(--deepneo); box-shadow: 0 0 0 3px rgba(0,114,178,0.12);
}
form.predict button {
  padding: 11px 22px; background: var(--deepneo); color: #fff; border: 0; border-radius: 6px;
  font: 600 14px var(--sans); cursor: pointer; transition: background 120ms;
}
form.predict button:hover { background: var(--deepneo-dark); }
form.predict button:disabled { background: var(--muted); cursor: wait; }
@media (max-width: 680px) { form.predict { grid-template-columns: 1fr; } }

form.batch {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
form.batch input[type=file] {
  padding: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; font-size: 13px;
  flex: 1 1 300px; background: #fff;
}
form.batch button {
  padding: 10px 18px; background: var(--ink); color: #fff; border: 0; border-radius: 6px;
  font: 600 14px var(--sans); cursor: pointer;
}
form.batch button:hover { background: #1e293b; }
.batch-status { font-size: 13px; color: var(--muted); }
.batch-status.err { color: var(--lose); }
.batch-status.ok { color: var(--win); }

/* ---------- prediction result ---------- */
.result { margin-top: 20px; }
.result .scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.result .score-card {
  padding: 16px 18px; background: var(--bg); border-radius: 6px;
  border-left: 3px solid var(--deepneo);
}
.result .score-card.el { border-left-color: var(--hla-b); }
.result .score-card .kind { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.result .score-card .value { font: 700 26px/1.1 var(--serif); font-variant-numeric: tabular-nums; margin-top: 4px; }
.result .score-card .label {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.result .score-card .label.binder { background: #fee2e2; color: #b91c1c; }
.result .score-card .label.non-binder { background: #f1f5f9; color: var(--muted); }
.result .score-card .label.presented { background: #dcfce7; color: #15803d; }
.result table.perfold { width: 100%; border-collapse: collapse; font: 12px var(--mono); margin-top: 8px; }
.result table.perfold th, .result table.perfold td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.result table.perfold th { text-align: center; color: var(--muted); font-weight: 500; }
.result .warning {
  background: #fef3c7; border: 1px solid #fbbf24; padding: 12px 16px; border-radius: 6px;
  color: #92400e; font-size: 14px;
}

/* ---------- tables ---------- */
table.bench { width: 100%; border-collapse: collapse; font-size: 14px; }
table.bench th, table.bench td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.bench th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
table.bench td:first-child, table.bench th:first-child { text-align: left; }
table.bench tr:hover td { background: rgba(0,114,178,0.02); }
table.bench tr.winner td { background: var(--win-bg); }
table.bench .num { font: 13px var(--mono); font-variant-numeric: tabular-nums; }
.delta-win { color: var(--win); font-weight: 600; }
.delta-lose { color: var(--lose); }
.delta-tie { color: var(--muted); }
.horiz-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Plotly containers ---------- */
.plot { width: 100%; height: 440px; margin-top: 8px; }
.plot.tall { height: 520px; }
.plot.short { height: 320px; }
.chart-controls {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.chart-controls label { font-size: 13px; color: var(--muted); font-weight: 500; }
.chart-controls select {
  padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  font: 13px var(--mono); background: #fff;
}
.chart-legend { display: flex; gap: 20px; font-size: 12px; color: var(--muted); }
.chart-legend .swatch { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }

/* ---------- code + prose ---------- */
code { font: 13px var(--mono); background: var(--bg); padding: 1px 6px; border-radius: 3px; }
pre {
  font: 13px/1.5 var(--mono); background: #0f172a; color: #e2e8f0; padding: 14px 16px;
  border-radius: 6px; overflow-x: auto;
}
pre code { background: transparent; color: inherit; padding: 0; }
.prose { max-width: 720px; }
.prose h3 { font-size: 16px; font-weight: 600; margin-top: 24px; margin-bottom: 8px; }
.prose p { margin: 0 0 12px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 4px; }

/* ---------- footer ---------- */
footer.site {
  text-align: center; color: var(--muted); font-size: 12px; padding: 32px 20px 60px;
  border-top: 1px solid var(--line); margin-top: 40px;
}
footer.site a { color: var(--deepneo); text-decoration: none; }
footer.site a:hover { text-decoration: underline; }
footer.site .row { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- utilities ---------- */
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.win-text { color: var(--win); font-weight: 600; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,114,178,0.2);
  border-top-color: var(--deepneo); border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
