/* Typing Games — Hand-crafted CSS */
:root {
  --primary: #4F46E5;
  --accent: #7C3AED;
  --dark-bg: #0F172A;
  --light-bg: #F8FAFC;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(79,70,229,0.12);
  --shadow-lg: 0 8px 28px rgba(79,70,229,0.16);
  --radius: 10px;
  --max-width: 1140px;
}

[data-theme="dark"] {
  --dark-bg: #0F172A;
  --light-bg: #1a2236;
  --card-bg: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--light-bg);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* Nav */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
}
[data-theme="dark"] .navbar { background: rgba(15,23,42,0.85); }

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--primary); }

.lang-switcher {
  position: relative;
}

.lang-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }

.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 6px 0;
  min-width: 170px;
  margin-top: 4px;
}
.lang-dropdown.show { display: block; }

.lang-dropdown a {
  display: block;
  padding: 7px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.lang-dropdown a:hover { background: var(--light-bg); color: var(--primary); }
.lang-dropdown a.active { color: var(--primary); font-weight: 600; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 48px 20px 28px;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto;
}

/* Game */
.game-section {
  padding: 20px 0 40px;
}
.game-wrapper {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 820px;
  margin: 0 auto;
}
.game-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.stat-item {
  text-align: center;
  min-width: 80px;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
#gameCanvas {
  display: block;
  width: 100%;
  max-width: 760px;
  height: 420px;
  background: #0F172A;
  border-radius: 10px;
  margin: 0 auto;
  touch-action: none;
}

/* Highlights */
.highlights {
  padding: 40px 0;
}
.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.highlight-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.highlight-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.highlight-card .icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
  display: block;
}
.highlight-card h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary);
}
.highlight-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* FAQ */
.faq-section {
  padding: 40px 0 60px;
}
.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  user-select: none;
}
.faq-question::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--primary);
  transition: transform 0.2s;
}
.faq-item.open .faq-question::after { transform: rotate(45deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 20px;
}
.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 20px 16px;
}
.faq-answer p {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* Footer */
footer {
  background: var(--dark-bg);
  color: #94a3b8;
  padding: 32px 20px;
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}
.footer-links a { color: #94a3b8; font-size: 0.88rem; }
.footer-links a:hover { color: #c7d2fe; }
.footer-copy { font-size: 0.85rem; }

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--dark-bg);
  color: #e2e8f0;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s;
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner p { font-size: 0.86rem; margin-right: 16px; }
.cookie-banner button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.cookie-banner button:hover { background: var(--accent); }

/* About/Privacy pages */
.page-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px;
}
.page-content h1 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--primary);
}
.page-content h2 {
  font-size: 1.3rem;
  margin: 28px 0 12px;
  color: var(--text-primary);
}
.page-content p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}
.page-content a { color: var(--primary); }

/* 404 */
.not-found {
  text-align: center;
  padding: 80px 20px;
}
.not-found h1 { font-size: 4rem; color: var(--primary); margin-bottom: 12px; }
.not-found p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 24px; }

/* Mobile */
@media (max-width: 640px) {
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.82rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.95rem; }
  #gameCanvas { height: 340px; }
  .stat-value { font-size: 1.2rem; }
  .highlight-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .nav-brand { font-size: 1.1rem; }
  .nav-links { gap: 8px; }
  .nav-links a { font-size: 0.78rem; }
  #gameCanvas { height: 280px; }
}
