:root {
  --bg-start: #fffdf8;
  --bg-end: #f0e7ff;
  --text-main: #1f1d2b;
  --text-muted: #6d6b7e;
  --accent: #6c63ff;
  --accent-strong: #8a74ff;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  font-size: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: linear-gradient(160deg, var(--bg-start), var(--bg-end));
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.sticky-actions {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 999;
}

.sticky-apple {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sticky-apple::before {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05), inset 0 1px 4px rgba(255, 255, 255, 0.08);
}

.sticky-apple:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.sticky-menu {
  position: absolute;
  top: 84px;
  right: 0;
  display: grid;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  min-width: 160px;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sticky-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sticky-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.8rem;
  border: none;
  background: rgba(108, 99, 255, 0.08);
  color: #1d1a26;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sticky-link:hover {
  transform: translateY(-1px);
  background: rgba(108, 99, 255, 0.14);
  box-shadow: 0 8px 16px rgba(108, 99, 255, 0.2);
}

@media (max-width: 640px) {
  .sticky-actions {
    top: 1rem;
    right: 1rem;
  }

  .sticky-apple {
    width: 56px;
    height: 56px;
    border-width: 2px;
  }

  .sticky-apple::before {
    width: 40px;
    height: 40px;
  }

  .sticky-menu {
    top: 68px;
    min-width: 140px;
  }
}

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

canvas#papers-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

.page-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 15% 20%, rgba(174, 214, 255, 0.6), transparent 45%),
    radial-gradient(circle at 80% 5%, rgba(255, 190, 232, 0.5), transparent 40%);
  z-index: -1;
  opacity: 0.9;
}

.wrap {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.hero {
  padding: 2rem 0 3rem;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  position: relative;
}

.logo {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-muted);
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--text-main);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  width: 25px;
  height: 2px;
  background: var(--text-main);
}

.hero-content {
  margin-top: 2rem;
  max-width: 650px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.tagline {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.subtext {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.papers-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.3fr) minmax(0, 1fr);
  gap: 2rem;
  padding-bottom: 4rem;
}

.filters-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 25px 55px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 2rem;
}

.filters-header p {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.group-title {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.search-field {
  position: relative;
}

.search-field input {
  width: 100%;
  padding: 0.85rem 2.8rem 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-main);
  font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-main);
  appearance: none;
}

.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.reset-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
}

.papers-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.paper-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 55px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1rem;
  min-height: 100%;
}

.paper-card h3 {
  font-size: 1.3rem;
}

.paper-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chip {
  font-size: 0.75rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(108, 99, 255, 0.3);
}

.chip-muted {
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.paper-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.paper-footer span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.paper-btn {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 15px 30px rgba(108, 99, 255, 0.25);
}

.empty-state {
  text-align: center;
  padding: 1.8rem;
  border-radius: 1rem;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.9);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footer-links a.active {
  color: var(--text-main);
}

@media (max-width: 960px) {
  .papers-layout {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 80px;
    right: 0;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.95);
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
    transform-origin: top right;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }
}
