/* Global layout */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

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

/* Ensure all elements respect box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 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-title {
  white-space: nowrap;
}

/* Desktop nav */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: #22c55e;
  transition: width 0.25s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Dropdown */
.dropdown-content {
  display: none;
  position: absolute;
  top: 125%;
  right: 0;
  background: #ffffff;
  min-width: 240px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  z-index: 1200;
}

.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, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding-left: 28px;
}

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

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

.mobile-menu {
  max-height: 0;
  overflow: hidden;
  background: #16a34a;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.mobile-menu.open {
  max-height: 420px; /* enough for all links */
  opacity: 1;
}

.mobile-menu-inner {
  padding: 10px 18px 18px;
}

.mobile-menu-inner a {
  display: block;
  padding: 10px 6px;
  color: #f9fafb;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

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

.mobile-menu-inner a:hover {
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
}

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

.page-header p {
  font-size: 18px;
  max-width: 720px;
  margin: 0 auto;
  opacity: 0.98;
  position: relative;
  z-index: 1;
  animation: slideInUp 0.6s ease;
}

.hero-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

/* 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 2.2s ease-in-out infinite;
}

/* Game layout */
.game-container {
  max-width: 1400px;
  margin: -50px auto 60px;
  padding: 0 20px 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(0,0,0,0.15);
  animation: slideUp 0.6s ease;
}

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

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

/* Inputs */
.input-group {
  margin-bottom: 20px;
}

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

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

.input-field:focus {
  outline: none;
  border-color: #764ba2;
  box-shadow: 0 0 0 4px rgba(118,75,162,0.12);
  transform: scale(1.01);
}

/* Buttons */
.game-btn {
  padding: 13px 28px;
  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;
  width: 100%;
  margin-bottom: 10px;
}

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

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

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

/* Theme buttons */
.theme-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-btn {
  padding: 9px 14px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.theme-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(240,147,251,0.4);
}

/* Extra options */
.extra-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 6px;
}

.extra-option input {
  width: 16px;
  height: 16px;
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 14px 10px;
  border-radius: 14px;
  color: #ffffff;
  text-align: center;
}

.stat-label {
  font-size: 11px;
  opacity: 0.9;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

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

/* Board */
.memory-grid {
  display: grid;
  gap: 10px;
  margin: 0 auto;
  max-width: 820px;
}

.memory-card {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  perspective: 1000px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
  transform: rotateY(180deg);
}

.memory-card:hover .card-inner {
  transform: translateY(-3px);
}

.memory-card.flipped:hover .card-inner,
.memory-card.matched:hover .card-inner {
  transform: rotateY(180deg) translateY(-3px);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.card-front {
  background: #ffffff;
  transform: rotateY(180deg);
}

/* Players */
.player-list {
  margin-top: 10px;
}

.player-item {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9e4f0 100%);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.25s ease;
}

.player-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(102,126,234,0.45);
}

.player-name {
  font-weight: 700;
  font-size: 15px;
}

.player-score {
  font-size: 20px;
  font-weight: 900;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 16px;
  color: #9ca3af;
  font-size: 14px;
}

.empty-board {
  text-align: center;
  padding: 50px 20px 40px;
  color: #9ca3af;
}

.empty-board-emoji {
  font-size: 58px;
  margin-bottom: 12px;
}

.empty-board-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #4b5563;
}

.empty-board-text {
  font-size: 15px;
  margin-bottom: 4px;
}

.empty-board-subtext {
  font-size: 14px;
  opacity: 0.85;
}

/* Notification */
.notification {
  position: fixed;
  top: 90px;
  right: 18px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  padding: 16px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16,185,129,0.4);
  z-index: 2000;
  animation: slideInRight 0.4s ease;
  max-width: 320px;
  font-size: 14px;
}

.notification-text {
  font-weight: 600;
}

.notification.hide {
  animation: slideOutRight 0.4s ease forwards;
}

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

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100px); }
}

/* Particles */
.particle {
  position: fixed;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 1900;
  animation: particle-float 1s ease-out forwards;
}

@keyframes particle-float {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx, 0px), var(--ty, -100px)) scale(0);
    opacity: 0;
  }
}

/* Adsense placeholder */
.adsense-container {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9e4f0 100%);
  border-radius: 16px;
  padding: 20px;
  margin: 22px 0;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #c7d2fe;
}

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

.adsense-emoji {
  font-size: 36px;
  margin-bottom: 8px;
}

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

/* Certificate block */
.certificate-block {
  margin-top: 18px;
}

.certificate-note {
  font-size: 13px;
  color: #6b7280;
  margin-top: 8px;
}

/* How to play */
.how-to-play-box {
  background: linear-gradient(135deg, #f0f4ff 0%, #e9e4f0 100%);
  padding: 18px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.6;
}

.how-to-play-title {
  font-weight: 700;
  color: #667eea;
  margin-bottom: 6px;
}

.how-to-play-text {
  color: #4b5563;
}

/* Blog / SEO content */
.blog-section {
  max-width: 1050px;
  margin: 70px auto 40px;
  padding: 0 20px;
}

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

.blog-content h2 {
  font-size: 32px;
  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: 14px;
}

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

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

.blog-content ul {
  color: #4a5568;
  margin-left: 26px;
  margin-bottom: 18px;
  padding-left: 4px;
}

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

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

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

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

/* Footer */
.footer {
  background: linear-gradient(135deg, #111827 0%, #020617 100%);
  color: #ffffff;
  padding: 55px 0 20px;
  margin-top: 70px;
}

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

.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: #6366f1;
  transform: translateX(4px);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 32px;
  padding-top: 24px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

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

  .game-card {
    padding: 26px 22px 24px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

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

  .page-header {
    padding: 65px 16px 75px;
  }

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

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

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

  .card-face {
    font-size: 30px;
  }

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

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

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

  .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer {
    margin-top: 50px;
  }
}

@media (max-width: 480px) {
  .game-card {
    padding: 22px 16px 20px;
  }
}
