/* ========================================
   MathMe Landing Page - CSS
   ======================================== */

:root {
  --color-primary: #3B82F6;
  --color-primary-dark: #2563EB;
  --color-primary-light: #DBEAFE;
  --color-accent: #8B5CF6;
  --color-bg: #FFFFFF;
  --color-surface: #F8FAFC;
  --color-dark: #0F172A;
  --color-dark-surface: #1E293B;
  --color-text: #1E293B;
  --color-text-secondary: #64748B;
  --color-border: #E2E8F0;

  --font-heading: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  --spacing-xxl: 64px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.3s ease;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; scroll-padding-top: 72px; }
body { font-family: var(--font-body); line-height: 1.6; color: var(--color-text); background: var(--color-bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

.skip-link { position: fixed; top: -48px; left: 0; background: var(--color-primary); color: white; padding: 8px; z-index: 1100; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link:focus { top: 0; }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; margin-bottom: var(--spacing-sm); }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
p { margin-bottom: var(--spacing-sm); }
@media (min-width: 768px) { h1 { font-size: 3rem; } h2 { font-size: 2.25rem; } h3 { font-size: 1.5rem; } }
@media (min-width: 1024px) { h1 { font-size: 3.5rem; } h2 { font-size: 2.5rem; } }

/* Layout */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--spacing-sm); }
@media (min-width: 768px) { .container { padding: 0 var(--spacing-md); } }
.section { padding: var(--spacing-xxl) 0; }
@media (min-width: 768px) { .section { padding: 80px 0; } }
@media (min-width: 1024px) { .section { padding: 100px 0; } }
.section-title { text-align: center; margin-bottom: var(--spacing-xl); }
.section-title.light { color: white; }
.section-subtitle { text-align: center; font-size: 1.125rem; color: var(--color-text-secondary); margin-bottom: var(--spacing-lg); max-width: 600px; margin-left: auto; margin-right: auto; }
.section-subtitle.light { color: rgba(255,255,255,0.7); }
.section-dark { background: var(--color-dark); color: white; }

/* ========================================
   Navigation
   ======================================== */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
}
.nav-container { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-sm); }
.nav-logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-weight: 700; font-size: 1.25rem; color: var(--color-text); }
.nav-logo img { border-radius: 8px; }
.nav-links { display: none; gap: var(--spacing-md); }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); transition: color var(--transition); }
.nav-links a:hover { color: var(--color-primary); }
.nav-toggle { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 44px; height: 44px; padding: 10px; margin-left: auto; border-radius: 8px; }
.nav-toggle-bar { display: block; height: 2px; width: 100%; background: var(--color-text); border-radius: 1px; }
.nav-links.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; gap: 0; background: white; border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow-md); padding: var(--spacing-xs) var(--spacing-sm); }
.nav-links.open a { padding: 12px 0; font-size: 1rem; }
@media (min-width: 768px) { .nav-links, .nav-links.open { display: flex; flex-direction: row; position: static; padding: 0; border: 0; box-shadow: none; background: none; } .nav-links.open a { padding: 0; font-size: 0.9rem; } .nav-toggle { display: none; } }
.btn-web-play {
  display: inline-block; padding: 8px 20px; border-radius: 8px; font-weight: 600; font-size: 0.85rem;
  background: var(--color-primary-dark); color: white; transition: all var(--transition);
}
.btn-web-play:hover { filter: brightness(0.9); transform: translateY(-1px); }

/* ========================================
   Buttons
   ======================================== */
.btn { display: inline-block; border-radius: var(--radius-md); transition: all var(--transition); cursor: pointer; text-align: center; }
.btn:hover { transform: translateY(-2px); }
.btn-app-store img, .btn-google-play img, .btn-app-store-large img, .btn-google-play-large img { height: 48px; width: auto; }
.btn-web, .btn-web-large {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 32px; border-radius: var(--radius-md); font-weight: 600; font-size: 1rem;
  background: white; color: var(--color-primary-dark); border: 2px solid white;
  transition: all var(--transition);
}
.btn-web:hover, .btn-web-large:hover { background: transparent; color: white; }

/* ========================================
   Hero
   ======================================== */
.hero-section {
  background: linear-gradient(135deg, var(--color-dark) 0%, #1a1a2e 50%, #16213e 100%);
  color: white; padding: 120px 0 var(--spacing-xxl); position: relative; overflow: hidden;
}
.hero-content { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--spacing-xl); }
.hero-text { max-width: 600px; }
.badge { display: inline-block; background: rgba(59,130,246,0.2); border: 1px solid rgba(59,130,246,0.3); padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; margin-bottom: var(--spacing-md); color: #93C5FD; }
.hero-title { margin-bottom: var(--spacing-sm); line-height: 1.1; }
.hero-subtitle { font-size: 1.125rem; margin-bottom: var(--spacing-lg); opacity: 0.8; line-height: 1.6; }
.cta-buttons { display: flex; flex-direction: column; gap: var(--spacing-sm); align-items: center; }
.hero-visual { max-width: 340px; }
.hero-visual img { width: 100%; border-radius: var(--radius-lg); filter: drop-shadow(0 20px 60px rgba(59,130,246,0.3)); }
@media (min-width: 1024px) {
  .hero-section { padding: 140px 0 80px; }
  .hero-content { flex-direction: row; justify-content: space-between; text-align: left; }
  .hero-text { max-width: 520px; }
  .cta-buttons { flex-direction: row; flex-wrap: wrap; }
  .hero-visual { max-width: 380px; }
}

/* ========================================
   Web Announcement
   ======================================== */
.web-announce-section { background: var(--color-surface); }
.web-announce { display: flex; flex-direction: column; align-items: center; gap: var(--spacing-xl); text-align: center; }
.web-announce-text { max-width: 500px; }
.web-announce-text h2 { color: var(--color-primary); }
.web-announce-text p { color: var(--color-text-secondary); font-size: 1.1rem; margin-bottom: var(--spacing-md); }
.web-announce-text .btn-web-large { background: var(--color-primary-dark); color: white; border-color: var(--color-primary-dark); }
.web-announce-text .btn-web-large:hover { filter: brightness(0.9); }
.web-announce-visual { max-width: 320px; }
.web-announce-visual img { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) {
  .web-announce { flex-direction: row; text-align: left; justify-content: space-between; }
}

/* ========================================
   Game Modes
   ======================================== */
.modes-grid { display: grid; grid-template-columns: 1fr; gap: var(--spacing-md); }
.mode-card {
  background: var(--color-dark-surface); border-radius: var(--radius-lg); padding: var(--spacing-md);
  transition: transform var(--transition), box-shadow var(--transition); overflow: hidden;
}
.mode-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.mode-header {
  display: inline-block; padding: 4px 14px; border-radius: 6px; font-family: var(--font-heading);
  font-weight: 700; font-size: 0.9rem; margin-bottom: var(--spacing-sm); text-transform: uppercase; letter-spacing: 0.05em;
}
.mode-header.practice { background: #3B82F6; }
.mode-header.swipe, .mode-header.standard { background: #10B981; }
.mode-header.arcade { background: #F59E0B; color: #1E293B; }
.mode-header.survival { background: #EF4444; }
.mode-header.timeattack { background: #8B5CF6; }
.mode-header.duel { background: #EC4899; }
.mode-card p { color: rgba(255,255,255,0.7); font-size: 0.95rem; margin-bottom: var(--spacing-sm); }
.mode-img { border-radius: var(--radius-md); width: 100%; }
.modes-grid { align-items: start; }
.modes-figure { max-width: 360px; margin: var(--spacing-xl) auto 0; }
.modes-figure img { border-radius: var(--radius-lg); width: 100%; }
@media (min-width: 768px) { .modes-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .modes-grid { grid-template-columns: repeat(3, 1fr); } }

/* ========================================
   Features
   ======================================== */
.features-grid-new { display: grid; grid-template-columns: 1fr; gap: var(--spacing-md); }
.feature-item {
  padding: var(--spacing-lg); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  transition: all var(--transition);
}
.feature-item:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.feature-num { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; color: var(--color-primary); opacity: 0.3; margin-bottom: var(--spacing-xs); }
.feature-item h3 { margin-bottom: var(--spacing-xs); }
.feature-item p { color: var(--color-text-secondary); margin: 0; font-size: 0.95rem; }
@media (min-width: 768px) { .features-grid-new { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .features-grid-new { grid-template-columns: repeat(3, 1fr); } }

/* ========================================
   Gallery
   ======================================== */
.gallery-scroll {
  display: flex; gap: var(--spacing-md); overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; padding-bottom: var(--spacing-sm);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.gallery-scroll::-webkit-scrollbar { height: 6px; }
.gallery-scroll::-webkit-scrollbar-track { background: transparent; }
.gallery-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.gallery-scroll .gallery-item {
  flex: 0 0 260px; scroll-snap-align: start; border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--transition);
}
.gallery-scroll .gallery-item:hover { transform: scale(1.03); }
.gallery-scroll .gallery-item img { width: 100%; height: auto; display: block; }
@media (min-width: 768px) { .gallery-scroll .gallery-item { flex: 0 0 300px; } }

/* ========================================
   FAQ
   ======================================== */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { background: var(--color-surface); border-radius: var(--radius-lg); margin-bottom: var(--spacing-sm); overflow: hidden; border: 1px solid var(--color-border); }
.faq-question {
  width: 100%; padding: var(--spacing-md); text-align: left; font-size: 1rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; transition: background var(--transition);
}
.faq-question:hover { background: white; }
.faq-icon { font-size: 1.25rem; transition: transform var(--transition); color: var(--color-primary); }
.faq-item.active .faq-icon { transform: rotate(45deg); }
.faq-answer p { padding: 0 var(--spacing-md) var(--spacing-md); color: var(--color-text-secondary); line-height: 1.7; }
.faq-answer a { color: var(--color-primary); text-decoration: underline; }

/* ========================================
   CTA
   ======================================== */
.cta-section {
  background: linear-gradient(135deg, var(--color-dark) 0%, #1a1a2e 100%);
  color: white; text-align: center;
}
.cta-section .section-title, .cta-section .section-subtitle { color: white; }
.cta-section .section-subtitle { opacity: 0.7; }
.cta-buttons-large { display: flex; flex-direction: column; gap: var(--spacing-md); align-items: center; }
@media (min-width: 768px) { .cta-buttons-large { flex-direction: row; justify-content: center; flex-wrap: wrap; } }

/* ========================================
   Footer
   ======================================== */
.footer { background: var(--color-dark); color: white; padding: var(--spacing-xxl) 0 var(--spacing-md); }
.footer-content { display: grid; grid-template-columns: 1fr; gap: var(--spacing-lg); margin-bottom: var(--spacing-xl); }
.footer-column h3 { margin-bottom: var(--spacing-md); color: white; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-logo { max-width: 80px; margin-bottom: var(--spacing-sm); border-radius: var(--radius-md); }
.footer-description { color: rgba(255,255,255,0.5); font-size: 0.9rem; }
.footer-links li { margin-bottom: var(--spacing-xs); }
.footer-links a { color: rgba(255,255,255,0.6); transition: color var(--transition); font-size: 0.9rem; }
.footer-links a:hover { color: white; }
.footer-download-buttons { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.footer-download-btn img { opacity: 0.7; transition: opacity var(--transition); }
.footer-download-btn:hover img { opacity: 1; }
.social-links { display: flex; gap: var(--spacing-sm); margin-top: var(--spacing-sm); }
.social-links a { transition: transform var(--transition), opacity var(--transition); }
.social-links a:hover { transform: translateY(-3px); opacity: 0.8; }
.social-links img { width: 36px; height: 36px; border-radius: 8px; }
.mt-20 { margin-top: 20px; }
.footer-link-button { color: rgba(255,255,255,0.6); font-size: 0.9rem; padding: 0; text-align: left; transition: color var(--transition); }
.footer-link-button:hover { color: white; }
.footer-bottom p { margin-bottom: var(--spacing-xs); }
.footer p a { color: rgba(255,255,255,0.6); transition: color var(--transition); }
.footer p a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: var(--spacing-md); text-align: center; color: rgba(255,255,255,0.65); font-size: 0.85rem; }
.footer-bottom a { color: rgba(255,255,255,0.9); text-decoration: underline; }
@media (min-width: 768px) { .footer-content { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-content { grid-template-columns: repeat(4, 1fr); } }

/* ========================================
   Animations
   ======================================== */
.fade-in { opacity: 1; transform: none; transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-in.pre-anim { opacity: 0; transform: translateY(20px); }
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, #2196F3, #4CAF50); z-index: 1050; }
.scroll-top { position: fixed; bottom: 20px; right: 20px; width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, #2196F3, #1976D2); color: white; font-size: 24px; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 1000; }
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { transform: scale(1.1); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; z-index: 9999; cursor: pointer; padding: 20px; }
.lightbox-img { max-width: 90%; max-height: 90vh; width: auto; height: auto; object-fit: contain; box-shadow: 0 0 50px rgba(255,255,255,0.2); border-radius: 8px; }

/* ========================================
   Accessibility
   ======================================== */
a:focus, button:focus, input:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ========================================
   Cookie Consent
   ======================================== */
.cookie-consent {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: rgba(15,23,42,0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: var(--spacing-md); display: flex; justify-content: center; align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2); animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cookie-consent-content { max-width: 1200px; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--spacing-md); flex-wrap: wrap; }
.cookie-consent[hidden] { display: none; }
.cookie-text { color: #fff; font-size: 0.9rem; margin: 0; flex: 1; min-width: 250px; }
.cookie-text a { color: #93C5FD; text-decoration: underline; }
.cookie-buttons { display: flex; gap: var(--spacing-sm); }
.cookie-btn { padding: 10px 24px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s ease; }
.cookie-btn { background: var(--color-primary-dark); color: white; min-width: 110px; }
.cookie-btn:hover { filter: brightness(0.9); }
.cookie-btn:focus-visible { outline: 2px solid white; outline-offset: 2px; }
@media (max-width: 600px) {
  .cookie-consent-content { flex-direction: column; text-align: center; }
  .cookie-buttons { width: 100%; justify-content: center; }
}

/* ========================================
   Invite and 404 pages
   ======================================== */
.invite-page { background: linear-gradient(135deg, var(--color-dark) 0%, #1a1a2e 50%, #16213e 100%); color: white; min-height: 100vh; }
.invite { max-width: 480px; margin: 0 auto; padding: 48px 16px 64px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--spacing-md); }
.invite-logo img { border-radius: var(--radius-md); }
.invite-title { font-size: 1.75rem; margin: 0; }
.invite-code-box { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius-lg); padding: var(--spacing-md); width: 100%; }
.invite-code-label { color: rgba(255,255,255,0.7); margin-bottom: var(--spacing-xs); }
.invite-code { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; letter-spacing: 0.12em; margin-bottom: var(--spacing-sm); overflow-wrap: anywhere; }
.invite-copy { background: white; color: var(--color-primary-dark); font-weight: 600; padding: 10px 28px; border-radius: var(--radius-md); min-height: 44px; }
.invite-copied { min-height: 1.6em; margin: var(--spacing-xs) 0 0; color: #93C5FD; }
.invite-buttons { display: flex; flex-direction: column; align-items: center; gap: var(--spacing-sm); }
.invite-buttons .btn img { height: 48px; width: auto; }
.invite-web { padding: 12px 28px; font-size: 1rem; }
.invite-hint { color: rgba(255,255,255,0.75); font-size: 0.95rem; margin: 0; }
.notfound { max-width: 560px; margin: 0 auto; padding: 120px 16px 80px; text-align: center; }
.notfound-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--spacing-sm); margin-top: var(--spacing-md); }
.notfound-links a { color: var(--color-primary-dark); text-decoration: underline; font-weight: 600; }

/* Print */
@media print { .hero-section, .cta-section, .footer, .site-nav { background: white; color: black; } .btn, .cta-buttons, .cta-buttons-large { display: none; } }
