:root {
  --ink: #17202a;
  --muted: #5f6f7f;
  --line: #d8e0e8;
  --surface: #f6f8fa;
  --paper: #ffffff;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --green: #15803d;
  --orange: #c2410c;
  --shadow: 0 14px 36px rgb(23 32 42 / 0.10);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--teal-dark);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(255 255 255 / 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.site-nav {
  width: min(1180px, calc(100% - 32px));
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  padding: 4px;
  background: var(--teal-dark);
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.94rem;
  font-weight: 650;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--teal-dark);
}

.hero-section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 44px;
  align-items: center;
}

.hero-copy,
.hero-panel,
.section-block > *,
article,
.chart-card {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 860px;
  font-size: 3.25rem;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.25;
}

.authors {
  margin: 22px 0 4px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 750;
}

.venue,
.summary,
.two-column p,
article p,
.caption {
  color: var(--muted);
}

.summary {
  max-width: 760px;
  margin: 24px 0 0;
  font-size: 1.05rem;
}

.mobile-summary {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
  border: 1px solid transparent;
}

.button.primary {
  background: var(--teal);
  color: #fff;
}

.button.primary:hover {
  background: var(--teal-dark);
  color: #fff;
}

.button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button.secondary:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.hero-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-kicker {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-grid div {
  min-height: 112px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-value {
  color: var(--teal-dark);
  font-size: 1.85rem;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.25;
}

.routing-sketch {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.routing-sketch span {
  min-height: 54px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 8px;
  background: var(--teal-dark);
}

.routing-sketch span:nth-child(2) {
  background: var(--blue);
}

.routing-sketch span:nth-child(3) {
  background: var(--green);
}

.routing-sketch span:nth-child(4) {
  background: var(--orange);
}

.section-block {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.section-block.band {
  width: 100%;
  max-width: none;
  padding: 56px max(16px, calc((100% - 1180px) / 2));
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-heading {
  max-width: 780px;
  margin-bottom: 26px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
}

.method-grid,
.diagnostic-grid,
.behavior-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.behavior-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

article {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.band article {
  background: var(--paper);
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tr.highlight td {
  background: #effaf7;
  color: var(--ink);
  font-weight: 700;
}

.chart-card {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 136px minmax(120px, 1fr) 64px;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  margin: 10px 0;
  font-size: 0.88rem;
}

.bar-row span {
  color: var(--muted);
  line-height: 1.15;
}

.bar-row b {
  text-align: right;
  font-size: 0.86rem;
}

.bar-track {
  height: 14px;
  background: #e7edf3;
  border-radius: 999px;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.bar-track.muted i {
  background: var(--orange);
}

.caption {
  margin-top: 14px;
  font-size: 0.9rem;
}

.stacked {
  height: 44px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e7edf3;
}

.stacked span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.stacked span:nth-child(1) {
  background: var(--teal-dark);
}

.stacked span:nth-child(2) {
  background: var(--blue);
}

.stacked span:nth-child(3) {
  background: var(--green);
}

.poster-frame {
  width: 100%;
  height: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.citation-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.citation-box pre {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
  font-size: 0.9rem;
}

.copy-bibtex-btn {
  min-height: 38px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.copy-bibtex-btn.copied {
  background: var(--green);
}

.site-footer {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.scroll-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 42px;
  height: 42px;
  display: none;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 850;
  cursor: pointer;
}

.scroll-to-top.visible {
  display: block;
}

@media (max-width: 980px) {
  .hero-section,
  .result-layout,
  .two-column {
    grid-template-columns: 1fr;
  }

  .hero-section {
    padding-top: 42px;
  }

  h1 {
    font-size: 2.45rem;
  }

  .method-grid,
  .diagnostic-grid,
  .behavior-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .poster-frame {
    height: 620px;
  }
}

@media (max-width: 680px) {
  main {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .hero-section,
  .section-block,
  .section-block.band {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  .site-nav {
    height: auto;
    padding: 12px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero-copy,
  .hero-panel,
  .summary,
  .venue,
  .eyebrow,
  h1 {
    width: calc(100vw - 64px) !important;
    max-width: calc(100vw - 64px) !important;
    box-sizing: border-box;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .desktop-summary {
    display: none;
  }

  .mobile-summary {
    display: inline;
  }

  .button {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.55rem;
  }

  .metric-grid,
  .method-grid,
  .diagnostic-grid,
  .behavior-grid {
    grid-template-columns: 1fr;
  }

  .routing-sketch {
    grid-template-columns: 1fr 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .bar-row b {
    text-align: left;
  }

  .citation-box {
    grid-template-columns: 1fr;
  }

  .poster-frame {
    height: 520px;
  }
}
