/* ==========================================================================
   Recall Arena: Leadership Principles
   Colorful study quiz. Medium teal theme.
   ========================================================================== */

:root {
  --coral: #c46960;
  --teal-light: #a9d4d6;
  --teal-mid: #82c3c5;
  --teal-dark: #065758;
  --lime: #e2f03f;

  --bg-grad: linear-gradient(135deg, #6db3b5 0%, #4a9496 30%, #065758 70%, #044546 100%);
  --glass: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(255, 255, 255, 0.2);
  --glass-border: rgba(255, 255, 255, 0.28);
  --text: #f8ffff;
  --text-soft: rgba(248, 255, 255, 0.78);
  --shadow: 0 12px 40px rgba(4, 69, 70, 0.35);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ---- App shell ---- */
.arena-app {
  position: relative;
  min-height: 100dvh;
  isolation: isolate;
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: none;
  flex-direction: column;
  padding: 1rem 1.1rem 1.25rem;
  max-width: 720px;
  margin: 0 auto;
}

.screen--visible {
  display: flex;
  animation: screenIn 0.55s var(--ease-out);
}

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

/* ---- Animated background ---- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: blobDrift 22s ease-in-out infinite;
}

.blob-1 { width: 340px; height: 340px; background: var(--teal-light); top: -10%; left: -12%; }
.blob-2 { width: 280px; height: 280px; background: var(--lime); top: 55%; right: -15%; animation-delay: -5s; opacity: 0.35; }
.blob-3 { width: 220px; height: 220px; background: var(--coral); bottom: 5%; left: 10%; animation-delay: -10s; opacity: 0.4; }
.blob-4 { width: 160px; height: 160px; background: var(--teal-mid); top: 25%; left: 50%; animation-delay: -15s; }
.blob-5 { width: 200px; height: 200px; background: #0a8a8c; bottom: -8%; right: 25%; animation-delay: -8s; opacity: 0.45; }

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.08); }
  50% { transform: translate(-25px, 30px) scale(0.92); }
  75% { transform: translate(20px, 25px) scale(1.04); }
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(226, 240, 63, 0.15);
  animation: ringPulse 8s ease-in-out infinite;
}

.ring-1 { width: 420px; height: 420px; top: 15%; right: -20%; }
.ring-2 { width: 300px; height: 300px; bottom: 10%; left: -15%; animation-delay: -4s; border-color: rgba(169, 212, 214, 0.2); }

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.12); opacity: 0.85; }
}

/* ---- Top bar & score ---- */
.top-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-light);
  opacity: 0.9;
}

.score-bar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.score-meter {
  height: 10px;
  background: rgba(6, 87, 88, 0.5);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.score-meter__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--lime), var(--teal-light), var(--coral));
  border-radius: var(--radius-pill);
  transition: width 0.7s var(--ease-out);
  box-shadow: 0 0 16px rgba(226, 240, 63, 0.45);
}

.score-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
}

.score-stat em {
  font-style: normal;
  color: var(--text-soft);
  margin-right: 0.25rem;
}

.score-stat strong {
  font-weight: 800;
  font-size: 1rem;
}

.score-stat--accent strong {
  color: var(--lime);
}

/* ---- Hero / start ---- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  padding: 1rem 0 2rem;
}

.hero-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--coral), #d8847a);
  color: #fff;
  box-shadow: 0 4px 20px rgba(196, 105, 96, 0.45);
  animation: badgeBob 3s ease-in-out infinite;
}

@keyframes badgeBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.hero-title {
  font-size: clamp(2.6rem, 11vw, 4rem);
  font-weight: 900;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff 0%, var(--lime) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 12px rgba(6, 87, 88, 0.4));
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 34ch;
  line-height: 1.55;
}

/* ---- Mode segment control ---- */
.topic-segment {
  margin-bottom: 0.65rem;
}

.mode-segment {
  display: flex;
  width: 100%;
  max-width: 420px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(6, 87, 88, 0.55);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.mode-segment--compact {
  max-width: 100%;
  margin-bottom: 0.75rem;
}

.segment-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.segment-btn:hover { color: var(--text); }

.segment-btn--active {
  background: linear-gradient(135deg, var(--lime), #c5d830);
  color: var(--teal-dark);
  box-shadow: 0 4px 16px rgba(226, 240, 63, 0.4);
}

/* ---- CTA button ---- */
.cta-btn {
  position: relative;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-pill);
  color: var(--teal-dark);
  background: linear-gradient(135deg, var(--lime) 0%, #b8cc28 100%);
  box-shadow: 0 8px 28px rgba(226, 240, 63, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  overflow: hidden;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s;
  margin-top: 0.5rem;
}

.cta-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 36px rgba(226, 240, 63, 0.55);
}

.cta-btn:active { transform: scale(0.97); }

.cta-btn__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.35) 50%, transparent 60%);
  animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
  0%, 100% { transform: translateX(-120%); }
  50% { transform: translateX(120%); }
}

/* ---- Arena main ---- */
.arena-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.arena-title {
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  font-weight: 900;
  margin-bottom: 0.65rem;
  background: linear-gradient(90deg, var(--lime), var(--teal-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Quiz stage (central arena panel) ---- */
.quiz-stage {
  position: relative;
  width: 100%;
  padding: 3px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(226,240,63,0.35), rgba(130,195,197,0.25), rgba(196,105,96,0.2));
}

.stage-ring {
  position: absolute;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.stage-ring--outer {
  inset: -6px;
  border: 2px solid rgba(226, 240, 63, 0.2);
  animation: ringSpin 12s linear infinite;
}

.stage-ring--inner {
  inset: -2px;
  border: 1px solid rgba(169, 212, 214, 0.25);
  animation: ringSpin 18s linear infinite reverse;
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.stage-inner {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: calc(var(--radius-lg) - 3px);
  padding: 1.35rem 1.15rem 1.5rem;
  box-shadow: var(--shadow);
}

.quiz-stage.shake {
  animation: stageShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes stageShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ---- Prompt ---- */
.prompt-wrap {
  text-align: center;
  margin-bottom: 1.35rem;
  min-height: 5.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.prompt-wrap.prompt-in {
  animation: promptIn 0.5s var(--ease-out);
}

@keyframes promptIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.prompt-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--teal-mid), var(--teal-dark));
  color: var(--lime);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(226, 240, 63, 0.25);
}

.prompt-text {
  font-size: clamp(1.1rem, 4.2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  max-width: 36ch;
}

/* ---- 2x2 choices grid ---- */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.choice {
  position: relative;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.85rem 0.9rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  color: var(--teal-dark);
  cursor: pointer;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice:disabled { cursor: default; }

.choice:nth-child(1) {
  background: linear-gradient(145deg, #f0f878, var(--lime));
  box-shadow: 0 4px 14px rgba(226, 240, 63, 0.35);
}
.choice:nth-child(2) {
  background: linear-gradient(145deg, #c8ecee, var(--teal-light));
  box-shadow: 0 4px 14px rgba(169, 212, 214, 0.35);
}
.choice:nth-child(3) {
  background: linear-gradient(145deg, #e8a098, var(--coral));
  color: #fff;
  box-shadow: 0 4px 14px rgba(196, 105, 96, 0.35);
}
.choice:nth-child(4) {
  background: linear-gradient(145deg, #9ad4d6, var(--teal-mid));
  box-shadow: 0 4px 14px rgba(130, 195, 197, 0.35);
}

.choice:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 22px rgba(6, 87, 88, 0.25);
}

.choice:active:not(:disabled) {
  transform: scale(0.95);
  animation: choicePop 0.35s var(--ease-bounce);
}

@keyframes choicePop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.choice--green-outline {
  border: 3px solid #34d399 !important;
  box-shadow:
    0 0 0 2px rgba(52, 211, 153, 0.35),
    0 0 18px rgba(52, 211, 153, 0.5) !important;
  opacity: 1 !important;
  transform: scale(1.02) !important;
  z-index: 1;
  animation: greenOutlineReveal 0.55s ease;
}

.choice--wrong {
  border-color: #8b3a32 !important;
  opacity: 0.85;
  animation: wrongFlash 0.4s ease;
}

@keyframes wrongFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(0.7); }
}

@keyframes greenOutlineReveal {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.8);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(52, 211, 153, 0.45),
      0 0 24px rgba(52, 211, 153, 0.6);
    transform: scale(1.04);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(52, 211, 153, 0.35),
      0 0 18px rgba(52, 211, 153, 0.5);
    transform: scale(1.02);
  }
}

.choice--dim {
  opacity: 0.4;
  transform: scale(0.97);
}

/* ---- Feedback ---- */
.feedback-zone {
  margin-top: 1.15rem;
  animation: promptIn 0.45s var(--ease-out);
}

.feedback-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.95rem;
}

.feedback-pill--win {
  background: rgba(226, 240, 63, 0.25);
  border: 1px solid rgba(226, 240, 63, 0.5);
  color: var(--lime);
}

.feedback-pill--lose {
  background: rgba(196, 105, 96, 0.3);
  border: 1px solid rgba(196, 105, 96, 0.55);
  color: #ffd4cf;
}

.feedback-emoji { font-size: 1.25rem; }

.feedback-reveal {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(6, 87, 88, 0.45);
  border-left: 4px solid var(--teal-light);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-soft);
}

.feedback-reveal strong {
  display: block;
  color: var(--lime);
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

/* ---- Next button ---- */
.next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  margin-top: 1.1rem;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.85rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  color: var(--teal-dark);
  background: linear-gradient(135deg, var(--lime), #b8cc28);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(226, 240, 63, 0.4);
  transition: transform 0.25s var(--ease-bounce);
}

.next-btn:hover { transform: translateY(-2px); }
.next-btn:active { transform: scale(0.97); }

/* ---- Bottom bar ---- */
.bottom-bar {
  margin-top: auto;
  padding-top: 1rem;
  text-align: center;
}

.bottom-bar--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
}

.bottom-bar--menu-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.menu-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

a.tool-btn,
.menu-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.tool-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
}

.tool-btn:hover {
  background: var(--glass-strong);
  transform: translateY(-1px);
}

.foot-note {
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-soft);
  opacity: 0.85;
}

/* ---- Stage transition ---- */
.quiz-stage.stage-out {
  animation: stageOut 0.3s var(--ease-out) forwards;
}

.quiz-stage.stage-in {
  animation: stageIn 0.45s var(--ease-out);
}

@keyframes stageOut {
  to { opacity: 0; transform: scale(0.96) translateY(8px); }
}

@keyframes stageIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 400px) {
  .choices-grid {
    grid-template-columns: 1fr;
  }

  .choice {
    min-height: 2.8rem;
    font-size: 0.78rem;
  }

  .segment-btn {
    font-size: 0.68rem;
    padding: 0.55rem 0.35rem;
  }
}

@media (min-width: 600px) {
  .screen { padding: 1.5rem 1.75rem 1.75rem; }
  .stage-inner { padding: 1.75rem 1.5rem 1.85rem; }
  .choice { font-size: 0.88rem; padding: 1rem 1rem; min-height: 3.8rem; }
  .choices-grid { gap: 0.85rem; }
}

/* ---- Confetti celebration ---- */
#celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.party-horn {
  position: fixed;
  font-size: clamp(3rem, 14vw, 5.5rem);
  line-height: 1;
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  filter: drop-shadow(0 6px 14px rgba(6, 87, 88, 0.4));
  z-index: 10001;
  display: block;
  width: 1em;
  text-align: center;
}

.party-horn--left {
  left: max(0.75rem, env(safe-area-inset-left, 0px));
  transform: scale(0) rotate(-15deg);
  transform-origin: bottom center;
  animation: hornPopLeft 0.6s var(--ease-bounce) forwards;
}

.party-horn--right {
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  transform: scaleX(-1) scale(0) rotate(15deg);
  transform-origin: bottom center;
  animation: hornPopRight 0.6s var(--ease-bounce) forwards;
}

@keyframes hornPopLeft {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  55% { transform: scale(1.2) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes hornPopRight {
  0% { transform: scaleX(-1) scale(0) rotate(30deg); opacity: 0; }
  55% { transform: scaleX(-1) scale(1.2) rotate(-8deg); opacity: 1; }
  100% { transform: scaleX(-1) scale(1) rotate(0deg); opacity: 1; }
}

.party-horn--exit.party-horn--left {
  animation: hornExitLeft 0.45s ease forwards !important;
}

.party-horn--exit.party-horn--right {
  animation: hornExitRight 0.45s ease forwards !important;
}

@keyframes hornExitLeft {
  to { opacity: 0; transform: scale(0.85) rotate(8deg); }
}

@keyframes hornExitRight {
  to { opacity: 0; transform: scaleX(-1) scale(0.85) rotate(-8deg); }
}

.confetti-piece {
  position: fixed;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  animation: confettiBurst var(--dur, 2s) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
  z-index: 10000;
}

.confetti-piece--circle {
  border-radius: 50%;
  width: 10px;
  height: 10px;
}

.confetti-piece--strip {
  width: 6px;
  height: 20px;
  border-radius: 2px;
}

.confetti-piece--star {
  width: 13px;
  height: 13px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

@keyframes confettiBurst {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(0.15);
    opacity: 0;
  }
  5% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  20% {
    opacity: 1;
    transform: translate(
      calc(-50% + var(--tx) * 0.25),
      calc(-50% + var(--ty) * 0.25 + var(--arc))
    ) rotate(calc(var(--rot) * 0.15));
  }
  55% {
    opacity: 1;
    transform: translate(
      calc(-50% + var(--tx) * 0.88),
      calc(-50% + var(--ty) * 0.88 + var(--arc) * 0.3)
    ) rotate(calc(var(--rot) * 0.55));
  }
  100% {
    transform: translate(
      calc(-50% + var(--tx)),
      calc(-50% + var(--ty) + var(--fall, 120px))
    ) rotate(var(--rot));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
