/**
 * MagnaPop - Magnetic Chain-Reaction Puzzle Stylesheet
 * Clean Gamesdle Layout + Electric Violet/Cyan Magnetic Theme
 */
body {
  margin: 0;
  padding: 0;
  background-color: #f4f6fb;
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  color: #1e293b;
}

header {
  margin: 0 auto;
  text-align: center;
  padding: 10px 0;
}

.responsive {
  max-width: 90%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.game-title {
  text-align: center;
  margin: 10px 0 4px 0;
  font-family: 'Fredoka', cursive, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.game-subtitle {
  text-align: center;
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  color: #64748b;
  font-weight: 500;
}

/* Game Area Container */
#magnapop-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto 22px auto;
  padding: 0 12px;
  box-sizing: border-box;
  position: relative;
}

/* Top Magnetic HUD */
.magna-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1.5px solid #c7d2fe;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.08);
  box-sizing: border-box;
}

.hud-scores {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hud-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  line-height: 1.1;
}

.hud-value {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #4f46e5;
  line-height: 1.15;
}

.hud-value.best-val {
  color: #0f172a;
}

.hud-hand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.magnet-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.magnet-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.85);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.magnet-badge.next-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0.88;
}

/* Turn Hint Pill */
.turn-hint {
  width: 100%;
  max-width: 480px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 600;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 6px 12px;
  margin-bottom: 8px;
  box-sizing: border-box;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.turn-hint.hidden {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

/* Canvas Wrapper */
.canvas-stage {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
}

#gameCanvas {
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.32), 0 0 0 2px #4338ca;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: block;
  cursor: crosshair;
}

/* Control Buttons */
.controls-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 9px 18px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #3730a3;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.control-btn:hover:not(:disabled) {
  background: #eef2ff;
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.16);
}

.control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Game Over Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border: 2px solid #6366f1;
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  max-width: 350px;
  width: 100%;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.35);
  animation: popIn 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.82); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-emoji {
  font-size: 3rem;
  margin-bottom: 6px;
}

.modal-content h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: #312e81;
  margin: 0 0 6px 0;
}

.modal-content p {
  color: #64748b;
  font-size: 0.94rem;
  margin: 0 0 16px 0;
}

.modal-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.modal-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 6px;
}

.modal-stat-box span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 2px;
}

.modal-stat-box strong {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  color: #4f46e5;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 13px 24px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.48);
}

/* SEO Content Section - Boba Sort Card Layout (Indigo/Cyan Theme) */
article.seo-section {
  max-width: 600px;
  margin: 30px auto 45px auto;
  padding: 24px 22px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(30, 41, 59, 0.07);
  border: 1px solid #c7d2fe;
  box-sizing: border-box;
  color: #334155;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-align: left;
}

article.seo-section .section-header {
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

article.seo-section .section-header:first-of-type {
  margin-top: 0.2rem;
}

article.seo-section .seo-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: #eef2ff;
  color: #4f46e5;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 6px;
}

article.seo-section h2 {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.45rem;
  font-weight: 600;
  color: #0f172a;
  margin: 4px 0 10px 0;
  line-height: 1.3;
}

article.seo-section p {
  font-size: 0.98rem;
  line-height: 1.7;
  margin: 0 0 1rem 0;
  color: #475569;
}

/* Steps list */
article.seo-section .steps-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 20px 0;
}

article.seo-section .step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

article.seo-section .step-card:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

article.seo-section .step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

article.seo-section .step-content {
  flex: 1;
  font-size: 0.94rem;
  line-height: 1.55;
  color: #475569;
}

article.seo-section .step-content strong {
  display: block;
  color: #0f172a;
  margin-bottom: 2px;
  font-size: 0.98rem;
  font-weight: 700;
}

/* Features Grid */
article.seo-section .seo-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 0 22px 0;
}

article.seo-section .seo-feature-card {
  background: #f8fafc;
  border: 1px solid #e0e7ff;
  border-radius: 14px;
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

article.seo-section .seo-feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.1);
  border-color: #a5b4fc;
}

article.seo-section .feature-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: inline-block;
  line-height: 1;
}

article.seo-section .seo-feature-card h4 {
  font-family: 'Fredoka', sans-serif;
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  color: #0f172a;
  font-weight: 600;
}

article.seo-section .seo-feature-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #64748b;
}

/* Pro Tips Cards */
article.seo-section .tips-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 22px 0;
}

article.seo-section .tip-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 4px solid #eab308;
  border-radius: 10px;
  padding: 12px 14px;
}

article.seo-section .tip-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

article.seo-section .tip-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #713f12;
}

article.seo-section .tip-text strong {
  color: #422006;
  font-weight: 700;
}

/* FAQ Cards */
article.seo-section .faq-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

article.seo-section .faq-card {
  background: #f8fafc;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px 16px;
  transition: background 0.2s ease;
}

article.seo-section .faq-card h3 {
  font-family: 'Fredoka', sans-serif;
  margin: 0 0 6px 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

article.seo-section .faq-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #475569;
}

@media (max-width: 600px) {
  .game-title {
    font-size: 26px;
  }
  article.seo-section {
    margin: 20px 10px 35px 10px;
    padding: 18px 14px;
    border-radius: 16px;
  }
  article.seo-section .seo-features-grid {
    grid-template-columns: 1fr;
  }
  article.seo-section h2 {
    font-size: 1.3rem;
  }
}

/* Ad Banners - Responsive & Side Skyscrapers */
.ad-banner-wrapper {
  max-width: 728px;
  width: 95%;
  min-height: 90px;
  margin: 15px auto;
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
}

.ad-banner-top {
  margin-top: 10px;
  margin-bottom: 15px;
}

.ad-banner-bottom {
  margin-top: 25px;
  margin-bottom: 25px;
}

.side-banner {
  display: none;
  position: fixed;
  top: 100px;
  width: 160px;
  height: 600px;
  z-index: 40;
  text-align: center;
}

.side-banner-left {
  left: 12px;
}

.side-banner-right {
  right: 12px;
}

@media (min-width: 1140px) {
  .side-banner {
    display: block;
  }
}
