:root {
  /* Premium Palette - Modern Teal & Soft Slate */
  --primary: #0f766e; /* Teal 700 */
  --primary-rgb: 15, 118, 110;
  --primary-hover: #0d9488; /* Teal 600 */

  --secondary: #3b82f6; /* Blue 500 */
  --secondary-rgb: 59, 130, 246;
  --secondary-hover: #2563eb; /* Blue 600 */

  --background: #f0fdfa; /* Teal 50 */
  --background-rgb: 240, 253, 250;

  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface-muted: #f1f5f9; /* Slate 100 */
  --surface-strong: #e2eee8;

  --text: #1e293b; /* Slate 800 */
  --text-rgb: 30, 41, 59;
  --text-muted: #64748b; /* Slate 500 */
  --text-inverse: #ffffff;

  --accent: #f59e0b; /* Amber 500 */
  --border: #e2e8f0; /* Slate 200 */

  --shadow-color: 15, 23, 42; /* Slate 900 */
  --shadow: 0 20px 25px -5px rgba(var(--shadow-color), 0.1),
    0 8px 10px -6px rgba(var(--shadow-color), 0.1);
  --shadow-soft: 0 4px 6px -1px rgba(var(--shadow-color), 0.05),
    0 2px 4px -2px rgba(var(--shadow-color), 0.05);
  --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), 0.3);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
}

.dark-mode,
.dark-theme,
html.dark {
  --primary: #14b8a6; /* Teal 500 */
  --primary-rgb: 20, 184, 166;
  --primary-hover: #2dd4bf; /* Teal 400 */

  --secondary: #60a5fa; /* Blue 400 */
  --secondary-rgb: 96, 165, 250;
  --secondary-hover: #93c5fd; /* Blue 300 */

  --background: #0f172a; /* Slate 900 */
  --background-rgb: 15, 23, 42;

  --surface: #1e293b; /* Slate 800 */
  --surface-rgb: 30, 41, 59;
  --surface-muted: #334155; /* Slate 700 */
  --surface-strong: #1b2c43;

  --text: #f1f5f9; /* Slate 100 */
  --text-rgb: 241, 245, 249;
  --text-muted: #94a3b8; /* Slate 400 */
  --text-inverse: #0f172a;

  --accent: #fbbf24; /* Amber 400 */
  --border: #334155; /* Slate 700 */

  --shadow-color: 0, 0, 0;
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 18px 36px rgba(0, 0, 0, 0.26);
  --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), 0.26);

  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Cairo", sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-image: radial-gradient(
      at 0% 0%,
      rgba(var(--primary-rgb), 0.1) 0px,
      transparent 50%
    ),
    radial-gradient(
      at 100% 100%,
      rgba(var(--secondary-rgb), 0.05) 0px,
      transparent 50%
    );
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1200px; /* Wider container */
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-container {
  display: none;
}

.page-container.active-container {
  display: block;
  animation: fadeScaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page {
  display: none;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 56px;
  box-shadow: var(--shadow);
}

.page.active {
  display: block;
}

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

.main-nav {
  position: sticky;
  top: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin: 20px auto;
  max-width: 1100px;
  border-radius: 24px;
  background: rgba(var(--surface-rgb), 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(var(--border), 0.6);
  box-shadow: var(--shadow-soft);
  transition: all 0.3s ease;
}

.main-nav:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.nav-brand {
  display: flex;
  align-items: center;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-hover) 100%
  );
  color: white; /* Always white on the gradient button */
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.nav-logo:hover {
  transform: scale(1.02);
}

.brand-mark {
  font-size: 1.5rem;
  color: white;
}

.brand-text {
  font-weight: 700;
  font-size: 1.2rem;
}

.nav-toggle {
  display: none;
  /* ... toggle styles if needed for mobile ... */
  color: var(--text);
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px; /* Compact gap */
  margin: 0;
  padding: 0;
}

/* Enforce black text for inputs in dark mode as requested */
.dark-mode input,
.dark-mode textarea,
.dark-mode select,
html.dark input,
html.dark textarea,
html.dark select {
  color: #000000 !important;
  background-color: #f8fafc; /* Slate 50 - Light background for contrast */
  border-color: #cbd5e1; /* Slate 300 */
}

/* Ensure placeholder is visible but distinct */
.dark-mode ::placeholder,
html.dark ::placeholder {
  color: #64748b; /* Slate 500 */
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  color: rgba(var(--text-rgb), 0.86);
  font-weight: 600;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.nav-link.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.nav-icon {
  font-size: 1.1rem;
  display: inline-flex;
}

.nav-label {
  font-size: 1rem;
}

.nav-item.has-dropdown > .nav-link {
  padding-inline-end: 16px;
}

.nav-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-inline-start: 5px solid transparent;
  border-inline-end: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.3s ease;
  margin-inline-start: 4px;
}

.nav-item.has-dropdown.open .nav-caret,
.nav-item.has-dropdown > .nav-link[aria-expanded="true"] .nav-caret {
  transform: rotateX(180deg);
}

.nav-dropdown {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 12px);
  min-width: 220px;
  list-style: none;
  margin: 0;
  padding: 16px 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.nav-dropdown.open,
.nav-item.has-dropdown:hover > .nav-dropdown {
  display: flex;
}

.nav-sublink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(var(--text-rgb), 0.8);
  font-size: 0.95rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.nav-sublink:hover,
.nav-sublink:focus-visible,
.nav-sublink.active {
  color: var(--text);
  background: rgba(var(--primary-rgb), 0.12);
}

.theme-toggle-container {
  display: flex;
  align-items: center;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.home-page {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.page-header {
  text-align: center;
}

.page-header h1 {
  margin: 0;
  font-size: 2.8rem;
  color: var(--text);
  text-shadow: 0 16px 40px rgba(var(--shadow-color), 0.16);
}

.page-subtitle {
  margin: 12px 0 6px;
  color: var(--text-muted);
  font-size: 1.12rem;
}

.page-meta {
  margin: 0;
  color: rgba(var(--text-rgb), 0.6);
  font-size: 0.96rem;
}

.hero-search {
  margin: 0 auto;
  margin-top: 20px;
  max-width: 520px;
  display: flex;
  gap: 12px;
  background: rgba(var(--surface-rgb), 0.85);
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.hero-card {
  background: linear-gradient(
    140deg,
    rgba(var(--primary-rgb), 0.16) 0%,
    var(--surface) 100%
  );
  border-radius: 26px;
  padding: 44px 38px;
  margin: 20px 0 20px 0;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: background-color 0.3s ease;
}

.hero-card h2 {
  margin: 0;
  font-size: 2rem;
  color: var(--text);
}

.hero-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.05rem;
}

.hero-card strong {
  color: var(--text);
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.home-form-card {
  background: var(--surface);
  border-radius: 26px;
  padding: 40px 36px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
}

.home-form-card h3 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--text);
}

.home-form-note {
  color: var(--text-muted);
  margin: 12px 0 28px;
  line-height: 1.6;
}

.home-form-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: rgba(var(--text-rgb), 0.85);
  font-size: 1rem;
}

.form-group select,
.form-group input,
.dropdown-select,
.essay-textarea {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(var(--border), 1);
  border-radius: 14px;
  font-size: 1rem;
  font-family: "Cairo", sans-serif;
  transition: border-color 0.3s ease, box-shadow 0.3s ease,
    background-color 0.3s ease, color 0.3s ease;
  background: rgba(var(--surface-rgb), 0.94);
  color: var(--text);
}

.form-group select:focus,
.form-group input:focus,
.dropdown-select:focus,
.essay-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.btn {
  background: var(--primary);
  color: var(--text-inverse);
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Cairo", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(var(--primary-rgb), 0.28);
}

.btn:disabled {
  background: rgba(var(--primary-rgb), 0.25);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(var(--border), 1);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.btn-group {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 30px;
  flex-wrap: wrap;
}

.rules-list,
.card-surface {
  background: var(--surface);
  padding: 28px;
  border-radius: 22px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
}

.rules-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  margin: 12px 0;
  padding-right: 12px;
  line-height: 1.9;
  font-size: 1.05rem;
  color: var(--text-muted);
}

#testInfo {
  background: var(--surface-muted);
  border-radius: 20px;
  padding: 22px;
  border: 1px solid rgba(var(--border), 1);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.timer {
  background: rgba(var(--accent), 0.18);
  color: var(--text);
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent), 0.65);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.progress-bar {
  background: rgba(var(--text-rgb), 0.15);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin: 24px 0;
}

.progress-fill {
  background: linear-gradient(
    90deg,
    rgba(var(--primary-rgb), 1) 0%,
    rgba(var(--primary-rgb), 0.7) 100%
  );
  height: 100%;
  transition: width 0.3s ease;
}

.question-container {
  margin: 32px 0;
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
  padding: 28px;
}

.question-header {
  background: var(--surface-muted);
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(var(--border), 1);
  margin-bottom: 22px;
}

.question-number {
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.9rem;
  color: var(--text);
  line-height: 1.7;
  font-weight: 600;
  font-family: "Calibri", sans-serif;
}

.question-level-badge {
  margin-inline-start: 12px;
}

.options-container,
.drag-items,
.drop-zone,
.ordering-items,
.multiple-select-container {
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid rgba(var(--border), 1);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.option,
.drag-item,
.ordering-item,
.multiple-select-option {
  background: var(--surface-muted);
  border: 1px solid rgba(var(--border), 1);
  padding: 16px 20px;
  border-radius: 14px;
  margin: 12px 0;
  font-size: 1.9rem;
  font-family: "Calibri", sans-serif;
  color: var(--text);
  transition: transform 0.25s ease, border-color 0.25s ease,
    background-color 0.25s ease;
  cursor: pointer;
}

.option:hover,
.multiple-select-option:hover,
.ordering-item:hover,
.drag-item:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
}

.option.selected,
.multiple-select-option.selected,
.ordering-item.fixed-ordering-item,
.drag-item.selected {
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.18) 0%,
    rgba(var(--primary-rgb), 0.45) 100%
  );
  border-color: var(--primary);
  color: var(--text-inverse);
}

.multiple-select-option {
  display: flex;
  align-items: center;
  gap: 14px;
}

.multiple-select-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(var(--border), 1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.multiple-select-option.selected .multiple-select-checkbox {
  background: var(--text-inverse);
  border-color: transparent;
}

.drag-items,
.drop-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 120px;
}

.drag-item {
  cursor: grab;
}

.drag-item.dragging {
  opacity: 0.45;
}

.drop-zone {
  border-style: dashed;
  border-color: rgba(var(--border), 1);
}

.drop-zone.drag-over {
  background: rgba(var(--primary-rgb), 0.08);
  border-color: var(--primary);
}

.ordering-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.ordering-number {
  background: var(--primary);
  color: var(--text-inverse);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.dropdown-select {
  cursor: pointer;
}

.dropdown-select.answered {
  background: rgba(var(--primary-rgb), 0.12);
}

/* --- Admin / Dashboard Generic Styles --- */

/* Info Cards - Replaces bg-blue-50 etc */
.info-card {
  background: var(--surface-muted);
  border: 1px solid rgba(var(--border), 1);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Avatar Card */
.avatar-card {
  margin-bottom: 16px;
}

/* Global Table Styles within Pages */
.page table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 10px;
}

.page thead {
  background: rgba(var(--primary-rgb), 0.06);
}

.page th {
  padding: 16px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
  white-space: nowrap;
}

.page th:first-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.page th:last-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.page tbody tr {
  transition: background-color 0.2s ease;
}

.page tbody tr:hover {
  background-color: rgba(var(--surface-rgb), 0.5);
}

.dark-mode .page tbody tr:hover,
html.dark .page tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.page td {
  padding: 16px;
  border-bottom: 1px solid rgba(var(--border), 0.5);
  color: var(--text);
  font-size: 0.95rem;
}

.page tr:last-child td {
  border-bottom: none;
}

/* Status Badges in Tables */
.role-badge,
.status-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(var(--border), 0.5);
  color: var(--text-muted);
}

.role-badge.admin {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}

.role-badge.user {
  background: rgba(var(--secondary-rgb), 0.15);
  color: var(--secondary);
}

.click-drag-container,
.essay-container,
.matching-container,
.ordering-container {
  margin: 24px 0;
}

.slider-container {
  background: var(--surface);
  border: 1px solid rgba(var(--border), 1);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(var(--text-rgb), 0.2);
  outline: none;
  margin: 20px 0;
  cursor: pointer;
}

.slider::-webkit-slider-thumb,
.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  box-shadow: 0 6px 14px rgba(var(--primary-rgb), 0.25);
}

.slider-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.essay-instructions,
.multiple-select-instructions {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text-muted);
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  margin-bottom: 16px;
}

.essay-textarea {
  min-height: 160px;
  line-height: 1.7;
  resize: vertical;
}

.essay-textarea.answered {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: var(--primary);
}

.word-count {
  text-align: left;
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.word-count.valid {
  color: rgba(var(--primary-rgb), 1);
}

#answerNote {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  display: none;
}

.results-summary {
  text-align: center;
  margin: 40px 0;
}

.score-circle {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  margin: 0 auto 32px;
  background: conic-gradient(
    var(--primary) 0deg,
    rgba(var(--primary-rgb), 0.12) var(--percentage, 0deg)
  );
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.score-circle .percentage {
  font-size: 3rem;
  font-weight: 800;
}

.score-circle .label {
  font-size: 1.1rem;
  color: rgba(var(--text-rgb), 0.9);
}

.stats-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  background: var(--surface-muted);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(var(--border), 1);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.stat-card .number {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .label {
  color: var(--text-muted);
  margin-top: 6px;
}

.answer-review {
  margin: 32px 0;
}

.review-item {
  background: var(--surface);
  padding: 24px;
  border-radius: 18px;
  border-inline-start: 6px solid transparent;
  border: 1px solid rgba(var(--border), 1);
  margin: 16px 0;
  box-shadow: var(--shadow-soft);
}

.review-item.correct {
  border-inline-start-color: var(--primary);
}

.review-item.incorrect {
  border-inline-start-color: #f16c62;
}

.review-question {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.review-answer {
  margin: 8px 0;
  color: var(--text-muted);
}

.review-answer.correct-answer {
  color: var(--primary);
  font-weight: 600;
}

.review-answer.user-answer {
  color: #f16c62;
}

.resources {
  background: var(--surface);
  padding: 28px;
  border-radius: 18px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
}

.resources h3 {
  margin-top: 0;
  color: var(--text);
}

.resource-link {
  display: block;
  color: rgba(var(--primary-rgb), 0.9);
  margin: 10px 0;
  transition: color 0.3s ease;
}

.resource-link:hover {
  color: var(--primary);
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.theme-icon {
  transition: transform 0.3s ease;
}

.theme-toggle-btn:hover .theme-icon {
  transform: rotate(20deg);
}

@media print {
  body {
    background: #ffffff;
  }
  .btn,
  .btn-group,
  .theme-toggle-container,
  nav {
    display: none !important;
  }
  .page {
    box-shadow: none;
    padding: 0;
  }
}

@media (max-width: 992px) {
  .main-nav {
    margin: 24px;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 18px;
  }
  .container {
    padding: 32px 16px 60px;
  }
  .page {
    padding: 36px 28px;
  }
}

@media (max-width: 768px) {
  .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    border-radius: 32px;
  }
  .nav-toggle {
    display: flex;
    align-self: stretch;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    background: rgba(var(--surface-rgb), 0.92);
    border-radius: 24px;
    padding: 18px 16px;
    border: 1px solid rgba(var(--border), 1);
    box-shadow: var(--shadow-soft);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-item.has-dropdown {
    width: 100%;
  }
  .nav-item.has-dropdown > .nav-link {
    justify-content: space-between;
  }
  .nav-dropdown {
    position: static;
    border-radius: 18px;
    margin-top: 8px;
    padding: 12px;
    background: rgba(var(--surface-rgb), 1);
    border: 1px solid rgba(var(--border), 1);
    display: none;
  }
  .nav-dropdown.open {
    display: flex;
  }
  .page {
    padding: 28px 20px;
  }
  .page-header h1 {
    font-size: 2.2rem;
  }
  .hero-card,
  .home-form-card,
  .rules-list,
  .question-container,
  .resources,
  .review-item {
    padding: 26px 20px;
  }
  .btn-group {
    justify-content: center;
  }
  .score-circle {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 480px) {
  .main-nav {
    margin: 18px;
    padding: 14px 16px;
    gap: 14px;
  }
  .page {
    padding: 24px 18px;
  }
  .nav-brand {
    font-size: 1.3rem;
  }
  .theme-toggle-btn {
    width: 44px;
    height: 44px;
  }
  .hero-card h2 {
    font-size: 1.6rem;
  }
}

/* Smooth transitions for theme switching */
body,
.page,
.btn,
.form-group input,
.form-group select,
.option,
.question-container,
.stat-card,
.resources,
.review-item {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease;
}

.matching-columns {
  display: flex;
  gap: 32px;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

.matching-column {
  flex: 1;
  border-radius: 18px;
  border: 1px solid rgba(var(--border), 1);
  box-shadow: var(--shadow-soft);
  padding: 18px 12px 18px 12px;
  min-width: 180px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.matching-column:first-child {
  background: #eaf3fb;
}
.matching-column:last-child {
  background: #fffbe8;
}

.dark-mode .matching-column:first-child,
.dark-theme .matching-column:first-child {
  background: #16344a;
}
.dark-mode .matching-column:last-child,
.dark-theme .matching-column:last-child {
  background: #4a4316;
}

.matching-column h4 {
  margin: 0 0 12px 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.matching-item {
  background: #0a920a88;
  border: 1.5px solid rgba(var(--border), 1);
  border-radius: 12px;
  padding: 15px 18px;
  font-size: 1.9rem;
  font-family: "Calibri", sans-serif;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
  margin: 0;
  text-align: center;
  font-weight: bold;
}

.matching-item.selected,
.matching-item.matched {
  border-color: #08b952;
  background: #05a78486;
  color: var(--text);
  font-weight: bold;
}

@media (max-width: 700px) {
  .matching-columns {
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
  }
  .matching-column {
    min-width: 0;
    max-width: 100%;
  }
}
.reading-paragraph {
  font-family: "Calibri", sans-serif;
  font-size: 1.9rem;
  line-height: 1.8;
}

.highlight-paragraph {
  background-color: #fff9c4; /* Light yellow highlight */
  transition: background-color 2s ease-out;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

.scroll-to-paragraph-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.2s;
}

.scroll-to-paragraph-btn:hover {
  background-color: var(--primary);
  color: white;
}

/* Watermark Style */
.watermark {
  position: relative;
  margin-top: 50px;
  padding-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
  text-align: center;
  width: 100%;
  font-family: "Cairo", sans-serif;
  user-select: none;
}

@media print {
  .watermark {
    position: absolute;
    bottom: 10px;
    opacity: 0.4;
  }
}
