:root {
  --bg-start: #fffdf8;
  --bg-end: #f4efe2;
  --text-main: #1d1a26;
  --text-muted: #6b6575;
  --accent: #6c63ff;
  --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #4f46e5 100%);
  --border: rgba(23, 15, 42, 0.08);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
  --shadow-premium: 0 25px 55px rgba(15, 23, 42, 0.1);
}

* {
  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;
  line-height: 1.6;
  padding-top: 68px;
}

/* ═══════════════ BACKGROUND & CANVAS ═══════════════ */
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(108, 99, 255, 0.05), transparent 45%),
    radial-gradient(circle at 80% 5%, rgba(159, 126, 255, 0.05), transparent 40%);
  z-index: -1;
  opacity: 0.9;
}

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

.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.tagline {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
  display: block;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

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

.papers-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
  padding-bottom: 6rem;
  align-items: start;
}

.filters-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 100px;
}

.filters-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.filters-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
}

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

.group-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.search-field {
  position: relative;
}

.search-field input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fcfcfd;
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
}

.search-icon {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  pointer-events: none;
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fcfcfd;
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  appearance: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-color: var(--text-muted);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

.reset-btn {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  background: rgba(108, 99, 255, 0.05);
  border-color: var(--accent);
  color: var(--accent);
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.paper-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.paper-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
  border-color: rgba(108, 99, 255, 0.2);
}

.paper-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.paper-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-grow: 1;
}

.paper-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(108, 99, 255, 0.03), transparent 60%);
  z-index: 0;
}

.paper-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.chip {
  padding: 0.4rem 1.1rem;
  border-radius: 12px;
  background: rgba(108, 99, 255, 0.08);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  border: none;
}

.chip-muted {
  background: #f0f1f4;
  color: var(--text-muted);
}

.paper-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

.paper-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

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

.paper-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.85rem 1.75rem;
  border-radius: 16px;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  box-shadow: 0 10px 20px rgba(108, 99, 255, 0.2);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.paper-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(108, 99, 255, 0.3);
  filter: brightness(1.1);
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  border-radius: 2rem;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  background: #ffffff;
  grid-column: 1 / -1;
  font-size: 1.1rem;
}

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

.footer p {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links {
  display: flex;
  gap: 2.5rem;
}

.footer-links a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer-links a:hover, 
.footer-links a.active {
  color: var(--accent);
}

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

  .filters-panel {
    position: static;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 3rem 0;
  }

  .paper-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
}

.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 #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 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: #1d1a26;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.sticky-apple:hover {
  transform: translateY(-2px);
}

.sticky-menu {
  position: absolute;
  top: 84px;
  right: 0;
  display: grid;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
  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: #f8f7ff;
  color: #1d1a26;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
