/* Professional Blue/White Color Palette with Pink for Game */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --secondary-color: #64748b;
  --accent-color: #3b82f6;
  --white: #ffffff;
  --light-gray: #f1f5f9;
  --gray: #e2e8f0;
  --dark-gray: #334155;
  
  /* Pink colors for game */
  --primary-pink: #ec4899;
  --dark-pink: #db2777;
  --light-pink: #fce7f3;
}

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

html, body {
  font-size: 16px;
  font-family: 'Segoe UI', Tahoma, Geneva, sans-serif;
  line-height: 1.6;
  color: #333;
}

body {
  background: var(--white);
}

/* Header & Navigation */
header {
  background: var(--primary-color);
  color: var(--white);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 1px;
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--white);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.2s;
  font-weight: 500;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  text-decoration: underline;
}

nav a.active {
  border-bottom: 3px solid var(--white);
}

/* Main Container */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Sections */
section {
  margin-bottom: 3rem;
}

section h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 2rem;
  text-align: center;
}

section h3 {
  color: var(--dark-gray);
  margin: 1rem 0 0.5rem;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--light-gray), var(--gray));
  padding: 3rem 1rem;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 2rem;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.tagline {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  color: var(--primary-dark);
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: var(--light-gray);
  color: var(--dark-gray);
  border: 2px solid var(--gray);
}

.btn-secondary:hover {
  background: var(--gray);
  color: var(--dark-gray);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cards & Grid */
.features-grid, .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.feature-card, .stat {
  background: white;
  border: 2px solid var(--light-gray);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  transform: translateY(-4px);
}

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

.stat-value {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: #666;
  font-size: 0.9rem;
}

/* Game Section */
.game-container {
  text-align: center;
}

.game-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

#gameCanvas {
  display: block;
  margin: 0 auto;
  background: #000;
  border: 4px solid var(--primary-pink);
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.game-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--light-pink);
  border-radius: 4px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--dark-pink);
}

.info-item {
  font-size: 1.1rem;
}

.game-instructions {
  background: var(--gray);
  padding: 1.5rem;
  border-radius: 4px;
  margin-top: 2rem;
  text-align: left;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.game-instructions h3 {
  color: var(--primary-pink);
  text-align: center;
}

.game-instructions ul {
  list-style: none;
  padding: 1rem 0;
}

.game-instructions li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd;
}

.game-instructions li:last-child {
  border-bottom: none;
}

/* Papers Section */
.papers-section {
  padding: 1rem 0;
}

.papers-info {
  background: var(--light-pink);
  padding: 1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
  text-align: center;
}

.papers-info p {
  margin: 0.5rem 0;
}

.controls {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.search-input, .sort-select {
  padding: 0.75rem;
  border: 2px solid var(--light-pink);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-input:focus, .sort-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.filters input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

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

.paper-card {
  background: white;
  border: 2px solid var(--light-pink);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s;
}

.paper-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  transform: translateY(-4px);
}

.paper-card h3 {
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.paper-card h3 a {
  color: var(--primary-color);
  text-decoration: none;
}

.paper-card h3 a:hover {
  text-decoration: underline;
}

.paper-card .authors {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.paper-card .date {
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.paper-card .abstract {
  color: #555;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--light-gray);
  color: var(--dark-gray);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.no-papers, .error, .loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-size: 1.1rem;
}

.error {
  color: var(--primary-color);
  font-weight: 600;
}

/* Footer */
footer {
  background: var(--gray);
  padding: 2rem;
  text-align: center;
  color: #666;
  border-top: 2px solid var(--light-pink);
  margin-top: 3rem;
}

footer p {
  margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }

  nav ul {
    gap: 1rem;
  }

  .hero h2 {
    font-size: 1.8rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .cta-buttons {
    gap: 0.75rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
  }

  main {
    padding: 1rem;
  }

  section h2 {
    font-size: 1.5rem;
  }

  .game-info {
    gap: 1rem;
  }

  .controls {
    flex-direction: column;
  }

  .search-input {
    min-width: unset;
  }

  .filters {
    width: 100%;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.paper-card {
  animation: slideInUp 0.3s ease-out;
}

/* Accessibility */
a:focus, button:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
