@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* --- Modern Palette: "Cyber-Organic" --- */
  --bg-deep: #030712;
  /* Very dark blue/black */
  --bg-surface: #0f172a;
  /* Slate 900 */

  /* Vibrant Accents */
  --primary: #6366f1;
  /* Indigo 500 */
  --primary-glow: rgba(99, 102, 241, 0.5);
  --secondary: #ec4899;
  /* Pink 500 */
  --accent: #06b6d4;
  /* Cyan 500 */

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --grad-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  --grad-surface: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);

  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Status */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  /* UI Elements */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(15, 23, 42, 0.6);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-glow: 0 0 40px -10px var(--primary-glow);
  --shadow-card: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Noise Texture */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* Ambient Background Orbs */
.ambient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -2;
  opacity: 0.4;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--primary);
}

.orb-2 {
  bottom: -10%;
  right: -10%;
  width: 40vw;
  height: 40vw;
  background: var(--secondary);
  animation-delay: -5s;
}

.orb-3 {
  top: 40%;
  left: 40%;
  width: 30vw;
  height: 30vw;
  background: var(--accent);
  animation-delay: -10s;
  opacity: 0.2;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(50px, 50px) scale(1.1);
  }
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
.hero-title,
.stat-number {
  font-family: 'Outfit', sans-serif;
}

/* =====================================
   Layout & Containers
   ===================================== */
.game-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

/* =====================================
   Glassmorphism Cards
   ===================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
}

/* =====================================
   Buttons
   ===================================== */
button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--grad-primary);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 4px 20px -5px var(--primary-glow);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -5px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  padding: 1rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* =====================================
   Hero Section
   ===================================== */
.hero-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
  overflow-y: auto;
  padding: 2rem;
}

.hero-page.active {
  opacity: 1;
  visibility: visible;
}

.hero-content-wrapper {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  max-width: 1200px;
  width: 100%;
  align-items: center;
}

.hero-text-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-full);
  color: #a5b4fc;
  font-size: 0.875rem;
  font-weight: 500;
  width: fit-content;
}

.hero-title {
  font-size: 4rem;
  line-height: 1.1;
  font-weight: 800;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.hero-title span {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 600px;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Visual Side (Bento Grid Style) */
.hero-visual-side {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  perspective: 1000px;
}

.feature-card {
  background: var(--grad-surface);
  border: 1px solid var(--glass-border);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px) rotateX(2deg);
  border-color: rgba(99, 102, 241, 0.3);
}

.feature-card.large {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(15, 23, 42, 0.8) 100%);
}

.feature-icon {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.feature-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-main);
}

.feature-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* =====================================
   Modals
   ===================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 1rem;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #1e293b;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 500px;
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-card);
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* Identify Modal Specifics */
.identify-options {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.input-group {
  position: relative;
}

.player-name-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid var(--glass-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: white;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.player-name-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.btn-google {
  background: white;
  color: #1f2937;
  border: none;
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.btn-google:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

/* =====================================
   Game Interface
   ===================================== */
.game-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  transform: translateY(-100%);
  transition: transform 0.5s ease;
}

.game-header.active {
  transform: translateY(0);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.hud-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.hearts {
  display: flex;
  gap: 0.25rem;
  font-size: 1.25rem;
}

/* Question Card */
.game-main {
  padding-top: 100px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.game-main.active {
  opacity: 1;
}

.question-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 3rem;
  width: 100%;
  max-width: 800px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad-primary);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.question-text {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 2.5rem;
  color: var(--text-main);
}

.question-options {
  display: grid;
  gap: 1rem;
}

.option-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  text-align: left;
  color: var(--text-main);
  font-size: 1.1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateX(5px);
}

.option-btn.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
}

.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--error);
}

.option-key {
  background: rgba(255, 255, 255, 0.1);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* =====================================
   Responsive
   ===================================== */
@media (max-width: 900px) {
  .hero-content-wrapper {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  .hero-text-side {
    align-items: center;
  }

  .hero-title {
    font-size: 3rem;
  }

  .hero-visual-side {
    display: none;
    /* Simplify for mobile/tablet */
  }

  .question-card {
    padding: 1.5rem;
    border-radius: 24px;
  }

  .question-text {
    font-size: 1.25rem;
  }
}

/* =====================================
   Utilities
   ===================================== */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================
   Matching & Ordering Styles
   ===================================== */
.matching-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

.matching-column h4,
.ordering-container h4 {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.matching-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.matching-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.matching-item.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.matching-item.matched {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  opacity: 0.6;
  pointer-events: none;
}

.ordering-container {
  margin-top: 1.5rem;
}

.ordering-item {
  background: rgba(255, 255, 255, 0.03) !important;
  /* Override inline styles from JS */
  border: 1px solid var(--glass-border) !important;
  color: var(--text-main);
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ordering-item:active {
  cursor: grabbing;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* =====================================
   Dynamic Modals (Hint, Reward)
   ===================================== */
.hint-modal .modal-content,
.reward-modal .modal-content {
  text-align: center;
  max-width: 400px;
}

.hint-icon,
.reward-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.hint-text,
.reward-detail {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.reward-modal h2 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-deep);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}