:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --ink: #202326;
  --muted: #5b6670;
  --subtle: #7b858d;
  --line: #dce3dd;
  --line-strong: #c6d2cc;
  --accent: #0d766f;
  --accent-dark: #0a4f4a;
  --amber: #9a5b17;
  --blue: #375a8c;
  --red: #9a3e35;
  --chip: #edf3f1;
  --shadow: 0 14px 34px rgba(31, 39, 43, 0.08);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.runtime-message {
  max-width: 720px;
  margin: 40px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #ffffff;
  text-align: center;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 18px 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #c7d3cf;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent-dark);
  font-size: 18px;
  font-weight: 780;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.brand span span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 28px;
  align-items: end;
  padding: 34px 0 22px;
}

h1 {
  margin: 0;
  max-width: 800px;
  font-size: 36px;
  line-height: 1.18;
  font-weight: 780;
  letter-spacing: 0;
}

.lead {
  max-width: 820px;
  margin: 16px 0 0;
  color: #46515a;
  font-size: 16px;
}

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

.stat {
  min-height: 82px;
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat b {
  display: block;
  font-size: 24px;
  line-height: 1.08;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin: 8px 0 16px;
}

.search {
  width: 100%;
  height: 44px;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.search:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 118, 111, 0.12);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab {
  min-height: 38px;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  padding: 0 13px;
  color: #344047;
  background: #ffffff;
}

.tab.is-active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.select,
.toggle {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  color: #344047;
  background: #ffffff;
}

.select {
  padding: 0 10px;
  outline: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  user-select: none;
}

.toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.route-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.route-card {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: inherit;
  background: #fffdf8;
  text-align: left;
}

.route-card.is-active {
  border-color: #d5b77e;
  background: #fbf2e4;
  box-shadow: inset 0 0 0 1px rgba(154, 91, 23, 0.12);
}

.route-card b {
  display: block;
  color: var(--amber);
  font-size: 14px;
}

.route-card span {
  display: block;
  margin-top: 8px;
  color: #4c555b;
  font-size: 13px;
}

.route-card small {
  display: block;
  margin-top: 10px;
  color: var(--subtle);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar,
.results,
.resultbar,
.grid,
.card,
.card-body,
.actions {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 18px;
}

.side-section {
  border-top: 1px solid var(--line-strong);
  padding-top: 14px;
}

.side-section h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topic-list,
.timeline {
  display: grid;
  gap: 8px;
}

.topic-item:hover,
.timeline-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 118, 111, 0.12);
}

.topic-item.is-active {
  border-color: var(--accent);
  background: var(--chip);
}

.topic-item,
.timeline-item {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: #39444b;
  background: #ffffff;
  text-align: left;
}

.topic-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.topic-item b {
  font-size: 13px;
  font-weight: 680;
}

.topic-item span {
  color: var(--subtle);
  font-size: 12px;
}

.timeline-item {
  display: grid;
  gap: 3px;
}

.timeline-item b {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.timeline-item span {
  color: var(--subtle);
  font-size: 12px;
}

.resultbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.reset {
  min-height: 34px;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  padding: 0 11px;
  color: #183f3b;
  background: #ffffff;
  font-size: 13px;
  font-weight: 650;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  overflow: visible;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform-origin: center;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  will-change: transform;
}

.card:hover,
.card:focus-within {
  z-index: 2;
  border-color: rgba(13, 118, 111, 0.34);
  box-shadow: 0 24px 58px rgba(31, 39, 43, 0.18);
  transform: translateY(-8px) scale(1.025);
}

.cover-wrap {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #dfe7e2;
}

.cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.text-cover {
  display: grid;
  align-content: center;
  min-height: 182px;
  aspect-ratio: 16 / 9;
  padding: 22px;
  color: #ffffff;
  background: linear-gradient(135deg, #0d766f 0%, #375a8c 100%);
}

.text-cover b {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.text-cover span {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.badge {
  position: absolute;
  left: 12px;
  top: 12px;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  color: #ffffff;
  background: rgba(32, 35, 38, 0.74);
  font-size: 12px;
  font-weight: 720;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 11px;
  padding: 15px;
}

.meta-row,
.labels,
.facts,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-row {
  justify-content: space-between;
  color: var(--subtle);
  font-size: 12px;
}

.label {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 2px 9px;
  color: #1f4f4a;
  background: var(--chip);
  font-size: 12px;
  font-weight: 650;
}

.label.alt {
  color: #6f3f0d;
  background: #f7ebdc;
}

.label.blue {
  color: #294d7d;
  background: #e9eef6;
}

.label.red {
  color: #79332d;
  background: #f5e8e6;
}

.card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.paper-name {
  margin: 0;
  color: #39444b;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.paper-name strong {
  color: #1f2529;
}

.desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.facts {
  gap: 6px;
  margin-top: 2px;
}

.fact {
  min-height: 24px;
  border: 1px solid #e1e7e2;
  border-radius: 999px;
  padding: 1px 8px;
  color: #546068;
  background: #fbfcfa;
  font-size: 12px;
}

.actions {
  margin-top: auto;
  padding-top: 4px;
}

.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  padding: 0 11px;
  color: #183f3b;
  background: #ffffff;
  font-size: 13px;
  font-weight: 650;
  white-space: normal;
  text-align: center;
}

.link.primary {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.link.is-fav {
  color: #ffffff;
  border-color: var(--amber);
  background: var(--amber);
}

.empty {
  display: none;
  border: 1px dashed #b9c7c2;
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  background: #ffffff;
  text-align: center;
}

.empty.is-visible {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(26, 31, 33, 0.54);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #cfd8d2;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  color: #344047;
  background: #ffffff;
  font-size: 18px;
  line-height: 1;
}

.modal-body {
  display: grid;
  gap: 15px;
  padding: 16px 18px 18px;
}

.detail-block {
  display: grid;
  gap: 5px;
}

.detail-block b {
  color: #1f2529;
  font-size: 14px;
}

.detail-block p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-height: 40px;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 9px 12px;
  color: #ffffff;
  background: var(--accent-dark);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

.toast[hidden] {
  display: none;
}

footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 880px) {
  .intro,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .tabs {
    justify-content: flex-start;
  }

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

  .route-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page {
    padding: 18px 14px 34px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .meta {
    white-space: normal;
  }

  h1 {
    font-size: 28px;
  }

  .stats,
  .filters,
  .route-strip,
  .sidebar,
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}
