@font-face { font-family: 'Castoro'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/castoro-latin.woff2) format('woff2'); }
:root {
  --ink: #1f2328;
  --muted: #5b6470;
  --line: #e3e6ea;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --accent: #2b6cb0;
  --accent-soft: #e8f0fa;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
.title, .subtitle, .button, .stat-num, .group-name, .type-tag, .lb-table th {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.container.is-max-desktop { max-width: 1000px !important; padding-left: 16px; padding-right: 16px; }
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-alt); }
.title { color: var(--ink); }
.section-lead { color: var(--muted); max-width: 720px; margin: -0.75rem auto 1.5rem; }

/* ---------- Hero ---------- */
.hero-body { padding: 3.5rem 0 2rem; }
.publication-title { font-family: 'Castoro', Georgia, serif !important; font-size: 3.2rem !important; margin-bottom: 0.6rem !important; }
.publication-subtitle { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 1.6rem !important; line-height: 1.3; color: #333; max-width: 860px; margin: 0 auto 1.4rem !important; }
.publication-authors { font-size: 1.2rem; margin-bottom: 0.35rem; }
.publication-authors .author-block { display: inline-block; margin: 0 0.2rem; }
.publication-affils { font-size: 1.02rem; color: #444; }
.publication-affils .author-block { display: inline-block; margin: 0 0.5rem; }
.publication-notes { font-size: 0.9rem; color: var(--muted); margin-top: 0.4rem; }
.publication-notes span { margin: 0 0.5rem; }
.publication-links { margin-top: 1.4rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.publication-links .button { background: #363636; }
.publication-links .button:hover { background: #222; }
.is-disabled-soft { opacity: 0.72; cursor: default; }
.soon-tag {
  margin-left: 0.45rem; font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: #fff; color: #363636; font-weight: 500; text-transform: lowercase;
}

/* ---------- Figures ---------- */
.paper-figure { margin: 2rem 0 0.5rem; }
.paper-figure img { display: block; width: 100%; height: auto; border-radius: 6px; }
.paper-figure figcaption { font-size: 0.92rem; color: var(--muted); margin-top: 0.7rem; line-height: 1.5; text-align: justify; }
.figure-narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.abstract p { font-size: 1.04rem; line-height: 1.7; }
.intro-text { color: #333; margin: 1.5rem 0 2rem; text-align: justify; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.75rem; margin-top: 1.5rem; }
.stat-card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 0.5rem; text-align: center; }
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }

/* ---------- Types ---------- */
.type-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.type-group { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; background: #fff; }
.group-name { font-weight: 700; font-size: 1.02rem; margin-bottom: 0.5rem; }
.type-group dl { margin: 0; }
.type-group dt { margin-top: 0.55rem; }
.type-group dd { margin: 0.2rem 0 0 0; font-size: 0.93rem; color: #333; line-height: 1.5; }
.type-tag {
  display: inline-block; font-size: 0.8rem; font-weight: 500; padding: 0.12rem 0.6rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.t-count { background: #e9f2fb; color: #1f5f99; }
.t-reid { background: #eaf6f6; color: #166a6a; }
.t-light { background: #fdf3e3; color: #915a0a; }
.t-device { background: #f6eefb; color: #6d3a8f; }
.t-patient { background: #fdecee; color: #a02c3c; }
.t-direction { background: #eef6e8; color: #3f6f1d; }
.t-route { background: #eef0fb; color: #3a46a0; }
.t-pass { background: #f2f2f2; color: #444; }

/* ---------- Sample browser ---------- */
.clip-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem; margin-bottom: 1.2rem;
}
.clip-thumb {
  border: 2px solid transparent; border-radius: 10px; padding: 0; background: #fff; cursor: pointer; overflow: hidden;
  text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,0.06); transition: border-color 0.15s, transform 0.15s;
}
.clip-thumb:hover { transform: translateY(-1px); }
.clip-thumb.is-active { border-color: var(--accent); }
.clip-thumb img { display: block; width: 100%; aspect-ratio: 768 / 448; object-fit: cover; }
.clip-thumb span { display: block; font-size: 0.74rem; padding: 0.25rem 0.45rem; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem; }
.player-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.clip-meta { font-size: 0.95rem; }
.clip-meta .fam { font-weight: 600; }
.clip-meta .sub { color: var(--muted); font-size: 0.85rem; margin-left: 0.4rem; }
.view-toggle { margin-bottom: 0 !important; }
.view-toggle .button { margin-bottom: 0 !important; }
.view-toggle .button.is-selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.video-wrap { position: relative; width: 100%; aspect-ratio: 1344 / 768; background: #111; border-radius: 8px; overflow: hidden; }
.video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; }
.view-note { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

.questions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; margin-top: 1rem; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem; display: flex; flex-direction: column; }
.q-card .q-text { font-size: 0.93rem; line-height: 1.5; margin: 0.5rem 0 0.6rem; }
.q-card ol { list-style: none; margin: 0 0 0.7rem; padding: 0; }
.q-card li { font-size: 0.9rem; padding: 0.3rem 0.55rem; border-radius: 8px; margin-bottom: 0.25rem; border: 1px solid var(--line); }
.q-card li b { display: inline-block; width: 1.3rem; }
.q-card li.is-correct { background: var(--ok-soft); border-color: var(--ok); color: #124d2c; }
.q-card .q-foot { margin-top: auto; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.q-card .answer-text { font-size: 0.88rem; color: var(--ok); font-weight: 600; }

/* ---------- Leaderboard ---------- */
.lb-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-bottom: 1rem; }
.lb-filters .button.is-selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
.lb-table { width: 100%; font-size: 0.86rem; margin: 0 !important; }
.lb-table th { font-weight: 600; font-size: 0.8rem; white-space: nowrap; cursor: pointer; user-select: none; background: #fafbfc; position: sticky; top: 0; vertical-align: bottom !important; }
.lb-table th.num, .lb-table td.num { text-align: right !important; }
.lb-table th .sort-ind { color: #aab; margin-left: 0.2rem; font-size: 0.7rem; }
.lb-table th.is-sorted .sort-ind { color: var(--accent); }
.lb-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-table td.model { white-space: nowrap; }
.lb-table td.avg, .lb-table th.avg { background: #f4f8fd; }
.lb-table tr.group-row td { background: #eef1f5 !important; font-weight: 600; font-size: 0.8rem; color: #39424e; letter-spacing: 0.01em; }
.lb-table tr.ours td { background: #fbf7e8; }
.lb-table tr.ours td.avg { background: #f5eed2; }
.lb-table td.best { font-weight: 700; }
.lb-table td.second { text-decoration: underline; text-underline-offset: 2px; }
.lb-table .col-sticky { position: sticky; left: 0; background: #fff; z-index: 1; }
.lb-table th.col-sticky { background: #fafbfc; z-index: 2; }
.lb-table tr.ours .col-sticky { background: #fbf7e8; }
.lb-foot { font-size: 0.85rem; color: var(--muted); margin-top: 0.7rem; }

/* ---------- Findings ---------- */
.findings { display: grid; gap: 0.8rem; }
.finding { display: flex; gap: 0.9rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; line-height: 1.55; }
.finding-icon { flex: 0 0 2.2rem; height: 2.2rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }

/* ---------- BibTeX ---------- */
.bib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.bib-head .title { margin-bottom: 0 !important; }
#bib-text { background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; }

.footer { padding: 2rem 1rem; background: #fff; font-size: 0.85rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .clip-strip { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .section { padding: 2.2rem 0; }
  .hero-body { padding: 2.2rem 0 1rem; }
  .publication-title { font-size: 2.2rem !important; }
  .publication-subtitle { font-size: 1.15rem !important; }
  .publication-authors { font-size: 1.02rem; }
  .publication-affils { font-size: 0.9rem; }
  .publication-affils .author-block { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 1.6rem; }
  .type-groups, .questions { grid-template-columns: 1fr; }
  .clip-strip { grid-template-columns: repeat(3, 1fr); }
  .paper-figure figcaption, .abstract, .content.has-text-justified, .intro-text { text-align: left !important; }
  .finding { padding: 0.8rem; }
}

/* ---------- Table fit + code tweaks ---------- */
.lb-table th { white-space: normal; line-height: 1.2; }
.lb-table th, .lb-table td { padding: 0.32em 0.42em !important; }
.lb-table td.model { white-space: normal; min-width: 9rem; max-width: 13rem; line-height: 1.3; }
.lb-table th[data-key="Re-ID"], .lb-table th[data-key="Count"], .lb-table th[data-key="Route"], .lb-table th[data-key="avg"] { white-space: nowrap; }
.lb-table th[data-key="Light owner"], .lb-table th[data-key="Patient frame"], .lb-table th[data-key="Device ref."] { min-width: 3.6rem; }
code { color: #3a46a0; background: #eef0fb; border-radius: 4px; padding: 0.08em 0.35em; font-size: 0.86em; }
@media (max-width: 640px) {
  .lb-table td.model { min-width: 8rem; max-width: 9.5rem; }
}
