/* Global */
@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: #f1f5f9;
  color: #0f172a;
  touch-action: manipulation;
}

/* Header */
.header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.15);
}

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

.site-logo {
  height: 40px;
  width: auto;
  border-radius: 8px;
}

.site-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Desktop nav */
.desktop-nav {
  display: flex;
}

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

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

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

.dropdown-toggle {
  cursor: pointer;
}

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

.dropdown-content a {
  display: block;
  padding: 10px 18px;
  font-size: 0.9rem;
  color: #4b5563;
  text-decoration: none;
  transition: all 0.2s ease;
}

.dropdown-content a:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  padding-left: 24px;
}

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

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

.mobile-menu {
  display: none;
  background: #064e3b;
  margin-top: 0.75rem;
  border-radius: 0.75rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.mobile-menu.open {
  max-height: 500px;
}

.mobile-menu a {
  display: block;
  padding: 10px 16px;
  color: #d1fae5;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 118, 110, 0.6);
  font-size: 0.95rem;
}

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

.mobile-menu a:hover {
  background-color: #047857;
}

/* Game container */
.game-container {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: calc(100vh - 200px);
  padding: 32px 0 48px;
}

/* Card grid */
.card-grid {
  display: grid;
  gap: 12px;
  justify-content: center;
  margin: 0 auto;
  max-width: 100%;
  padding: 20px 0;
}

/* Cards */
.card {
  width: 80px;
  height: 80px;
  position: relative;
  cursor: pointer;
  perspective: 1000px;
  transition: transform 0.15s ease;
}

.card:hover {
  transform: scale(1.04);
}

.card:active {
  transform: scale(0.96);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  border-radius: 12px;
}

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

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-front {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
}

.card-back {
  background: #ffffff;
  border: 3px solid #e2e8f0;
  transform: rotateY(180deg);
}

.card.matched {
  opacity: 0.7;
  transform: scale(0.9);
}

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

.card.hinted {
  outline: 3px solid #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.7);
}

/* Panels & buttons */
.stats-panel,
.control-panel,
.blog-section,
.faq-section {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Victory modal */
.victory-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.victory-content {
  background: #ffffff;
  padding: 32px;
  border-radius: 20px;
  text-align: center;
  max-width: 420px;
  margin: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.victory-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: victory-bounce 1s infinite;
}

@keyframes victory-bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Blog section */
.blog-section h2 {
  color: #111827;
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 18px;
  text-align: center;
}

.blog-section h3 {
  color: #111827;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 10px;
}

.blog-section p {
  color: #4b5563;
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: 0.97rem;
}

.blog-section ul,
.blog-section ol {
  color: #4b5563;
  line-height: 1.7;
  margin-bottom: 14px;
  padding-left: 22px;
}

.blog-section li {
  margin-bottom: 6px;
}

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

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

/* Highlight box */
.highlight-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-left: 4px solid #0ea5e9;
  padding: 18px;
  margin: 18px 0;
  border-radius: 10px;
}

/* FAQ */
.faq-section h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 18px;
  text-align: center;
}

.faq-item {
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.faq-item p {
  font-size: 0.95rem;
  color: #4b5563;
  margin: 0 0 4px 0;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 60px 0 30px;
  margin-top: 40px;
}

.footer-column h3 {
  color: #14b8a6;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
  position: relative;
}

.footer-column h3::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #14b8a6, #0d9488);
  border-radius: 2px;
}

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

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

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

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

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

/* Responsive */
@media (max-width: 1024px) {
  .header {
    position: sticky;
  }
}

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

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

  .site-title {
    font-size: 1.05rem;
  }

  .game-container {
    padding: 20px 0 32px;
  }

  .card {
    width: 60px;
    height: 60px;
  }

  .card-front,
  .card-back {
    font-size: 24px;
  }

  .blog-section,
  .faq-section,
  .control-panel,
  .stats-panel {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .card {
    width: 52px;
    height: 52px;
  }

  .card-front,
  .card-back {
    font-size: 20px;
  }

  .site-logo {
    height: 32px;
  }

  .site-title {
    display: none; /* keep logo only on very small screens */
  }
}
