*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

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

/* HEADER */

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

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

.logo-img {
  height: 40px;
  width: auto;
}

/* Desktop nav */

.desktop-nav {
  display: flex;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.nav-link:hover {
  color: #e5e7eb;
  transform: scale(1.1);
}

/* Dropdown */

.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  animation: fadeInDown 0.25s ease;
  z-index: 1100;
}

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

.dropdown-content a:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  padding-left: 28px;
}

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

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

/* Mobile menu */

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

.mobile-menu.open {
  display: block;
  max-height: 420px;
  opacity: 1;
}

.mobile-menu-inner {
  display: flex;
  flex-direction: column;
  padding: 12px 20px 20px;
}

.mobile-menu-inner a {
  color: #ecfdf5;
  text-decoration: none;
  padding: 10px 4px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mobile-menu-inner a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

/* HERO */

.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  padding: 80px 20px;
  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: 48px;
  font-weight: 900;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  animation: slideInDown 0.5s ease;
}

.page-header p {
  font-size: 20px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  animation: slideInUp 0.5s ease;
}

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

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

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
}

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

/* GAME LAYOUT */

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

.game-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.5s ease;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 26px;
  font-weight: 800;
  color: #667eea;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#gameCanvas {
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  background: linear-gradient(180deg, #87ceeb 0%, #e0f6ff 100%);
  cursor: crosshair;
}

.game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.game-btn {
  padding: 14px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.game-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.game-btn:active:not(:disabled) {
  transform: translateY(0);
}

.game-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* STATS */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 22px;
  border-radius: 16px;
  color: #ffffff;
  text-align: center;
  transition: all 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.stat-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
}

/* LEADERBOARD */

.leaderboard-table {
  width: 100%;
  margin-top: 24px;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

.leaderboard-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
}

.leaderboard-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 14px;
}

.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  color: #4a5568;
  font-size: 14px;
}

.leaderboard-table tr:hover {
  background: #f9fafb;
}

.rank-badge {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
  font-size: 14px;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
}

.rank-badge.silver {
  background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
}

/* FORM / BUTTONS BELOW GAME */

.input-group {
  margin-bottom: 18px;
}

.input-label {
  font-weight: 600;
  color: #5a67d8;
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.input-field {
  width: 100%;
  padding: 12px;
  border: 2px solid #667eea;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.25s ease;
  color: #1e293b;
  background: #ffffff;
}

.input-field:focus {
  outline: none;
  border-color: #764ba2;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12);
  transform: scale(1.02);
}

.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.download-btn {
  flex: 1;
  min-width: 160px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* INFO / ADS */

.info-box {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9d5ff 100%);
  padding: 18px 20px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  margin-top: 24px;
}

.info-title {
  font-weight: 700;
  color: #5a67d8;
  margin-bottom: 6px;
  font-size: 15px;
}

.info-text {
  color: #4c1d95;
  font-size: 14px;
  line-height: 1.7;
}

.adsense-container {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9d5ff 100%);
  border-radius: 16px;
  padding: 20px;
  margin: 24px 0;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #c4b5fd;
}

.adsense-placeholder {
  text-align: center;
  color: #5a67d8;
  font-size: 14px;
}

/* BLOG */

.blog-section {
  max-width: 900px;
  margin: 80px auto;
  padding: 0 20px;
}

.blog-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 50px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 34px;
  font-weight: 900;
  color: #1a202c;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-content h3 {
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  margin-top: 32px;
  margin-bottom: 18px;
}

.blog-content p {
  color: #4a5568;
  font-size: 16px;
  margin-bottom: 18px;
  line-height: 1.9;
}

.blog-content ul,
.blog-content ol {
  color: #4a5568;
  margin-left: 28px;
  margin-bottom: 18px;
}

.blog-content li {
  margin-bottom: 10px;
  line-height: 1.8;
}

.blog-content strong {
  color: #667eea;
  font-weight: 700;
}

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

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

.highlight-box {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9d5ff 100%);
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  margin: 26px 0;
}

.example-box {
  background: #f0f4ff;
  padding: 18px 20px;
  border-radius: 12px;
  border-left: 4px solid #764ba2;
  margin: 22px 0;
}

/* FOOTER */

.footer {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: #ffffff;
  padding: 60px 0 20px;
  margin-top: 80px;
}

.footer-column h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

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

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

.footer-column ul li a:hover {
  color: #667eea;
  transform: translateX(5px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 36px;
  padding-top: 26px;
  text-align: center;
  color: #a0aec0;
  font-size: 14px;
}

/* RESPONSIVE */

/* Force-hide desktop nav on mobile */
@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

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

  .page-header {
    padding: 60px 16px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .page-header p {
    font-size: 16px;
  }

  .game-card {
    padding: 24px 18px;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
  }

  .blog-content {
    padding: 32px 22px;
  }

  .blog-content h2 {
    font-size: 26px;
  }

  .blog-content h3 {
    font-size: 20px;
  }

  .download-buttons {
    flex-direction: column;
  }

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

@media (min-width: 769px) {
  .mobile-menu {
    display: none !important;
  }
}
