/* ============================================
   Basket Random — Main Stylesheet
   Basketball-themed, responsive, dark/light mode
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #FF6B2B;
  --primary-hover: #E55A1F;
  --primary-light: #FF8C5A;
  --secondary: #1A1A2E;
  --accent: #E94560;
  --gold: #F5A623;
  --bg: #FDF6F0;
  --bg-card: #FFFFFF;
  --text: #2C2C2C;
  --text-light: #5A5A5A;
  --text-muted: #888888;
  --border: #E8E0D8;
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 26, 46, 0.10);
  --shadow-lg: 0 8px 32px rgba(26, 26, 46, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: 0.25s ease;
  --font-heading: 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1200px;
  --navbar-height: 64px;
}

[data-theme="dark"] {
  --secondary: #0F0F1E;
  --bg: #12121F;
  --bg-card: #1E1E32;
  --text: #E8E8E8;
  --text-light: #B0B0B0;
  --text-muted: #777783;
  --border: #2A2A40;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.20);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.36);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h1, .h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
h2, .h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3, .h3 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-height);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--secondary);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.03em;
  transition: opacity var(--transition);
}

.nav-logo:hover {
  opacity: 0.8;
  text-decoration: none;
}

.nav-logo .logo-icon {
  font-size: 1.6rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Language Dropdown */
.lang-dropdown {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.lang-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.lang-btn .arrow {
  font-size: 0.6rem;
  margin-left: 2px;
  transition: transform var(--transition);
}

.lang-dropdown.open .lang-btn .arrow {
  transform: rotate(180deg);
}

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1001;
  max-height: 360px;
  overflow-y: auto;
}

.lang-dropdown.open .lang-menu {
  display: block;
}

.lang-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text);
  transition: background var(--transition);
}

.lang-menu a:hover,
.lang-menu a.active {
  background: var(--bg);
  color: var(--primary);
  text-decoration: none;
}

.lang-menu a.active {
  font-weight: 600;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  transform: rotate(15deg);
}

/* ---------- Hero Section ---------- */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, #252550 50%, var(--secondary) 100%);
  color: #fff;
  padding: 60px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255, 107, 43, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(233, 69, 96, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5rem);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  max-width: 650px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

/* Game Container */
.game-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 2px solid var(--primary);
}

.game-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0a14;
}

.game-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 14px 20px;
  background: var(--bg-card);
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(255, 107, 43, 0.35);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 43, 0.45);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: transparent;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--primary);
  color: #fff;
}

.score-display {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-display span {
  color: var(--primary);
  font-size: 1.8rem;
}

/* ---------- Highlights Section ---------- */
.section {
  padding: 72px 24px;
}

.section-alt {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  text-align: center;
  color: var(--secondary);
  margin-bottom: 12px;
}

.section-desc {
  text-align: center;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 48px;
  font-size: 1.05rem;
}

/* Highlights Grid */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.highlight-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  transition: all var(--transition);
}

.highlight-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.highlight-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  display: block;
}

.highlight-card h3 {
  font-size: 1.2rem;
  color: var(--secondary);
  margin-bottom: 8px;
}

.highlight-card p {
  color: var(--text-light);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ---------- FAQ Section ---------- */
.faq-list {
  max-width: 750px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

details.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
}

details.faq-item[open] {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

details.faq-item summary {
  padding: 18px 48px 18px 24px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--secondary);
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
}

details.faq-item summary::-webkit-details-marker {
  display: none;
}

details.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--primary);
  transition: transform var(--transition);
}

details.faq-item[open] summary::after {
  content: '−';
  transform: translateY(-50%);
}

details.faq-item .faq-answer {
  padding: 0 24px 18px;
  color: var(--text-light);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--secondary);
  color: rgba(255,255,255,0.75);
  padding: 40px 24px;
  text-align: center;
  border-top: 4px solid var(--primary);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--primary-light);
  text-decoration: none;
}

.footer-email {
  color: var(--primary-light);
  font-size: 0.9rem;
  word-break: break-all;
}

.footer-copy {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  margin-top: 12px;
}

/* ---------- Cookie Banner ---------- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.4s ease;
}

.cookie-banner.visible {
  transform: translateY(0);
}

.cookie-banner p {
  font-size: 0.85rem;
  color: var(--text-light);
  flex: 1;
  min-width: 220px;
  max-width: 700px;
}

.cookie-banner .btn-primary {
  font-size: 0.85rem;
  padding: 10px 20px;
  white-space: nowrap;
}

/* ---------- About & Privacy Page ---------- */
.page-header {
  background: linear-gradient(135deg, var(--secondary) 0%, #252550 100%);
  color: #fff;
  padding: 48px 24px;
  text-align: center;
}

.page-header h1 {
  background: linear-gradient(135deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

.page-content h2 {
  color: var(--secondary);
  margin: 36px 0 14px;
}

.page-content h2:first-child {
  margin-top: 0;
}

.page-content p {
  color: var(--text-light);
  margin-bottom: 16px;
  font-size: 1rem;
  line-height: 1.8;
}

.page-content ul {
  margin: 8px 0 20px 24px;
  color: var(--text-light);
}

.page-content ul li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.feature-list {
  list-style: none;
  margin-left: 0 !important;
}

.feature-list li {
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.feature-list li::before {
  content: '🏀';
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.contact-box p {
  margin-bottom: 8px;
}

.contact-box a {
  font-weight: 600;
}

/* ---------- 404 Page ---------- */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  padding: 48px 24px;
}

.not-found-emoji {
  font-size: 6rem;
  margin-bottom: 16px;
  animation: bounce 1.5s infinite;
}

.not-found h1 {
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--primary);
  margin-bottom: 8px;
}

.not-found p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* ---------- Animations ---------- */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-8px); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.fade-in {
  animation: fadeInUp 0.6s ease both;
}

.fade-in-1 { animation-delay: 0.1s; }
.fade-in-2 { animation-delay: 0.2s; }
.fade-in-3 { animation-delay: 0.3s; }
.fade-in-4 { animation-delay: 0.4s; }
.fade-in-5 { animation-delay: 0.5s; }
.fade-in-6 { animation-delay: 0.6s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .navbar-inner {
    padding: 0 16px;
    gap: 8px;
  }

  .nav-logo {
    font-size: 1.1rem;
  }

  .lang-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .highlights-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero {
    padding: 40px 16px 32px;
  }

  .game-controls {
    gap: 12px;
    padding: 10px 14px;
  }

  .btn-primary {
    padding: 10px 20px;
    font-size: 1rem;
  }

  .section {
    padding: 48px 16px;
  }

  .cookie-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .nav-logo {
    font-size: 1rem;
    gap: 4px;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .score-display {
    font-size: 1.1rem;
  }

  .footer-links {
    gap: 14px;
  }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
