/*---------------------------------------------Split Screen START: Variables & Resets-------------------------------------------*/
/* Ensures consistent sizing and integrates variables from style.css */
:root {
  --primary: #003366;
  --secondary: #00cc88;
  --accent: #ff6b00;
  --success: #28a745;
  --error: #dc3545;
  --warning: #ffc107;
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/*---------------------------------------------Split Screen END: Variables & Resets-------------------------------------------*/

/*---------------------------------------------Split Screen START: Base Layout-------------------------------------------*/
/* MAIN SPLIT SCREEN CONTAINER - FULL VIEWPORT (ORIGINAL PC SIZE) */
.split-screen {
  position: fixed;
  top: 0; /* CHANGED: Start from very top */
  left: 0; /* CHANGED: Full width */
  width: 100vw; /* CHANGED: Full viewport width */
  height: 100vh; /* CHANGED: Full viewport height */
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-color);
  z-index: 1000;
}

/* PC/Desktop adjustments - add slight spacing if needed */
@media (min-width: 1025px) {
  .split-screen {
    /* Optional: Add slight spacing from top for navigation */
    top: 50px; /* Your original value */
    height: calc(100vh - 50px); /* Subtract top spacing */
    left: 4px;
    width: calc(100vw - 20px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }
}

/* Mobile full-screen with safe area handling */
@media (max-width: 768px) {
  .split-screen {
    position: fixed !important;
    top: 0 !important; /* Start from top */
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 9999 !important;
    padding-top: env(safe-area-inset-top, 0px) !important; /* ADD THIS LINE - pushes everything down */
  }
  
  /* The rest of your CSS stays exactly the same... */
  .content-header {
    padding: 1rem 1rem 0.8rem 1rem !important;
    min-height: 65px !important;
    top: 0px !important;
    position: relative;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--primary) !important;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3) !important;

  }
  
  .content-header h3 {
    font-size: 1rem !important;
    color: #FFD700 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    max-width: 70% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-top: 5px !important; /* ADDS SPACE above title */
  }
  
  /* Fix close button positioning - MOVED DOWN */
  .close-exercise {
    position: relative !important;
    top: 5px !important; /* MOVED DOWN */
    z-index: 200 !important;
    width: 25px !important;
    height: 25px !important;
    font-size: 1.3rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(220, 53, 69, 0.9) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 50% !important;
    margin-top: 5px !important; /* ADDS SPACE above button */
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4) !important;
  }
  
  .close-exercise:hover {
    background: #c82333 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6) !important;
  }
 /* FIX EXERCISE SECTION HEADER - REVISED FOR COMPACT LAYOUT */
.exercises-section .exercise-header {
  padding: 0.6rem 0.8rem 0.4rem 0.8rem !important;
  min-height: 55px !important;
  position: relative;
  z-index: 100 !important;
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  gap: 0.2rem 0.3rem !important;
  background: var(--primary) !important;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3) !important;
}

/* Title - moved to top row with everything */
.exercises-section .exercise-title {
  grid-column: 1 / 4 !important;
  grid-row: 1 / 2 !important;
  font-size: 0.85rem !important;
  color: #FFD700 !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
  line-height: 1.1 !important;
  margin: 0 auto !important;
  max-width: 90% !important;
  padding: 0 0.5rem !important;
  margin-bottom: 0.1rem !important;
}

/* Arrow button - moved to top row, left side */
.exercises-section .console-btn {
  grid-column: 1 / 2 !important;
  grid-row: 1 / 2 !important;
  padding: 0.25rem 0.5rem !important;
  min-height: 28px !important;
  font-size: 0.75rem !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  margin-right: auto !important;
  align-self: flex-start !important;
  margin-top: -0.1rem !important;
}

/* Progress counter and score - moved to top row, right side */
.exercises-section .exercise-header {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .exercises-section .progress-bar-container {
    align-self: flex-end !important;
    margin-right: 2rem !important;
    width: 40% !important;
  }


/* Compact score displays */
.exercise-counter,
.score-display {
  font-size: 0.65rem !important;
  padding: 0.15rem 0.4rem !important;
  min-height: 24px !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  min-width: 80px !important;
  text-align: center !important;
  border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
}

/* Progress bar container - moved up and made smaller */
.exercises-section .progress-bar-container {
  grid-column: 1 / 4 !important;
  grid-row: 2 / 3 !important;
  width: 70% !important; /* Reduced from 85% */
  margin: 0.1rem auto 0 auto !important; /* Reduced margin */
  padding: 0 !important;
  align-self: center !important;
}

.exercises-section .progress-bar {
  width: 100% !important;
  height: 4px !important; /* Reduced height */
  margin: 0 auto !important;
  background: rgba(0, 0, 0, 0.3) !important;
}

.exercises-section .progress-bar .progress-fill {
  height: 4px !important;
  border-radius: 2px !important;
}
  
  /* Adjust content containers with PROPER spacing */
.html-content-container {
  height: calc(100% - 55px) !important; /* Reduced from 65px */
  padding-top: 0 !important;
}

.exercise-content {
  height: calc(100% - 75px) !important; /* Reduced from 85px */
  padding-top: 8px !important; /* Reduced from 10px */
  padding-bottom: 100px !important;
  overflow-y: auto !important;
}
  
  /* Adjust exercise footer position */
  .exercise-footer {
    bottom: 20px !important; /* Increased from 15px */
  }
  
  /* Exercise footer - ULTRA TRANSPARENT GLASS EFFECT */
  .exercise-footer {
    position: absolute !important;
    bottom: 15px !important;
    left: 10px !important;
    right: 10px !important;
    padding: 1rem !important;
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(25px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
    border-radius: 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 
      0 4px 30px rgba(0, 0, 0, 0.1),
      0 -2px 15px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    z-index: 50 !important;
    margin-top: 0 !important;
  }
  
  /* Adjust iframe positioning */
  #unitContentIframe {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
}


/* FLEX CONTAINER INSIDE - EQUAL SPLIT */
.split-screen-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

/*---------------------------------------------Split Screen END: Base Layout-------------------------------------------*/

/*---------------------------------------------Split Screen START: Content Pane-------------------------------------------*/
/* HTML CONTENT PANE (LEFT SIDE) - 50% */
.content-section {
  flex: 1.5;
  min-width: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--box-shadow);
  border-radius: 0;
  overflow: hidden;
  background: var(--card-bg);
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  width: 50%;
}

/* EXERCISES PANE (RIGHT SIDE) - 50% */
.exercises-section,
.sections-overview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--box-shadow);
  border-radius: 0;
  overflow: hidden;
  background: var(--card-bg);
  width: 50%;
}

.content-header {
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  min-height: 60px;
}

.content-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #FFD700;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.content-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.close-exercise {
  width: 32px;
  height: 32px;
  background: #dc3545 !important;
  border: none;
  color: white !important;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.close-exercise:hover {
  background: #c82333 !important;
  transform: scale(1.1);
}

.html-content-container {
  flex: 1;
  width: 100%;
  overflow: auto; /* CHANGED: from hidden to auto */
  -webkit-overflow-scrolling: touch;
  background: white;
  padding: 0;
  box-sizing: border-box;
  position: relative; /* Important for iframe positioning */
  
  /* CUSTOM SCROLLBAR */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0, 51, 102, 0.2) rgba(0, 0, 0, 0.05); /* Firefox */
}

/* WebKit scrollbar styling */
.html-content-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.html-content-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.html-content-container::-webkit-scrollbar-thumb {
  background: rgba(0, 51, 102, 0.2);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: content-box;
}

.html-content-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 51, 102, 0.4);
}

.html-content {
  max-width: 100%;
  min-height: 100%;
  line-height: 1.6;
  font-size: 18px; /* Slightly larger for better readability */
  color: #333;
  transition: opacity 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  
  /* Ensure no scrollbars on the content itself */
  overflow: visible !important;
}

.html-content h1,
.html-content h2,
.html-content h3,
.html-content h4 {
  color: var(--primary);
  margin: 1.5rem 0 1rem 0;
  font-family: 'Montserrat', sans-serif;
}

.html-content p {
  margin-bottom: 1rem;
}

.html-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  loading: lazy;
  object-fit: contain;
}

.html-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.html-content table,
.html-content th,
.html-content td {
  border: 1px solid #ddd;
  padding: 0.75rem;
}

.html-content th {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.html-content tr:nth-child(even) {
  background: #f9f9f9;
}

.html-content ul,
.html-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.html-content li {
  margin-bottom: 0.5rem;
}

.html-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #666;
}

.html-content code {
  background: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.html-content pre {
  background: #f8f8f8;
  padding: 1rem;
  border-radius: 8px;
  overflow: auto;
  margin: 1.5rem 0;
}

.html-content pre code {
  background: none;
  padding: 0;
}

#unitContentIframe {
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  margin: 0 !important;
  position: absolute !important;
  top: -15px !important;
  left: -35px !important;
  overflow: hidden !important;
  zoom: 0.87 !important;
}

.html-error-container,
.html-fallback-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: #666;
}

.html-error-container i,
.html-fallback-container i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #dc3545;
}

.html-error-container h3,
.html-fallback-container h3 {
  color: #333;
  margin-bottom: 1rem;
}

.html-fallback-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: var(--transition);
}

.html-fallback-btn:hover {
  background: var(--primary);
  transform: translateY(-2px);
}
/*---------------------------------------------Split Screen END: Content Pane-------------------------------------------*/

/*---------------------------------------------Split Screen START: Exercise Pane-------------------------------------------*/
/* Right pane for sections overview and exercise interface */
.sections-overview {
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.sections-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
  
  /* CUSTOM SCROLLBAR */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0, 51, 102, 0.2) rgba(0, 0, 0, 0.05); /* Firefox */
}

/* WebKit scrollbar styling for sections grid */
.sections-grid::-webkit-scrollbar {
  width: 6px;
}

.sections-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.sections-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 51, 102, 0.2);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: content-box;
}

.sections-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 51, 102, 0.4);
}

.section-card {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: var(--bg-color);
  transition: var(--transition);
}

.section-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.section-card.completed {
  border-color: var(--success);
  background: rgba(40, 167, 69, 0.05);
}

.section-btn {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: none;
}

.section-icon {
  position: relative;
  margin-right: 1rem;
  flex-shrink: 0;
}

.section-icon i:first-child {
  font-size: 2rem;
  color: var(--primary);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 51, 102, 0.1);
  border-radius: 50%;
}

.completion-badge {
  position: absolute;
  top: 45px;
  right: 12px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card-bg);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);
  z-index: 5;
  font-weight: 700;
}

.completion-badge::before {
  content: "✓";
  font-size: 12px;
  line-height: 1;
  display: block;
}

.dark-mode .completion-badge {
  border-color: var(--bg-color);
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.section-info {
  flex: 1;
}

.section-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.section-info p {
  margin: 0 0 0.8rem 0;
  color: var(--text-color);
  opacity: 0.8;
  font-size: 0.9rem;
  line-height: 1.4;
}

.section-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-progress .progress-bar.mini {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.section-progress .progress-bar.mini .progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.section-progress span {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
  min-width: 40px;
  text-align: right;
}

.reset-section-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 50%;
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
  opacity: 0;
}

.section-card:hover .reset-section-btn {
  opacity: 1;
}

.reset-section-btn:hover {
  background: var(--error);
  color: white;
  transform: scale(1.1);
}

.exercises-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  /* Add these for better control: */
  min-height: 0;
  flex: 1;
}
/*---------------------------------------------Split Screen END: Exercise Pane-------------------------------------------*/

/*---------------------------------------------Split Screen START: Headers & Footers-------------------------------------------*/
/* Compact headers and footers for both panes */
.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
  background: var(--primary);
  color: white;
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 1rem;
}

.exercise-header .header-top {
  display: flex;
  justify-content: center;
  align-items: center;
}

.exercise-header .header-top .exercise-title {
  color: #FFD700 !important;
  margin: 0;
  font-size: 0.9rem !important;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.exercise-header .header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.exercise-header .progress-score-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}


/*---------------------------------------------Split Screen END: Headers & Footers-------------------------------------------*/

/*---------------------------------------------Split Screen START: Buttons & Interactions-------------------------------------------*/
/* Simplified buttons with subtle animations */
.return-to-console {
  --a: #b02a37;
  --b: #e4606d;
  --c: #ff7b87;
  --rim: rgba(255, 255, 255, .08);
  --radius: 12px;
  --pad: .64rem 1.1rem;
  --fw: 700;
  --size: .96rem;
  
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: var(--pad);
  font-weight: var(--fw);
  font-size: var(--size);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  min-height: 44px;
  
  background: radial-gradient(600px 160px at 10% 10%, rgba(255, 120, 120, .08), transparent 12%),
              linear-gradient(135deg, var(--a) 0%, var(--b) 52%, var(--c) 100%);
  box-shadow: 0 8px 30px rgba(176, 42, 55, .20),
              inset 0 2px 0 rgba(255, 255, 255, .06);
  transition: transform .12s ease, box-shadow .16s ease, filter .12s ease;
}

.return-to-console:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(176, 42, 55, .26);
  filter: saturate(1.05) brightness(1.02);
}

.console-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.console-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15),
              0 0 0 1px rgba(255, 255, 255, 0.1);
}


.submit-answer {
  background: var(--accent);
  color: white;
}

.submit-answer:hover:not(:disabled) {
  background: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.prev-exercise {
  background: var(--primary);
  color: white;
  opacity: 0.9;
}

.prev-exercise:hover:not(:disabled) {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}


.next-exercise:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.prev-exercise:disabled,
.submit-answer:disabled,
.next-exercise:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

@keyframes buttonPulse {
  0% { filter: drop-shadow(0 0 12px rgba(255, 165, 0, 0.5)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.8)); }
  100% { filter: drop-shadow(0 0 12px rgba(255, 165, 0, 0.5)); }
}

.exercise-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  border-radius: 0 0 12px 12px;
  margin-top: auto;
}

.exercise-footer .btn-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.prev-exercise,
.submit-answer,
.next-exercise {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* First set of buttons - SUBMIT phase */
.submit-answer {
  background: var(--accent);
  color: white;
}

.submit-answer:hover:not(:disabled) {
  background: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.prev-exercise {
  background: var(--primary);
  color: white;
  opacity: 0.9;
}

.prev-exercise:hover:not(:disabled) {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

/* Second set of buttons - NEXT phase */
.next-exercise {
  background: var(--success);
  color: white;
  display: none; /* Hidden by default */
  margin-left: 0; /* Reset any auto margins */
}

.next-exercise:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* When Submit is hidden and Next should appear */
.submit-answer[style*="display: none"] ~ .next-exercise {
  display: inline-flex !important;
  order: 3; /* Keep it at the end */
}

/* Ensure both buttons in second set are visible and properly positioned */
.exercise-footer:has(.submit-answer[style*="display: none"]) {
  justify-content: space-between;
}

.exercise-footer:has(.submit-answer[style*="display: none"]) .btn-group {
  flex: 1;
  justify-content: space-between;
}

.exercise-footer:has(.submit-answer[style*="display: none"]) .next-exercise {
  margin-left: 1rem; /* Space between Previous and Next */
}

/* Disabled states */
.prev-exercise:disabled,
.submit-answer:disabled,
.next-exercise:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

/* Mobile fixes */
@media (max-width: 768px) {
  .exercise-footer {
    padding: 1rem;
    display: flex;
    flex-direction: row; /* Keep horizontal layout */
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
  }
  
  .exercise-footer .btn-group {
    width: auto; /* Don't stretch to full width */
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-width: auto;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    flex: none; /* Don't stretch */
    white-space: nowrap;
  }
  
  /* Ensure proper sizing on mobile */
  .prev-exercise,
  .next-exercise {
    min-width: 100px;
  }
  
  /* Mobile-specific layout for second set */
  .exercise-footer:has(.submit-answer[style*="display: none"]) .btn-group {
    gap: 0.5rem;
  }
  
  .exercise-footer:has(.submit-answer[style*="display: none"]) .next-exercise {
    min-width: 100px;
    margin-left: 0.5rem;
  }
}

/* Additional responsive improvements for very small screens */
@media (max-width: 480px) {
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-width: 90px;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  
  .exercise-footer {
    gap: 0.5rem;
    padding: 0.8rem;
  }
  
  .exercise-footer .btn-group {
    gap: 0.3rem;
  }
}

/*---------------------------------------------Split Screen END: Buttons & Interactions-------------------------------------------*/

/*---------------------------------------------Split Screen START: Progress & Feedback-------------------------------------------*/
/* Subtle progress indicators and feedback messages */
.overall-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.2rem 0.9rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #FFFFFF;
  background: linear-gradient(90deg, var(--c1) 0%, color-mix(in srgb, var(--c1) 60%, var(--c2) 40%) 25%, var(--c2) 50%, color-mix(in srgb, var(--c2) 60%, var(--c3) 40%) 75%, var(--c3) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
  min-height: 42px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 10px 30px rgba(74, 107, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  position: relative;
  top: -2px;
  left: -12px;
}


.progress-bar {
  width: 140px;
  height: 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 0.4rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 -1px 2px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(90deg, #00FFCC 0%, #00FF9D 25%, #00FF6A 50%, #00FFCC 75%, #00FF9D 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.7), 0 0 30px rgba(0, 255, 157, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: gradientShift 2s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.exercise-counter,
.score-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;
  white-space: nowrap;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  min-width: 110px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
}

.exercise-counter {
  background: linear-gradient(135deg, #ab05f3 0%, #8a09ed 70%, #6a00ff 100%);
  border-color: rgba(171, 5, 243, 0.4);
  animation: exerciseGlow 6s ease-in-out infinite;
}

@keyframes exerciseGlow {
  0%, 100% { box-shadow: 0 4px 12px rgba(171, 5, 243, 0.2); }
  50% { box-shadow: 0 6px 20px rgba(171, 5, 243, 0.35); }
}

.score-display {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 70%, #0d8f3d 100%);
  border-color: rgba(34, 197, 94, 0.4);
  animation: scorePulse 7s ease-in-out infinite;
}

@keyframes scorePulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35); }
}

.temp-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease-out;
}

.temp-message.success {
  background: var(--success);
  color: white;
}

.temp-message.info {
  background: var(--primary);
  color: white;
}

.temp-message.error {
  background: var(--error);
  color: white;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
/*---------------------------------------------Split Screen END: Progress & Feedback-------------------------------------------*/

/*---------------------------------------------Split Screen START: Exercise Interfaces-------------------------------------------*/
.exercise-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 3000;
  backdrop-filter: blur(5px);
}

.exercise-modal {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  animation: modalSlideIn 0.3s ease-out;
  box-shadow: none;
  border-radius: 0;
  max-width: none;
  max-height: none;
  overflow-y: visible;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exercise-content {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto; /* This creates vertical scrollbar */
  flex: 1;
  
  /* CUSTOM SCROLLBAR */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0, 51, 102, 0.2) rgba(0, 0, 0, 0.05); /* Firefox */
}

/* WebKit scrollbar styling for exercise content */
.exercise-content::-webkit-scrollbar {
  width: 6px;
}

.exercise-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.exercise-content::-webkit-scrollbar-thumb {
  background: rgba(0, 51, 102, 0.2);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: content-box;
}

.exercise-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 51, 102, 0.4);
}

.exercise {
  margin-bottom: 2rem;
}

.exercise-question {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--primary);
  line-height: 1.5;
}

.exercise-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-label {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-color);
}

.option-label:hover {
  border-color: var(--primary);
  background: rgba(0, 51, 102, 0.05);
  transform: translateX(5px);
}

.option-label input {
  margin-right: 1rem;
  transform: scale(1.1);
}

.option-text {
  flex: 1;
}

.writing-answer {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  background: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
}

.writing-answer:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.exercise-feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback.correct {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.feedback.incorrect {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
}

.feedback.info {
  background: rgba(0, 51, 102, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.explanation {
  margin-top: 0.5rem;
  font-style: italic;
  color: inherit;
  opacity: 0.9;
}

.model-answer {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(0, 51, 102, 0.05);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
  animation: slideDown 0.3s ease-out;
}

.fill-blank-sentence {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.blank-input,
.blank-select {
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: white;
  min-width: 120px;
  margin: 0 0.3rem;
}

.matching-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  overflow: hidden;
}

.matching-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  max-width: 100%;
}

.matching-word {
  font-weight: 600;
  min-width: 120px;
  color: var(--primary);
}

.matching-select {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: white;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 250px;
  margin-right: 1rem;
  width: 100%;
}

.sentence-rearrangement {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.rearrangement-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.rearrangement-input:focus {
  outline: none;
  border-color: var(--primary);
}

.completion-screen {
  padding: 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  isolation: isolate;
  /* ADD THESE LINES: */
  min-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.completion-visual {
  position: relative;
  margin-bottom: 2rem;
}

.completion-icon {
  position: relative;
  display: inline-block;
}

.completion-icon.mastered .icon-backdrop {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
}

.completion-icon.excellent .icon-backdrop {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  box-shadow: 0 8px 32px rgba(76, 175, 80, 0.3);
}

.completion-icon.good .icon-backdrop {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  box-shadow: 0 8px 32px rgba(33, 150, 243, 0.3);
}

.icon-backdrop {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  position: relative;
  z-index: 2;
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border: 2px solid;
  border-radius: 50%;
  animation: pulse 2s infinite;
  z-index: 1;
}

.completion-icon.mastered .pulse-ring {
  border-color: rgba(255, 215, 0, 0.3);
}

.completion-icon.excellent .pulse-ring {
  border-color: rgba(76, 175, 80, 0.3);
}

.completion-icon.good .pulse-ring {
  border-color: rgba(33, 150, 243, 0.3);
}

.completion-header h3 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.completion-header p {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 1.1rem;
}

.performance-analytics {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  margin: 2rem 0;
  align-items: center;
}

.score-display-circle {
  display: flex;
  justify-content: center;
}

.circular-progress {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 3.6deg), #e0e0e0 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.circular-progress::before {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  background: var(--card-bg);
  border-radius: 50%;
}

.inner-circle {
  position: relative;
  z-index: 1;
  text-align: center;
}

.score-percentage {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.score-label {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
}

.performance-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
}

.performance-message {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 12px;
  margin: 2rem 0;
  text-align: left;
}

.performance-message.mastered {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
  border-left: 4px solid #FFD700;
}

.performance-message.excellent {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(69, 160, 73, 0.1));
  border-left: 4px solid #4CAF50;
}

.performance-message.good {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(25, 118, 210, 0.1));
  border-left: 4px solid #2196F3;
}

.message-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.performance-message.mastered .message-icon {
  color: #FFD700;
}

.performance-message.excellent .message-icon {
  color: #4CAF50;
}

.performance-message.good .message-icon {
  color: #2196F3;
}

.message-content h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.message-content p {
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}

.completion-actions.enhanced {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.completion-actions.enhanced button {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: none;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 30;
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.completion-actions.enhanced button:hover {
  transform: translateY(-3px) translateZ(0);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  background: var(--primary);
  color: white;
  z-index: 40;
}

.completion-actions.enhanced button:hover .btn-subtext {
  color: rgba(255, 255, 255, 0.8);
}

.btn-icon {
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  flex-shrink: 0;
}

.btn-content {
  flex: 1;
}

.btn-text {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.btn-subtext {
  display: block;
  font-size: 0.85rem;
  opacity: 0.7;
}

.btn-arrow {
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.completion-actions.enhanced button:hover .btn-arrow {
  transform: translateX(5px);
}

.completion-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-tip {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
}

.progress-tip i {
  color: var(--accent);
  flex-shrink: 0;
}
/*---------------------------------------------Split Screen END: Exercise Interfaces-------------------------------------------*/

/*---------------------------------------------Split Screen START: Audio & Media-------------------------------------------*/
/* Enhanced audio player with progress controls */
.media-player-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(220, 53, 69, 0.05);
  border: 2px solid rgba(220, 53, 69, 0.2);
  border-radius: 12px;
  text-align: center;
}

.media-player-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
  min-width: 160px;
  justify-content: center;
  margin-bottom: 1rem;
}

.media-player-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.media-player-btn.playing {
  background: #28a745;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.media-player-btn.playing:hover {
  background: #218838;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.media-player-btn i {
  font-size: 1.1rem;
}

.audio-controls-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
}

.seek-btn {
  background: rgba(220, 53, 69, 0.1);
  border: 2px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.seek-btn:hover {
  background: #dc3545;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.audio-progress-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audio-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.audio-progress-bar:hover {
  height: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.audio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #dc3545, #e35d6a);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 4px;
  position: relative;
}

.audio-time-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.audio-current-time {
  color: #dc3545;
  font-weight: 600;
}

.audio-time-separator {
  margin: 0 0.2rem;
  opacity: 0.6;
}

.audio-duration {
  opacity: 0.8;
}

.video-player-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.video-player-btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}
/*---------------------------------------------Split Screen END: Audio & Media-------------------------------------------*/

/*---------------------------------------------Split Screen START: Accessibility & Utilities-------------------------------------------*/
/* Screen reader only, print, and reduced-motion support */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media print {
  .content-section,
  .html-content-container,
  .split-screen .content-section {
    display: none !important;
    visibility: hidden !important;
  }
}

.seek-btn:focus-visible,
.audio-progress-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.return-to-console:focus-visible {
  outline: 3px solid rgba(228, 96, 109, .14);
  outline-offset: 4px;
}

.dark-mode .media-player-section {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
}

.dark-mode .audio-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .audio-time-display {
  color: #ccc;
}

.dark-mode .seek-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.dark-mode .seek-btn:hover {
  background: #dc3545;
  color: white;
}
/*---------------------------------------------Split Screen END: Accessibility & Utilities-------------------------------------------*/

/*---------------------------------------------Split Screen START: Media Queries-------------------------------------------*/
/* Responsive design ensuring 50/50 symmetry on all devices */
@media (max-width: 1024px) {
  .split-screen-container {
    flex-direction: column;
    height: auto;
    max-height: 100vh;
  }
  
  .content-section,
  .exercises-section,
  .sections-overview {
    min-width: unset;
    width: 100%;
    flex: none;
    height: 50vh;
  }
  
  .content-section {
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1rem;
  }
  
  .section-btn {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .split-screen {
    padding: 0;
  }
  
  .content-header {
    padding: 0.5rem 1rem;
    min-height: 50px;
  }
  
  .content-header h3 {
    font-size: 1rem;
  }
    
  .close-exercise {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  
  .html-content-container {
    padding: 1rem;
    font-size: 14px;
  }
  
  .html-content {
    font-size: 14px;
    line-height: 1.5;
  }
  
  .html-content h1 { font-size: 1.5rem; }
  .html-content h2 { font-size: 1.3rem; }
  .html-content h3 { font-size: 1.2rem; }
  
  .html-content table {
    font-size: 12px;
  }
  
  .html-content table,
  .html-content th,
  .html-content td {
    padding: 0.5rem;
  }
  
  .sections-overview .exercise-header {
    padding: 0.5rem 1rem;
    min-height: 50px;
    flex-wrap: wrap;
  }
  
  .sections-overview .exercise-header h3 {
    font-size: 0.9rem;
  }
  
  .overall-progress {
    font-size: 0.75rem;
    padding: 0.15rem 0.7rem;
    min-height: 36px;
  }
  
  .progress-bar {
    width: 110px;
    height: 16px;
  }
  
  .section-icon i:first-child {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
  }
  
  .section-info h4 {
    font-size: 1rem;
  }
  
  .section-info p {
    font-size: 0.8rem;
  }
  
  .reset-section-btn {
    opacity: 1;
    width: 28px;
    height: 28px;
    top: 0.3rem;
    right: 0.3rem;
    font-size: 0.7rem;
  }
  
  
  .exercise-content {
    padding: 1rem;
  }
  
  .matching-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .matching-word {
    min-width: auto;
  }
  
  .completion-actions.enhanced {
    flex-direction: column;
  }
  
  .performance-breakdown {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  @media (max-width: 768px) {
  .exercise-content {
    padding: 1rem;
  }
  
  /* ADD THESE LINES: */
  .completion-screen {
    padding: 1.5rem;
    justify-content: flex-start !important;
    padding-top: 2rem !important;
  }
  
  .performance-analytics {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  /* ... other existing styles ... */
}
  
  .completion-header h3 {
    font-size: 1.5rem;
  }
  
  .circular-progress {
    width: 120px;
    height: 120px;
  }
  
  .circular-progress::before {
    width: 100px;
    height: 100px;
  }
  
  .performance-message {
    flex-direction: column;
    text-align: center;
    gap: 0.8rem;
  }
  
  .media-player-section {
    padding: 0.8rem;
    margin: 1rem 0;
  }
  
  .media-player-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    width: 100%;
  }
  
  .audio-controls {
    gap: 0.5rem;
  }
  
  .seek-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .audio-progress-bar {
    height: 6px;
  }
  
  .audio-time-display {
    font-size: 0.75rem;
  }
  
/* IFRAME: ZOOM OUT VIEW - Properly positioned below header */
#unitContentIframe {
  zoom: 0.5 !important;
  position: absolute !important;
  top: 30px !important;
  left: -25px !important;
  width: 200% !important;
  height: 200% !important;
  overflow: hidden !important;
  pointer-events: auto !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: white !important;
  box-shadow: none !important;
  transform: none !important;
  -webkit-transform: none !important;
}

/* Container adjustments */
.html-content-container {
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 300px !important;
  background: var(--card-bg) !important;
  padding-top: 5px !important;
}

/* Small phones (iPhone SE, etc.) */
@media (max-width: 375px) {
  #unitContentIframe {
    zoom: 0.42 !important;
    width: 220% !important;
    height: 220% !important;
    left: -30px !important;
    top: 20px !important;
  }
  
  .html-content-container {
    padding-top: 8px !important;
  }
}

/* Medium phones (iPhone 12/13, etc.) */
@media (min-width: 376px) and (max-width: 428px) {
  #unitContentIframe {
    zoom: 0.46 !important;
    width: 210% !important;
    height: 210% !important;
    left: -40px !important;
    top: 18px !important;
  }
  
  .html-content-container {
    padding-top: 6px !important;
  }
}

/* Large phones (iPhone Pro Max, etc.) */
@media (min-width: 429px) and (max-width: 768px) {
  #unitContentIframe {
    zoom: 0.5 !important;
    width: 200% !important;
    height: 200% !important;
    left: -50px !important;
    top: 15px !important;
  }
  
  .html-content-container {
    padding-top: 5px !important;
  }
}

/* For iPAD - Fix header coverage */
@media (min-width: 769px) and (max-width: 1024px) {
  #unitContentIframe {
    zoom: 0.65 !important;
    width: 160% !important;
    height: 160% !important;
    left: -15px !important;
    top: 50px !important;
  }
  
  .html-content-container {
    padding-top: 10px !important;
  }
}

/* === ADD THE NEW DEVICE-SPECIFIC RULES BELOW === */
/* iPhone XR specific */
@media (width: 414px) and (height: 896px) and (-webkit-device-pixel-ratio: 2) {
  #unitContentIframe {
    zoom: 0.48 !important;
    width: 205% !important;
    height: 205% !important;
    left: -50px !important;
    top: 18px !important;
  }
}

/* Google Pixel 7 */
@media (width: 412px) and (height: 915px) {
  #unitContentIframe {
    zoom: 0.47 !important;
    width: 208% !important;
    height: 208% !important;
    left: -50px !important;
    top: 17px !important;
  }
}

/* Samsung Galaxy A51/71 */
@media (width: 412px) and (height: 914px) {
  #unitContentIframe {
    zoom: 0.47 !important;
    width: 208% !important;
    height: 208% !important;
    left: -50px !important;
    top: 17px !important;
  }
}

/* iPad Mini */
@media (width: 768px) and (height: 1024px) {
  #unitContentIframe {
    zoom: 0.7 !important;
    width: 150% !important;
    height: 150% !important;
    left: -10px !important;
    top: 40px !important;
  }
  
  .split-screen {
    top: 0 !important;
    height: 100vh !important;
  }
  
  .html-content-container {
    padding-top: 8px !important;
  }
}

/* iPad Air */
@media (width: 820px) and (height: 1180px) {
  #unitContentIframe {
    zoom: 0.75 !important;
    width: 140% !important;
    height: 140% !important;
    left: -8px !important;
    top: 45px !important;
  }
  
  .split-screen {
    top: 0 !important;
    height: 100vh !important;
  }
  
  .content-header {
    min-height: 65px !important;
    padding-top: 15px !important;
  }
}

/* iPad Pro 11" */
@media (width: 834px) and (height: 1194px) {
  #unitContentIframe {
    zoom: 0.78 !important;
    width: 135% !important;
    height: 135% !important;
    left: -6px !important;
    top: 48px !important;
  }
  
  .split-screen {
    top: 0 !important;
    height: 100vh !important;
  }
  
  .content-header {
    min-height: 70px !important;
    padding-top: 18px !important;
  }
}

/* iPad Pro 12.9" */
@media (width: 1024px) and (height: 1366px) {
  #unitContentIframe {
    zoom: 0.85 !important;
    width: 125% !important;
    height: 125% !important;
    left: -4px !important;
    top: 52px !important;
  }
  
  .split-screen {
    top: 0 !important;
    height: 100vh !important;
  }
  
  .content-header {
    min-height: 75px !important;
    padding-top: 20px !important;
  }
}
}

@media (max-width: 480px) {
  .content-section,
  .exercises-section,
  .sections-overview {
    height: 50vh;
  }
  
  .content-header h3 {
    font-size: 0.9rem;
    max-width: 60%;
  }
  
  .sections-overview .exercise-header h3 {
    font-size: 0.8rem;
  }
  
  .exercise-title {
    font-size: 0.8rem;
  }
  
  .section-btn {
    flex-direction: column;
    text-align: center;
    padding: 0.8rem;
  }
  
  .section-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .section-progress {
    justify-content: space-between;
  }
  
  .completion-badge {
    width: 20px;
    height: 20px;
    top: 28px;
    right: 10px;
  }
  
  .completion-badge::before {
    font-size: 11px;
    position: absolute;
    top: 3px;
    left: 3px;
  }
  
  .exercise-counter,
  .score-display {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    min-width: 90px;
  }
  
  .prev-exercise,
  .submit-answer,
  .next-exercise {
    min-height: 40px;
    font-size: 0.8rem;
  }
  
  .media-player-section {
    padding: 0.6rem;
  }
  
  .media-player-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
  
  .audio-controls {
    gap: 0.3rem;
  }
  
  .seek-btn {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  
  .audio-time-display {
    font-size: 0.7rem;
  }
  
  .true-false-exercise .exercise-options {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}
/*---------------------------------------------Split Screen END: Media Queries-------------------------------------------*/

/*---------------------------------------------Split Screen END: All Sections-------------------------------------------*/