/* Custom playful animations and visual enhancements */

@layer utilities {
  .shadow-soft {
    box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  }
}

/* Smooth bounces and interactions */
button, 
.interactive-card {
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Custom card selection state styling */
.option-btn {
  border-width: 2px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.option-btn:hover {
  transform: translateY(-2px);
}

.option-btn:active {
  transform: translateY(0px) scale(0.98);
}

.option-btn.selected-idle {
  border-color: #0ea5e9;
  background-color: #f0f9ff;
  box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.18);
}

.option-btn.selected-correct {
  border-color: #10b981 !important;
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  box-shadow: 0 6px 18px 0 rgba(16, 185, 129, 0.25) !important;
}

.option-btn.selected-wrong {
  border-color: #f43f5e !important;
  background-color: #fff1f2 !important;
  color: #9f1239 !important;
  box-shadow: 0 6px 18px 0 rgba(244, 63, 94, 0.2) !important;
}

/* Image option zoom animation */
.image-option-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
}

.image-option-wrapper img {
  transition: transform 0.3s ease;
}

.option-btn:hover .image-option-wrapper img {
  transform: scale(1.05);
}

/* Soft pulse for mascot */
@keyframes softPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-mascot {
  animation: softPulse 3s ease-in-out infinite;
}

/* RTL Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Fresh science backdrop, hero depth, and card chrome */
body.page-canvas {
  background-color: #f0fdf4;
  background-image: 
    radial-gradient(#10b98114 1.5px, transparent 1.5px),
    linear-gradient(180deg, #f0fdf4 0%, #e0f2fe 100%);
  background-size: 20px 20px, 100% 100%;
  background-attachment: fixed;
}

.hero-glow {
  position: absolute;
  top: 4.25rem;
  left: 50%;
  width: min(880px, 94%);
  height: 220px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.22) 0%, rgba(14, 165, 233, 0.08) 50%, transparent 72%);
}

.deco-bubble {
  position: absolute;
  display: block;
  border-radius: 999px;
  box-shadow: none;
  background: transparent;
  opacity: 0;
}

.deco-gold { background: transparent; }
.deco-sky { background: transparent; }

.deco-a { width: 16px; height: 16px; top: 16%; right: 6%; }
.deco-b { width: 11px; height: 11px; top: 30%; left: 4%; }
.deco-c { width: 20px; height: 20px; top: 54%; right: 10%; }
.deco-d { width: 12px; height: 12px; top: 70%; left: 12%; }
.deco-e { width: 9px; height: 9px; top: 42%; right: 36%; }
.deco-f { width: 15px; height: 15px; bottom: 14%; left: 24%; }

.hero-banner {
  background: linear-gradient(135deg, #0d9488 0%, #10b981 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 14px 22px rgba(255, 255, 255, 0.12),
    0 18px 32px -4px rgba(13, 148, 136, 0.32);
}

.robot-well {
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 0 20px rgba(255, 255, 255, 0.5),
    0 8px 24px rgba(13, 148, 136, 0.28),
    inset 0 2px 6px rgba(255, 255, 255, 0.6);
}

.robot-well img {
  transform: scale(1.18);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.robot-well:hover img {
  transform: scale(1.26);
}

.unit-card {
  --unit-accent: #10b981;
  border: 1.5px solid #e2e8f0;
  border-top: 6px solid var(--unit-accent);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.unit-card.accent-green { --unit-accent: #10b981; }
.unit-card.accent-teal { --unit-accent: #059669; }
.unit-card.accent-gold { --unit-accent: #f59e0b; }
.unit-card.accent-sky { --unit-accent: #8b5cf6; }

.unit-card:hover {
  box-shadow: 0 16px 32px -4px rgba(0, 0, 0, 0.1), 0 8px 12px -4px rgba(0, 0, 0, 0.04);
}

.brand-badge,
.unit-badge {
  background: radial-gradient(circle at 32% 30%, #d1fae5 0%, #34d399 38%, #0f9b6e 72%, #067a52 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.75),
    inset 0 -8px 12px rgba(4, 90, 55, 0.2),
    0 0 0 1.5px rgba(15, 155, 110, 0.42);
  color: #ffffff;
}

.unit-card.accent-gold .unit-badge {
  background: radial-gradient(circle at 32% 30%, #fef3c7 0%, #fbbf24 40%, #f59e0b 70%, #d97706 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -8px 12px rgba(146, 64, 14, 0.18),
    0 0 0 1.5px rgba(217, 119, 6, 0.45);
}

.unit-card.accent-sky .unit-badge {
  background: radial-gradient(circle at 32% 30%, #ede9fe 0%, #c4b5fd 38%, #8b5cf6 70%, #6d28d9 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.75),
    inset 0 -8px 12px rgba(76, 29, 149, 0.22),
    0 0 0 1.5px rgba(124, 58, 237, 0.42);
}

.btn-start,
#btnNextQuestion,
#btnFeedbackContinue,
#btnBackHomeFromResults {
  color: #ffffff;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-radius: 16px;
  border: 0;
  border-bottom: 3px solid #065f46;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.22);
}

.btn-start:hover,
#btnNextQuestion:hover,
#btnFeedbackContinue:hover,
#btnBackHomeFromResults:hover {
  color: #ffffff;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.25) 0%, transparent 70%), linear-gradient(180deg, #10b981 0%, #047857 100%);
  box-shadow: 0 6px 14px rgba(5, 150, 105, 0.3);
}

.btn-start:active,
#btnNextQuestion:active,
#btnFeedbackContinue:active,
#btnBackHomeFromResults:active {
  color: #ffffff;
  background: #047857;
  transform: translateY(2px);
  border-bottom: 1px solid #065f46;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.2);
}

.q-count-pill {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.text-desc,
.text-untested {
  color: #4b5563;
}

.site-footer {
  color: #4b5563;
}

.header-icon-btn {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
}

.header-icon-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.header-icon-btn:active {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.score-chip {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 100%);
  border: 2px solid #e2e8f0;
  color: #854d0e;
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.18), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-pct {
  flex-shrink: 0;
  min-width: 2.7rem;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 999px;
  padding: 2px 6px;
}

.new-q-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}

.word-bank {
  background: #F5F3FF;
  border: 1px dashed #C4B5FD;
  border-radius: 1rem;
  padding: 12px;
  margin-bottom: 12px;
}

.word-bank-title {
  font-size: 12px;
  font-weight: 900;
  color: #5B21B6;
  margin-bottom: 8px;
}

.word-bank-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-chip {
  background: #FFFFFF;
  color: #5B21B6;
  border: 1px solid #DDD6FE;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 800;
}

.word-bank-hint {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #6D28D9;
}

.q-figure {
  margin: 0 0 4px;
}

.diagram-frame {
  position: relative;
  height: 230px;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid #DBE4EE;
  background: #F8FAFC;
}

.diagram-svg,
.diagram-photo {
  width: 100%;
  height: 100%;
  display: block;
}

.diagram-photo {
  position: absolute;
  inset: 0;
  object-fit: contain;
  object-position: center center;
  z-index: 1;
  background: transparent;
}

.aim-arrow {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}

.aim-top { top: 10px; inset-inline-start: 10px; color: #BE123C; }
.aim-mid { top: 46%; inset-inline-end: 10px; color: #0F766E; transform: translateY(-50%); }
.aim-low { bottom: 12px; inset-inline-start: 10px; color: #B45309; }

.diagram-frame[data-focus="top"] .aim-top,
.diagram-frame[data-focus="mid"] .aim-mid,
.diagram-frame[data-focus="low"] .aim-low {
  border-color: currentColor;
  animation: arrowPulse 1.1s ease-in-out infinite;
}

.diagram-frame[data-focus="top"] .aim-arrow:not(.aim-top),
.diagram-frame[data-focus="mid"] .aim-arrow:not(.aim-mid),
.diagram-frame[data-focus="low"] .aim-arrow:not(.aim-low) {
  opacity: 0.42;
}

.aim-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

.aim-dot-red { background: #E11D48; }
.aim-dot-teal { background: #0D9488; }
.aim-dot-gold { background: #D97706; }

.arrow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}

.arrow-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  padding: 4px 8px;
}

.illus-caption {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 800;
  color: #0F766E;
  text-align: center;
}

.blank-slot {
  display: inline-block;
  min-width: 4.75rem;
  margin-inline: 0.2rem;
  padding: 0 0.35rem 0.1rem;
  border-bottom: 3px dashed #059669;
  color: #047857;
  font-weight: 900;
  text-align: center;
  line-height: 1.2;
}

.blank-filled-ok {
  border-bottom-style: solid;
  background: #ECFDF5;
  border-radius: 0.45rem 0.45rem 0 0;
}

.feedback-correct-line {
  font-size: 13px;
  font-weight: 900;
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 0.7rem;
  padding: 6px 10px;
  margin: 0 0 6px;
}

.review-thumb {
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: #F8FAFC;
  border-radius: 0.8rem;
  margin-bottom: 0.5rem;
  border: 1px solid #E2E8F0;
}

.is-reading {
  background: #D1FAE5 !important;
  color: #065F46 !important;
  border-color: #6EE7B7 !important;
}

@keyframes arrowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

@media (max-height: 720px) {
  .diagram-frame { height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .aim-arrow { animation: none !important; }
}

.science-frame {
  position: relative;
  height: 180px;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 3px solid #A7F3D0;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.85), transparent 46%),
    linear-gradient(180deg, #E0F2FE 0%, #F0FDFA 100%);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.1);
  animation: frameIn 0.35s ease-out;
}

.science-frame.is-slim {
  height: 118px;
}

.science-frame::after {
  content: "صورة السؤال";
  position: absolute;
  z-index: 3;
  top: 8px;
  inset-inline-start: 8px;
  background: #FFFFFF;
  color: #047857;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid #A7F3D0;
  pointer-events: none;
}

.science-frame.is-slim::after {
  content: none;
}

.science-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #FFF8EE;
  z-index: 1;
  padding: 8px;
  box-sizing: border-box;
}

.science-svg-fallback {
  height: 100%;
}

.science-svg-fallback.is-off,
.science-svg-fallback[hidden] {
  display: none !important;
}

.science-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.science-figure {
  margin: 0 0 4px;
}

.science-figure .illus-caption {
  font-size: 14px;
  line-height: 1.5;
  color: #115E59;
  overflow-wrap: anywhere;
  padding-inline: 4px;
}

.image-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.image-choice-row .option-btn {
  position: relative;
  height: 100%;
  min-height: 132px;
  padding: 8px;
}

.image-choice-row .image-option-wrapper {
  height: 96px;
  margin-bottom: 6px;
}

.image-choice-row .option-btn .line-clamp-2 {
  white-space: normal;
  font-size: 11px;
  line-height: 1.35;
}

.image-choice-row .option-btn.selected-correct::after,
.image-choice-row .option-btn.selected-wrong::after {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.image-choice-row .option-btn.selected-correct::after {
  content: "✓";
  background: #059669;
}

.image-choice-row .option-btn.selected-wrong::after {
  content: "×";
  background: #E11D48;
}

.review-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.review-choice {
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  padding: 4px;
  text-align: center;
  min-width: 0;
}

.review-choice.is-correct {
  border-color: #10B981;
  background: #ECFDF5;
  box-shadow: 0 0 0 2px #10B981;
}

.review-choice img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: #F8FAFC;
  border-radius: 8px;
}

.review-choice span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  color: #334155;
}

.review-choice.is-correct span {
  color: #047857;
}

.feedback-art {
  margin: 0 0 8px;
}

#feedbackContent {
  max-height: 92vh;
  overflow-y: auto;
}

button:focus-visible,
.option-btn:focus-visible {
  outline: 3px solid #0EA5E9;
  outline-offset: 2px;
}

@keyframes frameIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 420px) {
  .science-frame { height: 164px; }
  .science-frame.is-slim { height: 108px; }
}

@media (prefers-reduced-motion: reduce) {
  .science-frame { animation: none; }
}