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

:root {
  --bg-start: #0a1f0e;
  --bg-mid: #0d2e14;
  --bg-end: #071a0a;
  --gold: #d4a843;
  --gold-light: #f0c96a;
  --gold-dark: #b8892e;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(212, 168, 67, 0.2);
  --text-main: #f0ead6;
  --text-muted: #a89b7a;
  --correct: #2ecc71;
  --wrong: #e74c3c;
  --correct-bg: rgba(46, 204, 113, 0.15);
  --wrong-bg: rgba(231, 76, 60, 0.15);
  --option-hover: rgba(212, 168, 67, 0.12);
  --option-border: rgba(212, 168, 67, 0.25);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body {
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  min-height: 100vh;
  color: var(--text-main);
  direction: rtl;
  overflow-x: hidden;
  position: relative;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--dur) ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.1; transform: scale(1); }
  to   { opacity: 0.8; transform: scale(1.3); }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeDown 0.7s ease both;
}

.crescent {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.4rem;
  filter: drop-shadow(0 0 16px rgba(212, 168, 67, 0.7));
  animation: sway 4s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-6deg); }
  50%       { transform: rotate(6deg); }
}

.title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.subtitle {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

.student-credit {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(212, 168, 67, 0.08);
  border: 1px solid rgba(212, 168, 67, 0.25);
  display: inline-block;
  padding: 0.35rem 1.2rem;
  border-radius: 50px;
  letter-spacing: 0.3px;
}

.card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2rem 2rem 1.8rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  animation: fadeUp 0.6s ease both;
}

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

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

.counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.2);
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 50px;
  margin-bottom: 1.4rem;
  letter-spacing: 0.5px;
}

.question {
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  font-weight: 700;
  line-height: 1.8;
  color: var(--text-main);
  margin-bottom: 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(212,168,67,0.12);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.option-btn {
  width: 100%;
  padding: 0.9rem 1.2rem;
  background: transparent;
  border: 1.5px solid var(--option-border);
  border-radius: 14px;
  color: var(--text-main);
  font-family: 'Cairo', sans-serif;
  font-size: 0.97rem;
  font-weight: 600;
  text-align: right;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--option-hover);
  opacity: 0;
  transition: opacity 0.25s;
}

.option-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateX(-4px);
  box-shadow: 0 4px 20px rgba(212,168,67,0.15);
}

.option-btn:disabled {
  cursor: default;
}

.option-badge {
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(212,168,67,0.15);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s;
}

.option-btn:hover:not(:disabled) .option-badge {
  background: var(--gold);
  color: #0a1f0e;
}

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
  transform: none;
  box-shadow: 0 0 20px rgba(46,204,113,0.2);
}

.option-btn.correct .option-badge {
  background: var(--correct);
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  color: var(--wrong);
  box-shadow: 0 0 20px rgba(231,76,60,0.2);
}

.option-btn.wrong .option-badge {
  background: var(--wrong);
  color: #fff;
}

.option-btn.dimmed {
  opacity: 0.4;
}

.result-box {
  display: none;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.9rem;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.result-box.correct {
  display: block;
  background: var(--correct-bg);
  border: 1px solid rgba(46,204,113,0.3);
  color: var(--correct);
}

.result-box.wrong {
  display: block;
  background: var(--wrong-bg);
  border: 1px solid rgba(231,76,60,0.3);
  color: var(--wrong);
}

.answer-box {
  display: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.4rem;
  animation: fadeUp 0.4s ease 0.15s both;
}

.answer-box.show {
  display: block;
}

.answer-box span {
  color: var(--gold-light);
}

.btn-next {
  display: block;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
  border: none;
  border-radius: 14px;
  color: #0a1f0e;
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 24px rgba(212,168,67,0.35);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn-next::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-next:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(212,168,67,0.5);
}

.btn-next:hover::after {
  opacity: 1;
}

.btn-next:active {
  transform: translateY(0);
}

.footer {
  margin-top: 2.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  opacity: 0.8;
  text-align: center;
}

/* ===== POPUP ===== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.popup-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.popup-box {
  position: relative;
  background: linear-gradient(145deg, #0f2a14, #1a4020);
  border: 2px solid var(--gold);
  border-radius: 28px;
  padding: 2.5rem 2rem 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 60px rgba(212, 168, 67, 0.35), 0 30px 80px rgba(0,0,0,0.6);
  overflow: hidden;
  transform: scale(0.7) translateY(40px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.popup-overlay.active .popup-box {
  transform: scale(1) translateY(0);
}

.popup-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(420px) rotate(720deg); opacity: 0; }
}

.popup-icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.8rem;
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
  filter: drop-shadow(0 0 20px rgba(212,168,67,0.6));
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.3) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.popup-title {
  font-size: 1.9rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
  animation: fadeUp 0.5s ease 0.3s both;
}

.popup-subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
  animation: fadeUp 0.5s ease 0.4s both;
}

.popup-prize {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: rgba(212, 168, 67, 0.12);
  border: 1.5px solid rgba(212, 168, 67, 0.3);
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.6rem;
  animation: fadeUp 0.5s ease 0.5s both;
}

.prize-icon {
  font-size: 1.8rem;
  animation: swing 1s ease-in-out 0.8s infinite alternate;
}

@keyframes swing {
  from { transform: rotate(-10deg); }
  to   { transform: rotate(10deg); }
}

.prize-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
}

.popup-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
  border: none;
  border-radius: 14px;
  color: #0a1f0e;
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 24px rgba(212,168,67,0.4);
  animation: fadeUp 0.5s ease 0.6s both;
}

.popup-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(212,168,67,0.55);
}

/* ===== END POPUP ===== */

@media (max-width: 480px) {
  .card {
    padding: 1.4rem 1rem 1.4rem;
    border-radius: 18px;
  }
  .option-btn {
    font-size: 0.9rem;
    padding: 0.8rem 1rem;
  }
  .crescent {
    font-size: 3rem;
  }
}
