/* LLM Arena - Premium Visuals (Inspired by neuralsite) */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap");

:root {
  /* Fonts */
  --font-display: "Space Grotesk", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Colors */
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --bg-card: #0d0d0d;

  /* Accent - Electric violet */
  --accent: #8b5cf6;
  --accent-bright: #a78bfa;
  --accent-dim: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.4);

  /* Secondary - Cyan */
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.3);

  /* Text */
  --text-100: #fafafa;
  --text-80: rgba(250, 250, 250, 0.8);
  --text-60: rgba(250, 250, 250, 0.6);
  --text-40: rgba(250, 250, 250, 0.4);
  --text-20: rgba(250, 250, 250, 0.2);

  /* Glass */
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-highlight: rgba(255, 255, 255, 0.1);

  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Animation */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --duration: 0.6s;

  --border-radius: 12px;
  --border-radius-lg: 24px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-80);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============================================
   AMBIENT BACKGROUND
   ============================================ */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.bg-ambient::before {
  content: "";
  position: absolute;
  width: 150vw;
  height: 150vh;
  top: -25vh;
  left: -25vw;
  background:
    radial-gradient(
      ellipse 50% 40% at 20% 30%,
      rgba(139, 92, 246, 0.12) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 40% 50% at 80% 20%,
      rgba(34, 211, 238, 0.08) 0%,
      transparent 50%
    );
  animation: drift 30s ease-in-out infinite alternate;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(-5%, 5%) rotate(3deg);
  }
}

/* ============================================
   HEADER (NeuralSite Style)
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 102;
  padding: 20px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s var(--ease);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-100);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--text-100);
  color: var(--bg);
  border-radius: 8px;
  padding: 6px;
}

.logo-mark svg {
  width: 100%;
  height: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-stats {
  display: flex;
  gap: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-bright);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-40);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.header-cta {
  padding: 8px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--text-100);
  border-radius: 100px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  border: none;
}

.header-cta:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 100px; /* Room for fixed header */
}

.main {
  flex: 1;
  padding: 2rem;
  width: 100%;
  display: flex;
  align-items: flex-start; /* Start from top as user scrolls */
  justify-content: center;
}

/* Screens */
.screen {
  display: none;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.screen.active {
  display: block;
  animation: screenEnter 0.8s var(--ease) forwards;
}

@keyframes screenEnter {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   WELCOME SCREEN
   ============================================ */
.welcome-content {
  text-align: center;
  max-width: 720px;
  margin: 2rem auto;
}

.welcome-content h2 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--text-100);
  letter-spacing: -0.03em;
}

.welcome-description {
  font-size: 1.25rem;
  color: var(--text-60);
  margin-bottom: 3rem;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.feature {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: left;
  transition: var(--duration) var(--ease);
}

.feature:hover {
  background: var(--glass-highlight);
  border-color: var(--text-20);
  transform: translateY(-5px);
}

.feature-icon {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.feature-icon svg {
  width: 32px;
  height: 32px;
}

.feature-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-100);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 2rem;
  border-radius: 100px;
  font-weight: 600;
  transition: all 0.3s var(--ease-out);
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-bright);
  transform: scale(1.02);
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-secondary {
  background: var(--glass);
  color: var(--text-100);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--glass-highlight);
  border-color: var(--text-40);
}

.btn-large {
  padding: 1.25rem 3rem;
  font-size: 1.1rem;
}

/* ============================================
   BATTLE SCREEN
   ============================================ */
.question-section {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  margin-bottom: 2rem;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.category-badge {
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--cyan-glow);
}

.question-number {
  font-family: var(--font-mono);
  color: var(--text-20);
  font-size: 0.9rem;
}

.question-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-100);
  line-height: 1.4;
}

.responses-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.response-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: var(--duration) var(--ease);
  display: flex;
  flex-direction: column;
}

.response-header {
  padding: 1.25rem;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.response-icon svg {
  width: 24px;
  height: 24px;
}
.response-label {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-60);
  text-transform: uppercase;
  font-size: 0.85rem;
}

.response-content {
  padding: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-wrap;
  flex: 1;
}

/* ============================================
   VOTE BUTTONS
   ============================================ */
.vote-section {
  background: var(--glass);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--glass-border);
}

.vote-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.btn-vote {
  background: var(--bg-card);
  border: 2px solid var(--glass-border);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 180px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  color: var(--text-60);
}

.btn-vote:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: var(--bg-elevated);
  color: var(--text-100);
}
.btn-vote.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text-100);
}
.vote-icon {
  font-size: 2rem;
}

/* ============================================
   RESULT SCREEN
   ============================================ */
.result-header {
  text-align: center;
  margin-bottom: 3rem;
}
.result-header h2 {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.result-header p {
  color: var(--text-40);
  font-size: 1.1rem;
}

.result-models {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: stretch;
  margin: 3rem 0;
}

.result-model {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  border-radius: var(--border-radius-lg);
  flex: 1;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  transition: all 0.4s var(--ease);
}

.result-model.winner {
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.1), transparent),
    var(--glass);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.2);
}

.model-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-40);
  font-weight: 600;
}
.model-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--text-100);
}
.model-result {
  font-size: 2.5rem;
  line-height: 1;
}

.result-vs {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-20);
  padding: 0 1rem;
}

.result-actions {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 3rem;
}

/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard-table-container {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin-top: 2rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.leaderboard-table th {
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-40);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 1rem;
}
.leaderboard-table tr:last-child td {
  border-bottom: none;
}
.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-table .rank {
  font-family: var(--font-mono);
  color: var(--text-40);
  font-weight: 600;
}
.leaderboard-table .rank-1 {
  color: #f59e0b;
  font-size: 1.2rem;
}
.leaderboard-table .elo {
  font-family: var(--font-mono);
}

.leaderboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: center;
  transition: all 0.3s var(--ease);
}

.stat-card:hover {
  border-color: var(--text-20);
  background: var(--glass-highlight);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-100);
  margin-bottom: 0.25rem;
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-40);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   GENERIC COMPONENTS
   ============================================ */
.loader {
  width: 48px;
  height: 48px;
  border: 2px solid var(--text-20);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}
@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

.footer {
  padding: 4rem 2rem;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  color: var(--text-20);
  font-size: 0.85rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .app {
    padding-top: 80px;
  }
  .welcome-features {
    grid-template-columns: 1fr;
  }
  .responses-section {
    grid-template-columns: 1fr;
  }
  .result-models {
    flex-direction: column;
    align-items: center;
  }
  .result-vs {
    transform: rotate(90deg);
    padding: 1rem 0;
  }
  .leaderboard-stats {
    grid-template-columns: 1fr;
  }
  .vote-buttons {
    flex-direction: column;
  }
  .result-actions {
    flex-direction: column;
  }
}
