@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800;900&display=swap');

:root {
  --bg-0: #0b1022;
  --bg-1: #121a34;
  --accent-cyan: #22d3ee;
  --accent-violet: #7c3aed;
  --ok: #10b981;
  --bad: #ff6b6b;
  --line: rgba(255, 255, 255, 0.22);
  --text-main: #f8fbff;
  --text-soft: #dbe7ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  background-color: #0a1432;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(96, 165, 250, 0.22) 0 2px, transparent 3px),
    radial-gradient(circle at 22% 28%, rgba(167, 139, 250, 0.22) 0 2px, transparent 3px),
    radial-gradient(circle at 44% 16%, rgba(56, 189, 248, 0.24) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 26%, rgba(244, 114, 182, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 14%, rgba(196, 181, 253, 0.18) 0 2px, transparent 3px),
    linear-gradient(120deg, rgba(71, 108, 255, 0.14) 1px, transparent 1px),
    linear-gradient(35deg, rgba(132, 204, 255, 0.11) 1px, transparent 1px),
    radial-gradient(circle at 90% 20%, rgba(168, 85, 247, 0.17), transparent 42%),
    linear-gradient(145deg, #071333 0%, #111f4d 52%, #231548 100%);
  background-size:
    auto,
    auto,
    auto,
    auto,
    auto,
    140px 80px,
    170px 110px,
    auto,
    auto;
}

.quiz-page {
  width: min(92vw, 780px);
  margin: 24px auto;
}

.quiz-headline h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
}

.quiz-headline p {
  margin: 10px 0 16px;
  color: var(--text-soft);
  font-weight: 500;
}

.quiz-card {
  position: relative;
  border-radius: 24px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  border: 1px solid transparent;
  background-clip: padding-box;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(1, 8, 26, 0.58);
}

.quiz-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(130deg, rgba(255,255,255,0.42), rgba(34,211,238,0.22), rgba(124,58,237,0.26));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.quiz-card.streak-glow {
  box-shadow:
    0 26px 60px rgba(1, 8, 26, 0.58),
    0 0 0 2px rgba(16, 185, 129, 0.42),
    0 0 30px rgba(16, 185, 129, 0.5);
}

.quiz-card.hidden,
.result-card.hidden,
.next-btn.hidden { display: none; }

.time-bar {
  height: 6px;
  border-radius: 999px;
  transform-origin: left center;
  background: linear-gradient(90deg, #12d6ff, #7c3aed);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.55);
  margin-bottom: 0;
  animation: barPulse 1.3s ease-in-out infinite;
  transition: transform 0.2s linear, background 0.2s linear;
}

.time-bar.danger {
  background: linear-gradient(90deg, #22d3ee, #f97316);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.65);
}

@keyframes barPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.24); }
}
.quiz-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.time-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-weight: 700;
  color: #f6fbff;
  background: rgba(9, 18, 41, 0.35);
}

.question-stage {
  opacity: 1;
  transform: translateY(0);
}

.question-stage.out-up {
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.question-stage.in-up {
  opacity: 0;
  transform: translateY(16px);
}

.question-stage.in-up.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.question-text {
  margin: 8px 0 18px;
  font-weight: 900;
  font-size: clamp(1.35rem, 3.6vw, 2.05rem);
  line-height: 1.2;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-card {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.93);
  color: #1a243a;
  border-radius: 16px;
  min-height: 78px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: answerIn 0.24s ease forwards;
  animation-delay: var(--delay, 0ms);
  transition: border-color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease, opacity 0.2s ease;
}

@keyframes answerIn {
  to { opacity: 1; transform: translateY(0); }
}

.answer-card .ico {
  width: 1.35em;
  text-align: center;
  font-size: 1.15rem;
  color: #334155;
}

.answer-card:hover {
  border-color: rgba(34, 211, 238, 0.8);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.42), 0 12px 26px rgba(34, 211, 238, 0.18);
}

.answer-card:active {
  transform: scale(0.98);
}

.answer-card:disabled { cursor: default; }

.answer-card.dimmed {
  opacity: 0.35 !important;
  filter: grayscale(50%) saturate(0.4) brightness(0.86) !important;
}

.answer-card.correct {
  position: relative;
  border-color: rgba(34, 211, 238, 0.95);
  background: linear-gradient(115deg, rgba(5, 18, 38, 0.92), rgba(18, 34, 64, 0.9));
  color: #e8fdff;
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.7),
    0 0 22px rgba(34, 211, 238, 0.55),
    inset 0 0 18px rgba(34, 211, 238, 0.14);
  overflow: hidden;
}

.answer-card.correct::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 14% 26%, rgba(34, 211, 238, 0.35) 0 1px, transparent 2px),
    radial-gradient(circle at 22% 68%, rgba(125, 249, 255, 0.3) 0 1px, transparent 2px),
    radial-gradient(circle at 7% 45%, rgba(34, 211, 238, 0.28) 0 1px, transparent 2px);
  opacity: 0.85;
  pointer-events: none;
}

.answer-card.correct .ico {
  color: #8ffcff;
}

.answer-card.correct-soft {
  border-color: rgba(16, 185, 129, 0.8);
  background: rgba(16, 185, 129, 0.12);
}

.answer-card.wrong {
  position: relative;
  opacity: 1;
  transform: translateY(0);
  border-color: rgba(255, 107, 107, 0.96);
  background: linear-gradient(115deg, rgba(49, 14, 18, 0.92), rgba(72, 20, 29, 0.9));
  color: #ffeef0;
  box-shadow:
    0 0 0 1px rgba(255, 107, 107, 0.72),
    0 0 22px rgba(255, 107, 107, 0.52),
    inset 0 0 18px rgba(255, 107, 107, 0.16);
  overflow: hidden;
  animation: shake 0.28s ease;
}

.answer-card.wrong::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 14% 26%, rgba(255, 146, 146, 0.34) 0 1px, transparent 2px),
    radial-gradient(circle at 22% 68%, rgba(255, 107, 107, 0.28) 0 1px, transparent 2px),
    radial-gradient(circle at 7% 45%, rgba(255, 146, 146, 0.26) 0 1px, transparent 2px);
  opacity: 0.82;
  pointer-events: none;
}

.answer-card.wrong .ico {
  color: #ffb1b1;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

.float-check {
  margin-left: auto;
  color: var(--ok);
  font-weight: 800;
  animation: floatCheck 0.38s ease;
}

@keyframes floatCheck {
  0% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.quiz-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.next-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 32px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #4f46e5, #6366f1);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.35);
  cursor: pointer;
}

.next-btn.secondary {
  background: linear-gradient(120deg, #334155, #475569);
}

.result-card h2 {
  margin: 4px 0 14px;
  font-weight: 800;
}

.result-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.accuracy-ring {
  --percent: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-violet) calc(var(--percent) * 1%), rgba(148, 163, 184, 0.26) 0);
  display: grid;
  place-items: center;
}

.accuracy-value {
  width: 95px;
  height: 95px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.18rem;
  font-weight: 800;
  color: #111827;
  background: rgba(255, 255, 255, 0.96);
}

.result-summary p,
.insight-list li {
  margin: 8px 0;
  font-weight: 600;
  color: #e9f2ff;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.insights-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.insight-list {
  margin: 0;
  padding-left: 18px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

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

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall 1.1s ease forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-18px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(220px) rotate(280deg); opacity: 0; }
}

@media (max-width: 720px) {
  .answers-grid { grid-template-columns: 1fr; }
  .quiz-card { padding: 16px; }
  .quiz-topbar { gap: 8px; }
  .meta-pill { padding: 6px 9px; font-size: 0.85rem; }
  .result-grid,
  .insights-grid { grid-template-columns: 1fr; display: grid; }
}




.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}

.score-icon {
  font-size: 1rem;
  color: #d1d5db;
  opacity: 0.95;
}

.score-text {
  font-weight: 700;
  color: #e5e7eb;
  letter-spacing: 0.2px;
}

.mode-card {
  text-align: center;
}

.mode-title {
  margin: 0 0 16px;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 800;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fbff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mode-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.8);
  box-shadow: 0 10px 20px rgba(34, 211, 238, 0.22);
}

.mode-name {
  font-size: 1.05rem;
  font-weight: 800;
}

.mode-desc {
  font-size: 0.92rem;
  color: #dbe7ff;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(5, 10, 25, 0.7);
  backdrop-filter: blur(6px);
}

.result-overlay.hidden {
  display: none;
}

.result-card {
  width: min(92vw, 760px);
  max-height: 92vh;
  overflow: auto;
}

@media (max-width: 720px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }
}

.mode-head {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.mode-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.mode-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, rgba(124, 236, 255, 0.2), rgba(124, 236, 255, 0.08));
  border: 1px solid rgba(124, 236, 255, 0.45);
  box-shadow: 0 0 10px rgba(63, 225, 255, 0.26), inset 0 0 8px rgba(63, 225, 255, 0.12);
}

.mode-icon::before {
  content: "";
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-image: var(--mode-icon-url);
  filter: brightness(0) saturate(100%) invert(57%) sepia(29%) saturate(774%) hue-rotate(147deg) brightness(86%) contrast(90%) drop-shadow(0 0 2px rgba(58, 169, 194, 0.45));
}

.mode-icon-cultura {
  --mode-icon-url: url("icons/en-todo-el-mundo.png");
}

.mode-icon-ia {
  --mode-icon-url: url("icons/automatizacion.png");
}

.mode-icon-peliculas {
  --mode-icon-url: url("icons/claqueta.png");
}

.mode-icon-fisica {
  --mode-icon-url: url("icons/fisica.png");
}
/* Mode cards style (reference-like) */
.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mode-btn {
  min-height: 108px;
  border-radius: 22px;
  border: 2px solid rgba(71, 225, 255, 0.72);
  background: linear-gradient(145deg, rgba(115, 131, 183, 0.28), rgba(91, 104, 166, 0.2));
  box-shadow: inset 0 0 0 1px rgba(68, 202, 255, 0.18);
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 18px 20px;
}

.mode-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(103, 235, 255, 0.9);
  box-shadow: 0 10px 22px rgba(58, 147, 255, 0.2), inset 0 0 0 1px rgba(68, 202, 255, 0.32);
}

.mode-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-name {
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  font-weight: 800;
  color: #f5fbff;
  line-height: 1.1;
}

.mode-desc {
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  color: rgba(225, 239, 255, 0.94);
  font-weight: 600;
}

.mode-icon {
  width: 46px;
  height: 46px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mode-icon::before {
  content: "";
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-image: var(--mode-icon-url);
  filter: brightness(0) saturate(100%) invert(57%) sepia(29%) saturate(774%) hue-rotate(147deg) brightness(86%) contrast(90%) drop-shadow(0 0 2px rgba(58, 169, 194, 0.45));
}

@media (max-width: 900px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }
}

/* force-two-columns-mode-grid */
.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* darker icon & border tone */
.mode-btn {
  border-color: rgba(58, 169, 194, 0.68) !important;
  box-shadow: inset 0 0 0 1px rgba(58, 169, 194, 0.22) !important;
}
.mode-btn:hover {
  border-color: rgba(73, 188, 214, 0.82) !important;
  box-shadow: 0 10px 22px rgba(26, 99, 145, 0.2), inset 0 0 0 1px rgba(73, 188, 214, 0.28) !important;
}
.mode-icon {
  background: radial-gradient(circle at 30% 30%, rgba(58, 169, 194, 0.16), rgba(58, 169, 194, 0.07)) !important;
  border: 1px solid rgba(58, 169, 194, 0.42) !important;
  box-shadow: 0 0 8px rgba(58, 169, 194, 0.2), inset 0 0 6px rgba(58, 169, 194, 0.11) !important;
}
.mode-icon::before {
  content: "";
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-image: var(--mode-icon-url);
  filter: brightness(0) saturate(100%) invert(57%) sepia(29%) saturate(774%) hue-rotate(147deg) brightness(86%) contrast(90%) drop-shadow(0 0 2px rgba(58, 169, 194, 0.45));
}

/* responsive-fix mode cards */
.quiz-page {
  width: min(96vw, 980px);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-btn {
  min-height: 96px;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 14px 16px;
}

.mode-name {
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
}

.mode-desc {
  font-size: clamp(0.85rem, 1.15vw, 1rem);
}

.mode-icon {
  width: 40px;
  height: 40px;
}

.mode-icon::before {
  content: "";
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-image: var(--mode-icon-url);
  filter: brightness(0) saturate(100%) invert(57%) sepia(29%) saturate(774%) hue-rotate(147deg) brightness(86%) contrast(90%) drop-shadow(0 0 2px rgba(58, 169, 194, 0.45));
}

@media (max-width: 900px) {
  .mode-grid {
    grid-template-columns: 1fr !important;
  }

  .mode-btn {
    min-height: 86px;
    padding: 12px 14px;
  }

  .mode-name {
    font-size: 1.15rem;
  }

  .mode-desc {
    font-size: 0.9rem;
  }
}

/* final-visibility-tune */
.mode-btn {
  border-color: rgba(86, 220, 245, 0.9) !important;
  box-shadow: inset 0 0 0 1px rgba(86, 220, 245, 0.35) !important;
}

.mode-btn:hover {
  border-color: rgba(120, 234, 255, 1) !important;
  box-shadow: 0 10px 22px rgba(40, 155, 210, 0.24), inset 0 0 0 1px rgba(120, 234, 255, 0.45) !important;
}

.mode-btn {
  grid-template-columns: 34px 1fr !important;
}

.mode-icon {
  width: 30px !important;
  height: 30px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.mode-icon::before {
  width: 30px !important;
  height: 30px !important;
  filter: brightness(0) saturate(100%) invert(78%) sepia(41%) saturate(1087%) hue-rotate(153deg) brightness(103%) contrast(102%) drop-shadow(0 0 3px rgba(122, 235, 255, 0.75)) !important;
}

/* lighter IA icon only */
.mode-icon-ia::before {
  filter: brightness(0) saturate(100%) invert(86%) sepia(32%) saturate(1355%) hue-rotate(157deg) brightness(108%) contrast(103%) drop-shadow(0 0 4px rgba(152, 245, 255, 0.95)) !important;
}

/* force IA icon brighter than others */
.mode-btn[data-mode="ia"] .mode-icon::before {
  opacity: 1 !important;
  filter: brightness(0) saturate(100%) invert(96%) sepia(18%) saturate(1688%) hue-rotate(151deg) brightness(118%) contrast(104%) drop-shadow(0 0 6px rgba(181, 248, 255, 1)) !important;
}
/* reset IA icon to same tone as others */
.mode-btn[data-mode="ia"] .mode-icon::before {
  filter: brightness(0) saturate(100%) invert(78%) sepia(41%) saturate(1087%) hue-rotate(153deg) brightness(103%) contrast(102%) drop-shadow(0 0 3px rgba(122, 235, 255, 0.75)) !important;
}
/* title gradient */
.mode-title {
  background: linear-gradient(90deg, #63e8ff 0%, #b386ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 0 16px rgba(99, 232, 255, 0.22);
}

/* title style match reference */
.mode-title {
  font-size: clamp(2rem, 4.2vw, 3.1rem) !important;
  font-weight: 900 !important;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #4de8ff 0%, #7be9ff 35%, #d06cff 100%) !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: none !important;
}

/* animated gradient title */
.mode-title {
  background-size: 220% 220% !important;
  animation: modeTitleGradientFlow 3.8s ease-in-out infinite;
}

@keyframes modeTitleGradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* title gradient fix */
.mode-title {
  margin: 0 0 16px;
  text-align: center;
}

.mode-title-gradient {
  display: inline-block;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #eaf6ff;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .mode-title-gradient {
    background: linear-gradient(90deg, #4de8ff 0%, #7be9ff 35%, #d06cff 100%);
    background-size: 220% 220%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: modeTitleGradientFlow 3.8s ease-in-out infinite;
  }
}

/* static gradient title */
.mode-title-gradient {
  background: linear-gradient(90deg, #66ecff 0%, #8defff 44%, #d063ff 100%) !important;
  background-size: 100% 100% !important;
  animation: none !important;
}

/* flowing gradient text animation (final) */
.mode-title-gradient {
  display: inline-block;
  background-image: linear-gradient(90deg, #66ecff 0%, #8defff 22%, #c77dff 50%, #66ecff 78%, #8defff 100%) !important;
  background-size: 320% 100% !important;
  background-repeat: repeat;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: quizTitleFlow 4.8s linear infinite !important;
  will-change: background-position;
}

@keyframes quizTitleFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* enforce animated gradient visibility */
.mode-title-gradient {
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  background-image: linear-gradient(90deg, #66ecff 0%, #8defff 20%, #c77dff 45%, #66ecff 70%, #8defff 100%) !important;
  background-size: 340% 100% !important;
  background-position: 0% 50% !important;
  animation: quizTitleFlow 2.6s linear infinite !important;
}

@keyframes quizTitleFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 340% 50%; }
}

/* fix title bar issue: clip only on span */
.mode-title {
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: initial !important;
  color: #eaf6ff !important;
  animation: none !important;
}

.mode-title-gradient {
  display: inline-block !important;
  background-image: linear-gradient(90deg, #66ecff 0%, #8defff 20%, #c77dff 45%, #66ecff 70%, #8defff 100%) !important;
  background-size: 340% 100% !important;
  background-position: 0% 50% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: quizTitleFlow 2.8s linear infinite !important;
}

/* final flowing gradient (left to right) */
.mode-title-gradient {
  background-image: linear-gradient(90deg, #66ecff 0%, #8defff 35%, #c964ff 70%, #8defff 100%) !important;
  background-size: 300% 100% !important;
  background-position: 0% 50% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: titleFlowLTR 3.2s linear infinite !important;
}

@keyframes titleFlowLTR {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* enforce visible LTR animation */
.mode-title-gradient {
  background-image: linear-gradient(90deg, #57e8ff 0%, #85efff 22%, #b983ff 50%, #e06dff 72%, #57e8ff 100%) !important;
  background-size: 420% 100% !important;
  background-position: 0% 50% !important;
  animation-name: titleFlowLTRFinal !important;
  animation-duration: 2.2s !important;
  animation-timing-function: linear !important;
  animation-iteration-count: infinite !important;
}

@keyframes titleFlowLTRFinal {
  0% { background-position: 0% 50%; }
  100% { background-position: 420% 50%; }
}

/* strong visible title animation */
.mode-title-gradient {
  background-image: linear-gradient(90deg, #62ecff 0%, #62ecff 22%, #b86aff 48%, #e06bff 58%, #62ecff 78%, #b86aff 100%) !important;
  background-size: 260% 100% !important;
  background-repeat: no-repeat !important;
  background-position: -30% 50% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: titleFlowVisible 1.9s linear infinite !important;
}

@keyframes titleFlowVisible {
  0% { background-position: -30% 50%; }
  100% { background-position: 130% 50%; }
}

/* static title gradient requested */
.mode-title-gradient {
  background-image: linear-gradient(90deg, #66ecff 0%, #8defff 45%, #d063ff 100%) !important;
  background-size: 100% 100% !important;
  background-position: 0% 50% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: none !important;
}

.mode-subtitle {
  margin: 0 0 14px;
  text-align: center;
  color: #dbe7ff;
  font-size: 0.98rem;
  font-weight: 500;
}

/* breathing glow for correct answer */
.answer-card.correct {
  animation: correctBreath 1.6s ease-in-out infinite;
}

@keyframes correctBreath {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(34, 211, 238, 0.68),
      0 0 16px rgba(34, 211, 238, 0.35),
      0 0 0 0 rgba(34, 211, 238, 0.22),
      inset 0 0 16px rgba(34, 211, 238, 0.12);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(34, 211, 238, 0.9),
      0 0 26px rgba(34, 211, 238, 0.62),
      0 0 0 8px rgba(34, 211, 238, 0.08),
      inset 0 0 22px rgba(34, 211, 238, 0.2);
  }
}

/* keep correct option visible while breathing */
.answer-card.correct {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* improved achievement modal */
.result-overlay {
  background: radial-gradient(circle at 25% 15%, rgba(75, 161, 255, 0.18), rgba(5, 10, 25, 0.82) 48%), rgba(5, 10, 25, 0.82);
  backdrop-filter: blur(8px);
}

.result-card {
  border-radius: 24px;
  border: 1px solid rgba(112, 215, 255, 0.28);
  background: linear-gradient(155deg, rgba(18, 29, 61, 0.96), rgba(36, 24, 74, 0.94));
  box-shadow: 0 24px 60px rgba(4, 8, 28, 0.6), inset 0 0 0 1px rgba(151, 221, 255, 0.08);
  padding: 22px;
}

.result-title {
  margin: 2px 0 14px;
  text-align: center;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 900;
  color: #f1f8ff;
}

.result-summary {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(133, 210, 255, 0.16);
}

.result-actions {
  margin-top: 8px;
}

.result-actions .next-btn {
  min-width: 150px;
}

.result-actions #retryBtn {
  background: linear-gradient(120deg, #4f46e5, #6366f1);
  color: #ffffff;
}

.result-actions #exitBtn {
  background: linear-gradient(120deg, #334155, #1f2937);
  color: #ffffff;
}



/* Achievement modal layout (reference style) */
.result-card {
  max-width: min(980px, 94vw);
  border-radius: 30px;
  padding: 22px 26px 24px;
  border: 1px solid rgba(122, 210, 255, 0.55);
  background: linear-gradient(145deg, #111a49 0%, #1b1f5f 38%, #24165d 100%);
}

.result-header {
  display: flex;
  justify-content: center;
  align-items: center;
}

.result-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.9rem);
  font-weight: 800;
  color: #e8eeff;
}

.result-divider {
  height: 1px;
  margin: 12px 0 16px;
  background: linear-gradient(90deg, rgba(92, 199, 255, 0), rgba(92, 199, 255, 0.65), rgba(178, 122, 255, 0));
}

.result-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.accuracy-ring {
  width: clamp(150px, 18vw, 220px);
  height: clamp(150px, 18vw, 220px);
}

.result-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.result-stat {
  border-radius: 16px;
  border: 1px solid rgba(170, 220, 255, 0.35);
  padding: 10px 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
}

.stat-label {
  margin: 0;
  color: #dbe7ff;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.8vw, 1.3rem);
}

.result-stat strong {
  display: block;
  margin-top: 6px;
  color: #f8fbff;
  font-size: clamp(1.5rem, 2.3vw, 2.2rem);
  line-height: 1;
}

.result-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.result-actions #retryBtn,
.result-actions #exitBtn {
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  font-size: clamp(1.2rem, 2.2vw, 2rem);
  font-weight: 700;
  padding: 12px 14px;
}

.result-actions #retryBtn {
  background: linear-gradient(90deg, #6f43ff, #4f70ff, #4fe1ff);
}

.result-actions #exitBtn {
  background: linear-gradient(90deg, #2b3f7a, #273566);
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .result-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .result-card {
    padding: 16px 14px 16px;
    border-radius: 18px;
  }

  .result-stats-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .result-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Result stat cards match reference */
.result-stats-row {
  gap: 14px;
}

.result-stat {
  border-radius: 18px;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, rgba(22, 28, 78, 0.88), rgba(22, 19, 68, 0.86));
  border: 1px solid rgba(174, 212, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative;
  overflow: hidden;
}

.result-stat::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 46px;
  height: 1px;
  background: rgba(188, 214, 255, 0.28);
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: #f3f7ff;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.5vw, 1.5rem);
}

.result-stat strong {
  margin-top: 14px;
  font-size: clamp(2.1rem, 2.4vw, 2.6rem);
  color: #f8fbff;
}

.result-stat.stat-score {
  border-color: rgba(255, 133, 152, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 133, 152, 0.2), 0 0 18px rgba(255, 84, 118, 0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}

.result-stat.stat-correct {
  border-color: rgba(84, 238, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(84, 238, 255, 0.2), 0 0 18px rgba(84, 238, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.18);
}

.result-stat.stat-xp {
  border-color: rgba(98, 190, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(98, 190, 255, 0.2), 0 0 18px rgba(98, 190, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.18);
}

.result-stat.stat-coins {
  border-color: rgba(255, 183, 94, 0.8);
  box-shadow: 0 0 0 1px rgba(255, 183, 94, 0.22), 0 0 18px rgba(255, 164, 74, 0.32), inset 0 1px 0 rgba(255,255,255,0.18);
}

/* Exact card row tune */
.result-stats-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) !important;
  gap: 5px !important;
  margin: 0 auto 18px !important;
  width: 86% !important;
}

.result-stat {
  min-height: 94px !important;
  border-radius: 18px !important;
  padding: 12px 14px 10px !important;
  background: radial-gradient(120% 110% at 50% 100%, rgba(73,129,255,0.12), rgba(21,26,72,0.96)) !important;
}

.result-stat::after {
  top: 44px !important;
  left: 10px !important;
  right: 10px !important;
  background: rgba(189, 214, 255, 0.36) !important;
}

.stat-label {
  justify-content: flex-start !important;
  font-size: 24px !important;
  line-height: 1.1 !important;
  letter-spacing: 0.2px !important;
  color: #f2f7ff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2) !important;
}

.result-stat strong {
  margin-top: 18px !important;
  font-size: 34px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  color: #f5f9ff !important;
}

@media (max-width: 1300px) {
  .stat-label { font-size: 30px !important; }
  .result-stat strong { font-size: 46px !important; }
}

@media (max-width: 980px) {
  .result-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .stat-label { font-size: 24px !important; }
  .result-stat strong { font-size: 38px !important; }
}

@media (max-width: 560px) {
  .result-stats-row {
    grid-template-columns: 1fr !important;
  }
  .result-stat {
    min-height: 98px !important;
  }
  .stat-label { font-size: 20px !important; }
  .result-stat strong { font-size: 32px !important; }
}


/* Final achievement modal skin */
#resultOverlay.result-overlay {
  background: radial-gradient(circle at 25% 25%, rgba(57, 120, 255, 0.2), rgba(6, 10, 28, 0.9) 54%), rgba(6, 10, 28, 0.92) !important;
  backdrop-filter: blur(7px) !important;
}

#resultCard.result-card {
  max-width: min(980px, 94vw) !important;
  border-radius: 34px !important;
  padding: 20px 26px 22px !important;
  border: 1px solid rgba(114, 209, 255, 0.6) !important;
  background:
    radial-gradient(120% 90% at 70% 42%, rgba(153, 57, 255, 0.25), transparent 60%),
    radial-gradient(120% 90% at 28% 40%, rgba(69, 173, 255, 0.18), transparent 60%),
    linear-gradient(150deg, #101944 0%, #16185a 46%, #1f0f52 100%) !important;
  box-shadow:
    0 24px 52px rgba(8, 11, 35, 0.72),
    0 0 0 1px rgba(151, 88, 255, 0.28),
    0 0 24px rgba(77, 198, 255, 0.34) !important;
}

#resultCard .result-divider {
  height: 2px !important;
  margin: 10px 0 16px !important;
  background: linear-gradient(90deg, rgba(99, 199, 255, 0), rgba(99, 199, 255, 0.78), rgba(199, 95, 255, 0.78), rgba(199, 95, 255, 0)) !important;
}

#resultCard .result-title {
  text-align: center !important;
  font-size: clamp(2rem, 3.2vw, 3.2rem) !important;
  color: #eef4ff !important;
  font-weight: 800 !important;
}

#resultCard .result-ring-wrap {
  margin: 6px 0 16px !important;
}

#resultCard .accuracy-ring {
  width: clamp(170px, 26vw, 250px) !important;
  height: clamp(170px, 26vw, 250px) !important;
}

#resultCard .result-stats-row {
  grid-template-columns: repeat(4, minmax(120px, 152px)) !important;
  justify-content: center !important;
  gap: 14px !important;
  margin: 0 auto 14px !important;
}

#resultCard .result-stat {
  min-height: 82px !important;
  border-radius: 16px !important;
  padding: 8px 10px 8px !important;
}

#resultCard .result-stat::after {
  top: 36px !important;
}

#resultCard .stat-label {
  font-size: clamp(0.88rem, 1.1vw, 1.05rem) !important;
  gap: 5px !important;
  justify-content: center !important;
  text-align: center !important;
}

#resultCard .result-stat strong {
  margin-top: 8px !important;
  font-size: clamp(1.45rem, 1.9vw, 1.95rem) !important;
  text-align: center !important;
}

#resultCard .result-actions {
  margin-top: 4px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;`r`n  }

#resultCard .result-actions .next-btn {
  width: 86% !important;
  min-width: 0 !important;
  padding: 12px 16px !important;
  border-radius: 999px !important;
  font-size: clamp(1.35rem, 2.2vw, 2.2rem) !important;
  font-weight: 700 !important;
}

#resultCard #retryBtn {
  background: linear-gradient(90deg, #6d2dff, #5e52ff, #3bd7ff) !important;
  box-shadow: 0 0 16px rgba(95, 143, 255, 0.45) !important;
}

#resultCard #exitBtn {
  background: linear-gradient(90deg, #2d3d7e, #2b3569) !important;
  box-shadow: 0 0 10px rgba(70, 102, 186, 0.26) !important;
}

@media (max-width: 900px) {
  #resultCard .result-stats-row {
  grid-template-columns: repeat(4, minmax(120px, 152px)) !important;
  justify-content: center !important;
  gap: 14px !important;
  margin: 0 auto 14px !important;
}

#resultCard .result-stat {
  min-height: 82px !important;
  border-radius: 16px !important;
  padding: 8px 10px 8px !important;
}

#resultCard .result-stat::after {
  top: 36px !important;
}

#resultCard .stat-label {
  font-size: clamp(0.88rem, 1.1vw, 1.05rem) !important;
  gap: 5px !important;
  justify-content: center !important;
  text-align: center !important;
}

#resultCard .result-stat strong {
  margin-top: 8px !important;
  font-size: clamp(1.45rem, 1.9vw, 1.95rem) !important;
  text-align: center !important;
}

#resultCard .result-actions { grid-template-columns: 1fr !important; }
}

/* Compact achievement modal */
#resultCard.result-card {
  max-width: min(700px, 90vw) !important;
  padding: 12px 14px 14px !important;
  border-radius: 22px !important;
}

#resultCard .result-title {
  font-size: clamp(1.45rem, 2.2vw, 2rem) !important;
}

#resultCard .result-divider {
  margin: 8px 0 12px !important;
}

#resultCard .accuracy-ring {
  width: clamp(120px, 15vw, 165px) !important;
  height: clamp(120px, 15vw, 165px) !important;
}

#resultCard .accuracy-value {
  font-size: clamp(1.4rem, 2.3vw, 2rem) !important;
}

#resultCard .result-ring-wrap {
  margin: 4px 0 10px !important;
}

#resultCard .result-stats-row {
  grid-template-columns: repeat(4, minmax(120px, 152px)) !important;
  justify-content: center !important;
  gap: 14px !important;
  margin: 0 auto 14px !important;
}

#resultCard .result-stat {
  min-height: 82px !important;
  border-radius: 16px !important;
  padding: 8px 10px 8px !important;
}

#resultCard .result-stat::after {
  top: 36px !important;
}

#resultCard .stat-label {
  font-size: clamp(0.88rem, 1.1vw, 1.05rem) !important;
  gap: 5px !important;
  justify-content: center !important;
  text-align: center !important;
}

#resultCard .result-stat strong {
  margin-top: 8px !important;
  font-size: clamp(1.45rem, 1.9vw, 1.95rem) !important;
  text-align: center !important;
}

#resultCard .result-actions {
  gap: 14px !important;
  width: 86% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

#resultCard .result-actions .next-btn {
  font-size: clamp(1.18rem, 1.5vw, 1.35rem) !important;
  padding: 10px 14px !important;
}

@media (max-width: 900px) {
  #resultCard.result-card {
    max-width: min(620px, 93vw) !important;
  }

  #resultCard .result-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
}

@media (max-width: 560px) {
  #resultCard.result-card {
    max-width: min(460px, 94vw) !important;
    padding: 12px 10px 12px !important;
  }

  #resultCard .result-title {
    font-size: clamp(1.25rem, 5.6vw, 1.8rem) !important;
  }

  #resultCard .accuracy-ring {
    width: 120px !important;
    height: 120px !important;
  }

  #resultCard .result-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  #resultCard .result-stat {
    min-height: 78px !important;
    padding: 7px 8px !important;
  }

  #resultCard .result-stat strong {
    font-size: 1.45rem !important;
  }

  #resultCard .result-actions {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  #resultCard .result-actions .next-btn {
    font-size: 1.05rem !important;
    padding: 7px 8px !important;
  }
}

@media (min-width: 901px) {
  #resultCard.result-card {
    max-width: 640px !important;
    padding: 10px 12px 12px !important;
  }

  #resultCard .accuracy-ring {
    width: 112px !important;
    height: 112px !important;
  }

  #resultCard .result-stats-row {
    grid-template-columns: repeat(4, minmax(108px, 132px)) !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
  }

  #resultCard .result-stat {
    min-height: 74px !important;
    padding: 7px 8px !important;
  }

  #resultCard .result-stat::after {
    top: 32px !important;
  }

  #resultCard .result-stat strong {
    font-size: 1.32rem !important;
    margin-top: 7px !important;
  }

  #resultCard .result-actions {
    width: 82% !important;
    gap: 10px !important;
  }

  #resultCard .result-actions .next-btn {
    font-size: 1.02rem !important;
    padding: 7px 10px !important;
  }
}

/* Stats separator + value alignment */
#resultCard .result-stat {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#resultCard .stat-label {
  width: 100% !important;
  justify-content: center !important;
  line-height: 1.1 !important;
}

#resultCard .result-stat::after {
  left: 12px !important;
  right: 12px !important;
  height: 1px !important;
  background: linear-gradient(90deg, rgba(206, 214, 238, 0.14), rgba(206, 214, 238, 0.58), rgba(206, 214, 238, 0.14)) !important;
}

#resultCard .result-stat strong {
  width: 100% !important;
  text-align: center !important;
  margin-top: 14px !important;
}

@media (min-width: 901px) {
  #resultCard .result-stat::after {
    top: 30px !important;
  }

  #resultCard .result-stat strong {
    margin-top: 12px !important;
  }
}

/* Fix label alignment in stat cards */
#resultCard .stat-label {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  text-align: center !important;
  margin: 0 !important;
  gap: 6px !important;
  font-size: clamp(0.8rem, 0.95vw, 1rem) !important;
}

@media (min-width: 901px) {
  #resultCard .result-stats-row {
    grid-template-columns: repeat(4, minmax(116px, 145px)) !important;
  }
}

