/* ── UFO Math Workshop ─────────────────────────────────────────────────────── */

/* ── HUD ──────────────────────────────────────────────────────────────────── */
.ufo-hud {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hud-chip {
  background: rgba(255,255,255,0.9);
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

/* ── Stage wrapper ────────────────────────────────────────────────────────── */
.ufo-stage {
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Scene 1 – Sky / UFO
   ══════════════════════════════════════════════════════════════════════════ */
.sky-bg {
  min-height: 400px;
  background: radial-gradient(ellipse at 50% 10%, #1a2980 0%, #0d0d2b 70%);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 20px;
  position: relative;
}

/* Stars */
.stars-layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: none;
}
.star {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  animation: twinkle 2s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 0.2; }
}

/* UFO tap area */
.ufo-tap-area {
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  animation: ufo-float 3s ease-in-out infinite;
  outline: none;
}
@keyframes ufo-float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%       { transform: translateY(-16px) rotate(4deg); }
}

.ufo-disc {
  font-size: 100px;
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 0 22px rgba(100,200,255,0.75));
  -webkit-filter: drop-shadow(0 0 22px rgba(100,200,255,0.75));
  animation: disc-spin 1.8s ease-in-out infinite;
  transition: filter 0.3s;
  -webkit-transition: -webkit-filter 0.3s;
}
@keyframes disc-spin {
  0%, 100% { transform: scaleX(1); }
  25%       { transform: scaleX(0.25); }
  50%       { transform: scaleX(1); }
  75%       { transform: scaleX(0.25); }
}
.ufo-disc.stopped {
  animation: none;
  transform: scaleX(1);
  filter: drop-shadow(0 0 32px rgba(180,240,100,0.9));
  -webkit-filter: drop-shadow(0 0 32px rgba(180,240,100,0.9));
}
.ufo-tap-area:hover .ufo-disc {
  filter: drop-shadow(0 0 36px rgba(150,230,255,1));
  -webkit-filter: drop-shadow(0 0 36px rgba(150,230,255,1));
}

/* Character bubble that pops out of UFO on reveal */
.char-bubble {
  font-size: 54px;
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  animation: char-pop 0.45s cubic-bezier(0.34,1.56,0.64,1) forwards;
  z-index: 3;
}
@keyframes char-pop {
  from { transform: translateX(-50%) scale(0); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}

.sky-hint {
  color: #93c5fd;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   Scene 2 – Math test
   ══════════════════════════════════════════════════════════════════════════ */
.math-bg {
  min-height: 400px;
  background: linear-gradient(160deg, #dbeafe 0%, #ede9fe 100%);
  padding: 20px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 14px;
}

.math-toprow {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}
.math-char-badge { font-size: 40px; }
.q-counter { font-size: 14px; font-weight: 700; color: #64748b; }

/* Progress dots */
.prog-strip { display: -webkit-box; display: -webkit-flex; display: flex; gap: 6px; }
.prog-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.25s;
}
.prog-dot.ok      { background: #22c55e; }
.prog-dot.fail    { background: #ef4444; }
.prog-dot.current { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.35); }

/* Question card */
.math-card {
  background: #ffffff;
  border-radius: 22px;
  padding: 28px 22px 22px;
  box-shadow: 0 8px 32px rgba(15,23,42,0.12);
  text-align: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 20px;
}

.q-equation {
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 900;
  color: #1e293b;
  letter-spacing: 3px;
  animation: q-in 0.25s ease;
}
@keyframes q-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.opts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.opt-btn {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 800;
  padding: 18px 8px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: transform 80ms, background 80ms, border-color 80ms;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.opt-btn:hover  { background: #f0f9ff; border-color: #7dd3fc; }
.opt-btn:active { transform: scale(0.92); }
.opt-btn.correct { background: #dcfce7; border-color: #22c55e; color: #15803d; pointer-events: none; }
.opt-btn.wrong   { background: #fee2e2; border-color: #ef4444; color: #991b1b; pointer-events: none; }
.opt-btn.locked  { pointer-events: none; opacity: 0.55; }

.math-msg {
  font-size: 16px; font-weight: 700; min-height: 24px;
  text-align: center; margin: 0;
}
.math-msg.ok  { color: #16a34a; }
.math-msg.bad { color: #dc2626; }

/* ══════════════════════════════════════════════════════════════════════════
   Scene 3 – Moon (success)
   ══════════════════════════════════════════════════════════════════════════ */
.moon-bg {
  min-height: 440px;
  background: radial-gradient(ellipse at 50% 0%, #0f172a 0%, #020617 100%);
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
  overflow: hidden;
}

.space-stars {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: none;
}

.earth-dot {
  position: absolute;
  top: 18px; right: 22px;
  font-size: 38px;
  animation: earth-spin 12s linear infinite;
}
@keyframes earth-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Moon surface */
.moon-surface {
  width: 110%;
  min-height: 200px;
  background: linear-gradient(180deg, #d4d4d4 0%, #a0a0a0 100%);
  border-radius: 60% 60% 0 0;
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
  align-items: flex-end;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding-bottom: 16px;
  z-index: 2;
}

/* Hills */
.moon-hill {
  position: absolute;
  background: #b8b8b8;
  border-radius: 50% 50% 0 0;
  bottom: 0;
}
.mh-l { width: 180px; height: 90px; left: -30px; }
.mh-r { width: 140px; height: 70px; right: -20px; }

/* Craters */
.moon-crater {
  position: absolute;
  background: radial-gradient(circle at 35% 35%, #b0b0b0, #888);
  border-radius: 50%;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.3);
}
.mc-1 { width: 48px; height: 24px; top: 28px; left: 14%; }
.mc-2 { width: 28px; height: 14px; top: 48px; right: 22%; }
.mc-3 { width: 64px; height: 32px; bottom: 44px; left: 40%; transform: translateX(-50%); }

/* Moon items (carrots / fish) */
.moon-items {
  position: absolute;
  top: 22px;
  left: 50%; transform: translateX(-50%);
  display: -webkit-box; display: -webkit-flex; display: flex;
  gap: 8px; font-size: 30px;
  white-space: nowrap;
}
.moon-item { animation: item-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }
.moon-item:nth-child(1) { animation-delay: 0.0s; }
.moon-item:nth-child(2) { animation-delay: 0.1s; }
.moon-item:nth-child(3) { animation-delay: 0.2s; }
.moon-item:nth-child(4) { animation-delay: 0.3s; }
.moon-item:nth-child(5) { animation-delay: 0.4s; }
@keyframes item-pop {
  from { transform: scale(0) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0);    opacity: 1; }
}

/* Character on moon */
.moon-char {
  font-size: 56px;
  position: relative; z-index: 3;
  animation: moon-bounce 1.2s ease-in-out infinite;
}
@keyframes moon-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* Panel below moon */
.moon-panel {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 16px 20px 20px;
  margin: 10px 16px 16px;
  text-align: center;
  color: #e2e8f0;
  width: calc(100% - 32px);
  z-index: 3; position: relative;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  gap: 8px;
}
.moon-title { font-size: 20px; font-weight: 900; margin: 0; }
.moon-sub   { font-size: 14px; font-weight: 600; color: #94a3b8; margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   Scene 4 – Fail
   ══════════════════════════════════════════════════════════════════════════ */
.fail-bg {
  min-height: 400px;
  background: linear-gradient(160deg, #fff1f2 0%, #fce7f3 100%);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
  gap: 14px;
  padding: 32px 20px;
  text-align: center;
}
.fail-ufo  { font-size: 48px; filter: grayscale(0.5); -webkit-filter: grayscale(0.5); }
.fail-char { font-size: 64px; animation: char-sad 0.5s ease; }
@keyframes char-sad {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  60%       { transform: translateX(8px); }
}
.fail-score { font-size: 32px; font-weight: 900; color: #be123c; margin: 0; }
.fail-sub   { font-size: 16px; font-weight: 600; color: #9f1239; margin: 0; }

/* ── Shared action buttons ───────────────────────────────────────────────── */
.action-btn {
  padding: 14px 32px;
  border-radius: 16px;
  border: none;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 80ms, box-shadow 80ms;
  display: inline-block;
  margin-top: 4px;
}
.action-btn:active { transform: scale(0.93); }
.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  box-shadow: 0 6px 18px rgba(249,115,22,0.32);
}
.btn-retry {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  box-shadow: 0 6px 18px rgba(124,58,237,0.32);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ufo-disc { font-size: 76px; }
  .char-bubble { font-size: 42px; }
  .q-equation { font-size: 36px; }
  .opt-btn { padding: 14px 6px; font-size: 22px; }
  .moon-char { font-size: 44px; }
}
