:root {
  --bg: #f7f8fa;
  --card: #fff;
  --accent: #0077ff;
  --muted: #888;
  --correct: #4caf50;
  --wrong: #e53935;
  --shadow: rgba(0,0,0,0.1);
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background: var(--bg);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #222;
}

.card {
  background: var(--card);
  box-shadow: 0 8px 20px var(--shadow);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  max-width: 900px;
  width: 95%;
  position: relative;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
}

.lead { color: var(--muted); }

.controls { display: flex; justify-content: space-between; align-items: center; }
.progress { flex: 1; background: #eee; height: 6px; margin: 0 10px; border-radius: 3px; overflow: hidden; }
.progress i { display: block; background: var(--accent); width: 0%; height: 100%; transition: width .3s ease; }

.question-area {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 1rem;
  margin-top: 1rem;
}

.qbox .q { font-weight: 600; margin-bottom: 1rem; }
.options button {
  display: block;
  background: #f0f0f0;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.options button:hover { background: #e6e6e6; transform: scale(1.02); }
.options button.correct { background: var(--correct); color: white; }
.options button.wrong { background: var(--wrong); color: white; }

.side { display: flex; flex-direction: column; justify-content: space-between; }
.side-actions {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;          /* more spacing */
  margin-top: 1.2rem;
}
.side-actions .btn {
  flex: 1;                     /* both buttons become bigger evenly */
  padding: 1rem 1.25rem;       /* bigger height */
  font-size: 1.05rem;          /* bigger text */
  border-radius: 12px;         /* smoother shape */
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.result {
  display: none;
  text-align: center;
  padding: 2rem;
  position: relative;
}

.submit-mode {
    background-color: #28a745 !important; /* green */
    border-color: #28a745 !important;
    color: #fff !important;
}
.result.active { display: block; animation: fadeIn 0.4s ease-in; }
.result .score { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.badge { font-size: 1.25rem; font-weight: 600; color: var(--accent); }
.result-buttons { margin-top: 1rem; display: flex; justify-content: center; gap: 1rem; }

#confetti {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#sadOverlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  background: rgba(255,255,255,0.8);
  z-index: 20;
  pointer-events: none;
  animation: floatSad 1.5s ease-in-out infinite;
}

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

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

@media (max-width: 768px) {
  .question-area { grid-template-columns: 1fr; }
  .side { flex-direction: row; justify-content: space-between; }
  .side-actions .btn {
    font-size: 1.1rem;
    padding: 1.3rem 1.1rem;
    border-radius: 16px;
  }
}

/* --- Share Card (Hidden by default) --- */
.share-card {
  display: none; /* ✅ Hide initially */
  background: #f9fbff;
  border: 1px solid #e0e6ef;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
  text-align: center;
  box-shadow: 0 6px 18px rgba(11,102,209,0.08);
  animation: fadeIn 0.4s ease;
}

/* Becomes visible when .active class is added by JS */
.share-card.active {
  display: block;
}

.share-card-body h3 {
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--accent);
}

.share-card-body p {
  margin: 0 0 12px;
  color: var(--muted);
}

.share-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.share-links a {
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
}

.share-links a:hover {
  background: #005fcc;
  transform: scale(1.05);
}

.back-home {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.back-home:hover {
  background: #005fcc;
}

/* --------------------------- */
/* 📱 MOBILE RESPONSIVE FIXES  */
/* --------------------------- */

@media (max-width: 768px) {
  body {
    align-items: flex-start;
    padding: 1rem;
  }

  .card {
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .logo {
    font-size: 1.25rem;
    padding: 0.6rem 0.9rem;
  }

  .lead {
    font-size: 0.95rem;
  }

  .controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .progress {
    width: 100%;
    margin: 0.4rem 0;
  }

  /* Stack main question + sidebar */
  .question-area {
    display: flex;
    flex-direction: column;
  }

  .side {
    flex-direction: column;
    margin-top: 1rem;
    gap: 1rem;
  }

  .side-actions {
    justify-content: space-between;
    width: 100%;
  }

  .btn {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    padding: 0.75rem;
    border-radius: 10px;
  }

  .options button {
    font-size: 0.95rem;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.6rem;
  }

  .result-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .share-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .share-links a {
    width: 100%;
    text-align: center;
  }

  .back-home {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 1rem;
    padding: 0.8rem;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .btn,
  .options button {
    font-size: 0.9rem;
    padding: 0.7rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .score {
    font-size: 1.6rem;
  }
}

/* ------------------------------------ */
/* 🎮 GAME-SHOW FEEL ON MOBILE BUTTONS  */
/* ------------------------------------ */

/* Subtle glowing animation on hover/tap */
@media (max-width: 768px) {
  .btn,
  .options button,
  .back-home,
  .share-links a {
    transition: transform 0.12s ease, box-shadow 0.25s ease, background 0.25s ease;
  }

  /* Tap or hover feedback */
  .btn:active,
  .options button:active,
  .back-home:active,
  .share-links a:active {
    transform: scale(0.96);
    box-shadow: 0 0 12px rgba(0, 119, 255, 0.4);
  }

  /* Gentle hover glow (for tablets or desktop touch mode) */
  .btn:hover,
  .options button:hover,
  .share-links a:hover {
    background: #0062d9;
    box-shadow: 0 0 10px rgba(0, 119, 255, 0.35);
  }

  /* Animated pulse for correct/wrong answer reveal */
  .options button.correct {
    animation: pulseCorrect 0.35s ease;
  }
  .options button.wrong {
    animation: pulseWrong 0.35s ease;
  }

  /* 🎮 GAME-SHOW BUTTON STYLING */
  .side-actions .btn {
    flex: 1;
    padding: 1.2rem 1.4rem;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 14px;

    background: linear-gradient(135deg, #0077ff, #0056d6);
    box-shadow: 0 6px 18px rgba(0, 119, 255, 0.45);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  }

  /* Hover glow */
  .side-actions .btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 119, 255, 0.55);
  }

  /* Press animation */
  .side-actions .btn:active:not(:disabled) {
    transform: scale(0.94);
    box-shadow: 0 4px 12px rgba(0, 119, 255, 0.3);
  }

  /* ✳ Special style for submit (you already have submit-mode) */
  .submit-mode {
    background: linear-gradient(135deg, #28a745, #1e7d34) !important;
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.55) !important;
  }

  .submit-mode:hover {
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.65) !important;
    transform: translateY(-3px);
  }

  @keyframes pulseCorrect {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
    50% { transform: scale(1.05); box-shadow: 0 0 18px rgba(76, 175, 80, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
  }

  @keyframes pulseWrong {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(229, 57, 53, 0); }
    50% { transform: scale(0.94); box-shadow: 0 0 18px rgba(229, 57, 53, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(229, 57, 53, 0); }
  }
}

/* ===============================
   QUIZ LAYOUT FIX
   =============================== */

.quiz-context {
  max-width: 960px;
  margin: 40px auto 20px;
  padding: 20px 24px;
  background: #f7f9fc;
  border-left: 4px solid #1e40af;
  border-radius: 8px;
  font-size: 15px;
  color: #374151;
}

/* ===============================
   FORCE QUIZ CENTERING (FINAL FIX)
   =============================== */

/* Neutralize any right-push behavior */
.wrap {
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
  position: relative !important;
}

/* If parent uses flex and pushes right */
.quiz-shell {
  display: flex;
  justify-content: center !important;
  margin: 40px 0 80px;
}

/* Safety: prevent body-level flex issues */
body {
  background: #f9fafb; /* light neutral backdrop */
  display: block !important;
}