/* ===================== VitalAgent project page ===================== */
:root {
  --bg: #fbfcfd;
  --surface: #ffffff;
  --text: #1c2530;
  --muted: #5d6b7a;
  --faint: #8b97a4;
  --line: #e6ebf0;
  --line-strong: #d3dbe3;

  --accent: #0e8a8a;          /* clinical teal */
  --accent-deep: #0a6d6d;
  --accent-soft: #e3f5f4;
  --reactive: #2563c9;        /* blue */
  --reactive-soft: #e6eefb;
  --proactive: #8b46c9;       /* violet */
  --proactive-soft: #f1e8fb;
  --af: #e0533d;              /* AF / alert warm */
  --af-soft: #fce7e2;
  --ok: #1f9d63;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,40,60,.05), 0 8px 28px rgba(20,40,60,.06);
  --maxw: 980px;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

b, strong { font-weight: 650; }

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 5vw, 40px);
  background: rgba(251,252,253,.82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 19px; color: var(--text); letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.navlinks { display: flex; gap: 22px; }
.navlinks a { color: var(--muted); font-size: 15px; font-weight: 500; }
.navlinks a:hover { color: var(--accent-deep); text-decoration: none; }
@media (max-width: 640px) { .navlinks { display: none; } }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 78px) clamp(18px, 5vw, 40px) 26px;
  text-align: center;
}
.venue { color: var(--muted); font-size: 14.5px; letter-spacing: .01em; margin: 0 0 18px; }
.venue a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(46px, 9vw, 80px);
  letter-spacing: -.035em;
  line-height: 1.12;
  margin: 0;
  padding-bottom: .08em;
  background: linear-gradient(180deg, #16323f 0%, #0e8a8a 140%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  font-family: var(--serif);
  font-size: clamp(19px, 2.8vw, 25px);
  color: #33424f;
  font-weight: 500;
  margin: 16px auto 26px;
  max-width: 760px;
  line-height: 1.35;
}
.authors { font-size: 17.5px; margin: 0 0 6px; line-height: 1.9; }
.authors a { color: var(--accent-deep); font-weight: 550; }
.authors sup, .affil sup { font-size: .68em; color: var(--faint); }
.affil { color: var(--muted); font-size: 15px; margin: 0 0 26px; }

/* ---------- buttons ---------- */
.cta { display: flex; flex-wrap: wrap; gap: 11px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: #1d2a36; color: #fff;
  border-radius: 999px;
  font-size: 15px; font-weight: 550;
  border: 1px solid #1d2a36;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); background: #25333f; }
.btn .ico { font-size: 13px; opacity: .9; }
.btn-logo { height: 15px; width: auto; vertical-align: -2px; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-deep); }
.btn-disabled {
  background: #e7ebee; color: #9aa6b0; border-color: #dde2e7;
  cursor: not-allowed; box-shadow: none;
}
.btn-disabled:hover { transform: none; box-shadow: none; background: #e7ebee; }
.btn-disabled .ico { opacity: .6; }

/* ---------- sections ---------- */
.band {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 60px) clamp(18px, 5vw, 40px);
  border-top: 1px solid var(--line);
}
.band.narrow { max-width: 760px; }
.band.teaser { border-top: none; }
h2 {
  font-family: var(--sans);
  font-size: clamp(25px, 4vw, 33px);
  letter-spacing: -.025em;
  font-weight: 750;
  margin: 0 0 18px;
  text-align: center;
}
h3 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.sub-h3 { text-align: center; margin: 38px 0 18px; color: #2c3a45; }
.sub-h3::after { content: ""; display: block; width: 38px; height: 3px; border-radius: 2px; background: var(--accent); margin: 10px auto 0; }
.lead { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 26px; }
.muted { color: var(--faint); }
.center { text-align: center; }

.abstract { font-size: 17.5px; color: #2a3742; text-align: justify; hyphens: auto; }

/* ---------- architecture diagram ---------- */
.arch { width: 100%; }
.arch svg { width: 100%; height: auto; display: block; }
.arch img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: #fff;
}

/* ---------- highlights ---------- */
.hl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 760px) { .hl-grid { grid-template-columns: 1fr; } }
.hl-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--shadow);
}
.hl-ico {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font-size: 24px; font-weight: 700;
  margin-bottom: 14px;
}
.hl-ico-dual { background: var(--reactive-soft); color: var(--reactive); }
.hl-ico-tool { background: var(--accent-soft); color: var(--accent-deep); }
.hl-ico-bench { background: var(--proactive-soft); color: var(--proactive); }
.hl-card h3 { margin: 0 0 8px; font-size: 18px; }
.hl-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.caption {
  max-width: 760px; margin: 16px auto 0;
  color: var(--muted); font-size: 15px; text-align: center; line-height: 1.55;
}

/* ---------- method two-column ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.engine-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
}
.engine-tag {
  display: inline-block; padding: 4px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 650; letter-spacing: .02em;
}
.tag-reactive { background: var(--reactive-soft); color: var(--reactive); }
.tag-proactive { background: var(--proactive-soft); color: var(--proactive); }
.engine-sub { color: var(--faint); font-size: 14px; margin: 8px 0 14px; font-weight: 500; }
.flow { margin: 0; padding-left: 20px; }
.flow li { margin: 9px 0; color: #2e3a45; }
.engine-note { margin: 16px 0 0; font-size: 14.5px; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 14px; }

/* ---------- core components / tiers ---------- */
.comp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 760px) { .comp-grid { grid-template-columns: 1fr; } }
.comp-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px; box-shadow: var(--shadow);
}
.comp-key { font-size: 16px; font-weight: 700; color: var(--accent-deep); margin-bottom: 8px; letter-spacing: -.01em; }
.comp-key .sym { font-family: var(--serif); font-style: italic; font-weight: 600; color: var(--faint); margin-left: 4px; font-size: 15px; }
.comp-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.comp-card sub { font-size: .72em; }
.mode-card .engine-tag { margin-bottom: 13px; }
.mode-card p { color: #2e3a45; font-size: 14.5px; line-height: 1.6; }

/* ---------- two-mode vertical flow (left / right modules) ---------- */
.modes-v { align-items: start; }
.flow-col {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.flow-col .engine-tag { display: inline-block; margin-bottom: 14px; }
.flow-steps-v { display: flex; flex-direction: column; align-items: stretch; }
.flow-step {
  background: #fafcfe; border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px; text-align: center;
  font-size: 14.5px; font-weight: 650; color: #25323d;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.flow-step small { font-weight: 400; color: var(--faint); font-size: 12px; line-height: 1.3; }
.flow-arrow-v { display: block; text-align: center; color: var(--accent); font-size: 16px; font-weight: 700; line-height: 1; padding: 7px 0; }
.tier-row { margin-top: 18px; }
.tier-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 6px; margin-right: 6px;
  background: var(--reactive-soft); color: var(--reactive);
}

/* ---------- results table ---------- */
.table-wrap { overflow-x: auto; margin: 0 auto 12px; max-width: 720px; }
.table-wrap:has(.rtab-wide) { max-width: 100%; }
.rtab { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.rtab-wide { font-size: 13.5px; min-width: 640px; }
.rtab thead th {
  text-align: center; padding: 12px 14px; color: var(--muted);
  font-weight: 600; font-size: 14px; border-bottom: 2px solid var(--line-strong);
}
.rtab thead th:first-child { text-align: left; }
.rtab thead th span { font-weight: 400; font-size: 11.5px; color: var(--faint); }
.rtab-wide .rtab-group th { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rtab-wide .rtab-group th:not(:first-child) { color: #2c3a45; font-size: 13px; }
.rtab-wide .rtab-sub th { padding: 7px 10px; font-size: 12px; font-weight: 600; }
.rtab-wide tbody td { padding: 10px 10px; }
.rtab tbody td { padding: 12px 14px; text-align: center; border-bottom: 1px solid var(--line); }
.rtab tbody td:first-child { text-align: left; white-space: nowrap; }
.rtab tbody td:not(:first-child) { font-variant-numeric: tabular-nums; font-weight: 550; color: #2c3a45; }
.rtab .grp-b { border-left: 1px solid var(--line-strong); }
.rtab-best { background: var(--accent-soft); }
.rtab-best td { color: var(--accent-deep) !important; font-weight: 700 !important; }
.rtab-best td:first-child { border-radius: 8px 0 0 8px; }
.rtab-best td:last-child { border-radius: 0 8px 8px 0; }
.rtab-best .grp-b { border-left-color: #b9e3e0; }
.rtab-section td {
  text-align: left !important; background: #eef2f5; color: var(--muted);
  font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  padding: 7px 12px !important;
}
.rtab-section td .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.rtab u { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--faint); }
.tag-ours {
  display: inline-block; font-size: 10.5px; font-weight: 700; vertical-align: middle;
  padding: 1px 7px; border-radius: 5px; background: var(--accent); color: #fff; margin-left: 4px;
}
.rtab .aster { color: var(--accent); font-weight: 700; }
.tab-legend { max-width: 720px; margin: 0 auto 6px; text-align: center; font-size: 12.5px; color: var(--muted); }
.tab-legend u { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--faint); }
.tab-note { max-width: 740px; margin: 0 auto; text-align: center; font-size: 13.5px; color: var(--faint); line-height: 1.5; }
.engine-card > p:not(.engine-sub) { margin: 10px 0 0; color: #2e3a45; font-size: 14.5px; line-height: 1.58; }

/* ---------- demo ---------- */
.demo-h3 { text-align: center; margin: 40px 0 6px; }
.demo-h3:first-of-type { margin-top: 8px; }
.demo-desc { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 22px; font-size: 15.5px; }
.pill {
  display: inline-block; vertical-align: middle;
  font-size: 12px; font-weight: 650; padding: 2px 10px; border-radius: 999px; margin-left: 6px;
}
.pill-reactive { background: var(--reactive-soft); color: var(--reactive); }
.pill-proactive { background: var(--proactive-soft); color: var(--proactive); }

.loading { color: var(--faint); text-align: center; padding: 40px; font-size: 15px; }

/* ---------- demo board (single frame + case selector) ---------- */
.demo-board {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 460px;
}
@media (max-width: 760px) { .demo-board { grid-template-columns: 1fr; } }

.case-tabs {
  border-right: 1px solid var(--line);
  background: #f7f9fb;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
@media (max-width: 760px) {
  .case-tabs { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
}
.case-tab {
  text-align: left; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; padding: 12px 13px;
  font-family: var(--sans); color: var(--muted);
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  display: flex; flex-direction: column; gap: 3px; min-width: 190px;
}
.case-tab:hover { background: #eef3f7; }
.case-tab.active { background: var(--accent-soft); border-color: #b9e3e0; color: var(--text); }
.case-tab .ct-top { display: flex; align-items: center; gap: 7px; }
.case-tab .ct-idx {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: #d6e0e8; color: #44525e; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.case-tab.active .ct-idx { background: var(--accent); color: #fff; }
.case-tab .ct-ds { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.case-tab.active .ct-ds { color: var(--accent-deep); }
.case-tab .ct-title { font-size: 13.5px; font-weight: 550; line-height: 1.3; }

.case-stage { padding: 4px; display: flex; }
.case-stage .replay { border: none; box-shadow: none; border-radius: 0; width: 100%; }
.case-stage .replay-head { background: transparent; }

/* ---------- replay card ---------- */
.replay {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.replay-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fcfdfe, #f7f9fb);
}
.src-chip {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-deep);
}
.replay-title {
  flex: 1 1 auto;
  min-width: 120px;
  font-size: 14px;
  font-weight: 600;
  color: #36434f;
  text-align: left;
  overflow-wrap: anywhere;
}
.replay-head .play-btn {
  flex: none;
}

.replay-body { padding: 18px 18px 6px; flex: 1; }
.q-line { font-family: var(--serif); font-size: 18px; color: #1f2c37; margin: 0 0 4px; line-height: 1.4; }
.q-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

.stage { margin-top: 16px; }

.routing-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; padding: 5px 12px; border-radius: 8px;
  background: var(--reactive-soft); color: var(--reactive); font-weight: 550;
  opacity: 0; transform: translateY(6px); transition: all .4s ease;
}
.routing-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.tool-step {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 13px; margin-top: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fcfdfe;
  opacity: 0; transform: translateY(8px); transition: all .42s ease;
}
.tool-step .num {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: grid; place-items: center; margin-top: 1px;
}
.tool-step .tool-name { font-family: var(--mono); font-size: 13px; color: #18323f; font-weight: 500; }
.tool-step .tool-label { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.answer-box {
  margin-top: 16px; padding: 15px 16px;
  border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: #f6fcfb;
  opacity: 0; transform: translateY(8px); transition: all .45s ease;
}
.answer-box .ans-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 8px; }
.answer-md { font-size: 14.5px; color: #25323d; line-height: 1.6; }
.answer-md p { margin: 0 0 8px; }
.answer-md ul { margin: 6px 0; padding-left: 20px; }
.answer-md li { margin: 4px 0; }
.answer-md code { font-family: var(--mono); font-size: 12.5px; background: #eef4f3; padding: 1px 5px; border-radius: 4px; color: #0a6d6d; }
.answer-badge {
  display: inline-block; font-size: 22px; font-weight: 750; color: var(--accent-deep);
  text-transform: capitalize; letter-spacing: -.01em;
}

.reveal { opacity: 1 !important; transform: none !important; }

.replay-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line); margin-top: 12px;
  font-size: 13px; color: var(--muted);
}
.verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.verdict.correct { color: var(--ok); }
.verdict .check { font-weight: 800; }
.foot-stat { color: var(--faint); }
.foot-spacer { margin-left: auto; }

.play-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  transition: background .12s ease, transform .12s ease;
}
.play-btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
.play-btn:disabled { background: #b9c6cd; cursor: default; transform: none; }
.play-btn.replay-again { background: #38474f; }

/* ---------- proactive timeline ---------- */
.proactive-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.mon-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.mon-top .play-btn { margin-left: auto; }

.mon-svg-wrap { width: 100%; overflow: hidden; }
.mon-svg-wrap svg { width: 100%; height: auto; display: block; }

.mon-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.mon-stat .n { font-size: 21px; font-weight: 750; color: var(--text); }
.mon-stat .l { font-size: 12.5px; color: var(--faint); }
.mon-note { margin-top: 12px; font-size: 13px; color: var(--faint); font-style: italic; }

/* ---------- benchmark stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 8px 0 18px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: clamp(30px, 5vw, 40px); font-weight: 800; letter-spacing: -.03em; color: var(--accent-deep); }
.stat-num span { font-size: .5em; color: var(--faint); font-weight: 700; }
.stat-lab { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.35; }

/* ---------- bibtex ---------- */
.bibtex-wrap { position: relative; }
#bibtex-block {
  background: #16202a; color: #d6e2ea; border-radius: var(--radius);
  padding: 20px 22px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  border: 1px solid #1f2c38;
}
.copy-btn {
  position: absolute; top: 12px; right: 12px;
  background: #2a3a47; color: #d6e2ea; border: 1px solid #3a4d5c;
  border-radius: 7px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  font-family: var(--sans); font-weight: 550;
}
.copy-btn:hover { background: #344656; }
.copy-btn.copied { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- footer ---------- */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 30px 40px 50px; border-top: 1px solid var(--line); }
.site-footer p { color: var(--faint); font-size: 13.5px; text-align: center; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
