/* IELTS Prep Studio - CSS Stylesheet */

/* Global Variables & Color System */
:root {
  /* Fonts */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* HSL Colors (Light Mode Default) */
  --bg-primary: hsl(210, 30%, 98%);
  --bg-secondary: hsl(0, 0%, 100%);
  --bg-tertiary: hsl(210, 30%, 94%);
  --text-primary: hsl(222, 47%, 12%);
  --text-secondary: hsl(217, 19%, 40%);
  --border-color: hsl(214, 32%, 91%);
  
  --primary: hsl(193, 82%, 26%);       /* Deep Teal */
  --primary-hover: hsl(193, 82%, 18%);
  --primary-light: hsl(193, 82%, 95%);
  --primary-alpha: hsla(193, 82%, 26%, 0.15);
  
  --secondary: hsl(35, 92%, 50%);     /* Amber/Gold Accent */
  --secondary-hover: hsl(35, 92%, 40%);
  --secondary-light: hsl(35, 92%, 95%);

  --success: hsl(142, 72%, 29%);       /* Correct Answer Green */
  --success-light: hsl(142, 72%, 95%);
  --danger: hsl(0, 84%, 44%);          /* Alert/Incorrect Red */
  --danger-light: hsl(0, 84%, 96%);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-blur: 16px;

  --transition-speed: 0.3s;
}

/* Dark Theme Variables */
body.dark-theme {
  --bg-primary: hsl(222, 47%, 4%);
  --bg-secondary: hsl(222, 47%, 8%);
  --bg-tertiary: hsl(222, 47%, 12%);
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 65%);
  --border-color: hsl(222, 47%, 15%);
  
  --primary: hsl(193, 85%, 42%);      /* Bright Teal */
  --primary-hover: hsl(193, 85%, 48%);
  --primary-light: hsl(193, 85%, 12%);
  --primary-alpha: hsla(193, 85%, 42%, 0.25);
  
  --secondary: hsl(35, 95%, 58%);
  --secondary-hover: hsl(35, 95%, 68%);
  --secondary-light: hsl(35, 95%, 14%);

  --success: hsl(142, 69%, 40%);
  --success-light: hsl(142, 69%, 10%);
  --danger: hsl(0, 84%, 55%);
  --danger-light: hsl(0, 84%, 12%);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* Resets & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-speed), color var(--transition-speed);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* App Header Styling */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-speed);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px var(--primary-alpha);
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.logo-highlight {
  color: var(--primary);
}

/* Test State Bar in Header */
.test-state-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.35rem 1rem;
  background: var(--bg-tertiary);
  border-radius: 99px;
  border: 1px solid var(--border-color);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.test-title-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.mode-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background-color: var(--secondary-light);
  color: var(--secondary);
}

.test-timer-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--danger);
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
}

.timer-icon {
  animation: pulse 2s infinite;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Button & Icon Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.215, 0.61, 0.355, 1);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-alpha);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: hsl(0, 84%, 35%);
}

.btn-full-width {
  width: 100%;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-speed);
}
.icon-btn:hover {
  background-color: var(--bg-tertiary);
}

.icon-btn.btn-secondary {
  width: auto;
  padding: 0 1rem;
  border-radius: 99px;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.85rem;
}

/* Hidden Class */
.hidden {
  display: none !important;
}

/* App Main Content */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* View Panels */
.view-panel {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.view-panel.active {
  display: block;
  opacity: 1;
}

/* Dashboard Hero */
.dashboard-hero {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 3rem auto;
}

.dashboard-hero h1 {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 850;
  line-height: 1.15;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.accent-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Dashboard Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.metric-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-speed);
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-value {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary);
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Module Cards Grid */
.test-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.module-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s, border-color var(--transition-speed);
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--primary);
  transform: scaleX(0.2);
  transform-origin: left;
  transition: transform 0.4s;
}

.module-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-alpha);
}

.module-card:hover::before {
  transform: scaleX(1);
}

/* Card Icons & Colors */
.module-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: transform 0.4s;
}
.module-card:hover .module-icon {
  transform: scale(1.1) rotate(2deg);
}

.listening .module-icon {
  background-color: hsl(200, 95%, 95%);
  color: hsl(200, 95%, 40%);
}
.listening::before { background-color: hsl(200, 95%, 40%); }
body.dark-theme .listening .module-icon {
  background-color: hsl(200, 95%, 15%);
  color: hsl(200, 95%, 60%);
}

.reading .module-icon {
  background-color: hsl(280, 95%, 96%);
  color: hsl(280, 90%, 45%);
}
.reading::before { background-color: hsl(280, 90%, 45%); }
body.dark-theme .reading .module-icon {
  background-color: hsl(280, 95%, 15%);
  color: hsl(280, 90%, 65%);
}

.writing .module-icon {
  background-color: hsl(150, 95%, 95%);
  color: hsl(150, 90%, 35%);
}
.writing::before { background-color: hsl(150, 90%, 35%); }
body.dark-theme .writing .module-icon {
  background-color: hsl(150, 95%, 12%);
  color: hsl(150, 90%, 55%);
}

.speaking .module-icon {
  background-color: hsl(15, 95%, 95%);
  color: hsl(15, 90%, 45%);
}
.speaking::before { background-color: hsl(15, 90%, 45%); }
body.dark-theme .speaking .module-icon {
  background-color: hsl(15, 95%, 15%);
  color: hsl(15, 90%, 60%);
}

.module-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.module-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.module-metadata {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  background-color: var(--bg-tertiary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.module-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.5rem;
}

/* Test Layout Container */
#test-view {
  max-width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 73px); /* 100vh minus header height */
  overflow: hidden;
}

#test-view.hidden {
  display: none !important;
}

#test-view.active {
  display: flex;
  opacity: 1;
}

/* Test Workspace Split Panels */
.test-workspace {
  flex: 1;
  display: flex;
  height: calc(100% - 70px); /* Space for footer */
  overflow: hidden;
}

/* Split Pane Styling (Reading / Writing) */
.pane-left, .pane-right {
  height: 100%;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.pane-left {
  flex: 1;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.pane-right {
  flex: 1;
  background-color: var(--bg-primary);
}

.pane-title {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.pane-passage-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.pane-passage-content p {
  margin-bottom: 1.5rem;
}

/* Split pane highlights */
.highlighted {
  background-color: hsla(50, 100%, 75%, 0.8);
  color: black;
  border-radius: 2px;
}
body.dark-theme .highlighted {
  background-color: hsla(50, 100%, 30%, 0.8);
  color: white;
}

/* Form Questions Layout */
.question-group {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.question-group.flagged {
  border-color: var(--secondary);
  border-left: 4px solid var(--secondary);
}

.question-num {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--bg-tertiary);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  color: var(--text-secondary);
}

.question-text {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background-color: var(--bg-primary);
}

.option-item:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  margin-top: 0.25rem;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.option-item.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

/* Fill in the blanks */
.text-input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.text-input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

/* Custom Audio Player for Listening Section */
.listening-control-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.audio-player-ui {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.audio-progress-bar {
  flex-grow: 1;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 99px;
  cursor: pointer;
  position: relative;
}

.audio-progress-filled {
  height: 100%;
  background-color: var(--primary);
  border-radius: 99px;
  width: 0%;
}

.audio-timer-digits {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-secondary);
  min-width: 80px;
}

.audio-speed-selector {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Writing Area Component */
.writing-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 1.5rem;
}

.writing-header-tab {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.writing-editor-box {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.writing-editor-box textarea {
  flex-grow: 1;
  width: 100%;
  min-height: 250px;
  border: none;
  resize: none;
  background-color: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.6;
}

.writing-editor-box textarea:focus {
  outline: none;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.word-count-badge {
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.word-count-badge.success-limit {
  background-color: var(--success-light);
  color: var(--success);
}

/* SVG Chart Styles */
.svg-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.chart-grid-line {
  stroke: var(--border-color);
  stroke-dasharray: 4;
}

.chart-bar {
  fill: var(--primary);
  transition: height var(--transition-speed), y var(--transition-speed);
}
.chart-bar:hover {
  fill: var(--secondary);
}

.chart-axis {
  stroke: var(--text-secondary);
  stroke-width: 1.5;
}

.chart-text {
  fill: var(--text-secondary);
  font-size: 10px;
  font-family: var(--font-body);
}

/* Speaking Simulator Component */
.speaking-simulation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  height: 100%;
}

.speaking-examiner-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.avatar-sphere {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px var(--primary-alpha);
  position: relative;
}

.avatar-sphere::after {
  content: '';
  position: absolute;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  border-radius: 50%;
  border: 2px dashed var(--primary);
  opacity: 0.4;
  animation: rotateClockwise 20s linear infinite;
}

.avatar-sphere.speaking::after {
  border-color: var(--secondary);
  animation: pulseScale 1.5s infinite;
}

.examiner-prompt-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 2rem;
  min-height: 80px;
  max-width: 450px;
}

.speaking-user-panel {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.speaking-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-secondary);
}

.status-indicator.recording .indicator-dot {
  background-color: var(--danger);
  animation: pulse 1s infinite alternate;
}

.status-indicator.listening .indicator-dot {
  background-color: var(--primary);
}

/* Audio Waveform Canvas */
.audio-visualizer-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.audio-visualizer-container canvas {
  width: 100%;
  height: 100%;
}

.speaking-timer-display {
  text-align: center;
  font-family: monospace;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.speaking-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Recorded Tracks Review */
.recordings-history-box {
  margin-top: 1.5rem;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  max-height: 150px;
  overflow-y: auto;
}

.recording-track-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}
.recording-track-item:last-child {
  border-bottom: none;
}

.recording-track-item span {
  font-size: 0.85rem;
  font-weight: 600;
}

.track-playback-controls {
  display: flex;
  gap: 0.5rem;
}

/* Test Footer Panel */
.test-footer {
  height: 70px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.02);
  z-index: 50;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Question Navigator Center Bubble List */
.footer-center {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  max-width: 50%;
  padding: 0.5rem 0;
}

.q-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
}

.q-dot:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.q-dot.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.q-dot.answered {
  background-color: var(--primary-alpha);
  border-color: var(--primary);
}

.q-dot.flagged::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--secondary);
  border: 2px solid var(--bg-secondary);
}

/* Custom Modal Dialog Framework */
.custom-dialog {
  margin: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 500px;
  width: 90%;
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.custom-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

body.dark-theme .custom-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.large-dialog {
  max-width: 800px;
}

.dialog-form {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.35rem;
  color: var(--primary);
}

.dialog-body {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto;
}

.dialog-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-tertiary);
}

.instruction-box {
  background-color: var(--bg-primary);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.instruction-box ul {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}

.mode-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  font-size: 0.85rem;
}

.summary-item {
  background-color: var(--bg-tertiary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.summary-item strong {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.warning-text {
  color: var(--danger);
  background-color: var(--danger-light);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* History Drawer Styles */
.drawer-dialog {
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
  height: 100vh;
  max-height: 100vh;
  max-width: 420px;
  border-radius: 0;
  border-left: 1px solid var(--border-color);
  animation: slideRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-body {
  padding: 1.5rem;
  flex-grow: 1;
  overflow-y: auto;
  background-color: var(--bg-primary);
}

.drawer-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

/* History list items */
.history-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-section-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.history-score {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
}
.history-score.pending {
  font-size: 0.8rem; font-weight: 700; color: #92600a;
  background: #fde9c8; padding: 0.2rem 0.6rem; border-radius: 999px;
}
.scorecard-badge.pending {
  background: #fff7ec; border-color: #e0a64b; color: #92600a;
  display: flex; align-items: center; justify-content: center;
}
.scorecard-badge.pending .scorecard-num { color: #92600a; }

.history-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Results Scorecard Layout */
.scorecard-summary {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: center;
}

.scorecard-badge {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-alpha));
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
}

.scorecard-num {
  font-family: var(--font-title);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
}

.scorecard-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.scorecard-meta-table {
  width: 100%;
  border-collapse: collapse;
}

.scorecard-meta-table td {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}
.scorecard-meta-table tr:last-child td {
  border-bottom: none;
}

.scorecard-meta-table td.label {
  color: var(--text-secondary);
  font-weight: 500;
}

.scorecard-meta-table td.value {
  text-align: right;
  font-weight: 700;
}

/* Answers Review Section */
.results-review-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.review-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  background-color: var(--bg-secondary);
}

.review-item.correct {
  border-left: 4px solid var(--success);
}

.review-item.incorrect {
  border-left: 4px solid var(--danger);
}

.review-q-text {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.review-answer-line {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.review-answer-line strong {
  color: var(--text-secondary);
}

.correct-ans-highlight {
  color: var(--success);
  font-weight: 600;
}

.user-ans-highlight.correct {
  color: var(--success);
  font-weight: 600;
}

.user-ans-highlight.incorrect {
  color: var(--danger);
  font-weight: 600;
}

.review-explanation {
  background-color: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  border-left: 2px dashed var(--text-secondary);
}

/* Animations */
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.05); opacity: 0.7; }
}

@keyframes pulseScale {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.08); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.4; }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  .test-state-bar {
    gap: 0.5rem;
    padding: 0.2rem 0.6rem;
  }
  .header-actions span {
    display: none;
  }
  .view-panel {
    padding: 1.5rem 1rem;
  }
  .dashboard-hero h1 {
    font-size: 2.25rem;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .test-workspace {
    flex-direction: column;
  }
  .pane-left {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    height: 50%;
  }
  .pane-right {
    height: 50%;
  }
  .speaking-simulation-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .test-footer {
    padding: 0 1rem;
  }
  .footer-center {
    max-width: 40%;
  }
}

/* =====================================================================
   INSPERA-STYLE READING TEST LOOK  (scoped to body.in-test + .insp-*)
   Mimics the official IELTS computer-delivered player layout.
   ===================================================================== */

/* --- White, clean header while a test is running --- */
body.in-test .app-header {
  background: #ffffff;
  color: #44403c;
  border-bottom: 1px solid #e7e5e4;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
body.in-test .logo-text { color: #1c1917; }
body.in-test .logo-icon {
  background: #059669;
  box-shadow: 0 4px 12px rgba(5,150,105,0.25);
}
body.in-test .header-actions .icon-btn { color: #57534e; }

/* Center test-state bar -> Inspera identity + timer */
body.in-test .test-state-bar { gap: 1rem; }
body.in-test .test-title-badge { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
body.in-test #state-test-name { color: #1c1917; font-weight: 700; }
body.in-test .mode-badge {
  background: #f5f5f4; color: #059669; border: 1px solid #e7e5e4;
}
body.in-test .test-timer-container {
  background: transparent; border: none;
}
body.in-test #test-timer {
  font-size: 1.35rem; font-weight: 800; letter-spacing: 0.5px; color: #292524;
}

/* --- Split workspace --- */
.insp-wrap { display: flex; width: 100%; height: 100%; overflow: hidden; }

.insp-passage {
  height: 100%; overflow-y: auto; padding: 1.5rem 1.75rem;
  background: #ffffff; border-right: 1px solid #e7e5e4;
  -webkit-user-select: text; user-select: text;
}
.insp-section-box {
  border: 1px solid #d6d3d1; background: #f5f5f4;
  padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1.1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.insp-section-box h2 { font-size: 1rem; font-weight: 800; color: #1c1917; margin: 0 0 0.15rem; letter-spacing: 0.4px; }
.insp-section-box p  { font-size: 0.8rem; color: #78716c; margin: 0; }
.insp-passage h1 { font-size: 1.35rem; font-weight: 800; color: #1c1917; margin: 0 0 0.5rem; }
.insp-passage .lead { font-style: italic; color: #57534e; margin-bottom: 0.75rem; }
.insp-passage p { color: #292524; font-size: 0.97rem; line-height: 1.75; margin: 0 0 0.9rem; }

/* Drag handle between panes */
.insp-divider {
  width: 10px; height: 100%; flex: 0 0 10px; cursor: col-resize;
  background: #f5f5f4; border-left: 1px solid #e7e5e4; border-right: 1px solid #e7e5e4;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.insp-divider:hover { background: #059669; }
.insp-divider span { width: 2px; height: 2rem; background: #a8a29e; border-radius: 2px; }
.insp-divider:hover span { background: #fff; }

.insp-questions {
  height: 100%; overflow-y: auto; padding: 1.5rem 1.75rem; background: #fafaf9;
}
.insp-questions-inner { max-width: 48rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 4rem; }

/* Grouped instruction banner (e.g. "Questions 1–7") */
.insp-instr {
  background: #e7e5e4; border-left: 4px solid #44403c;
  padding: 0.85rem 1rem; border-radius: 0 6px 6px 0; font-size: 0.875rem;
}
.insp-instr h4 { font-weight: 800; color: #1c1917; margin: 0; }
.insp-instr p  { margin: 0.3rem 0 0; color: #292524; }
.insp-instr .legend { margin-top: 0.5rem; font-size: 0.8rem; }
.insp-instr .legend div { margin: 0.1rem 0; }

/* True/False/Not-Given question card */
.insp-card {
  background: #fff; border: 1px solid #e7e5e4; border-radius: 8px;
  padding: 0.9rem 1rem; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.9rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.insp-card.active { border-color: #059669; box-shadow: 0 0 0 1px rgba(5,150,105,0.2); }
.insp-card .qstem { display: flex; gap: 0.5rem; font-size: 0.9rem; }
.insp-card .qnum { font-weight: 800; color: #a8a29e; flex: 0 0 auto; }
.insp-card .qtext { margin: 0; color: #292524; font-weight: 500; }

/* Segmented control (TRUE / FALSE / N/G) */
.insp-seg {
  display: grid; grid-auto-flow: column; gap: 4px;
  background: #f5f5f4; padding: 4px; border-radius: 6px; border: 1px solid #e7e5e4; flex: 0 0 auto;
}
.insp-seg label {
  padding: 0.4rem 0.7rem; border-radius: 4px; font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; cursor: pointer; text-align: center; border: 1px solid #e7e5e4;
  background: #fff; color: #57534e; transition: all 0.12s; white-space: nowrap;
}
.insp-seg label:hover { background: #f5f5f4; }
.insp-seg label.sel { background: #059669; color: #fff; border-color: #059669; }
.insp-seg input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Note / summary completion block */
.insp-note {
  background: #fff; border: 1px solid #e7e5e4; border-radius: 8px;
  padding: 1.1rem 1.25rem; font-size: 0.92rem; line-height: 2.1;
}
.insp-note h3 { font-weight: 800; color: #1c1917; border-bottom: 1px solid #e7e5e4; padding-bottom: 0.5rem; margin: 0 0 0.75rem; }
.insp-note .nrow.active { background: rgba(5,150,105,0.06); border-radius: 4px; }
.insp-note .qnum { font-weight: 800; color: #a8a29e; margin-right: 0.4rem; }
.insp-blank {
  margin: 0 0.45rem; padding: 0.1rem 0.5rem; width: 150px; text-align: center;
  font-weight: 700; color: #1c1917; background: #fafaf9;
  border: none; border-bottom: 2px solid #d6d3d1; outline: none; transition: border-color 0.15s;
}
.insp-blank:focus { border-bottom-color: #059669; }

/* --- Two-layer Inspera footer (Part tabs + palette) --- */
body.in-test .test-footer {
  flex-wrap: wrap; align-items: center; row-gap: 0.6rem;
  background: #f4f4f4; border-top: 1px solid #d6d3d1; padding: 0.6rem 1.25rem;
}
.insp-parttabs {
  display: inline-flex; gap: 3px; background: #e7e5e4; padding: 3px; border-radius: 6px; border: 1px solid #d6d3d1;
}
.insp-parttab {
  padding: 0.35rem 1rem; font-size: 0.8rem; font-weight: 800; border-radius: 4px;
  color: #57534e; background: transparent; border: none; cursor: pointer; transition: all 0.12s;
}
.insp-parttab.active { background: #fff; color: #1c1917; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.insp-parttab:not(.active):hover { color: #1c1917; }

/* Reposition existing footer pieces inside the Inspera layout */
body.in-test .footer-left { gap: 0.5rem; }
body.in-test .footer-center {
  order: 3; width: 100%; justify-content: flex-start; overflow-x: auto;
  gap: 6px; padding: 2px 0; flex-wrap: nowrap;
}

/* Recolor the number palette to Inspera emerald */
body.in-test .q-dot {
  width: 34px; height: 34px; border-radius: 4px; background: #fff;
  border: 1px solid #d6d3d1; color: #44403c; font-weight: 700; flex: 0 0 auto; position: relative;
}
body.in-test .q-dot:hover { border-color: #a8a29e; background: #fafaf9; }
body.in-test .q-dot.active {
  border-color: #059669; background: #ecfdf5; color: #065f46;
  box-shadow: 0 0 0 2px rgba(5,150,105,0.3);
}
body.in-test .q-dot.answered { background: #fff; border-color: #059669; color: #065f46; }
body.in-test .q-dot.answered::before {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: #059669;
}

/* Submit button -> Inspera green */
body.in-test #submit-test-btn { background: #059669; }
body.in-test #submit-test-btn:hover { background: #047857; }

/* =====================================================================
   INSPERA EXACT REPLICA  (body.reading-mode -> custom .rd-* chrome)
   Hides the app's own header/footer and renders an Inspera clone.
   ===================================================================== */
body.reading-mode .app-header,
body.reading-mode .test-footer { display: none !important; }
body.reading-mode .app-main { height: 100vh; }
body.reading-mode #test-view.active { display: flex; height: 100vh; }
body.reading-mode .test-workspace {
  flex: 1; min-height: 0; padding: 0; margin: 0; display: flex; background: #fff;
}

.rd-root {
  flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column;
  background: #fff; color: #1a1a1a;
  font-family: Arial, Helvetica, "Helvetica Neue", sans-serif;
}

/* --- Top header --- */
.rd-header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.5rem; border-bottom: 1px solid #cfcfcf;
  box-shadow: 0 3px 4px -3px rgba(0,0,0,0.12);
}
.rd-brand { display: flex; align-items: center; gap: 2.25rem; }
.rd-logo {
  font-weight: 800; font-size: 2rem; line-height: 1; color: #e2001a;
  letter-spacing: -1px; font-family: Arial, Helvetica, sans-serif;
}
.rd-logo sup { font-size: 0.7rem; font-weight: 700; top: -0.9em; }
.rd-logo-img { height: 1.9rem; width: auto; display: block; }
.rd-taker { font-size: 1.05rem; font-weight: 700; color: #1a1a1a; }
.rd-tools { display: flex; align-items: center; gap: 1.5rem; color: #555; }
.rd-tools svg { cursor: pointer; }
.rd-tools svg:hover { color: #1a1a1a; }

/* --- Full-width Part banner --- */
.rd-partbanner {
  flex: 0 0 auto; margin: 1rem 1.25rem 0; padding: 0.85rem 1.25rem;
  background: #ececec; border: 1px solid #d9d9d9; border-radius: 5px;
}
.rd-part-title { font-weight: 700; font-size: 1.05rem; color: #1a1a1a; }
.rd-part-sub   { font-size: 1rem; color: #1a1a1a; margin-top: 0.25rem; }

/* --- Split body --- */
.rd-body { flex: 1; min-height: 0; display: flex; width: 100%; overflow: hidden; }
.rd-passage {
  height: 100%; overflow-y: auto; padding: 1.25rem 1.75rem 2rem;
  -webkit-user-select: text; user-select: text;
}
.rd-passage h1 { font-size: 1.4rem; font-weight: 800; color: #1a1a1a; margin: 0.5rem 0 1rem; }
.rd-passage p { font-size: 1.05rem; line-height: 1.65; color: #1a1a1a; margin: 0 0 1rem; }

.rd-divider {
  flex: 0 0 1px; width: 1px; height: 100%; background: #cdcdcd; position: relative;
}
.rd-handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 34px; background: #fff; border: 1px solid #c4c4c4; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; cursor: col-resize;
  color: #444; box-shadow: 0 1px 3px rgba(0,0,0,0.12); z-index: 5;
}
.rd-handle:hover { background: #f3f3f3; }

.rd-questions { height: 100%; overflow-y: auto; padding: 1.25rem 1.75rem 2rem; }
.rd-qgroup-title { font-size: 1.1rem; font-weight: 800; color: #1a1a1a; margin: 0 0 0.6rem; }
.rd-qgroup-instr { font-size: 1rem; line-height: 1.5; color: #1a1a1a; margin: 0 0 1.4rem; }

/* Question block */
.rd-q { margin-bottom: 1.6rem; }
.rd-qhead { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.65rem; }
.rd-qnum {
  flex: 0 0 auto; min-width: 24px; height: 26px; padding: 0 5px; font-weight: 700; font-size: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center; color: #1a1a1a;
}
.rd-qnum.sel { border: 2px solid #2f6fb0; border-radius: 3px; }
.rd-qtext { font-size: 1.02rem; line-height: 1.5; color: #1a1a1a; padding-top: 1px; }

.rd-opts { display: flex; flex-direction: column; gap: 0.7rem; padding-left: 0.15rem; }
.rd-opt { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 1.02rem; color: #1a1a1a; }
.rd-opt input {
  appearance: none; -webkit-appearance: none; margin: 0; width: 18px; height: 18px;
  border: 1.5px solid #8a8a8a; border-radius: 50%; position: relative; cursor: pointer; flex: 0 0 auto;
}
.rd-opt input:checked { border-color: #1a1a1a; }
.rd-opt input:checked::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #1a1a1a;
}

/* Inline note/summary completion blank */
.rd-blank {
  margin: 0 0.4rem; padding: 0.05rem 0.4rem; width: 150px; text-align: center;
  font-weight: 700; color: #1a1a1a; background: #fafafa;
  border: none; border-bottom: 2px solid #b8b8b8; outline: none;
}
.rd-blank:focus { border-bottom-color: #2f6fb0; }

/* --- Floating prev / next --- */
.rd-floatnav {
  position: absolute; right: 1.25rem; bottom: 5.2rem; display: flex; gap: 0.55rem; z-index: 30;
}
.rd-nav {
  width: 54px; height: 48px; border: none; border-radius: 3px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.18);
}
.rd-nav-back { background: #d4d4d4; color: #1a1a1a; }
.rd-nav-back:hover { background: #c6c6c6; }
.rd-nav-next { background: #1a1a1a; color: #fff; }
.rd-nav-next:hover { background: #000; }

/* --- Bottom footer (parts + palette + submit) --- */
.rd-footer {
  flex: 0 0 auto; display: flex; align-items: center; gap: 1.5rem;
  border-top: 1px solid #cfcfcf; padding: 0.55rem 1.25rem; background: #fff;
  box-shadow: 0 -2px 6px -3px rgba(0,0,0,0.1);
}
.rd-foot-part { display: flex; align-items: center; gap: 0.85rem; }
.rd-foot-label { font-weight: 700; font-size: 1rem; color: #1a1a1a; cursor: pointer; white-space: nowrap; }
.rd-foot-count { font-size: 0.95rem; color: #6b6b6b; }
.rd-foot-part.inactive { cursor: pointer; }
.rd-foot-part.inactive:hover .rd-foot-label { text-decoration: underline; }
.rd-foot-sep { flex: 1; }

.rd-palette { display: flex; align-items: flex-end; gap: 0.55rem; overflow-x: auto; padding-bottom: 2px; }
.rd-pnum { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; flex: 0 0 auto; }
.rd-pdash { width: 16px; height: 3px; background: #cfcfcf; border-radius: 1px; }
.rd-pnum.answered .rd-pdash { background: #4a4a4a; }
.rd-pnum-label {
  font-size: 0.95rem; color: #1a1a1a; min-width: 22px; height: 24px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rd-pnum.current .rd-pnum-label { border: 2px solid #2f6fb0; border-radius: 3px; font-weight: 700; }

.rd-submit {
  flex: 0 0 auto; width: 46px; height: 38px; background: #d4d4d4; border: 1px solid #bcbcbc;
  border-radius: 3px; cursor: pointer; color: #1a1a1a; display: flex; align-items: center; justify-content: center;
}
.rd-submit:hover { background: #c6c6c6; }

/* ============================================================
   Shared exam tools — Options menu (contrast / text size / instructions)
   ============================================================ */
.rd-tool-btn { display: inline-flex; align-items: center; color: inherit; cursor: pointer; }

.xt-overlay {
  position: fixed; inset: 0; z-index: 4000; background: rgba(20,20,20,0.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 3.5rem 1rem;
}
.xt-modal {
  width: min(640px, 96vw); background: #fff; color: #1a1a1a; border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35); overflow: hidden;
  font-family: Arial, Helvetica, "Helvetica Neue", sans-serif;
}
.xt-modal-head {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid #e2e2e2; min-height: 56px;
}
.xt-modal-title { font-size: 1.15rem; font-weight: 700; }
.xt-back {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 2px; border: none; background: none;
  color: #2f6fb0; font-size: 1rem; font-weight: 600; cursor: pointer; padding: 4px;
}
.xt-back svg { transform: rotate(180deg); }
.xt-close {
  position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%);
  border: none; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: #555; padding: 4px;
}
.xt-close:hover { color: #1a1a1a; }
.xt-panel { padding: 0.65rem 0; max-height: 70vh; overflow-y: auto; }

.xt-row {
  width: 100%; display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.4rem;
  background: none; border: none; border-bottom: 1px solid #ececec; cursor: pointer;
  font-size: 1.05rem; color: #1a1a1a; text-align: left;
}
.xt-row:last-child { border-bottom: none; }
.xt-row:hover { background: #f5f5f5; }
.xt-row-ic { display: inline-flex; color: #555; }
.xt-row-label { flex: 1; }
.xt-row-chev { color: #999; display: inline-flex; }

.xt-choice {
  width: 100%; display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.4rem;
  background: none; border: none; border-bottom: 1px solid #ececec; cursor: pointer;
  font-size: 1.05rem; color: #1a1a1a; text-align: left;
}
.xt-choice:last-child { border-bottom: none; }
.xt-choice:hover { background: #f5f5f5; }
.xt-choice-tick { width: 22px; display: inline-flex; color: #1f8a3b; }
.xt-choice.sel { font-weight: 700; }

.xt-instr { padding: 0.4rem 1.4rem 1.2rem; }
.xt-instr p { font-size: 1rem; line-height: 1.6; margin: 0 0 0.9rem; color: #1a1a1a; }

/* Preview swatches on the contrast choices */
.xt-panel-contrast .xt-choice[data-mode="bw"] .xt-choice-label { background: #fff; color: #111; }
.xt-panel-contrast .xt-choice[data-mode="wb"] .xt-choice-label { background: #111; color: #fff; }
.xt-panel-contrast .xt-choice[data-mode="yb"] .xt-choice-label { background: #111; color: #ffe100; }
.xt-panel-contrast .xt-choice-label { padding: 3px 10px; border-radius: 3px; border: 1px solid #cfcfcf; }

/* Make the Options modal follow the chosen contrast so it isn't a bright flash */
body.contrast-wb .xt-modal, body.contrast-yb .xt-modal { background: #141414; }
body.contrast-wb .xt-modal-head, body.contrast-yb .xt-modal-head,
body.contrast-wb .xt-row, body.contrast-yb .xt-row,
body.contrast-wb .xt-choice, body.contrast-yb .xt-choice { border-color: #3a3a3a; }
body.contrast-wb .xt-modal-title, body.contrast-wb .xt-row, body.contrast-wb .xt-choice,
body.contrast-wb .xt-instr p, body.contrast-wb .xt-close { color: #f2f2f2; }
body.contrast-yb .xt-modal-title, body.contrast-yb .xt-row, body.contrast-yb .xt-choice,
body.contrast-yb .xt-instr p, body.contrast-yb .xt-close { color: #ffe100; }
body.contrast-wb .xt-row:hover, body.contrast-wb .xt-choice:hover,
body.contrast-yb .xt-row:hover, body.contrast-yb .xt-choice:hover { background: #242424; }

/* ---- Contrast: White on black ---- */
body.contrast-wb .rd-root { background: #0d0d0d; color: #f2f2f2; }
body.contrast-wb .rd-header, body.contrast-wb .rd-footer { background: #0d0d0d; border-color: #4a4a4a; box-shadow: none; }
body.contrast-wb .rd-partbanner { background: #1f1f1f; border-color: #4a4a4a; }
body.contrast-wb .rd-tools { color: #d0d0d0; }
body.contrast-wb .rd-divider { background: #4a4a4a; }
body.contrast-wb .rd-handle { background: #1f1f1f; border-color: #5a5a5a; color: #f2f2f2; }
body.contrast-wb .rd-root h1, body.contrast-wb .rd-root h2, body.contrast-wb .rd-root h3,
body.contrast-wb .rd-root p, body.contrast-wb .rd-root span, body.contrast-wb .rd-root label,
body.contrast-wb .rd-root li, body.contrast-wb .rd-root td, body.contrast-wb .rd-root th,
body.contrast-wb .rd-root .rd-qtext, body.contrast-wb .rd-root .rd-taker,
body.contrast-wb .rd-root .rd-part-title, body.contrast-wb .rd-root .rd-part-sub,
body.contrast-wb .rd-root .rd-qgroup-title, body.contrast-wb .rd-root .rd-qgroup-instr,
body.contrast-wb .rd-root .rd-foot-label, body.contrast-wb .rd-root .rd-pnum-label,
body.contrast-wb .rd-root .rd-foot-count { color: #f2f2f2; }
body.contrast-wb .rd-blank, body.contrast-wb .rd-select, body.contrast-wb .rd-select-sm,
body.contrast-wb .wr-textarea, body.contrast-wb .ls-box, body.contrast-wb .ls-select {
  background: #1f1f1f; color: #fff; border-color: #6a6a6a;
}
body.contrast-wb .rd-opt input, body.contrast-wb .ls-block input[type="radio"] { border-color: #cfcfcf; }
body.contrast-wb .rd-opt input:checked { border-color: #fff; }
body.contrast-wb .rd-opt input:checked::after { background: #fff; }
body.contrast-wb .rd-pdash { background: #5a5a5a; }
body.contrast-wb .rd-pnum.answered .rd-pdash { background: #f2f2f2; }
body.contrast-wb .rd-phrase, body.contrast-wb .ls-optbox, body.contrast-wb .ls-note { background: #1f1f1f; border-color: #4a4a4a; }
body.contrast-wb .highlighted { background: #7a5f00; color: #fff; }

/* ---- Contrast: Yellow on black ---- */
body.contrast-yb .rd-root { background: #000; color: #ffe100; }
body.contrast-yb .rd-header, body.contrast-yb .rd-footer { background: #000; border-color: #6b5d00; box-shadow: none; }
body.contrast-yb .rd-partbanner { background: #1a1600; border-color: #6b5d00; }
body.contrast-yb .rd-tools { color: #ffe100; }
body.contrast-yb .rd-divider { background: #6b5d00; }
body.contrast-yb .rd-handle { background: #1a1600; border-color: #6b5d00; color: #ffe100; }
body.contrast-yb .rd-root h1, body.contrast-yb .rd-root h2, body.contrast-yb .rd-root h3,
body.contrast-yb .rd-root p, body.contrast-yb .rd-root span, body.contrast-yb .rd-root label,
body.contrast-yb .rd-root li, body.contrast-yb .rd-root td, body.contrast-yb .rd-root th,
body.contrast-yb .rd-root .rd-qtext, body.contrast-yb .rd-root .rd-taker,
body.contrast-yb .rd-root .rd-part-title, body.contrast-yb .rd-root .rd-part-sub,
body.contrast-yb .rd-root .rd-qgroup-title, body.contrast-yb .rd-root .rd-qgroup-instr,
body.contrast-yb .rd-root .rd-foot-label, body.contrast-yb .rd-root .rd-pnum-label,
body.contrast-yb .rd-root .rd-foot-count { color: #ffe100; }
body.contrast-yb .rd-blank, body.contrast-yb .rd-select, body.contrast-yb .rd-select-sm,
body.contrast-yb .wr-textarea, body.contrast-yb .ls-box, body.contrast-yb .ls-select {
  background: #1a1600; color: #ffe100; border-color: #6b5d00;
}
body.contrast-yb .rd-opt input, body.contrast-yb .ls-block input[type="radio"] { border-color: #ffe100; }
body.contrast-yb .rd-opt input:checked { border-color: #ffe100; }
body.contrast-yb .rd-opt input:checked::after { background: #ffe100; }
body.contrast-yb .rd-pdash { background: #6b5d00; }
body.contrast-yb .rd-pnum.answered .rd-pdash { background: #ffe100; }
body.contrast-yb .rd-phrase, body.contrast-yb .ls-optbox, body.contrast-yb .ls-note { background: #1a1600; border-color: #6b5d00; }
body.contrast-yb .highlighted { background: #ffe100; color: #000; }

/* ---- Text size (scales the reading/content panes) ---- */
body.tsize-large .rd-passage, body.tsize-large .rd-questions,
body.tsize-large .ls-body, body.tsize-large .rd-partbanner { zoom: 1.15; }
body.tsize-xlarge .rd-passage, body.tsize-xlarge .rd-questions,
body.tsize-xlarge .ls-body, body.tsize-xlarge .rd-partbanner { zoom: 1.3; }

/* ============================================================
   Flag for review — per-question bookmark + nav-bar marker
   ============================================================ */
.rd-flaggable { position: relative; padding-right: 28px; }
.rd-flag {
  position: absolute; top: 0; right: 0; background: none; border: none; cursor: pointer;
  color: #a9a9a9; padding: 2px; line-height: 0;
}
.rd-flag:hover { color: #e2001a; }
.rd-flag.on { color: #e2001a; }
.rd-flag.on svg { fill: #e2001a; }

.rd-pnum { position: relative; }
.rd-pnum.flagged::after {
  content: ""; position: absolute; top: -3px; right: 1px; width: 7px; height: 9px;
  background: #e2001a; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
body.contrast-wb .rd-flag, body.contrast-yb .rd-flag { color: #8a8a8a; }
body.contrast-wb .rd-flag:hover, body.contrast-wb .rd-flag.on,
body.contrast-yb .rd-flag:hover, body.contrast-yb .rd-flag.on { color: #ff5b5b; }
body.contrast-wb .rd-flag.on svg, body.contrast-yb .rd-flag.on svg { fill: #ff5b5b; }
body.contrast-wb .rd-pnum.flagged::after, body.contrast-yb .rd-pnum.flagged::after { background: #ff5b5b; }

/* ============================================================
   Notes & Highlighter
   ============================================================ */
/* Selection popup (Note / Highlight) */
.xt-selpop {
  position: fixed; z-index: 4200; display: flex; gap: 2px; padding: 3px;
  background: #2b2b2b; color: #fff; border-radius: 7px; box-shadow: 0 5px 16px rgba(0,0,0,0.35);
}
.xt-selpop-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: #fff;
  font-size: 0.9rem; padding: 6px 11px; border-radius: 4px; cursor: pointer; font-family: inherit;
}
.xt-selpop-btn:hover { background: rgba(255,255,255,0.16); }

/* Noted text (distinct from a plain highlight) */
.xt-noted { background: #bfe9fb; color: inherit; border-bottom: 2px solid #37a0c9; cursor: pointer; }
body.contrast-wb .xt-noted, body.contrast-yb .xt-noted { background: #14556b; color: #fff; border-bottom-color: #58c0e0; }

/* Notes side panel */
.xt-notes-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 320px; z-index: 4100;
  background: #fff; color: #1a1a1a; border-left: 1px solid #d0d0d0;
  box-shadow: -5px 0 18px rgba(0,0,0,0.14); display: flex; flex-direction: column;
  font-family: Arial, Helvetica, "Helvetica Neue", sans-serif;
}
.xt-notes-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem; border-bottom: 1px solid #e2e2e2;
}
.xt-notes-title { font-weight: 700; font-size: 1.05rem; }
.xt-notes-close { border: none; background: none; font-size: 1.15rem; line-height: 1; cursor: pointer; color: #555; }
.xt-notes-close:hover { color: #1a1a1a; }
.xt-notes-list { flex: 1; overflow-y: auto; padding: 0.8rem; }
.xt-notes-empty { color: #8a8a8a; font-size: 0.95rem; line-height: 1.55; text-align: center; padding: 2.4rem 1rem; }

.xt-note { background: #f5f9fc; border: 1px solid #dde8ef; border-radius: 6px; padding: 0.7rem; margin-bottom: 0.8rem; }
.xt-note-quote {
  font-size: 0.82rem; color: #37729a; font-style: italic; line-height: 1.35;
  border-left: 3px solid #9cc9e0; padding-left: 0.55rem; margin-bottom: 0.55rem;
  max-height: 4.6em; overflow: hidden;
}
.xt-note-body {
  width: 100%; min-height: 64px; resize: vertical; border: 1px solid #cfd8dd; border-radius: 4px;
  padding: 0.45rem; font-size: 0.92rem; font-family: inherit; color: #1a1a1a;
}
.xt-note-del { margin-top: 0.4rem; background: none; border: none; color: #c0392b; font-size: 0.85rem; cursor: pointer; padding: 2px 0; }
.xt-note-del:hover { text-decoration: underline; }

/* Shift the exam so the open panel doesn't cover the answer area */
body.xt-notes-open .rd-root { width: calc(100% - 320px); }

/* Panel in dark contrast modes */
body.contrast-wb .xt-notes-panel, body.contrast-yb .xt-notes-panel { background: #141414; border-left-color: #3a3a3a; }
body.contrast-wb .xt-notes-head, body.contrast-yb .xt-notes-head { border-bottom-color: #3a3a3a; }
body.contrast-wb .xt-note, body.contrast-yb .xt-note { background: #1f1f1f; border-color: #3a3a3a; }
body.contrast-wb .xt-note-body, body.contrast-yb .xt-note-body { background: #0d0d0d; color: #f2f2f2; border-color: #4a4a4a; }
body.contrast-wb .xt-notes-title, body.contrast-wb .xt-notes-close { color: #f2f2f2; }
body.contrast-yb .xt-notes-title, body.contrast-yb .xt-notes-close { color: #ffe100; }

/* Reading-mode: let the test view fill the whole viewport (override .view-panel) */
body.reading-mode #test-view {
  max-width: none; margin: 0; padding: 0; opacity: 1;
}

/* --- Passage 2 extras: intro, paragraph letters, footnote --- */
.rd-intro { font-style: italic; color: #444; margin: 0 0 1rem; font-size: 1rem; line-height: 1.5; }
.rd-passage p .rd-para {
  font-weight: 800; margin-right: 0.6rem; color: #1a1a1a;
}
.rd-footnote { font-size: 0.85rem; color: #555; border-top: 1px solid #ddd; padding-top: 0.6rem; margin-top: 0.8rem; }

/* --- Matching (A–G dropdown) rows --- */
.rd-q-match { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.rd-q-match .rd-qtext { flex: 1; }
.rd-select {
  flex: 0 0 auto; min-width: 64px; padding: 0.35rem 0.5rem; font-size: 1rem; font-weight: 700;
  color: #1a1a1a; background: #fff; border: 1px solid #8a8a8a; border-radius: 4px; cursor: pointer;
}
.rd-select:focus { outline: none; border-color: #2f6fb0; box-shadow: 0 0 0 2px rgba(47,111,176,0.2); }

/* --- "Choose TWO letters" checkbox options --- */
.rd-multi-prompt { font-weight: 600; margin-bottom: 0.8rem; }
.rd-checkopts { display: flex; flex-direction: column; gap: 0.55rem; }
.rd-checkopt {
  display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; font-size: 1.02rem;
  color: #1a1a1a; padding: 0.5rem 0.65rem; border: 1px solid #e2e2e2; border-radius: 6px; transition: all 0.12s;
}
.rd-checkopt:hover { background: #f7f7f7; }
.rd-checkopt.sel { border-color: #2f6fb0; background: #eef4fb; }
.rd-checkopt input {
  appearance: none; -webkit-appearance: none; margin: 2px 0 0; width: 18px; height: 18px; flex: 0 0 auto;
  border: 1.5px solid #8a8a8a; border-radius: 4px; position: relative; cursor: pointer;
}
.rd-checkopt input:checked { border-color: #2f6fb0; background: #2f6fb0; }
.rd-checkopt input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.rd-cletter { font-weight: 800; min-width: 1.1rem; }

/* Partial-credit review item (e.g. one of two letters correct) */
.review-item.partial { border-left: 4px solid #c9881f; background: rgba(201,136,31,0.06); }

/* --- Passage 3: lettered MCQ (A–D) reuse rd-opt with letter --- */
.rd-opt .rd-cletter { font-weight: 800; min-width: 1.1rem; }

/* --- Summary completion from a list of phrases (A–J) --- */
.rd-summary {
  background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.rd-summary-heading {
  font-weight: 800; font-size: 1.05rem; text-align: center; color: #1a1a1a;
  border-bottom: 1px solid #e7e5e4; padding-bottom: 0.6rem; margin-bottom: 0.8rem;
}
.rd-summary-text { font-size: 1.02rem; line-height: 2.1; color: #1a1a1a; }
.rd-sumblank { display: inline-flex; align-items: center; gap: 4px; margin: 0 2px; }
.rd-sumnum { font-weight: 800; color: #2f6fb0; }
.rd-select-sm { min-width: 56px; padding: 0.15rem 0.35rem; }

.rd-phrase-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem 1rem;
  border: 1px solid #d6d3d1; border-radius: 8px; padding: 1rem 1.25rem; background: #fafafa;
}
.rd-phrase { display: flex; gap: 0.5rem; font-size: 0.97rem; color: #1a1a1a; }
@media (max-width: 1100px) { .rd-phrase-list { grid-template-columns: repeat(2, 1fr); } }

/* --- Inspera header countdown timer --- */
.rd-header { gap: 1rem; }
.rd-brand { flex: 1 1 0; }
.rd-tools { flex: 1 1 0; justify-content: flex-end; }
.rd-timer {
  flex: 0 0 auto; text-align: center; white-space: nowrap;
  font-size: 1.35rem; font-weight: 800; color: #1a1a1a;
  font-family: Arial, Helvetica, sans-serif; letter-spacing: 0.3px;
}
.rd-timer.danger { color: #e11d48; animation: rd-timer-pulse 1s ease-in-out infinite; }
@keyframes rd-timer-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

@media (max-width: 820px) {
  .rd-timer { font-size: 1.05rem; }
}

/* =====================================================================
   TEST SELECTION (candidate landing) + module-type badges
   ===================================================================== */
.module-type-badge {
  display: inline-block; margin-left: 0.5rem; padding: 0.2rem 0.7rem; border-radius: 99px;
  font-size: 0.8rem; font-weight: 700; background: var(--primary-light); color: var(--primary);
  border: 1px solid var(--primary-alpha);
}
.back-tests-btn { margin-bottom: 1rem; }

.test-select-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem;
}
.test-card {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 1.5rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.85rem;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.test-card.ready:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.test-card.locked, .test-card.soon { opacity: 0.75; }
.test-card-top { display: flex; align-items: center; justify-content: space-between; }
.test-card-num { font-family: var(--font-title); font-size: 1.35rem; font-weight: 800; color: var(--text-primary); }
.test-card-flag {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0.2rem 0.55rem; border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary);
}
.test-card-flag.active { background: var(--success-light); color: var(--success); }
.test-card-flag.locked { background: var(--danger-light); color: var(--danger); }
.test-card-note { font-size: 0.85rem; color: var(--text-secondary); flex: 1; }
.test-card-btn { width: 100%; }
.test-card-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* =====================================================================
   LISTENING TEST  (single column + Play overlay + audio status)
   Reuses the .rd-* chrome; adds .ls-* specifics.
   ===================================================================== */
.ls-root { position: relative; }

/* Header: candidate id with the audio-playing status underneath */
.ls-headblock { display: flex; flex-direction: column; gap: 1px; }
.ls-audio-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; font-weight: 600; color: #555;
}
.ls-audio-status svg { color: #1a1a1a; }
.ls-audio-status.danger { color: #e11d48; animation: rd-timer-pulse 1s ease-in-out infinite; }

/* Single-column body */
.ls-body { flex: 1; min-height: 0; overflow-y: auto; background: #fff; }
.ls-col { max-width: 880px; margin: 0 auto; padding: 1.25rem 1.75rem 3rem; }

/* Note completion layout */
.ls-note { font-size: 1.05rem; line-height: 2; color: #1a1a1a; }
.ls-note .ls-note-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 0.75rem; }
.ls-note .ls-sub { font-weight: 800; margin: 1rem 0 0.25rem; }
.ls-note p { margin: 0.15rem 0; }

/* Boxed inputs (match the Inspera look) */
.ls-box {
  display: inline-block; min-width: 130px; padding: 0.3rem 0.6rem; margin: 0 0.3rem;
  font-size: 1rem; font-weight: 700; color: #1a1a1a; text-align: center;
  background: #fff; border: 1px solid #8a8a8a; border-radius: 3px; outline: none;
  vertical-align: middle;
}
.ls-box:focus { border-color: #2f6fb0; box-shadow: 0 0 0 2px rgba(47,111,176,0.25); }

/* The question number sits centered & bold inside the empty answer box
   (Inspera note-completion style) — shown via the placeholder. */
.ls-box::placeholder,
.rd-blank::placeholder {
  color: #1a1a1a; font-weight: 700; opacity: 1; text-align: center;
}

/* Play overlay (dims the questions behind it) */
.ls-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(40,40,40,0.78); backdrop-filter: blur(1px);
  display: flex; align-items: center; justify-content: center; text-align: center; color: #fff;
}
.ls-overlay-inner { max-width: 760px; padding: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }
.ls-headphones { color: #fff; }
.ls-overlay-text { font-size: 1.25rem; line-height: 1.6; margin: 0; }
.ls-play-btn {
  display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1.6rem;
  font-size: 1.05rem; font-weight: 700; color: #fff; background: #1a1a1a;
  border: none; border-radius: 5px; cursor: pointer;
}
.ls-play-btn:hover { background: #000; }
.ls-play-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ls-play-btn:disabled:hover { background: #1a1a1a; }

/* "Preparing audio…" buffer readout under the Play button */
.ls-prep {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.95rem; font-weight: 600; color: rgba(255,255,255,0.85);
}
.ls-prep.ready { color: #86efac; }
.ls-prep.ready .ls-spinner { display: none; }
.ls-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: ls-spin 0.8s linear infinite;
}
@keyframes ls-spin { to { transform: rotate(360deg); } }

/* Listening block extras (map, options box, dropdowns, headings) */
.ls-block { margin-bottom: 2rem; }
.ls-qheading { font-size: 1.1rem; font-weight: 800; text-align: center; margin: 0.5rem 0 1rem; color: #1a1a1a; }
.ls-note .ls-indent { padding-left: 1.5rem; }
.ls-map-img { display: block; max-width: 100%; height: auto; border: 1px solid #d6d3d1; border-radius: 6px; margin: 0 auto 1.25rem; }
.ls-maprows { display: flex; flex-direction: column; gap: 0.6rem; max-width: 520px; }
.ls-maprows .rd-q-match { margin-bottom: 0; }
.ls-select {
  flex: 0 0 auto; min-width: 64px; padding: 0.35rem 0.5rem; font-size: 1rem; font-weight: 700;
  color: #1a1a1a; background: #fff; border: 1px solid #8a8a8a; border-radius: 4px; cursor: pointer;
}
.ls-select:focus { outline: none; border-color: #2f6fb0; box-shadow: 0 0 0 2px rgba(47,111,176,0.2); }
.ls-optbox { border: 1px solid #d6d3d1; border-radius: 8px; padding: 0.5rem 0.5rem 0.75rem; margin: 0.75rem 0 1rem; background: #fafafa; }
.ls-optbox-title { text-align: center; font-weight: 800; padding: 0.4rem; }

/* =====================================================================
   WRITING (Inspera replica) — prompt pane + answer editor
   ===================================================================== */
.wr-promptlead { font-size: 1.05rem; line-height: 1.6; color: #1a1a1a; margin: 0 0 0.85rem; }
.wr-promptbox {
  border: 1px solid #555; border-radius: 2px; padding: 1rem 1.25rem;
  margin: 0 0 1rem; font-size: 1.05rem; line-height: 1.6; color: #1a1a1a;
  font-style: italic; font-weight: 700; background: #fff;
}
.wr-chart { margin: 1rem 0 0.5rem; max-width: 640px; }
.wr-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wr-editor-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.2rem 0.55rem; font-size: 0.92rem; color: #6b6b6b;
}
.wr-textarea {
  flex: 1 1 auto; min-height: 260px; width: 100%; resize: none;
  padding: 1rem 1.1rem; font-size: 1.05rem; line-height: 1.6; color: #1a1a1a;
  font-family: Arial, Helvetica, sans-serif; background: #fff;
  border: 1px solid #8a8a8a; border-radius: 4px; outline: none;
}
.wr-textarea:focus { border-color: #2f6fb0; box-shadow: 0 0 0 2px rgba(47,111,176,0.2); }
.wr-wordcount {
  font-weight: 800; color: #fff; background: #2f6fb0;
  padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.9rem;
}
.wr-wordcount.ok { background: #1f7a3d; }

/* =====================================================================
   SPEAKING (Inspera replica) — examiner + recorder, single column
   ===================================================================== */
.sp-col { max-width: 760px; margin: 0 auto; }
.sp-examiner {
  display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem;
  background: #f3f4f6; border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 1.25rem;
}
.sp-avatar {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #2f6fb0; color: #fff; transition: transform 0.2s, box-shadow 0.2s;
}
.sp-avatar.speaking { box-shadow: 0 0 0 6px rgba(47,111,176,0.18); transform: scale(1.04); }
.sp-examiner-meta { flex: 1 1 auto; }
.sp-examiner-name { font-weight: 800; color: #1a1a1a; }
.sp-status { font-size: 0.95rem; color: #555; margin-top: 2px; }
.rd-textbtn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem;
  background: #fff; border: 1px solid #b8b8b8; border-radius: 5px; color: #1a1a1a;
  font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
.rd-textbtn:hover { background: #f3f3f3; }
.sp-question-box, .sp-cuecard {
  padding: 1.1rem 1.25rem; background: #fff; border: 1px solid #d6d3d1;
  border-radius: 8px; margin-bottom: 1.25rem;
}
.sp-examiner-q { font-size: 1.15rem; line-height: 1.55; color: #1a1a1a; margin: 0; }
.sp-cue-topic { font-size: 1.2rem; font-weight: 800; color: #1a1a1a; margin: 0.25rem 0 0.75rem; }
.sp-cue-sub { font-weight: 700; margin: 0 0 0.35rem; }
.sp-cue-list { margin: 0; padding-left: 1.3rem; line-height: 1.7; color: #333; }
.sp-recorder { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin: 1.5rem 0 2rem; }
.sp-timer { font-size: 2.6rem; font-weight: 800; color: #1a1a1a; font-variant-numeric: tabular-nums; }
.sp-timer.danger { color: #d32030; }
.rd-bigbtn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.8rem;
  background: #2f6fb0; color: #fff; border: none; border-radius: 6px;
  font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.rd-bigbtn:hover { background: #285f97; }
.rd-bigbtn.recording { background: #d32030; }
.rd-bigbtn.recording:hover { background: #b71c2c; }
.sp-history { border-top: 1px solid #e0e0e0; padding-top: 1rem; }
.sp-history-title {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #6b6b6b; margin: 0 0 0.6rem;
}
.sp-empty { font-size: 0.9rem; color: #888; font-style: italic; }
.sp-track {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px solid #eee;
}
.sp-track-label { font-size: 0.92rem; color: #333; overflow: hidden; }
.sp-track-label span { color: #666; }
.sp-track audio { height: 32px; flex: 0 0 auto; }
