/* =========================================================
  ChemEquilibrium Lab - assets/css/components.css
  ---------------------------------------------------------
  Komponen visual reusable:
  - button system
  - mode card landing page
  - preview animasi kecil
  - cards dan badges
  - concept card
  - level/game card
  - feedback dan option buttons
  - chemistry chips
  - graph/game extras
  - responsive component polish
========================================================= */

/* =========================================================
  Button System
========================================================= */

.btn,
.icon-button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.72rem 1.05rem;
  border-radius: var(--radius-xl);
  color: var(--color-white);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-sm);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: nowrap;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    filter var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: saturate(1.08);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  transform: none;
  box-shadow: none;
  filter: grayscale(0.3);
}

.btn-primary {
  background: var(--gradient-primary);
}

.btn-secondary {
  background: var(--gradient-secondary);
}

.btn-success {
  background: var(--gradient-success);
}

.btn-warning {
  color: var(--slate-900);
  background: var(--gradient-warning);
}

.btn-danger {
  background: var(--gradient-danger);
}

.btn-outline {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  color: var(--primary);
  background: var(--color-white);
  border-color: rgba(37, 99, 235, 0.28);
}

.icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-xl);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
  font-weight: 950;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-2px);
  color: var(--primary);
  background: var(--color-white);
  box-shadow: var(--shadow-md);
}

/* =========================================================
  Landing Mode Cards
========================================================= */

.mode-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius-3xl);
  color: var(--text-main);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.88), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.78));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--duration-slow) var(--ease-out),
    background-color var(--duration-slow) var(--ease-out),
    border-color var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out),
    filter var(--duration-slow) var(--ease-out);
}

.mode-card::before {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -70px;
  top: -70px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.08);
  pointer-events: none;
}

.mode-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  left: -46px;
  bottom: -46px;
  border-radius: var(--radius-full);
  background: rgba(34, 211, 238, 0.16);
  pointer-events: none;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(37, 99, 235, 0.22);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.98), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.84));
  box-shadow: var(--shadow-xl);
  filter: saturate(1.08);
}

.mode-card > * {
  position: relative;
  z-index: 1;
}

.mode-card-body {
  display: grid;
  gap: var(--space-2);
}

.mode-card h2 {
  color: var(--text-main);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
}

.mode-card p {
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.mode-card .btn {
  width: 100%;
}

.mode-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.1),
    var(--shadow-sm);
  position: relative;
}

/* =========================================================
  Preview: Simulation
========================================================= */

.simulation-preview {
  background:
    radial-gradient(circle at 30% 28%, rgba(219, 234, 254, 0.95), transparent 42%),
    linear-gradient(135deg, #eff6ff, #fff7ed);
}

.mini-vessel {
  width: 190px;
  height: 112px;
  position: relative;
  border: 3px solid rgba(37, 99, 235, 0.22);
  border-radius: 34px;
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.8), transparent 22%),
    rgba(255, 255, 255, 0.56);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.66),
    var(--shadow-sm);
  overflow: hidden;
}

.mini-particle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  box-shadow:
    inset -4px -4px 7px rgba(0, 0, 0, 0.18),
    inset 4px 4px 7px rgba(255, 255, 255, 0.72),
    0 4px 10px rgba(15, 23, 42, 0.14);
  animation: previewParticleFloat 3.6s ease-in-out infinite;
}

.particle-reactant {
  background: var(--reactant);
}

.particle-product {
  background: var(--product);
}

.mini-particle.p1 {
  left: 30px;
  top: 26px;
}

.mini-particle.p2 {
  left: 70px;
  top: 70px;
  animation-delay: 420ms;
}

.mini-particle.p3 {
  right: 38px;
  top: 24px;
  animation-delay: 780ms;
}

.mini-particle.p4 {
  right: 72px;
  bottom: 24px;
  animation-delay: 1080ms;
}

.mini-particle.p5 {
  right: 24px;
  bottom: 42px;
  animation-delay: 1380ms;
}

@keyframes previewParticleFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  35% {
    transform: translate(7px, -8px) scale(1.06);
  }

  70% {
    transform: translate(-6px, 7px) scale(0.96);
  }
}

/* =========================================================
  Preview: Concept
========================================================= */

.concept-preview {
  background: linear-gradient(135deg, #faf5ff, #eff6ff);
}

.concept-loop {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  color: var(--text-main);
}

.concept-loop strong {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-secondary);
  box-shadow: var(--shadow-md), var(--shadow-glow-purple);
  font-size: var(--text-4xl);
  animation: softPulse 2.4s ease-in-out infinite;
}

.concept-loop span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 900;
}

/* =========================================================
  Preview: Graph
========================================================= */

.graph-preview {
  background: linear-gradient(135deg, #ecfeff, #f8fafc);
}

.mini-graph {
  width: min(220px, 92%);
  height: 130px;
}

.mini-graph .axis {
  fill: none;
  stroke: rgba(15, 23, 42, 0.34);
  stroke-width: 4;
  stroke-linecap: round;
}

.mini-graph .line {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-reactant {
  stroke: var(--reactant);
}

.line-product {
  stroke: var(--product);
}

.graph-dot {
  fill: var(--equilibrium);
  filter: drop-shadow(0 4px 8px rgba(147, 51, 234, 0.28));
  animation: softPulse 2s ease-in-out infinite;
}

/* =========================================================
  Preview: Game
========================================================= */

.game-preview {
  background:
    radial-gradient(circle at 50% 20%, rgba(251, 191, 36, 0.32), transparent 36%),
    linear-gradient(135deg, #fef3c7, #f3e8ff);
}

.game-badge {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  color: var(--color-white);
  background: var(--gradient-danger);
  box-shadow: var(--shadow-md), var(--shadow-glow-orange);
  font-size: var(--text-2xl);
  font-weight: 950;
  transform: rotate(-6deg);
}

.star-strip {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  color: var(--warning);
  font-size: var(--text-xl);
  letter-spacing: 0.1em;
  text-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

/* =========================================================
  Generic Cards & Badges
========================================================= */

.info-card,
.graph-card,
.game-simulation-card,
.game-challenge-card {
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.info-card:hover,
.graph-card:hover,
.game-simulation-card:hover,
.game-challenge-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.badge,
.status-pill,
.chem-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  font-weight: 900;
  white-space: nowrap;
}

.badge {
  min-height: 28px;
  padding: 0.25rem 0.65rem;
  color: var(--color-white);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--primary);
}

.badge-secondary {
  background: var(--secondary);
}

.badge-success {
  background: var(--success);
}

.badge-warning {
  color: var(--slate-900);
  background: var(--warning);
}

.badge-danger {
  background: var(--danger);
}

.status-pill {
  min-height: 38px;
  padding: 0.45rem 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
  font-size: var(--text-sm);
}

.status-pill.is-balanced {
  color: var(--success-dark);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.18);
}

.status-pill.is-shifting-right {
  color: var(--primary-dark);
  background: var(--blue-50);
  border-color: rgba(37, 99, 235, 0.18);
}

.status-pill.is-shifting-left {
  color: var(--warning-dark);
  background: var(--orange-50);
  border-color: rgba(249, 115, 22, 0.2);
}

.chem-chip {
  min-height: 38px;
  padding: 0.45rem 0.9rem;
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.chem-chip.reactant {
  background: var(--gradient-primary);
}

.chem-chip.product {
  background: var(--gradient-warning);
}

.chem-chip.equilibrium {
  background: var(--gradient-secondary);
}

/* =========================================================
  Data Display Components
========================================================= */

.value-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
}

.value-card span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 850;
}

.value-card strong {
  color: var(--text-main);
  font-size: var(--text-3xl);
  line-height: 1;
}

.formula-card {
  padding: var(--space-4);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.formula-card code {
  color: var(--equilibrium);
  font-size: var(--text-xl);
  font-weight: 900;
}

/* =========================================================
  Concept Cards
========================================================= */

.concept-card {
  min-height: 220px;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out),
    border-color var(--duration-slow) var(--ease-out),
    background-color var(--duration-slow) var(--ease-out);
}

.concept-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -56px;
  top: -56px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.09);
}

.concept-card:hover,
.concept-card.is-active {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
}

.concept-card.is-active {
  box-shadow: var(--shadow-md), var(--shadow-glow-blue);
}

.concept-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xl);
  color: var(--color-white);
  background: var(--gradient-secondary);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-2xl);
  font-weight: 950;
}

.concept-card h3 {
  color: var(--text-main);
}

.concept-card p {
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

/* =========================================================
  Control Components
========================================================= */

.control-card h4 {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-main);
}

.control-card h4::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

.range-control input[type="range"] {
  height: 8px;
}

.toggle-row {
  min-height: 48px;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--border-soft);
}

.toggle-row span {
  color: var(--text-main);
}

/* =========================================================
  Feedback Components
========================================================= */

.feedback-box,
.game-feedback {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border-soft);
  font-weight: 850;
  line-height: var(--leading-normal);
  text-align: center;
}

.feedback-box.is-success,
.game-feedback.is-correct {
  color: var(--success-dark);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.22);
}

.feedback-box.is-error,
.game-feedback.is-wrong {
  color: var(--danger-dark);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.22);
}

.feedback-box.is-warning {
  color: var(--warning-dark);
  background: var(--warning-soft);
  border-color: rgba(245, 158, 11, 0.22);
}

.feedback-box.is-info,
.game-feedback.is-info {
  color: var(--primary-dark);
  background: var(--blue-50);
  border-color: rgba(37, 99, 235, 0.18);
}

/* =========================================================
  Answer / Option Components
========================================================= */

.answer-grid,
.option-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.answer-button,
.option-button {
  min-height: 62px;
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-lg);
  font-weight: 900;
  text-align: center;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.answer-button:hover,
.option-button:hover,
.answer-button:focus-visible,
.option-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.26);
  background: var(--blue-50);
  box-shadow: var(--shadow-md);
}

.answer-button.is-correct,
.option-button.is-correct {
  color: var(--color-white);
  background: var(--gradient-success);
  border-color: rgba(22, 163, 74, 0.28);
}

.answer-button.is-wrong,
.option-button.is-wrong {
  color: var(--color-white);
  background: var(--gradient-danger);
  border-color: rgba(220, 38, 38, 0.28);
}

.answer-button.is-selected,
.option-button.is-selected {
  color: var(--color-white);
  background: var(--gradient-secondary);
}

.number-answer-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.number-answer-row input {
  width: 150px;
  height: 64px;
  border: 2px solid var(--text-main);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  font-size: var(--text-3xl);
  font-weight: 950;
  text-align: center;
}

.number-answer-row .btn {
  min-height: 64px;
  padding-inline: var(--space-6);
}

/* =========================================================
  Level / Game Cards
========================================================= */

.level-card {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-2xl);
  color: var(--text-main);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.72), transparent 36%),
    linear-gradient(135deg, #cffafe 0%, #ddd6fe 56%, #fed7aa 100%);
  box-shadow: var(--shadow-lg);
  text-align: center;
  overflow: hidden;
  position: relative;
  transition:
    transform var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out),
    filter var(--duration-slow) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}

.level-card::before {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  top: -70px;
  right: -70px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.35);
}

.level-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  left: -45px;
  bottom: -45px;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.12);
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-xl);
  filter: saturate(1.08);
}

.level-card.is-locked,
.level-card:disabled {
  opacity: 0.48;
  filter: grayscale(0.55);
}

.level-card.is-locked:hover,
.level-card:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-lg);
}

.level-card > * {
  position: relative;
  z-index: 1;
}

.level-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  color: var(--color-white);
  background: var(--gradient-equilibrium);
  box-shadow: var(--shadow-md), var(--shadow-glow-purple);
  font-size: var(--text-4xl);
  font-weight: 950;
}

.level-card strong {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.04em;
}

.level-card span:not(.level-icon):not(.level-stars) {
  color: var(--slate-700);
  font-weight: 800;
}

.level-stars {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--slate-300);
  background: rgba(255, 255, 255, 0.82);
  font-size: var(--text-xl);
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.level-stars.is-earned,
.level-stars .star-earned,
.star.is-earned {
  color: var(--warning);
}

.level-stars .star-empty,
.star.is-empty {
  color: var(--slate-300);
}

/* =========================================================
  Game Challenge Components
========================================================= */

.game-challenge-content {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  margin-inline: auto;
  animation: challengeFadeIn var(--duration-slow) var(--ease-out);
}

@keyframes challengeFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.challenge-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  color: var(--primary);
  background: var(--blue-50);
  border: 1px solid var(--primary-soft);
  font-size: var(--text-xs);
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.challenge-title {
  color: var(--text-main);
  font-size: clamp(var(--text-3xl), 5vw, 3.4rem);
  font-weight: 900;
  line-height: var(--leading-tight);
  letter-spacing: -0.05em;
}

.challenge-description {
  max-width: 48ch;
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

.challenge-reaction-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-4);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.challenge-reaction-card .arrow {
  color: var(--equilibrium);
  font-size: var(--text-4xl);
  font-weight: 950;
}

.challenge-disturbance-card,
.challenge-qk-visual,
.mission-target-card,
.challenge-visual {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.challenge-disturbance-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  color: var(--color-white);
  background: var(--gradient-equilibrium);
  box-shadow: var(--shadow-md);
  font-size: var(--text-3xl);
  font-weight: 950;
}

.challenge-qk-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.challenge-qk-value {
  min-width: 110px;
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--color-white);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
}

.challenge-qk-value span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 900;
}

.challenge-qk-value strong {
  color: var(--text-main);
  font-size: var(--text-3xl);
  line-height: 1;
}

.challenge-qk-divider {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-secondary);
  box-shadow: var(--shadow-md);
  font-size: var(--text-3xl);
  font-weight: 950;
}

.qk-visual,
.lechatelier-visual,
.catalyst-visual {
  width: 100%;
}

.qk-scale {
  width: min(360px, 100%);
  height: 18px;
  margin: var(--space-3) auto;
  position: relative;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--reactant), var(--equilibrium), var(--product));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.qk-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  border: 4px solid var(--color-white);
  border-radius: var(--radius-full);
  background: var(--slate-900);
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -50%);
}

.qk-visual.is-left .qk-marker {
  left: 78%;
}

.qk-visual.is-right .qk-marker {
  left: 22%;
}

.qk-visual.is-balanced .qk-marker {
  left: 50%;
}

.qk-result {
  color: var(--text-soft);
  font-weight: 850;
}

.mission-progress {
  width: 100%;
  display: grid;
  gap: var(--space-2);
}

.mission-progress span {
  color: var(--text-muted);
  font-weight: 850;
}

.mission-progress-track {
  height: 14px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.mission-progress-fill {
  display: block;
  width: var(--mission-progress, 50%);
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-equilibrium);
}

.mission-action-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.mission-action-card {
  min-height: 124px;
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.mission-action-card:hover,
.mission-action-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.26);
  background: var(--blue-50);
  box-shadow: var(--shadow-md);
}

.mission-action-card .icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xl);
  color: var(--color-white);
  background: var(--gradient-secondary);
  font-size: var(--text-xl);
  font-weight: 950;
}

.mission-action-card small {
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.mission-action-card.is-correct {
  color: var(--color-white);
  background: var(--gradient-success);
}

.mission-action-card.is-wrong {
  color: var(--color-white);
  background: var(--gradient-danger);
}

.mission-action-card.is-correct small,
.mission-action-card.is-wrong small {
  color: rgba(255, 255, 255, 0.8);
}

.catalyst-track {
  width: min(420px, 100%);
  height: 120px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.16), transparent 38%),
    rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border-soft);
}

.catalyst-track::before,
.catalyst-track::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  transform: translateY(-50%);
}

.catalyst-track::before {
  left: var(--space-4);
}

.catalyst-track::after {
  right: var(--space-4);
  background: var(--gradient-warning);
}

.catalyst-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-secondary);
  box-shadow: var(--shadow-md), var(--shadow-glow-purple);
  font-size: var(--text-3xl);
  transform: translate(-50%, -50%);
  animation: softPulse 1.8s ease-in-out infinite;
}

.combo-badge,
.combo-float {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-danger);
  box-shadow: var(--shadow-md), var(--shadow-glow-orange);
  font-weight: 950;
  animation: softPulse 1.4s ease-in-out infinite;
}

.combo-float {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: var(--z-modal);
  pointer-events: none;
  transform: translateX(-50%);
  animation: comboFloat 1s var(--ease-out) forwards;
}

@keyframes comboFloat {
  from {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.9);
  }

  25% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(-50%, -42px) scale(1.08);
  }
}

/* =========================================================
  Result Card
========================================================= */

.result-card {
  width: min(580px, 100%);
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  padding: var(--space-8);
  border-radius: var(--radius-3xl);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.result-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-success);
  font-size: var(--text-5xl);
  box-shadow: var(--shadow-md), 0 0 34px rgba(22, 163, 74, 0.28);
}

.result-title {
  color: var(--text-main);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 950;
  letter-spacing: -0.06em;
}

.result-score {
  color: var(--primary);
  font-size: clamp(var(--text-4xl), 7vw, 5rem);
  font-weight: 950;
  line-height: 1;
}

.result-stars {
  display: inline-flex;
  gap: var(--space-1);
  color: var(--warning);
  font-size: var(--text-3xl);
  letter-spacing: 0.04em;
}

.result-message {
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* =========================================================
  Particle Visual Helpers
========================================================= */

.particle-dot {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: var(--radius-full);
  box-shadow:
    inset -4px -4px 7px rgba(0, 0, 0, 0.2),
    inset 4px 4px 7px rgba(255, 255, 255, 0.72),
    0 3px 8px rgba(15, 23, 42, 0.14);
}

.particle-dot.reactant {
  background: var(--reactant);
}

.particle-dot.product {
  background: var(--product);
}

.particle-dot.equilibrium {
  background: var(--equilibrium);
}

.collision-flash {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(147, 51, 234, 0.36), transparent 68%);
  animation: collisionFlash 520ms ease-out forwards;
}

@keyframes collisionFlash {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.8);
  }
}

.shift-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 46px;
  border-radius: var(--radius-full);
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.32), transparent);
  transform: translate(-50%, -50%);
  animation: shiftWave 1s var(--ease-out) forwards;
}

.shift-wave.to-left {
  background: linear-gradient(270deg, transparent, rgba(249, 115, 22, 0.34), transparent);
}

.shift-wave.to-right {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.34), transparent);
}

@keyframes shiftWave {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scaleX(0.4);
  }

  35% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scaleX(1.18);
  }
}

.temperature-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(249, 115, 22, 0.28), transparent 64%);
  animation: temperatureFlash 800ms var(--ease-out) forwards;
}

.temperature-flash.is-cold {
  background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.28), transparent 64%);
}

@keyframes temperatureFlash {
  from {
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* =========================================================
  Graph Extra Components
========================================================= */

.graph-tooltip {
  position: fixed;
  z-index: var(--z-modal);
  display: grid;
  gap: 0.2rem;
  min-width: 148px;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.graph-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.graph-tooltip strong {
  color: var(--primary);
}

.graph-tooltip span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 800;
}

.graph-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-5);
}

.graph-stat-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
}

.graph-stat-card span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 850;
}

.graph-stat-card strong {
  color: var(--text-main);
  font-size: var(--text-2xl);
  line-height: 1;
}

.graph-stat-card.is-reactant strong {
  color: var(--reactant);
}

.graph-stat-card.is-product strong {
  color: var(--product);
}

.graph-stat-card.is-equilibrium strong {
  color: var(--equilibrium);
}

.graph-snapshot-panel {
  margin: 0 var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.graph-snapshot-panel h3 {
  margin-bottom: var(--space-4);
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.snapshot-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-soft);
}

.snapshot-thumb {
  min-height: 86px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(219, 234, 254, 0.9), rgba(255, 247, 237, 0.9));
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.snapshot-card small {
  color: var(--text-muted);
  font-weight: 800;
  line-height: var(--leading-normal);
}

.graph-legend {
  display: grid;
  gap: var(--space-2);
}

.graph-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-soft);
  font-size: var(--text-sm);
  font-weight: 850;
}

.graph-legend-line {
  width: 28px;
  height: 5px;
  border-radius: var(--radius-full);
  display: inline-block;
  background: var(--primary);
}

.graph-legend-line.reactant {
  background: var(--reactant);
}

.graph-legend-line.product {
  background: var(--product);
}

.graph-legend-line.equilibrium {
  background: var(--equilibrium);
}

/* =========================================================
  Confetti
========================================================= */

.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: var(--z-modal);
  width: 10px;
  height: 16px;
  pointer-events: none;
  border-radius: 3px;
  background: var(--primary);
  animation: confettiFall 2.2s var(--ease-out) forwards;
}

.confetti-piece.is-blue {
  background: var(--primary);
}

.confetti-piece.is-purple {
  background: var(--secondary);
}

.confetti-piece.is-orange {
  background: var(--product);
}

.confetti-piece.is-green {
  background: var(--success);
}

@keyframes confettiFall {
  from {
    opacity: 1;
    transform: translate3d(0, -20px, 0) rotate(0);
  }

  to {
    opacity: 0;
    transform: translate3d(var(--confetti-x, 0), 110vh, 0) rotate(720deg);
  }
}

/* =========================================================
  State Flash Helpers
========================================================= */

.is-updating {
  animation: updateFlash 520ms var(--ease-out);
}

.is-disturbed {
  animation: disturbedFlash 760ms var(--ease-out);
}

.is-correct-flash {
  animation: correctFlash 680ms var(--ease-out);
}

.is-wrong-flash {
  animation: wrongFlash 680ms var(--ease-out);
}

@keyframes updateFlash {
  0% {
    box-shadow: var(--shadow-lg);
  }

  45% {
    box-shadow: var(--shadow-lg), 0 0 0 5px rgba(37, 99, 235, 0.14);
  }

  100% {
    box-shadow: var(--shadow-lg);
  }
}

@keyframes disturbedFlash {
  0% {
    filter: saturate(1);
  }

  45% {
    filter: saturate(1.25) brightness(1.03);
  }

  100% {
    filter: saturate(1);
  }
}

@keyframes correctFlash {
  0%,
  100% {
    box-shadow: var(--shadow-lg);
  }

  45% {
    box-shadow: var(--shadow-lg), 0 0 0 8px rgba(22, 163, 74, 0.16);
  }
}

@keyframes wrongFlash {
  0%,
  100% {
    box-shadow: var(--shadow-lg);
  }

  45% {
    box-shadow: var(--shadow-lg), 0 0 0 8px rgba(220, 38, 38, 0.16);
  }
}

/* =========================================================
  Responsive Components
========================================================= */

@media (max-width: 1180px) {
  .level-card {
    min-height: 270px;
  }

  .level-icon {
    width: 82px;
    height: 82px;
    font-size: var(--text-3xl);
  }

  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .mode-card {
    min-height: 300px;
  }

  .mode-preview {
    min-height: 130px;
  }

  .answer-grid,
  .option-grid,
  .mission-action-grid {
    grid-template-columns: 1fr;
  }

  .graph-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .btn {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
  }

  .mode-card {
    min-height: auto;
    padding: var(--space-5);
  }

  .mode-preview {
    min-height: 120px;
  }

  .mini-vessel {
    width: 170px;
    height: 104px;
  }

  .concept-card {
    min-height: auto;
  }

  .level-card {
    min-height: 230px;
  }

  .level-icon {
    width: 72px;
    height: 72px;
    font-size: var(--text-3xl);
  }

  .number-answer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .number-answer-row input {
    width: 100%;
  }

  .challenge-title {
    font-size: var(--text-3xl);
  }

  .challenge-description {
    font-size: var(--text-base);
  }

  .result-card {
    padding: var(--space-5);
  }

  .result-icon {
    width: 78px;
    height: 78px;
    font-size: var(--text-4xl);
  }

  .graph-stats-strip {
    padding-inline: var(--space-3);
  }

  .graph-snapshot-panel {
    margin-inline: var(--space-3);
  }
}

@media (max-width: 520px) {
  .reaction-hero-card .reactant-chip,
  .reaction-hero-card .product-chip {
    width: 100%;
  }

  .formula-token {
    width: 100%;
  }

  .answer-button,
  .option-button {
    min-height: 56px;
    font-size: var(--text-base);
  }

  .level-stars {
    font-size: var(--text-base);
  }

  .graph-stats-strip,
  .snapshot-grid {
    grid-template-columns: 1fr;
  }
}