/* Global */
html, body {
  height: 100%;
}

body {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100%;
}

* {
  box-sizing: border-box;
}

/* HEADER */
.header {
  background: linear-gradient(135deg, #111827 0%, #1f2933 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Logo */
.site-logo {
  height: 40px;
  width: auto;
  display: block;
}

.logo-text {
  color: #f9fafb;
  font-weight: 800;
  font-size: 1.15rem;
}

.logo-link {
  text-decoration: none;
}

/* Desktop nav */
.nav-links-desktop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-link {
  color: #f9fafb;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
}

.nav-link:hover {
  color: #e5e7eb;
  transform: translateY(-1px);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background: #ffffff;
  min-width: 220px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  z-index: 9999;
}

.dropdown-content a {
  color: #4b5563;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  transition: all 0.2s ease;
  font-size: 14px;
}

.dropdown-content a:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding-left: 26px;
}

.dropdown-content.show {
  display: block;
}

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 2px solid #10b981;
  border-radius: 8px;
  color: #ecfdf5;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 10px;
}

.mobile-menu {
  display: none;
  background: linear-gradient(135deg, #047857 0%, #10b981 100%);
  padding: 10px 0 14px;
  border-top: 1px solid rgba(15, 118, 110, 0.6);
}

.mobile-menu a {
  display: block;
  padding: 10px 18px;
  color: #ecfdf5;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(16, 185, 129, 0.45);
  transition: background 0.2s ease, padding-left 0.2s ease;
}

.mobile-menu a:last-child {
  border-bottom: none;
}

.mobile-menu a:hover {
  background: rgba(6, 95, 70, 0.85);
  padding-left: 24px;
}

.mobile-menu.open {
  display: block;
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HERO */
.page-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 72px 20px 90px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,0 Q300,60 600,30 T1200,0 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.1)"/></svg>') repeat-x bottom;
  background-size: 1200px 120px;
  opacity: 0.3;
}

.page-header h1 {
  font-size: 2.8rem;
  font-weight: 900;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  text-shadow: 2px 2px 4px rgba(15, 23, 42, 0.5);
}

.page-header p {
  font-size: 1.1rem;
  opacity: 0.96;
  position: relative;
  z-index: 1;
}

.page-header-sub {
  max-width: 780px;
  margin: 10px auto 0;
}

/* Animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

/* MAIN LAYOUT */
.game-container {
  max-width: 1400px;
  margin: -50px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.game-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
}

/* Cards */
.game-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 32px 30px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  animation: slideUp 0.6s ease;
}

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

.card-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #4f46e5;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-text {
  font-size: 0.95rem;
  color: #4b5563;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Buttons */
.game-btn {
  padding: 13px 24px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 10px;
}

.game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.game-btn.secondary {
  background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
}

.game-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Info boxes */
.info-box {
  padding: 16px 18px;
  border-radius: 14px;
  margin-top: 14px;
  border-left: 4px solid #4f46e5;
  background: linear-gradient(135deg, #f9fafb 0%, #eef2ff 100%);
}

.info-box.secondary {
  border-left-color: #ec4899;
  background: linear-gradient(135deg, #fff7ed 0%, #fef2f2 100%);
}

.info-box.difficulty-box {
  border-left-color: #22c55e;
  background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
}

.info-title {
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.info-body {
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.7;
}

.current-difficulty {
  font-size: 1.1rem;
  font-weight: 800;
  color: #16a34a;
}

.difficulty-note {
  font-size: 0.85rem;
  margin-top: 6px;
  color: #4b5563;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-box {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  padding: 16px 16px 14px;
  border-radius: 14px;
  text-align: center;
  border-left: 4px solid #4f46e5;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4f46e5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: #4338ca;
}

/* Achievement */
.achievement-list {
  list-style: none;
  padding-left: 0;
  margin: 12px 0 16px;
}

.achievement-list li {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 6px;
}

.player-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
}

.player-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.player-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.2);
}

.achievement-badge {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: #e5e7eb;
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 8px 16px;
  text-align: center;
  margin-bottom: 12px;
}

/* Canvas */
#gameCanvas {
  width: 100%;
  border-radius: 16px;
  background: #1a1a2e;
  display: block;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

/* Mobile controls */
.mobile-controls {
  display: none;
  margin-top: 14px;
  text-align: center;
}

.mobile-controls-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 6px;
}

.mobile-arrow {
  border-radius: 999px;
  border: none;
  width: 52px;
  height: 52px;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.45);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.mobile-arrow:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.6);
}

/* Game hint */
.game-hint {
  text-align: center;
  margin-top: 14px;
  color: #4f46e5;
  font-size: 0.85rem;
  font-weight: 600;
}

/* AdSense */
.adsense-container {
  background: linear-gradient(135deg, #eef2ff 0%, #e5e7eb 100%);
  border-radius: 16px;
  padding: 18px;
  margin: 24px 0;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #c7d2fe;
}

.adsense-placeholder {
  text-align: center;
  color: #4f46e5;
  font-size: 0.9rem;
}

.adsense-icon {
  font-size: 2.4rem;
  margin-bottom: 4px;
}

.adsense-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* History */
.history-empty {
  text-align: center;
  padding: 18px;
  color: #9ca3af;
  font-size: 0.9rem;
}

.history-item {
  background: linear-gradient(135deg, #eef2ff 0%, #e5e7eb 100%);
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideInRight 0.5s ease;
}

.history-score {
  font-size: 0.95rem;
  font-weight: 700;
  color: #4f46e5;
}

.history-date {
  font-size: 0.78rem;
  color: #6b7280;
}

.history-medal {
  font-size: 1.4rem;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Notifications */
.notification {
  position: fixed;
  top: 90px;
  right: 20px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
  z-index: 10000;
  animation: slideInRight 0.5s ease;
  max-width: 320px;
  font-size: 0.9rem;
}

.notification.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 26px;
  max-width: 540px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #4f46e5;
  margin-bottom: 14px;
  text-align: center;
}

.difficulty-btn {
  padding: 11px 20px;
  background: linear-gradient(135deg, #f9fafb 0%, #eef2ff 100%);
  color: #4f46e5;
  border: 2px solid #4f46e5;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 8px;
}

.difficulty-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  transform: translateY(-2px);
}

.difficulty-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
}

/* BLOG */
.blog-section {
  max-width: 1000px;
  margin: 60px auto 80px;
  padding: 0 20px;
}

.blog-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 48px 42px 46px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.2);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 2rem;
  font-weight: 900;
  color: #111827;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-content h3 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 28px;
  margin-bottom: 14px;
}

.blog-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin-top: 22px;
  margin-bottom: 8px;
}

.blog-content p {
  color: #4b5563;
  font-size: 0.98rem;
  margin-bottom: 16px;
}

.blog-content ul {
  color: #4b5563;
  margin-left: 24px;
  margin-bottom: 16px;
}

.blog-content li {
  margin-bottom: 8px;
}

.blog-content strong {
  color: #4f46e5;
  font-weight: 700;
}

.blog-content a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.blog-content a:hover {
  text-decoration: underline;
}

.highlight-box {
  background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
  padding: 18px 18px;
  border-radius: 14px;
  border-left: 4px solid #4f46e5;
  margin: 22px 0;
  font-size: 0.95rem;
}

.example-box {
  background: #eef2ff;
  padding: 16px 18px;
  border-radius: 14px;
  border-left: 4px solid #7c3aed;
  margin: 20px 0;
  font-size: 0.95rem;
}

.faq-item {
  margin-top: 16px;
  padding-top: 6px;
}

.faq-item h4 {
  margin-bottom: 4px;
}

/* FOOTER */
.footer {
  background: linear-gradient(135deg, #111827 0%, #020617 100%);
  color: white;
  padding: 50px 0 20px;
  margin-top: 40px;
}

.footer-column h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column ul li {
  margin-bottom: 8px;
}

.footer-column ul li a {
  color: #cbd5e0;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
  font-size: 0.9rem;
}

.footer-column ul li a:hover {
  color: #60a5fa;
  transform: translateX(4px);
}

.footer-bottom {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin-top: 28px;
  padding-top: 18px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Hide desktop nav + More dropdown completely on mobile */
  .nav-links-desktop,
  .nav-links-desktop .dropdown,
  .nav-links-desktop .dropdown-toggle {
    display: none !important;
  }

  .mobile-menu-btn {
    display: block;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .page-header p {
    font-size: 0.95rem;
  }

  .game-card {
    padding: 22px 18px 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .blog-content {
    padding: 28px 20px 26px;
  }

  .mobile-controls {
    display: block;
  }
}


@media (max-width: 480px) {
  .logo-text {
    font-size: 0.95rem;
  }

  .game-container {
    margin-top: -40px;
  }

  #gameCanvas {
    height: auto;
  }
}
