/**
 * TIMSS PSI Simulation — World-Class EdTech Design System (Light Surface Edition)
 * Aligned with Duolingo, Khan Academy & Official TIMSS E-Assessment UI Standards
 */

:root {
  /* Base Canvas & Surface Elevation */
  --bg-deep: #0c1524;
  --bg-panel: #132238;
  --bg-card: #182b47;
  --bg-card-hover: #20375a;
  --bg-input: #0f1c30;

  /* Crisp Slate Borders */
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-focus: #10B981;

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;

  /* Accent & Brand Palette */
  --brand-primary: #3B82F6;
  --brand-primary-light: #6366F1;
  --brand-accent: #10B981;
  --brand-emerald: #10B981;
  --brand-emerald-dark: #059669;
  --brand-warning: #F59E0B;
  --brand-danger: #EF4444;
  --brand-purple: #6366F1;

  /* Refined Border Radii (rounded-2xl / rounded-xl) */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  /* Micro-Shadows & Surface Elevation */
  --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.04), 0 1px 3px -1px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow-blue: 0 4px 14px rgba(59, 130, 246, 0.25);
  --shadow-glow-emerald: 0 4px 14px rgba(16, 185, 129, 0.25);

  --header-height: 76px;
  --actions-bar-height: 74px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  min-height: 100dvh;
  font-family: 'Cairo', 'Alexandria', 'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 45%),
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 45%),
    radial-gradient(at 50% 100%, rgba(99, 102, 241, 0.04) 0px, transparent 50%);
  color: var(--text-main);
  direction: rtl;
  overflow-x: hidden !important;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Global Scrollbar Elimination (No Vertical or Horizontal Scrollbars) */
* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* ==========================================================================
   1. Track Selection Modal (Light Surface Overhaul)
   ========================================================================== */
.track-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 11, 20, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.track-modal-overlay.hidden,
.track-modal-overlay.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none !important;
}

.track-resume-btn-wrap {
  width: 100%;
  margin-bottom: 16px;
}

.btn-resume-session {
  width: 100%;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.btn-resume-session:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(2, 132, 199, 0.45);
}

.track-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.track-card-top-row .track-card-badge {
  position: static;
}

.track-card-top-row .track-card-icon {
  margin-bottom: 0;
}

.track-modal-dialog {
  width: 100%;
  max-width: 860px;
  background: #182b47;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
  animation: modalEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.track-modal-header {
  text-align: center;
  margin-bottom: 28px;
}

.track-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #10B981, #059669);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.28);
}

.track-modal-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.track-modal-subtitle {
  font-size: 0.98rem;
  color: #94a3b8;
  max-width: 620px;
  margin: 0 auto;
}

.track-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.track-card {
  position: relative;
  background: #182b47;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  text-align: right;
  box-shadow: var(--shadow-sm);
}

.track-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow-md);
}

.track-card.selected {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), var(--shadow-md);
}

.track-card.card-measurement.selected {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.14);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), var(--shadow-md);
}

.track-card-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

.track-card-badge.official {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.track-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.track-card-icon.learning {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
}

.track-card-icon.measurement {
  background: rgba(59, 130, 246, 0.22);
  color: #60a5fa;
}

.track-card-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
}

.track-card-desc {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 16px;
  line-height: 1.6;
}

.track-card-features {
  list-style: none;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-card-features li {
  font-size: 0.84rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.track-card-features li i {
  color: #10B981;
  font-size: 0.8rem;
}

.track-card.card-measurement .track-card-features li i {
  color: #3B82F6;
}

.track-select-status {
  margin-top: 16px;
  padding: 9px 14px;
  border-radius: 12px;
  background: #0f1c30;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.track-card.selected .track-select-status {
  background: #10B981;
  color: #FFFFFF;
}

.track-card.card-measurement.selected .track-select-status {
  background: #3B82F6;
  color: #FFFFFF;
}

.track-modal-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-portal-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: 14px;
  background: #0f1c30;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-portal-back:hover {
  background: #20375a;
  color: #f8fafc;
  transform: translateY(-1px);
}

.btn-start-track {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  border: none;
  padding: 14px 36px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.15s ease;
}

.btn-start-track:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.42);
}

.btn-start-track:active {
  transform: translateY(0);
}

/* ==========================================================================
   2. Header, Stepper Header & Navigation Bar
   ========================================================================== */
.lab-header {
  height: var(--header-height);
  background: rgba(19, 34, 56, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10B981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
}

/* Center Progress & Connected Stepper Badges */
.header-center-progress {
  flex: 1;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.header-screen-label {
  font-weight: 700;
  color: #f8fafc;
}

.track-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.track-badge.badge-learning {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  border: 1px solid #A7F3D0;
}

.track-badge.badge-measurement {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  border: 1px solid #BFDBFE;
}

.header-step-number {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #10B981;
  background: rgba(16, 185, 129, 0.16);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
}

/* Connected Circular Stepper Header */
.header-stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 2px 0;
}

.stepper-node {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: #182b47;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.stepper-node:hover {
  border-color: #10B981;
  color: #34d399;
  transform: scale(1.08);
}

.stepper-node.completed {
  background: rgba(16, 185, 129, 0.22);
  border-color: #10B981;
  color: #6ee7b7;
}

.stepper-node.active {
  background: linear-gradient(135deg, #10B981, #059669);
  border-color: #34d399;
  color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  transform: scale(1.1);
}

.stepper-connector {
  flex: 1;
  height: 2px;
  background: #20375a;
  border-radius: 999px;
  transition: background 0.25s ease;
}

.stepper-connector.completed {
  background: #10B981;
}

.header-progress-track {
  width: 100%;
  height: 5px;
  background: #20375a;
  border-radius: 999px;
  overflow: hidden;
}

.header-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #3B82F6);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header Tools */
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tool {
  height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: #0f1c30;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background: #20375a;
  color: #f8fafc;
  transform: translateY(-1px);
}

.btn-tool.active {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border-color: #93C5FD;
}

/* Unified Menu & Experiment Switcher Dropdowns */
.dropdown-menu-content {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: #182b47;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  z-index: 999;
}

.dropdown-menu-content.show {
  display: block;
  animation: fadeInDown 0.18s ease-out;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: #0f1c30;
  color: #f8fafc;
}

.dropdown-item.danger {
  color: #EF4444;
}

.dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

/* ==========================================================================
   3. Main Two-Column Layout (Generous Whitespace & Breathing Room)
   ========================================================================== */
.lab-main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 24px;
  padding: 24px 28px calc(var(--actions-bar-height) + 24px);
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

.simulation-viewport-panel {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  height: calc(100vh - var(--header-height) - var(--actions-bar-height) - 44px);
  min-height: 540px;
  background: #182b47;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.task-question-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#task-question-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   4. Question Cards, Narrative & Prompts
   ========================================================================== */
.task-card {
  background: #182b47;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 0;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: cardFadeIn 0.28s ease-out;
}

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

.task-body-content {
  padding: 28px 30px;
}

.task-text {
  font-size: 1.04rem;
  color: #cbd5e1;
  margin-bottom: 14px;
  line-height: 1.75;
}

.task-text strong {
  color: #f8fafc;
  font-weight: 700;
}

.lead-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
}

/* Form Controls */
.timss-textarea,
.timss-input,
.timss-select {
  width: 100%;
  background: #182b47;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 16px;
  color: #f8fafc;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.timss-textarea:focus,
.timss-input:focus,
.timss-select:focus {
  outline: none;
  border-color: #10B981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* Data Tables */
.timss-data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;
  font-size: 0.94rem;
  background: #182b47;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

.timss-data-table th,
.timss-data-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.timss-data-table th {
  background: #132238;
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.88rem;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.1);
}

.timss-data-table tr:last-child td {
  border-bottom: none;
}

.timss-data-table tbody tr:hover {
  background: #132238;
}

/* Submission Alert Banners */
.submission-alert {
  padding: 16px 20px;
  border-radius: 14px;
  margin-top: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.95rem;
  line-height: 1.6;
  animation: cardFadeIn 0.25s ease;
}

.submission-alert i {
  font-size: 1.35rem;
  margin-top: 2px;
}

.submission-alert.alert-success {
  background: rgba(16, 185, 129, 0.16);
  border: 1.5px solid #6EE7B7;
  color: #a7f3d0;
}

.submission-alert.alert-success i {
  color: #10B981;
}

.submission-alert.alert-warning {
  background: rgba(245, 158, 11, 0.16);
  border: 1.5px solid #FCD34D;
  color: #fde68a;
}

.submission-alert.alert-warning i {
  color: #F59E0B;
}

.submission-alert.alert-danger {
  background: rgba(239, 68, 68, 0.16);
  border: 1.5px solid #FCA5A5;
  color: #fecaca;
}

.submission-alert.alert-danger i {
  color: #EF4444;
}

.submission-alert.alert-measurement {
  background: rgba(59, 130, 246, 0.16);
  border: 1.5px solid #93C5FD;
  color: #bfdbfe;
}

.submission-alert.alert-measurement i {
  color: #3B82F6;
}

/* ==========================================================================
   5. Fixed Bottom Actions Bar & Tactile Buttons
   ========================================================================== */
.lab-actions-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--actions-bar-height);
  background: rgba(19, 34, 56, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 110;
  display: flex;
  align-items: center;
  padding: 0 28px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
}

.actions-bar-inner {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.actions-dock-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.actions-dock-start,
.actions-dock-end {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-action-nav,
.btn-action-submit,
.btn-action-help,
.btn-action-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 24px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

/* Secondary Navigation Button */
.btn-action-nav.btn-prev {
  background: #0f1c30;
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-action-nav.btn-prev:hover {
  background: #20375a;
  color: #f8fafc;
  transform: translateY(-1px);
}

/* Primary Next Button */
.btn-action-nav.btn-next {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-action-nav.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Primary Submit Button (Emerald) */
.btn-action-submit {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-action-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-action-submit:disabled,
.btn-action-submit.disabled {
  background: #20375a;
  color: #94A3B8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Help Button (Warm Amber Highlight) */
.btn-action-help {
  background: rgba(245, 158, 11, 0.16);
  border: 1.5px solid #FCD34D;
  color: #fbbf24;
}

.btn-action-help:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #F59E0B;
  transform: translateY(-1px);
}

/* Retry Button */
.btn-action-retry {
  background: #0f1c30;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #cbd5e1;
}

.btn-action-retry:hover {
  background: #20375a;
  color: #f8fafc;
  transform: translateY(-1px);
}

/* ==========================================================================
   6. Help Drawer (ساعدني أفهم — 4-Tier Progressive Scaffolding Floating Card)
   ========================================================================== */
.help-drawer {
  position: fixed;
  bottom: calc(var(--actions-bar-height) + 14px);
  left: 28px;
  z-index: 950;
  max-width: 520px;
  width: calc(100% - 56px);
  background: rgba(18, 29, 48, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35), 0 0 30px rgba(245, 158, 11, 0.22);
  display: none;
  animation: slideUpHelp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: #F8FAFC;
}

.help-drawer.open {
  display: block;
}

.help-drawer[hidden] {
  display: none !important;
}

@keyframes slideUpHelp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.help-drawer-content {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.help-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.help-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.help-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.help-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.help-main-title {
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
}

.help-sub-title {
  font-size: 12.5px;
  color: #94A3B8;
  font-weight: 600;
}

.btn-close-help,
.help-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #CBD5E1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-close-help:hover,
.help-close-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #F87171;
}

.help-levels-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.help-level-btn {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: #94A3B8;
  font-family: inherit;
  transition: all 0.2s ease;
  text-align: center;
}

.help-level-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #FFFFFF;
  border-color: rgba(245, 158, 11, 0.4);
}

.help-level-btn .lvl-num {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.help-level-btn .lvl-text {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
}

.help-level-btn.unlocked {
  border-color: rgba(245, 158, 11, 0.35);
  color: #E2E8F0;
}

.help-level-btn.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #F59E0B;
  color: #FBBF24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.28);
}

.help-body-card,
.current-hint-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 18px;
}

.help-level-badge,
.hint-tier-tag {
  font-size: 13px;
  font-weight: 800;
  color: #FBBF24;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-text-content,
.hint-text {
  font-size: 14.5px;
  color: #F8FAFC;
  line-height: 1.75;
}

.help-drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-next-hint,
.btn-help-next {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35));
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #FEF3C7;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-next-hint:hover,
.btn-help-next:hover {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  border-color: #FBBF24;
}

.help-complete-notice,
.hint-complete-notice {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6EE7B7;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Inline Retry & Help Buttons inside Submission Alert */
.btn-retry-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: #182b47;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-retry-inline:hover {
  background: #0f1c30;
  border-color: #94A3B8;
}

.btn-retry-inline.btn-help-inline {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border-color: #fbbf24;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.28);
}

.btn-retry-inline.btn-help-inline:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .help-drawer {
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
    max-width: 100%;
    bottom: calc(var(--actions-bar-height) + 8px);
  }
  .help-levels-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   7. Sleek Floating Gadget Calculator Modal
   ========================================================================== */
.floating-calculator {
  position: fixed;
  top: 96px;
  left: 28px;
  width: 280px;
  background: #182b47;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  z-index: 500;
  padding: 16px;
  display: none;
  direction: ltr;
}

.floating-calculator.open {
  display: block;
  animation: fadeInDown 0.2s ease-out;
}

.calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  font-weight: 800;
  color: #f8fafc;
  direction: rtl;
  cursor: move;
}

.calc-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0f1c30;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calc-close-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #EF4444;
}

.calc-display {
  background: #132238;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 12px;
  overflow-x: auto;
}

.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-key {
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #182b47;
  color: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.calc-key:hover {
  background: #132238;
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.calc-key:active {
  transform: translateY(1px);
}

.calc-key.op {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border-color: #BFDBFE;
}

.calc-key.clear {
  background: rgba(239, 68, 68, 0.16);
  color: #EF4444;
  border-color: #FECACA;
}

.calc-key.equals {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.28);
}

/* ==========================================================================
   8. Diagnostic Report Card (Screen 9)
   ========================================================================== */
.diagnostic-report-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-header-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(59, 130, 246, 0.14) 100%);
  border: 1px solid #A7F3D0;
  border-radius: 20px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
}

.banner-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.banner-text h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 4px;
}

.banner-text p {
  font-size: 0.9rem;
  color: #94a3b8;
}

.report-hero-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.hero-score-card,
.hero-meta-card,
.report-section-card {
  background: #182b47;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.hero-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, #182b47 0%, #132238 100%);
}

.hero-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
}

.hero-score-val {
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.score-num {
  font-size: 2.8rem;
  font-weight: 800;
  color: #10B981;
}

.score-den {
  font-size: 1.3rem;
  font-weight: 700;
  color: #94a3b8;
}

.hero-percentage {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 6px 0 10px;
}

.hero-benchmark-badge {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 999px;
}

.hero-meta-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

.meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-k {
  color: #94a3b8;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-v {
  color: #f8fafc;
  font-weight: 700;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.competencies-progress-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.competency-progress-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
}

.comp-bar-track {
  height: 9px;
  background: #0f1c30;
  border-radius: 999px;
  overflow: hidden;
}

.comp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #3B82F6);
  border-radius: 999px;
}

.cognitive-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cog-stat-box {
  background: #132238;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.cog-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #94a3b8;
  display: block;
}

.cog-score-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 6px 0;
  font-family: 'JetBrains Mono', monospace;
}

.cog-bar {
  height: 6px;
  background: #20375a;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.cog-fill {
  height: 100%;
  background: #3B82F6;
}

.cog-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: #60a5fa;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.audit-table th,
.audit-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-table th {
  background: #132238;
  color: #94a3b8;
  font-weight: 800;
}

.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-ok { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; }
.badge-warning { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }

.report-actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-report-action {
  padding: 12px 22px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #182b47;
  color: #cbd5e1;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-report-action:hover {
  background: #132238;
  color: #f8fafc;
  transform: translateY(-1px);
}

.btn-report-action.btn-print {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
}

/* Utility Classes */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.text-primary { color: #3B82F6; }
.text-success { color: #10B981; }
.text-warning { color: #F59E0B; }
.text-danger { color: #EF4444; }
.text-info { color: #3B82F6; }
.font-bold { font-weight: 700; }
