:root {
  color-scheme: dark;
  --bg: #11100e;
  --bg-glow-primary: rgba(45, 212, 191, 0.12);
  --bg-glow-secondary: rgba(251, 113, 133, 0.12);
  --surface: #1b1a17;
  --surface-2: #24221e;
  --surface-3: #2f2a24;
  --text: #f4efe6;
  --muted: #b7afa4;
  --line: rgba(244, 239, 230, 0.13);
  --topbar-bg: rgba(17, 16, 14, 0.82);
  --button-bg: rgba(255, 255, 255, 0.05);
  --control-bg: #141310;
  --overview-bg:
    linear-gradient(135deg, rgba(251, 191, 36, 0.14), transparent 42%),
    linear-gradient(315deg, rgba(45, 212, 191, 0.18), rgba(36, 34, 30, 0.8));
  --metric-bg: rgba(27, 26, 23, 0.82);
  --metric-accent-bg: linear-gradient(145deg, rgba(251, 113, 133, 0.18), rgba(27, 26, 23, 0.9));
  --panel-bg: rgba(27, 26, 23, 0.86);
  --card-bg: rgba(27, 26, 23, 0.9);
  --card-footer-bg: rgba(255, 255, 255, 0.035);
  --empty-bg: rgba(27, 26, 23, 0.7);
  --summary-text: #e8e0d7;
  --tag-bg: rgba(251, 191, 36, 0.1);
  --tag-line: rgba(251, 191, 36, 0.28);
  --tag-text: #f8d98a;
  --download-text: #fecdd3;
  --teal: #2dd4bf;
  --coral: #fb7185;
  --gold: #fbbf24;
  --green: #22c55e;
  --low: #8b8b84;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-glow-primary: rgba(37, 99, 235, 0.12);
  --bg-glow-secondary: rgba(245, 158, 11, 0.11);
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --surface-3: #dbe5ef;
  --text: #172033;
  --muted: #647087;
  --line: rgba(30, 41, 59, 0.13);
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --button-bg: rgba(30, 41, 59, 0.045);
  --control-bg: #ffffff;
  --overview-bg:
    linear-gradient(135deg, rgba(37, 99, 235, 0.13), transparent 44%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.15), rgba(255, 255, 255, 0.96));
  --metric-bg: rgba(255, 255, 255, 0.94);
  --metric-accent-bg: linear-gradient(145deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0.96));
  --panel-bg: rgba(255, 255, 255, 0.93);
  --card-bg: rgba(255, 255, 255, 0.98);
  --card-footer-bg: rgba(30, 41, 59, 0.035);
  --empty-bg: rgba(255, 255, 255, 0.78);
  --summary-text: #283447;
  --tag-bg: rgba(37, 99, 235, 0.08);
  --tag-line: rgba(37, 99, 235, 0.22);
  --tag-text: #1d4ed8;
  --download-text: #be123c;
  --teal: #2563eb;
  --coral: #be123c;
  --gold: #b7791f;
  --green: #15803d;
  --low: #7b8494;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

body[data-theme="eye"] {
  color-scheme: light;
  --bg: #eef7ed;
  --bg-glow-primary: rgba(22, 163, 74, 0.14);
  --bg-glow-secondary: rgba(217, 119, 6, 0.08);
  --surface: #fbfff7;
  --surface-2: #e7f2df;
  --surface-3: #d8e8cf;
  --text: #1f3324;
  --muted: #64735f;
  --line: rgba(45, 82, 50, 0.17);
  --topbar-bg: rgba(251, 255, 247, 0.9);
  --button-bg: rgba(48, 98, 65, 0.07);
  --control-bg: #fcfff7;
  --overview-bg:
    linear-gradient(135deg, rgba(101, 163, 13, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.11), rgba(251, 255, 247, 0.96));
  --metric-bg: rgba(251, 255, 247, 0.92);
  --metric-accent-bg: linear-gradient(145deg, rgba(234, 88, 12, 0.1), rgba(251, 255, 245, 0.96));
  --panel-bg: rgba(251, 255, 245, 0.92);
  --card-bg: rgba(252, 255, 247, 0.96);
  --card-footer-bg: rgba(48, 98, 65, 0.05);
  --empty-bg: rgba(252, 255, 247, 0.76);
  --summary-text: #2d3e33;
  --tag-bg: rgba(101, 163, 13, 0.1);
  --tag-line: rgba(101, 163, 13, 0.28);
  --tag-text: #4d7c0f;
  --download-text: #9f3f32;
  --teal: #0f766e;
  --coral: #c85543;
  --gold: #96721c;
  --green: #2f8f46;
  --low: #77836f;
  --shadow: 0 18px 45px rgba(47, 82, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(140deg, var(--bg-glow-primary), transparent 34%),
    linear-gradient(320deg, var(--bg-glow-secondary), transparent 30%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(45, 212, 191, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(251, 191, 36, 0.14));
  color: var(--teal);
  font-weight: 850;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  padding: 3px;
}

.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  padding: 6px 9px;
}

.theme-option.active {
  background: var(--control-bg);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}

.theme-option:hover {
  color: var(--teal);
}

.theme-swatch {
  width: 13px;
  height: 13px;
  border: 1px solid var(--line);
  border-radius: 50%;
  flex: 0 0 auto;
}

.dark-swatch {
  background: linear-gradient(135deg, #11100e 50%, #2dd4bf 50%);
}

.light-swatch {
  background: linear-gradient(135deg, #ffffff 50%, #2563eb 50%);
}

.eye-swatch {
  background: linear-gradient(135deg, #eef7ed 50%, #65a30d 50%);
}

.icon-link {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--text);
  font-size: 18px;
  text-decoration: none;
}

.shell {
  display: grid;
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 52px) 48px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: stretch;
}

.overview-title {
  display: grid;
  align-content: end;
  min-height: 158px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--overview-bg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.overview-title p {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-title h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

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

.metric {
  display: grid;
  align-content: space-between;
  min-height: 158px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--metric-bg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.metric.accent {
  border-color: rgba(251, 113, 133, 0.38);
  background: var(--metric-accent-bg);
}

.metric-value {
  color: var(--text);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  padding: 14px;
}

.collection-tabs,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.collection-tab,
.tab,
.paper-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.collection-tab {
  padding: 8px 13px;
}

.tab {
  padding: 8px 13px;
}

.collection-tab.active,
.tab.active {
  border-color: rgba(45, 212, 191, 0.62);
  background: rgba(45, 212, 191, 0.16);
  color: var(--teal);
}

.filters {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(160px, 1fr) minmax(120px, 0.6fr) minmax(220px, 1.4fr);
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}

input:focus,
select:focus,
.icon-link:focus,
.theme-option:focus,
.collection-tab:focus,
.tab:focus,
.paper-link:focus {
  outline: 2px solid rgba(45, 212, 191, 0.34);
  outline-offset: 2px;
}

.content {
  min-width: 0;
}

.content-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 14px;
}

.content-head h2 {
  margin: 0;
  font-size: 22px;
}

.content-head p,
.content-head span {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.paper-list {
  display: grid;
  gap: 14px;
}

.paper-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.paper-main {
  padding: 18px;
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.match-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 3px 10px;
  color: #11100e;
  font-weight: 850;
  text-transform: uppercase;
}

.match-badge.high {
  background: var(--green);
}

.match-badge.medium {
  background: var(--gold);
}

.match-badge.low {
  background: var(--low);
  color: var(--text);
}

.paper-title {
  margin: 12px 0 8px;
  max-width: 1050px;
  font-size: clamp(19px, 2vw, 25px);
  line-height: 1.24;
  letter-spacing: 0;
}

.paper-authors {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-color: var(--tag-line);
  padding: 3px 8px;
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.summary-grid div {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.summary-grid dt {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

.summary-grid dd {
  margin: 0;
  color: var(--summary-text);
  font-size: 14px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.paper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  background: var(--card-footer-bg);
  padding: 13px 18px;
}

.match-reason {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.paper-links {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.paper-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
}

.paper-link:hover,
.icon-link:hover,
.collection-tab:hover,
.tab:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.download-link {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--download-text);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--empty-bg);
  color: var(--muted);
  padding: 34px;
  text-align: center;
}

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

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

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

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
  }

  .theme-switcher {
    flex: 1 1 220px;
    justify-content: space-between;
  }

  .theme-option {
    flex: 1 1 0;
    justify-content: center;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .metric-grid,
  .filters,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .overview-title {
    min-height: 112px;
  }

  .paper-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .paper-links {
    justify-content: stretch;
  }

  .paper-link {
    flex: 1 1 auto;
  }
}
