﻿:root {
  --font-ui: "IBM Plex Sans Arabic", Arial, sans-serif;
  --font-main: var(--font-ui);
  --bg: var(--color-bg-page);
  --panel: var(--color-bg-card);
  --ink: var(--color-text-main);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --secondary: var(--color-primary-light);
  --accent: var(--color-primary);
  --success: var(--color-success-text);
  --danger: var(--color-error-text);
  --card-bg: var(--color-bg-card);
  --score-soft: var(--color-progress-track);
  --radius: 22px;
  --shadow: 0 18px 42px rgba(30, 41, 59, 0.07);
  --soft-shadow: 0 8px 22px rgba(30, 41, 59, 0.045);
}

@property --score-progress {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.theme-blue,
.theme-purple,
.theme-default,
.theme-girls,
.theme-kids {
  --bg: var(--color-bg-page);
  --panel: var(--color-bg-card);
  --ink: var(--color-text-main);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --secondary: var(--color-primary-light);
  --accent: var(--color-primary);
  --success: var(--color-success-text);
  --danger: var(--color-error-text);
  --card-bg: var(--color-bg-card);
  --score-soft: var(--color-progress-track);
}

[data-theme="default"],
.theme-default,
.theme-blue {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-bg-page: #f8fbff;
  --color-bg-card: #ffffff;
  --color-text-muted: #64748b;
  --color-border: #dbe7f6;
  --color-progress-track: #eaf2ff;
  --color-success-bg: #e8f8ef;
  --color-success-text: #15803d;
  --color-error-bg: #fef2f2;
  --color-error-text: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-main);
  color: var(--ink);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 50%, #fff), #fff 42%, color-mix(in srgb, var(--bg) 82%, #fff)),
    color-mix(in srgb, var(--bg) 86%, #fff);
  letter-spacing: 0;
}

body.theme-kids {
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 42%, #fff), transparent 34%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 32px 18px 104px;
  display: grid;
  align-items: center;
}

.brand-footer {
  width: min(1120px, 100%);
  margin: -76px auto 0;
  padding: 0 18px 28px;
  color: var(--ink);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  direction: rtl;
  opacity: 0.68;
}

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-logotype {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.brand-logotype strong {
  color: #4A5568;
  font-family: "IBM Plex Sans Arabic", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
}

.brand-logotype span {
  color: #9AA3AE;
  font-family: "IBM Plex Mono", "IBM Plex Sans", Consolas, monospace;
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.25;
}

.screen {
  width: 100%;
}

.hidden {
  display: none !important;
}

.panel,
.hero-panel {
  border: 1px solid color-mix(in srgb, var(--line) 80%, #fff);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(24px, 5vw, 48px);
}

.compact-panel {
  max-width: 660px;
  margin: 0 auto;
  text-align: center;
}

.hero-panel {
  min-height: auto;
  padding: clamp(22px, 4vw, 46px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  backdrop-filter: blur(10px);
}

.hero-content {
  order: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-card {
  order: 1;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  color: #fff;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary-dark));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  min-height: auto;
  box-shadow: 0 18px 42px color-mix(in srgb, var(--primary-dark) 18%, transparent);
}

.hero-card p,
.hero-card span {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.8;
}

.hero-card p {
  width: 100%;
  font-weight: 600;
}

.hero-card strong {
  flex: 1 1 260px;
  max-width: 100%;
  font-size: clamp(1.38rem, 3vw, 1.88rem);
  line-height: 1.35;
  font-weight: 600;
}

#hero-gift-line {
  flex: 1 1 100%;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.94rem, 1.6vw, 1.08rem);
  font-weight: 600;
}

#hero-grade,
#hero-stats {
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 1.8vw, 1.14rem);
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  padding: 7px 14px;
}

#hero-stats {
  margin-top: 4px;
  color: #fff;
}

.delivery-pill,
.eyebrow {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.delivery-pill {
  width: fit-content;
  padding: 9px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 82%, #fff);
  border: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 16px;
  font-size: clamp(2.35rem, 7vw, 5.2rem);
  line-height: 1.08;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.55rem);
  line-height: 1.25;
  font-weight: 700;
}

h3 {
  line-height: 1.55;
  font-weight: 700;
}

.gift-line {
  width: fit-content;
  margin-bottom: 20px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--primary-dark);
  font-weight: 600;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 2;
}

.muted,
.counter {
  color: var(--muted);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 30px 0;
}

.student-grid div,
.student-code-box,
.start-review-card,
.previous-results div,
.result-details div,
.performance-card,
.subject-strip,
.theme-strip,
.summary-box,
.mistake-item,
.feedback,
.score-tile,
.readiness-tile {
  border: 1px solid color-mix(in srgb, var(--line) 82%, #fff);
  border-radius: 18px;
  background: var(--card-bg);
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.student-grid span,
.student-code-box label,
.previous-results span,
.result-details span,
.performance-card span,
.subject-strip p,
.theme-strip p,
.score-tile span,
.readiness-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.student-grid strong,
.previous-results strong,
.result-details strong,
.performance-card strong,
.score-tile strong,
.readiness-tile strong {
  font-size: 1.12rem;
}

.previous-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0;
}

.attempt-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.unit-test-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.unit-test-control select {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  font: inherit;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 26px;
}

.performance-card {
  width: min(100%, 760px);
  margin: 24px auto 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  text-align: center;
}

.performance-card div {
  padding: 0 14px;
}

.performance-card div + div {
  border-inline-start: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
}

.performance-card strong {
  display: block;
  color: var(--primary-dark);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.4;
}

.student-code-box {
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.start-review-card {
  width: min(100%, 620px);
  margin: 30px auto 0;
  padding: clamp(22px, 4vw, 34px);
  display: grid;
  gap: 18px;
}

.student-code-box input {
  width: 100%;
  min-height: 52px;
  border: 2px solid color-mix(in srgb, var(--line) 78%, #fff);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 11px 16px;
  font: inherit;
  direction: ltr;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.student-code-box input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 54%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--secondary) 74%, transparent);
}

#student-name-input {
  direction: rtl;
  text-align: right;
  margin-bottom: 14px;
}

.student-code-box label:not(:first-child) {
  margin-top: 6px;
}

.start-save-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
}

.save-status {
  min-height: 24px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.subject-strip {
  margin-bottom: 0;
  padding: 16px;
  box-shadow: none;
}

.theme-strip {
  margin-bottom: 18px;
}

#subject-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.start-action-row {
  margin-top: 2px;
}

.start-action-row .btn {
  width: 100%;
}

.home-progress-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--secondary) 55%, #fff), #fff);
  box-shadow: 0 12px 30px rgba(27, 39, 55, 0.05);
}

.home-progress-summary div {
  min-width: 0;
}

.home-progress-summary span,
.home-section-heading span,
.home-unit-card small,
.unit-progress-note,
.unit-resume-box p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.home-progress-summary strong,
.home-section-heading strong {
  display: block;
  color: var(--primary-dark);
  font-size: 1.12rem;
  line-height: 1.5;
}

.home-units-preview {
  display: grid;
  gap: 12px;
}

.home-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-units-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-unit-card {
  min-height: 78px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, #fff);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 13px 14px;
  text-align: right;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(27, 39, 55, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.home-unit-card:hover,
.home-unit-card:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  box-shadow: 0 12px 26px rgba(27, 39, 55, 0.055);
}

.home-unit-card span,
.home-unit-card small {
  display: block;
}

.home-unit-card span {
  font-weight: 800;
  line-height: 1.6;
}

#welcome-screen {
  display: grid;
  place-items: center;
}

#welcome-screen .hero-panel {
  width: min(100%, 720px);
  min-height: 0;
  padding: clamp(28px, 6vw, 54px);
  border: 1px solid color-mix(in srgb, var(--primary) 9%, var(--line));
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.08);
  backdrop-filter: none;
}

#welcome-screen .hero-content {
  order: 1;
  align-items: center;
  text-align: center;
}

#welcome-screen #welcome-title {
  max-width: 640px;
  margin-inline: auto;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.25;
}

#welcome-screen #welcome-message {
  max-width: 460px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  line-height: 1.8;
}

#welcome-screen .hero-card,
#welcome-screen .home-progress-summary,
#welcome-screen .home-units-preview,
#welcome-screen .path-preview {
  display: none !important;
}

#welcome-screen .start-review-card {
  width: min(100%, 520px);
  margin: 24px auto 0;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--line));
  border-radius: 20px;
  background: color-mix(in srgb, var(--secondary) 18%, #fff);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.055);
  gap: 14px;
}

#welcome-screen .student-grid {
  width: min(100%, 520px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 22px auto 0;
}

#welcome-screen .student-grid div {
  padding: 12px;
  border-radius: 14px;
  box-shadow: none;
  background: color-mix(in srgb, var(--secondary) 20%, #fff);
}

#welcome-screen .student-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

#welcome-screen .student-grid strong {
  color: var(--ink);
  font-size: 0.94rem;
}

#welcome-screen .student-code-box {
  display: grid;
  gap: 8px;
}

#welcome-screen .student-code-box label {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

#welcome-screen .student-code-box input {
  min-height: 44px;
  border-width: 1px;
  border-radius: 14px;
  font-size: 0.95rem;
}

#welcome-screen .start-save-note {
  margin-top: 6px;
  font-size: 0.82rem;
}

#welcome-screen .save-status {
  margin: 0;
  min-height: 18px;
  font-size: 0.78rem;
}

#welcome-screen .subject-strip {
  padding-top: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#welcome-screen .subject-strip p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

#welcome-screen #subject-list {
  justify-content: center;
}

#welcome-screen .subject-badge {
  min-height: 44px;
  padding-inline: 18px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.06);
}

#welcome-screen .start-action-row {
  margin-top: 0;
}

#welcome-screen #start-review-btn {
  min-height: 50px;
  border-radius: 16px;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.16);
}

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subject-badge,
.theme-choice,
.path-preview span {
  border: 1px solid color-mix(in srgb, var(--line) 82%, #fff);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--muted);
  background: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(27, 39, 55, 0.04);
}

.subject-badge {
  cursor: pointer;
}

.theme-choice {
  cursor: pointer;
}

.subject-badge.active,
.theme-choice.active {
  color: #fff;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.path-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.path-preview span {
  background: var(--secondary);
  color: var(--primary-dark);
  font-size: 0.86rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.review-topbar {
  justify-content: center;
  text-align: center;
}

.review-topbar > div {
  width: 100%;
}

.review-topbar .eyebrow:empty {
  display: none;
}

.units-topbar {
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #fff);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 96%, var(--secondary));
  box-shadow: var(--soft-shadow);
}

.units-topbar > div {
  min-width: 0;
}

.units-topbar .eyebrow {
  margin-bottom: 6px;
}

.units-topbar .btn {
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.units-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.unit-card {
  width: 100%;
  text-align: right;
  border: 1px solid color-mix(in srgb, var(--line) 68%, #fff);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 22px 22px 42px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(27, 39, 55, 0.045);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.unit-card:hover,
.unit-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
}

.unit-card:focus-visible {
  outline: none;
  box-shadow:
    var(--soft-shadow),
    0 0 0 4px color-mix(in srgb, var(--secondary) 78%, transparent);
}

.unit-card.active {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--secondary) 74%, #fff), #fff);
  box-shadow:
    0 16px 38px rgba(27, 39, 55, 0.065),
    0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
}

.unit-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.unit-card h3 {
  margin: 0;
  line-height: 1.55;
}

.unit-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.unit-progress-note {
  margin-top: 8px;
  color: color-mix(in srgb, var(--primary-dark) 70%, var(--muted));
  font-weight: 700;
}

.unit-chevron {
  position: absolute;
  right: 50%;
  bottom: 16px;
  width: 12px;
  height: 12px;
  border-inline-end: 2px solid color-mix(in srgb, var(--muted) 82%, #fff);
  border-bottom: 2px solid color-mix(in srgb, var(--muted) 82%, #fff);
  transform: translateX(50%) rotate(45deg);
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.unit-card.active .unit-chevron {
  border-color: var(--primary-dark);
  transform: translateX(50%) rotate(225deg);
}

.unit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.unit-pill {
  border: 1px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 18%, #fff);
  color: var(--muted);
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.unit-pill.is-complete,
.unit-pill.is-excellent {
  border-color: color-mix(in srgb, var(--success) 22%, #fff);
  background: color-mix(in srgb, var(--success) 10%, #fff);
  color: color-mix(in srgb, var(--success) 78%, #173b32);
}

.unit-pill.is-not-started {
  border-color: color-mix(in srgb, var(--muted) 16%, #fff);
  background: color-mix(in srgb, var(--muted) 8%, #fff);
  color: color-mix(in srgb, var(--muted) 86%, var(--ink));
}

.unit-pill.is-progress,
.unit-pill.is-medium {
  border-color: color-mix(in srgb, #d98b22 22%, #fff);
  background: color-mix(in srgb, #d98b22 11%, #fff);
  color: #8a5516;
}

.unit-pill.is-weak {
  border-color: color-mix(in srgb, var(--danger) 20%, #fff);
  background: color-mix(in srgb, var(--danger) 10%, #fff);
  color: color-mix(in srgb, var(--danger) 78%, #4b1f1f);
}

.unit-actions-panel {
  margin-top: 18px;
}

.unit-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, #fff);
}

.unit-resume-box {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--secondary) 34%, #fff);
}

.unit-resume-box .unit-inline-actions {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

#units-screen {
  max-width: 980px;
  margin-inline: auto;
}

#units-screen .units-topbar {
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid color-mix(in srgb, var(--primary) 9%, var(--line));
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.07);
}

#units-screen .units-topbar h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  line-height: 1.45;
}

#units-screen .units-topbar .eyebrow {
  color: var(--primary);
}

#units-screen .units-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

#units-screen .unit-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 18px;
  border-color: color-mix(in srgb, var(--primary) 8%, var(--line));
  border-radius: 14px;
  background: #fff;
  padding: 16px 18px 16px 20px;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.05);
  overflow: hidden;
}

#units-screen .unit-card::before {
  content: "";
  position: absolute;
  inset-block: 12px;
  inset-inline-start: auto;
  inset-inline-end: 0;
  width: 4px;
  border-radius: 999px 0 0 999px;
  background: color-mix(in srgb, var(--primary) 82%, #fff);
  opacity: 0.72;
}

#units-screen .unit-card:hover,
#units-screen .unit-card:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.075);
}

#units-screen .unit-card.active {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  background: linear-gradient(90deg, color-mix(in srgb, var(--secondary) 58%, #fff), #fff 52%);
  box-shadow:
    0 14px 34px rgba(37, 99, 235, 0.095),
    0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent);
}

#units-screen .unit-card-header {
  grid-column: 1;
  margin-bottom: 0;
}

#units-screen .unit-card h3 {
  color: var(--ink);
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  line-height: 1.45;
}

#units-screen .unit-card p {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

#units-screen .unit-meta {
  grid-column: 2;
  grid-row: 1 / span 3;
  justify-content: flex-end;
  align-self: center;
  gap: 6px;
  margin-top: 0;
  min-width: 170px;
}

#units-screen .unit-pill {
  padding: 5px 10px;
  font-size: 0.78rem;
}

#units-screen .unit-inline-actions {
  grid-column: 1 / -1;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  }

#units-screen .unit-inline-actions .btn {
  min-height: 42px;
  border-radius: 14px;
  padding-inline: 16px;
  font-size: 0.9rem;
}

#units-screen .unit-progress-note {
  grid-column: 1;
  margin-top: 0;
}

#units-screen .unit-chevron {
  inset-block: 50% auto;
  inset-inline: auto 18px;
  opacity: 0.34;
  transform: translateY(-50%) rotate(45deg);
}

#units-screen .unit-card.active .unit-chevron {
  opacity: 0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 26px;
}

.action-row.center {
  justify-content: center;
}

.btn {
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 24px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  transform: none;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 22%, transparent);
}

.primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary-dark));
}

.secondary,
.ghost {
  color: var(--primary);
  background: #fff;
  border-color: color-mix(in srgb, var(--line) 86%, #fff);
}

.ghost {
  background: rgba(255, 255, 255, 0.62);
}

.small {
  min-height: 40px;
  padding: 0 16px;
}

.progress-wrap {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 58%, #fff);
  margin-bottom: 18px;
  box-shadow: inset 0 1px 3px rgba(27, 39, 55, 0.08);
}

.progress-fill {
  position: relative;
  overflow: hidden;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transform: translateX(100%);
  animation: progress-shimmer 3.4s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(100%);
  }
  55%,
  100% {
    transform: translateX(-100%);
  }
}

.focus-panel {
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

#quiz-screen {
  font-family: var(--df-font-body);
  color: var(--df-color-text-primary);
}

body:has(#quiz-screen:not(.hidden)) .platform-tools {
  display: none;
}

#quiz-screen .quiz-shell,
#quiz-screen .quiz-focus-panel {
  width: min(760px, 100%);
  margin-inline: auto;
}

#quiz-screen .quiz-shell {
  margin-bottom: var(--df-space-2);
}

#quiz-screen .quiz-header {
  text-align: center;
  margin-bottom: var(--df-space-2);
  padding-top: 0;
}

#quiz-screen #quiz-kicker {
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-metadata);
  font-size: var(--df-text-metadata-size);
  font-weight: var(--df-text-metadata-weight);
  letter-spacing: var(--df-text-metadata-letter-spacing);
}

#quiz-screen .quiz-header h2 {
  margin: 0;
  color: var(--df-color-text-primary);
  font-family: var(--df-font-heading);
  font-size: clamp(1.05rem, 2.1vw, 1.45rem);
  font-weight: 500;
  line-height: var(--df-text-heading-line);
}

#quiz-screen .quiz-topline,
#quiz-screen .quiz-progress-line {
  display: flex;
  align-items: center;
  gap: var(--df-space-3);
}

#quiz-screen .quiz-topline {
  justify-content: space-between;
  margin-bottom: var(--df-space-2);
}

#quiz-screen .quiz-progress-line {
  margin-bottom: var(--df-space-2);
}

#quiz-screen .question-pill {
  display: inline-flex;
  flex: 0 0 auto;
  margin: 0;
  border-radius: var(--df-radius-2);
  background: transparent;
  color: var(--df-color-text-tertiary);
  padding: 0;
  font-family: var(--df-font-numbers);
  font-size: var(--df-text-metadata-size);
  font-weight: var(--df-text-metadata-weight);
  letter-spacing: var(--df-text-metadata-letter-spacing);
  text-transform: uppercase;
}

#quiz-screen #deferred-counter {
  background: transparent;
  color: var(--df-color-text-tertiary);
  border: 0;
}

#quiz-screen .quiz-progress-wrap {
  flex: 1;
  height: 5px;
  border: 0;
  border-radius: var(--df-radius-0);
  background:
    linear-gradient(
      90deg,
      transparent 0,
      transparent 12%,
      var(--df-color-surface-muted) 12%,
      var(--df-color-surface-muted) 100%
    );
  box-shadow: none;
  margin-bottom: 0;
}

#quiz-screen .quiz-progress-wrap .progress-fill {
  background: var(--df-color-accent);
  box-shadow: none;
}

#quiz-screen .quiz-progress-wrap .progress-fill::after {
  display: none;
}

#quiz-screen .quiz-focus-panel {
  min-height: auto;
  padding: clamp(var(--df-space-4), 3vw, var(--df-space-6));
  border: var(--df-divider);
  border-radius: var(--df-radius-1);
  background: var(--df-color-surface);
  box-shadow: none;
}

#quiz-screen .quiz-focus-panel .action-row {
  min-height: 44px;
  margin-top: var(--df-space-4);
  gap: var(--df-space-3);
}

#quiz-screen .btn {
  min-height: 40px;
  border: var(--df-border);
  border-radius: var(--df-radius-1);
  padding: 0 var(--df-space-5);
  box-shadow: none;
  font-family: var(--df-font-label);
  font-size: var(--df-text-label-size);
  font-weight: var(--df-text-label-weight);
  transition: var(--df-transition-color);
}

#quiz-screen .btn:hover {
  transform: none;
}

#quiz-screen .btn:focus-visible {
  outline: var(--df-focus-outline);
  outline-offset: var(--df-focus-offset);
}

#quiz-screen .btn.primary {
  border-color: var(--df-color-text-primary);
  background: var(--df-color-text-primary);
  color: var(--df-color-surface);
}

#quiz-screen .btn.secondary,
#quiz-screen .btn.ghost {
  border-color: var(--df-color-border);
  background: var(--df-color-surface);
  color: var(--df-color-text-primary);
}

#quiz-screen .btn.secondary:hover,
#quiz-screen .btn.ghost:hover {
  border-color: var(--df-hover-border);
  background: var(--df-hover-background);
}

#quiz-screen .question-box {
  margin-bottom: var(--df-space-4);
  padding: 0 0 var(--df-space-4);
  border: 0;
  border-bottom: var(--df-divider);
  border-radius: var(--df-radius-0);
  background: transparent;
  box-shadow: none;
}

#quiz-screen #question-text {
  margin: 0;
  color: var(--df-color-text-primary);
  font-family: var(--df-font-heading);
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-weight: var(--df-text-heading-weight);
  line-height: 1.65;
}

.math-token {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.fraction {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  min-width: 1.3em;
  margin-inline: 0.12em;
  vertical-align: -0.35em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.math-expression {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  white-space: nowrap;
}

.fraction > span:first-child {
  width: 100%;
  padding-block-end: 0.08em;
  border-bottom: 0.09em solid currentColor;
}

.fraction > span:last-child {
  padding-block-start: 0.08em;
}

.simulation-feature-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 4px;
  justify-content: center;
}

#welcome-message + .simulation-feature-strip {
  margin-top: 16px;
}

.is-simulation-experiment #welcome-message:not(.hidden) {
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.simulation-feature-strip span {
  border: 1px solid var(--df-color-border, #d8e1ea);
  border-radius: 999px;
  background: var(--df-color-surface, #fff);
  color: var(--df-color-text-primary, #1f2937);
  padding: 8px 12px;
  font-family: var(--df-font-label);
  font-size: 0.9rem;
  line-height: 1.4;
}

.review-focus-panel {
  align-items: stretch;
  max-width: 920px;
  margin-inline: auto;
  padding: clamp(22px, 4vw, 38px);
}

.review-cards-list {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

.review-card-item {
  width: 100%;
  min-height: clamp(230px, 34vw, 300px);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: 1500px;
}

.review-card-item:hover,
.review-card-item:focus-visible {
  outline: none;
}

.review-card-item:focus-visible .review-card-inner {
  outline: none;
  box-shadow:
    0 24px 58px rgba(15, 23, 42, 0.12),
    0 0 0 4px color-mix(in srgb, var(--secondary) 78%, transparent);
}

.review-card-inner {
  position: relative;
  width: 100%;
  min-height: inherit;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
  border-radius: 28px;
  box-shadow:
    0 24px 54px rgba(15, 23, 42, 0.09),
    0 5px 14px rgba(15, 23, 42, 0.05);
}

.review-card-item:hover .review-card-inner {
  transform: translateY(-3px);
  box-shadow:
    0 30px 70px rgba(15, 23, 42, 0.12),
    0 8px 18px rgba(15, 23, 42, 0.06);
}

.review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg) translateZ(0);
}

.review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg) translateY(-3px) translateZ(0);
}

.review-card-face {
  position: absolute;
  inset: 0;
  min-height: inherit;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line));
  border-radius: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 44%, #fff), #fff 48%),
    #fff;
  padding: clamp(24px, 4vw, 38px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.review-card-face::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, #fff));
  opacity: 0.84;
}

.review-card-face::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 52%, #fff);
  border-radius: 22px;
  pointer-events: none;
}

.review-card-back {
  color: var(--primary-dark);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 78%, #fff), #fff 62%),
    #fff;
  transform: rotateY(180deg);
}

.review-card-number {
  display: inline-flex;
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, #fff 90%, var(--secondary));
  color: var(--primary-dark);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.review-card-question,
.review-card-back strong {
  display: block;
  width: min(100%, 700px);
  color: var(--ink);
  font-size: clamp(1.22rem, 3vw, 1.72rem);
  font-weight: 700;
  line-height: 1.85;
  position: relative;
  z-index: 1;
}

.review-card-back strong {
  color: var(--primary-dark);
  font-size: clamp(1.34rem, 3.5vw, 1.95rem);
}

.review-card-face small {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

#review-screen {
  max-width: 980px;
  margin-inline: auto;
}

#review-screen .topbar {
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid color-mix(in srgb, var(--primary) 9%, var(--line));
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.065);
}

#review-screen .topbar h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.95rem);
  line-height: 1.45;
}

#review-screen .topbar .muted,
#review-screen .counter {
  color: var(--muted);
}

#review-screen .review-focus-panel {
  margin-top: 16px;
  border-color: color-mix(in srgb, var(--primary) 7%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--secondary) 18%, #fff);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.05);
  padding: clamp(14px, 3vw, 22px);
}

#review-screen .review-cards-list {
  gap: 14px;
  margin-top: 0;
}

#review-screen .review-card-item {
  min-height: clamp(230px, 34vw, 300px);
}

#review-screen .review-card-inner {
  border-radius: 18px;
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.07),
    0 4px 10px rgba(15, 23, 42, 0.03);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: translateY(-1px);
  box-shadow:
    0 18px 38px rgba(37, 99, 235, 0.09),
    0 5px 12px rgba(15, 23, 42, 0.035);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg) translateZ(0);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg) translateY(-1px) translateZ(0);
}

#review-screen .review-card-face {
  border-color: color-mix(in srgb, var(--primary) 8%, var(--line));
  border-radius: 18px;
  background: #fff;
  padding: clamp(22px, 3vw, 34px);
  align-items: flex-start;
  justify-content: space-between;
  text-align: right;
}

#review-screen .review-card-face::before {
  inset: 16px auto 16px 0;
  width: 5px;
  height: auto;
  border-radius: 999px;
  background: var(--primary);
  opacity: 0.74;
}

#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-back {
  background: #fff;
}

#review-screen .review-card-number {
  align-self: flex-start;
  margin-bottom: 10px;
  border-color: color-mix(in srgb, var(--primary) 14%, var(--line));
  background: color-mix(in srgb, var(--secondary) 72%, #fff);
  color: var(--primary-dark);
  padding: 6px 12px;
  font-size: 0.76rem;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: min(100%, 660px);
  margin-block: auto;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.9vw, 1.68rem);
  line-height: 1.85;
  font-weight: 700;
}

#review-screen .review-card-back strong {
  color: var(--primary-dark);
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid color-mix(in srgb, var(--primary) 9%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--secondary) 34%, #fff);
}

#review-screen .review-card-face small {
  align-self: flex-start;
  margin-top: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--secondary) 68%, #fff);
  color: var(--primary-dark);
  padding: 8px 14px;
  font-size: 0.82rem;
  line-height: 1.4;
}

#review-screen .style-scroll-end {
  margin-top: 18px;
}

#review-screen .style-scroll-end .btn {
  min-height: 44px;
  border-radius: 14px;
  padding-inline: 18px;
}

#review-screen .topbar {
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.045);
}

#review-screen .topbar h2 {
  font-size: clamp(1.22rem, 2.5vw, 1.65rem);
}

#review-screen #review-instruction,
#review-screen #card-counter {
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.65;
}

#review-screen .review-focus-panel {
  margin-top: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.045);
  padding: clamp(12px, 2.5vw, 18px);
}

#review-screen .review-cards-list {
  gap: 12px;
}

#review-screen .review-card-item {
  min-height: clamp(208px, 29vw, 260px);
}

#review-screen .review-card-inner {
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.055);
  transition: transform 360ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.075);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg) translateY(-1px);
}

#review-screen .review-card-face {
  border: 1px solid color-mix(in srgb, var(--primary) 9%, var(--line));
  border-radius: 14px;
  background: #fff;
  padding: clamp(56px, 6vw, 66px) clamp(20px, 3vw, 34px);
  align-items: center;
  justify-content: center;
  text-align: center;
}

#review-screen .review-card-face::before {
  inset: 12px auto 12px 12px;
  width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 78%, #fff);
  opacity: 1;
}

#review-screen .review-card-number {
  position: absolute;
  top: 16px;
  right: 18px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 68%, #fff);
  color: var(--primary-dark);
  padding: 5px 11px;
  font-size: 0.74rem;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: min(100%, 620px);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.08rem, 2.4vw, 1.42rem);
  line-height: 1.82;
  font-weight: 700;
}

#review-screen .review-card-back strong {
  color: var(--primary-dark);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

#review-screen .review-card-face small {
  position: absolute;
  right: 18px;
  bottom: 16px;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 74%, #fff);
  color: var(--primary-dark);
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

#review-screen .style-scroll-end {
  margin-top: 14px;
  gap: 8px;
}

#review-screen .style-scroll-end .btn {
  min-height: 40px;
  border-radius: 10px;
  padding-inline: 16px;
  box-shadow: none;
  font-size: 0.9rem;
}

#review-screen .style-scroll-end .btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

#review-screen .style-scroll-end .btn.ghost,
#review-screen .style-scroll-end .btn.secondary {
  border-color: color-mix(in srgb, var(--primary) 10%, var(--line));
  background: #fff;
  color: var(--muted);
}

#review-screen {
  --review-surface: #fff;
  --review-soft: color-mix(in srgb, var(--secondary) 34%, #fff);
  --review-border: color-mix(in srgb, var(--primary) 10%, var(--line));
  --review-border-strong: color-mix(in srgb, var(--primary) 30%, var(--line));
  --review-shadow: 0 8px 22px rgba(37, 99, 235, 0.055);
  max-width: 900px;
}

#review-screen .topbar {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--review-border);
  border-radius: 8px;
  background: var(--review-surface);
  box-shadow: var(--review-shadow);
  text-align: right;
}

#review-screen .topbar h2 {
  color: var(--ink);
  font-size: clamp(1.16rem, 2.2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.55;
}

#review-screen #review-instruction,
#review-screen #card-counter {
  color: color-mix(in srgb, var(--muted) 88%, var(--ink));
  font-size: 0.86rem;
  line-height: 1.6;
}

#review-screen .review-focus-panel {
  margin-top: 0;
  border: 1px solid var(--review-border);
  border-radius: 8px;
  background: var(--review-surface);
  box-shadow: var(--review-shadow);
  padding: clamp(12px, 2.5vw, 18px);
}

#review-screen .review-cards-list {
  gap: 10px;
}

#review-screen .review-card-item {
  min-height: clamp(214px, 30vw, 268px);
}

#review-screen .review-card-inner {
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.055);
  transition: transform 300ms cubic-bezier(0.2, 0, 0, 1), box-shadow 160ms ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: none;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.075);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-face {
  border: 1px solid var(--review-border);
  border-radius: 8px;
  background: var(--review-surface);
  padding: clamp(50px, 6vw, 62px) clamp(18px, 3vw, 30px);
  align-items: center;
  justify-content: center;
  text-align: center;
}

#review-screen .review-card-face::before {
  inset: 0 0 auto;
  width: auto;
  height: 4px;
  border-radius: 8px 8px 0 0;
  background: var(--primary);
  opacity: 0.72;
}

#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-back {
  background: var(--review-surface);
}

#review-screen .review-card-number {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  border: 1px solid var(--review-border);
  border-radius: 999px;
  background: var(--review-soft);
  color: var(--primary-dark);
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 700;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: min(100%, 620px);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.08rem, 2.35vw, 1.42rem);
  font-weight: 700;
  line-height: 1.85;
}

#review-screen .review-card-back strong {
  color: var(--primary-dark);
  padding: 0;
  border: 0;
  background: transparent;
}

#review-screen .review-card-face small {
  position: absolute;
  right: 14px;
  bottom: 14px;
  margin: 0;
  border: 1px solid var(--review-border-strong);
  border-radius: 8px;
  background: var(--review-soft);
  color: var(--primary-dark);
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

#review-screen .style-scroll-end {
  margin-top: 12px;
  gap: 8px;
}

#review-screen .style-scroll-end .btn {
  min-height: 40px;
  border: 1px solid var(--review-border);
  border-radius: 8px;
  padding-inline: 16px;
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 600;
}

#review-screen .style-scroll-end .btn:hover {
  transform: none;
}

#review-screen .style-scroll-end .btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

#review-screen .style-scroll-end .btn.ghost,
#review-screen .style-scroll-end .btn.secondary {
  background: #fff;
  color: color-mix(in srgb, var(--muted) 88%, var(--ink));
}

@media (prefers-reduced-motion: reduce) {
  .review-card-inner {
    transition: transform 0.01ms linear, box-shadow 0.01ms linear;
  }
}

.review-empty-card {
  border: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
  border-radius: 22px;
  background: var(--card-bg);
  color: var(--muted);
  padding: 24px;
  text-align: center;
  font-weight: 600;
  line-height: 1.9;
}

.style-scroll-end {
  justify-content: center;
  margin-top: 28px;
  padding-bottom: 18px;
}

.platform-tools {
  position: fixed;
  right: 18px;
  top: 50%;
  bottom: auto;
  z-index: 124;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 24px);
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, #fff);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateY(-50%);
}

.global-theme-switcher,
.support-tools {
  position: relative;
  display: flex;
}

.support-tools {
  gap: 7px;
}

.floating-glass-btn {
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--line));
  border-radius: 999px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 94%, #fff), color-mix(in srgb, var(--secondary) 38%, #fff));
  color: var(--primary-dark);
  padding: 0 13px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.tool-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--primary-dark);
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tool-chip:hover,
.tool-chip:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  background: color-mix(in srgb, var(--secondary) 36%, #fff);
}

.tool-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  opacity: 0.78;
  position: relative;
  flex: 0 0 auto;
}

.tool-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon svg circle {
  fill: currentColor;
  stroke: none;
}

.ai-spark-icon svg {
  fill: currentColor;
  stroke: none;
}

.ai-spark-icon svg path:nth-child(2) {
  opacity: 0.72;
}

.ai-spark-icon svg path:nth-child(3) {
  opacity: 0.62;
}

.assistant-open-btn {
  min-height: 44px;
  color: #fff;
  background: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 82%, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent),
    0 4px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}

.assistant-open-btn .tool-icon {
  width: 18px;
  height: 18px;
  opacity: 1;
}

.assistant-open-btn.is-collapsed {
  width: auto;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 14px;
  gap: 8px;
}

.assistant-open-btn.is-collapsed .assistant-open-text {
  display: inline;
}

body:has(#quiz-screen:not(.hidden)) .platform-tools {
  display: none;
}


/* Final tools reference shape: collapsed ⋮ trigger with compact vertical toolbar. */
.platform-tools {
  right: auto;
  left: 12px;
  top: 12px;
  bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  transform: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.platform-tools .global-theme-switcher,
.platform-tools .support-tools {
  position: relative;
  flex-direction: column;
  gap: 5px;
  border: 0.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 5px;
}

.platform-tools .support-tools {
  border-top: 0;
  border-radius: 0 0 10px 10px;
  margin-top: -5px;
  padding-top: 0;
}

.platform-tools .tool-chip:not(.assistant-open-btn) {
  width: 34px;
  min-height: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  padding: 0;
  gap: 0;
  font-size: 0;
  transform: none;
}

.platform-tools .tool-chip:not(.assistant-open-btn):hover,
.platform-tools .tool-chip:not(.assistant-open-btn):focus-visible {
  background: var(--bg);
  border-color: transparent;
  transform: none;
}

.platform-tools .tool-chip:not(.assistant-open-btn) .tool-icon {
  width: 17px;
  height: 17px;
  opacity: 1;
}

.platform-tools .tool-chip:not(.assistant-open-btn) > span:not(.tool-icon) {
  display: none;
}

.platform-tools .assistant-open-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  top: auto;
  right: auto;
}

.theme-menu {
  top: 0;
  right: auto;
  left: calc(100% + 8px);
  border-radius: 8px;
}

.floating-glass-btn:hover,
.floating-glass-btn:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  box-shadow: 0 14px 34px rgba(31, 79, 191, 0.13);
  outline: none;
}

.theme-menu {
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  min-width: 154px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, #fff);
  padding: 8px;
  display: grid;
  gap: 6px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: none;
}

.theme-menu .theme-choice {
  width: 100%;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  text-align: right;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.assistant-open-btn {
  position: relative;
}

.internal-test-panel {
  position: fixed;
  right: 12px;
  bottom: 66px;
  z-index: 130;
  width: min(278px, calc(100vw - 28px));
  border: 1px solid color-mix(in srgb, var(--primary) 7%, var(--line));
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.065);
  opacity: 0.88;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: width 0.2s ease, right 0.2s ease, left 0.2s ease, bottom 0.2s ease, transform 0.2s ease;
}

.internal-test-panel:hover,
.internal-test-panel:focus-within,
.internal-test-panel.is-expanded {
  opacity: 1;
}

.internal-test-panel.is-expanded {
  right: 50%;
  bottom: 50%;
  width: min(82vw, 980px);
  max-height: min(78vh, 720px);
  transform: translate(50%, 50%);
}

.internal-test-panel.is-expanded .assistant-chat-messages {
  min-height: 320px;
  max-height: min(54vh, 520px);
}

.internal-test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.internal-test-header p {
  margin: 0;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 800;
}

.assistant-window-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.assistant-window-btn {
  width: 20px;
  height: 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, #fff);
  color: var(--primary-dark);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.assistant-window-btn:hover,
.assistant-window-btn:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  outline: none;
}

.internal-test-panel.is-minimized {
  width: min(210px, calc(100vw - 28px));
}

.internal-test-panel.is-minimized .assistant-window-body {
  display: none;
}

.ai-test-btn {
  min-height: 30px;
  padding-inline: 9px;
  font-size: 0.72rem;
  color: #fff;
  border-color: color-mix(in srgb, var(--primary) 82%, #fff);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 12px 28px rgba(31, 79, 191, 0.18);
}

.ai-test-btn:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.assistant-chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 5px;
  margin-top: 7px;
}

.assistant-question-input {
  width: 100%;
  resize: none;
  min-height: 32px;
  max-height: 96px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid color-mix(in srgb, var(--line) 82%, #fff);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 96%, #fff);
  color: var(--ink);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.74rem;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.assistant-question-input:focus {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
}

.assistant-chat-messages {
  max-height: 190px;
  min-height: 68px;
  overflow: auto;
  margin: 8px 0 0;
  color: var(--ink);
  direction: rtl;
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.6;
  border: 1px solid color-mix(in srgb, var(--primary) 7%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--secondary) 28%, #fff);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assistant-empty-state {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 16px 6px;
}

.assistant-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 90%;
}

.assistant-message-user {
  align-self: flex-end;
}

.assistant-message-assistant {
  align-self: flex-start;
}

.assistant-bubble {
  border: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
  border-radius: 13px;
  padding: 7px 9px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.assistant-message-user .assistant-bubble {
  background: #1B6CA8;
  color: #fff;
  border-color: #1B6CA8;
}

.assistant-message-assistant.is-waiting .assistant-bubble {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 92%, var(--secondary));
}

.assistant-bubble p {
  margin: 0;
}

.assistant-bubble p + p,
.assistant-bubble ul + p,
.assistant-bubble p + ul {
  margin-top: 6px;
}

.assistant-bubble ul {
  margin: 5px 0 0;
  padding-inline-start: 16px;
}

.assistant-bubble li {
  margin: 3px 0;
}

.assistant-bubble strong {
  color: var(--primary-dark);
  font-weight: 800;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assistant-actions button {
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, #fff);
  color: var(--primary-dark);
  padding: 4px 7px;
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
}

.assistant-actions button:hover,
.assistant-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  outline: none;
}

.assistant-actions button:disabled {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

#sound-toggle-btn {
  color: color-mix(in srgb, var(--primary-dark) 82%, var(--muted));
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.36);
  padding: 22px;
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(100%, 560px);
  border: 1px solid color-mix(in srgb, var(--line) 82%, #fff);
  border-radius: 26px;
  background: var(--panel);
  color: var(--ink);
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  position: relative;
}

.modal-card h2 {
  margin: 0 0 14px;
  color: var(--primary-dark);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.45;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 2;
  font-weight: 600;
}

.modal-card .modal-note {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, #fff);
  border-radius: 18px;
  background: var(--secondary);
  color: var(--primary-dark);
  padding: 12px 14px;
}

.modal-card .action-row {
  margin-top: 20px;
}

.contact-modal-card {
  width: min(100%, 390px);
  padding: 28px 24px 24px;
  text-align: center;
  border-radius: 24px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, #fff), color-mix(in srgb, var(--secondary) 24%, #fff));
}

.contact-modal-card .action-row {
  margin-top: 18px;
}

.contact-modal-card .btn.primary {
  border-radius: 999px;
  min-height: 42px;
  padding-inline: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 14px 32px rgba(31, 79, 191, 0.16);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
}

.modal-close-btn:hover,
.modal-close-btn:focus-visible {
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  outline: none;
}

.flashcard-container {
  width: 100%;
  min-height: clamp(300px, 48vw, 390px);
  margin: 16px auto 0;
  display: flex;
  perspective: 1200px;
}

.flashcard {
  width: 100%;
  min-height: clamp(300px, 48vw, 390px);
  position: relative;
  cursor: pointer;
  outline: none;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard:focus-visible {
  border-radius: 24px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--secondary) 78%, transparent);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  min-height: clamp(300px, 48vw, 390px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 72%, #fff);
  border-radius: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 48%, #fff), #fff 42%),
    #fff;
  padding: clamp(26px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 22px 52px rgba(27, 39, 55, 0.09);
}

.card-face::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, #fff));
  opacity: 0.88;
}

.card-face::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 62%, #fff);
  border-radius: 22px;
  pointer-events: none;
}

.card-face span {
  display: inline-block;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 68%, #fff);
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 18px;
}

.card-front h3 {
  width: min(100%, 680px);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.46rem, 4vw, 2.16rem);
  line-height: 1.75;
  font-weight: 600;
}

.card-back {
  color: var(--primary-dark);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--secondary) 88%, #fff), #fff 58%),
    #fff;
  transform: rotateY(180deg);
}

#card-body,
.warm-note,
.feedback,
.mistake-item p,
.summary-box p,
.readiness-tile p,
.score-tile p {
  color: var(--muted);
  line-height: 2;
}

#card-body {
  width: min(100%, 620px);
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 22px;
  background: #fff;
  color: var(--primary-dark);
  padding: clamp(18px, 4vw, 28px);
  font-size: clamp(1.38rem, 4vw, 1.92rem);
  line-height: 1.65;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(27, 39, 55, 0.07);
}

.warm-note {
  width: min(100%, 760px);
  margin: 18px auto 0;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--secondary) 54%, #fff);
  padding: 13px 18px;
  font-weight: 600;
  color: var(--primary-dark);
  text-align: center;
}

.review-focus-panel .action-row {
  justify-content: center;
  margin-top: 20px;
}

#quiz-screen .options-list {
  display: grid;
  gap: 0;
  margin-top: 0;
  border-top: var(--df-divider);
}

#quiz-screen .option-btn {
  width: 100%;
  min-height: 46px;
  text-align: right;
  border: 0;
  border-bottom: var(--df-divider);
  border-radius: var(--df-radius-1);
  background: var(--df-color-surface);
  padding: var(--df-space-2) var(--df-space-3);
  color: var(--df-color-text-primary);
  cursor: pointer;
  font-family: var(--df-font-body);
  font-size: 0.96rem;
  font-weight: 400;
  line-height: 1.75;
  transition: var(--df-transition-color);
}

#quiz-screen .option-btn:hover:not(:disabled) {
  border-color: var(--df-color-border-strong);
  background: var(--df-hover-background);
  transform: none;
}

#quiz-screen .option-btn:focus-visible {
  outline: var(--df-focus-outline);
  outline-offset: var(--df-focus-offset);
}

#quiz-screen .option-btn.is-selected {
  border: 1.5px solid var(--df-color-accent);
  border-inline-start: 5px solid var(--df-color-accent);
  background: color-mix(in srgb, var(--df-color-accent) 13%, #fff);
  color: var(--df-color-text-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--df-color-accent) 12%, transparent);
}

#quiz-screen .option-btn:disabled {
  cursor: default;
}

#quiz-screen .option-btn.correct {
  border-bottom-color: var(--df-color-success);
  border-inline-start: var(--df-border-width-strong) solid var(--df-color-success);
  background: var(--df-color-success-surface);
  color: var(--df-color-success);
  box-shadow: none;
}

#quiz-screen .option-btn.wrong {
  border-bottom-color: var(--df-color-error);
  border-inline-start: var(--df-border-width-strong) solid var(--df-color-error);
  background: var(--df-color-error-surface);
  color: var(--df-color-error);
  box-shadow: none;
}

#quiz-screen .feedback {
  margin-top: var(--df-space-3);
  height: 68px;
  padding: var(--df-space-2) var(--df-space-3);
  border-style: solid;
  border-radius: var(--df-radius-2);
  display: flex;
  align-items: center;
  overflow: auto;
  border-width: var(--df-border-width);
  font-weight: 400;
  font-size: 0.92rem;
  line-height: 1.7;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: var(--df-transition-state);
}

#quiz-screen #feedback-box.hidden {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
}

#quiz-screen .feedback.success {
  color: var(--df-color-success);
  border-color: var(--df-color-success);
  background: var(--df-color-success-surface);
}

#quiz-screen .feedback.danger {
  color: var(--df-color-error);
  border-color: var(--df-color-error);
  background: var(--df-color-error-surface);
}

#quiz-screen #deferred-review-box {
  min-height: 0;
  height: auto;
  text-align: center;
  color: var(--df-color-text-primary);
  border-color: var(--df-color-accent);
  background: var(--df-color-accent-surface);
  display: grid;
  align-items: center;
  justify-items: center;
  gap: var(--df-space-3);
  overflow: visible;
}

#quiz-screen #deferred-review-box p {
  margin: 0;
}

#quiz-screen #deferred-review-box .action-row {
  min-height: 0;
  margin-top: 0;
  justify-content: center;
}

#quiz-screen:has(#deferred-review-box:not(.hidden)) .question-box,
#quiz-screen:has(#deferred-review-box:not(.hidden)) #feedback-box.hidden,
#quiz-screen:has(#deferred-review-box:not(.hidden)) .quiz-focus-panel > .action-row {
  display: none !important;
}

#quiz-screen #next-question-btn.hidden {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
}

#quiz-screen #skip-question-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.result-panel {
  max-width: 930px;
  margin: 0 auto;
  text-align: center;
  padding-block: clamp(24px, 5vw, 46px);
}

#result-screen {
  --df-color-surface: #ffffff;
  --df-color-surface-muted: color-mix(in srgb, var(--secondary) 62%, #fff);
  --df-color-border: color-mix(in srgb, var(--primary) 10%, var(--line));
  --df-color-border-strong: color-mix(in srgb, var(--primary) 52%, var(--line));
  --df-color-text-primary: var(--ink);
  --df-color-text-secondary: color-mix(in srgb, var(--muted) 88%, var(--ink));
  --df-color-text-tertiary: color-mix(in srgb, var(--muted) 92%, var(--ink));
  --df-color-success: var(--success);
  --df-color-accent: var(--primary);
  --df-divider: var(--df-border-width) solid color-mix(in srgb, var(--primary) 8%, var(--line));
  font-family: var(--df-font-body);
  color: var(--df-color-text-primary);
}

#result-screen .result-panel {
  max-width: 920px;
  border: var(--df-border);
  border-radius: var(--df-radius-4);
  background: var(--df-color-surface);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.08);
  text-align: right;
  padding: clamp(var(--df-space-4), 3vw, var(--df-space-6));
}

#result-screen .result-intro {
  padding-bottom: var(--df-space-3);
  border-bottom: var(--df-divider);
}

.result-jadeer-status-card {
  display: inline-flex;
  align-items: center;
  gap: var(--df-space-3);
  margin: 0 0 var(--df-space-3);
  border-radius: var(--df-radius-2);
  padding: var(--df-space-2) var(--df-space-3);
}

.result-jadeer-status-card img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.result-jadeer-status-card strong {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.7;
}

.result-jadeer-status-card.is-success {
  background: #E6F5EE;
  color: #1A7A4A;
}

.result-jadeer-status-card.is-focus {
  background: #E8F2FB;
  color: #1B6CA8;
}

#result-screen #result-kicker {
  margin: 0 0 var(--df-space-2);
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-metadata);
  font-size: var(--df-text-metadata-size);
  font-weight: var(--df-text-metadata-weight);
  letter-spacing: var(--df-text-metadata-letter-spacing);
}

#result-screen #result-heading {
  margin: 0;
  color: var(--df-color-text-primary);
  font-family: var(--df-font-heading);
  font-size: clamp(1.28rem, 2.4vw, 1.72rem);
  font-weight: var(--df-text-heading-weight);
  line-height: var(--df-text-heading-line);
}

#result-screen #result-heading:empty {
  display: none;
}

#result-screen #result-subtitle {
  max-width: 620px;
  margin: var(--df-space-2) 0 0;
  color: var(--df-color-text-secondary);
  font-size: 0.98rem;
  line-height: var(--df-text-body-line);
}

#result-screen #result-subtitle:empty {
  display: none;
}

#result-screen .result-section:not(.mistakes-section) {
  margin-top: var(--df-space-4);
}

#result-screen .result-section:not(.mistakes-section) .section-head {
  margin-bottom: var(--df-space-2);
}

#result-screen .result-section:not(.mistakes-section) .section-head h3 {
  color: var(--df-color-text-primary);
  font-family: var(--df-font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
}

#result-screen .result-outcome {
  margin-top: var(--df-space-4);
}

#result-screen .result-score-summary {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(var(--df-space-4), 4vw, var(--df-space-6));
}

#result-screen .result-score-block {
  --result-progress: 0deg;
  position: relative;
  isolation: isolate;
  display: block;
  width: clamp(170px, 21vw, 220px);
  aspect-ratio: 1;
  margin: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--primary) var(--result-progress),
    var(--df-color-surface-muted) 0
  );
  color: var(--primary-dark);
  text-align: center;
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.15);
}

#result-screen .result-score-block::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 9%, #fff);
  border-radius: inherit;
  background: #fff;
}

#result-screen .result-score-block strong {
  display: inline-block;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 100%;
  font-family: var(--df-font-numbers);
  font-size: clamp(3.05rem, 8vw, 4.7rem);
  font-weight: var(--df-text-number-weight);
  line-height: var(--df-text-number-line);
  letter-spacing: 0;
  text-align: center;
  transform: translate(-50%, -50%);
}

#result-screen .result-score-total {
  display: block;
  position: absolute;
  top: calc(50% + clamp(1.8rem, 5vw, 2.6rem));
  left: 50%;
  z-index: 1;
  margin: 0;
  color: color-mix(in srgb, var(--muted) 88%, var(--primary-dark));
  font-family: var(--df-font-numbers);
  font-size: clamp(0.64rem, 1.08vw, 0.78rem);
  font-weight: 400;
  line-height: 1.1;
  transform: translateX(-50%);
}

#result-screen .result-score-details {
  min-width: 0;
}

#result-screen .result-readiness-text {
  display: block;
  margin: 0 0 var(--df-space-1);
  color: var(--df-color-text-primary);
  font-size: clamp(0.96rem, 1.7vw, 1.12rem);
  font-weight: 600;
  line-height: 1.6;
}

#result-screen .result-score-sentence {
  max-width: 560px;
  margin: 0 0 var(--df-space-3);
  color: var(--df-color-text-secondary);
  font-size: 0.95rem;
  line-height: var(--df-text-body-line);
}

#result-screen .result-jadeer-motivation {
  margin: calc(var(--df-space-2) * -1) 0 var(--df-space-3);
  color: #4A5568;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
}

#result-screen .feedback-msg {
  margin: var(--df-space-2) 0 0;
  color: var(--df-color-text-secondary);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: var(--df-text-body-line);
  text-align: right;
}

#result-screen .performance-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-block: var(--df-divider);
  border-inline: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#result-screen .performance-card div {
  padding: var(--df-space-2) var(--df-space-3);
  border-inline-start: var(--df-divider);
  text-align: right;
}

#result-screen .performance-card div:first-child {
  border-inline-start: 0;
}

#result-screen .performance-card span {
  display: block;
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-label);
  font-size: var(--df-text-label-size);
  font-weight: var(--df-text-label-weight);
  line-height: var(--df-text-label-line);
}

#result-screen .performance-card strong {
  display: block;
  margin-top: var(--df-space-1);
  color: var(--df-color-text-primary);
  font-family: var(--df-font-numbers);
  font-size: clamp(1.05rem, 2.1vw, 1.36rem);
  font-weight: 500;
  line-height: 1.2;
}

#result-screen .result-topic-performance {
  margin-top: var(--df-space-5);
  padding-top: var(--df-space-3);
  border-top: var(--df-divider);
}

#result-screen .result-topic-bars {
  display: grid;
  gap: var(--df-space-2);
  margin-top: var(--df-space-3);
}

#result-screen .result-topic-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(160px, 1.4fr) auto;
  align-items: center;
  gap: var(--df-space-4);
}

#result-screen .result-topic-name {
  color: var(--df-color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

#result-screen .result-topic-track {
  height: 3px;
  background: var(--df-color-surface-muted);
}

#result-screen .result-topic-fill {
  display: block;
  height: 100%;
  background: var(--primary);
}

#result-screen .result-topic-row:nth-child(even) .result-topic-fill {
  background: var(--success);
}

#result-screen .result-topic-percent {
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-numbers);
  font-size: var(--df-text-metadata-size);
}

#result-screen .share-section {
  max-width: none;
  padding-top: 0;
}

#result-screen .share-section .muted {
  max-width: 560px;
  margin: 0;
  color: var(--df-color-text-secondary);
}

#result-screen .result-primary-step {
  margin-top: var(--df-space-2);
}

#result-screen .result-primary-step .btn {
  width: min(100%, 360px);
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--primary) 78%, #fff);
  border-radius: var(--df-radius-2);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
  font-family: var(--df-font-label);
  font-size: 0.95rem;
  font-weight: 600;
}

#result-screen .result-secondary-actions {
  position: relative;
  justify-content: flex-start;
  gap: var(--df-space-1);
  margin-top: var(--df-space-4);
}

#result-screen .result-secondary-actions .btn {
  min-height: 32px;
  border: var(--df-border);
  border-radius: var(--df-radius-2);
  background: var(--df-color-surface);
  color: var(--df-color-text-secondary);
  box-shadow: none;
  font-family: var(--df-font-label);
  font-size: 0.74rem;
  font-weight: 500;
  padding: var(--df-space-1) var(--df-space-3);
  opacity: 0.88;
}

#result-screen .result-secondary-actions .btn.primary {
  border-color: #1B6CA8;
  background: #1B6CA8;
  color: #fff;
  opacity: 1;
}

#units-screen .units-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--df-space-1);
}

.attempt-summary-section {
  border-top: var(--df-divider);
  padding-top: var(--df-space-3);
}

.attempt-summary-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 0;
  border-block: var(--df-divider);
  background: transparent;
}

.attempt-summary-card div {
  min-width: 0;
  padding: var(--df-space-2) var(--df-space-3);
  border-inline-start: var(--df-divider);
}

.attempt-summary-card div:first-child {
  border-inline-start: 0;
}

.attempt-summary-card span {
  display: block;
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-label);
  font-size: var(--df-text-label-size);
  font-weight: var(--df-text-label-weight);
  line-height: var(--df-text-label-line);
}

.attempt-summary-card strong {
  display: block;
  margin-top: var(--df-space-1);
  color: var(--df-color-text-primary);
  font-family: var(--df-font-numbers);
  font-size: clamp(1rem, 1.8vw, 1.22rem);
  font-weight: 500;
  line-height: 1.25;
}

.attempt-summary-card .btn {
  justify-self: end;
  margin-inline-start: var(--df-space-3);
}

.attempt-history-panel {
  margin-top: var(--df-space-3);
  border: var(--df-border);
  border-radius: var(--df-radius-2);
  background: color-mix(in srgb, var(--df-color-surface) 96%, var(--secondary));
  padding: var(--df-space-3);
}

.attempt-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--df-space-3);
  margin-bottom: var(--df-space-2);
}

.attempt-history-head h3 {
  margin: 0;
  color: var(--df-color-text-primary);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.6;
}

.attempt-history-table-wrap {
  overflow-x: auto;
}

.attempt-history-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  color: var(--df-color-text-secondary);
  font-size: 0.84rem;
  line-height: 1.6;
}

.attempt-history-table th,
.attempt-history-table td {
  border-bottom: var(--df-divider);
  padding: var(--df-space-2);
  text-align: right;
  white-space: nowrap;
}

.attempt-history-table th {
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-label);
  font-size: var(--df-text-label-size);
  font-weight: var(--df-text-label-weight);
}

#result-screen .mistakes-section {
  margin-top: var(--df-space-4);
}

#result-screen .mistakes-section .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--df-space-2);
}

#result-screen .mistakes-section .section-head h3 {
  margin: 0;
}

#result-screen #result-focus-action-btn {
  min-height: 36px;
  border: 1px solid #1B6CA8;
  border-radius: var(--df-radius-2);
  background: #1B6CA8;
  color: #fff;
  box-shadow: 0 8px 18px rgba(27, 108, 168, 0.14);
  font-size: 0.84rem;
  font-weight: 600;
  padding: var(--df-space-1) var(--df-space-4);
}

#result-screen #result-focus-action-btn:hover,
#result-screen #result-focus-action-btn:focus-visible {
  border-color: #0D4470;
  background: #0D4470;
  outline: none;
}

.result-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 12px;
  margin: 26px 0;
  text-align: right;
}

.score-circle {
  --score-progress: 0%;
  width: 184px;
  height: 184px;
  margin: 30px auto 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 55%, transparent 56%),
    conic-gradient(var(--primary) var(--score-progress), var(--score-soft) 0);
  color: var(--primary-dark);
  display: grid;
  place-content: center;
  text-align: center;
  box-shadow: 0 18px 42px color-mix(in srgb, var(--primary) 18%, transparent);
  transform: scale(0.94);
  transition: --score-progress 1.1s ease, transform 0.35s ease;
}

.score-circle.animate {
  transform: scale(1);
}

.score-circle strong {
  display: block;
  font-size: clamp(2.1rem, 7vw, 3.1rem);
  line-height: 1;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease 0.28s, transform 0.35s ease 0.28s;
}

.score-circle.animate strong {
  opacity: 1;
  transform: translateY(0);
}

.score-circle span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.feedback-msg {
  max-width: 680px;
  margin: 0 auto 30px;
  color: var(--primary-dark);
  font-size: 1.12rem;
  line-height: 1.9;
  text-align: center;
  font-weight: 600;
}

.extra-actions {
  max-width: 720px;
  margin: 22px auto 0;
  text-align: center;
}

.extra-actions summary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #fff);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}

.extra-actions .action-row {
  justify-content: center;
  margin-top: 16px;
}

.score-tile strong {
  display: block;
  color: var(--primary);
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1;
}

.readiness-tile strong {
  display: block;
  color: var(--primary-dark);
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.45;
}

.result-section {
  margin-top: clamp(42px, 6vw, 64px);
}

.section-head {
  margin-bottom: 18px;
}

.result-section .section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
}

.result-section .summary-box {
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(20px, 4vw, 28px);
}

#mistakes-list {
  display: grid;
  gap: 5px;
}

.mistake-item {
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.055);
  background: #fff;
  border-color: color-mix(in srgb, var(--primary) 10%, var(--line));
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}

.mistake-toggle {
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  line-height: 1.45;
}

.mistake-toggle::after {
  content: "+";
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 90%, #fff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.mistake-item.is-open .mistake-toggle::after {
  content: "−";
}

.mistake-question-number {
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 86%, #fff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.mistake-question-text {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.mistake-toggle:hover,
.mistake-toggle:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--secondary) 34%, #fff);
}

.mistake-content {
  display: grid;
  gap: 5px;
  border-top: 1px solid color-mix(in srgb, var(--primary) 10%, var(--line));
  padding: 7px 10px 8px;
  background: color-mix(in srgb, var(--secondary) 20%, #fff);
}

.mistake-content[hidden] {
  display: none;
}

.mistake-content p {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--line) 70%, #fff);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.85rem;
  line-height: 1.55;
}

.mistake-answer.wrong-answer {
  color: var(--color-error-text);
  border-color: color-mix(in srgb, var(--color-error-text) 24%, #fff);
  background: var(--color-error-bg);
}

.mistake-answer.correct-answer {
  color: var(--color-success-text);
  border-color: color-mix(in srgb, var(--color-success-text) 28%, #fff);
  background: var(--color-success-bg);
}

.mistake-explanation {
  color: var(--muted);
  background: #fff;
}

.mistake-answer strong,
.mistake-explanation strong {
  color: inherit;
}

.mistake-item.celebration {
  border-color: var(--line);
  background: var(--secondary);
  padding: 12px;
}

.share-section {
  max-width: 780px;
  margin-inline: auto;
  padding-top: 6px;
}

.result-primary-actions {
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.result-primary-actions .btn.secondary {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.mistakes-section {
  padding-top: clamp(10px, 3vw, 22px);
}

.achievement-card {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1080px;
  height: 1350px;
  padding: 72px;
  background:
    linear-gradient(145deg, #F5F6F8 0%, #EEF3F7 100%);
  color: var(--ink);
  direction: rtl;
}

.achievement-card.is-capturing {
  left: 0;
  top: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(145deg, #F5F6F8 0%, #EEF3F7 100%);
}

.achievement-frame {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(220, 234, 244, 0.9);
  border-radius: 34px;
  padding: 68px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 42px;
  text-align: right;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 254, 0.96));
  box-shadow: 0 28px 80px rgba(27, 39, 55, 0.07);
  overflow: visible;
  position: relative;
}

.achievement-frame::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(232, 234, 237, 0.72);
  border-radius: 24px;
  pointer-events: none;
}

.readiness-card-accent {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 12px;
  background: #1A7A4A;
}

.achievement-card[data-readiness="steady"] .readiness-card-accent {
  background: #1B6CA8;
}

.achievement-card[data-readiness="review"] .readiness-card-accent {
  background: #7C8A99;
}

.achievement-card[data-readiness="focused"] .readiness-card-accent {
  background: #0D4470;
}

.readiness-card-header,
.readiness-card-intro,
.achievement-score-block,
.readiness-card-summary {
  position: relative;
  z-index: 1;
}

.readiness-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.readiness-card-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  background: rgba(245, 246, 248, 0.64);
  padding: 10px 12px;
  direction: ltr;
}

.readiness-card-brand img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.readiness-card-brand div {
  display: grid;
  gap: 2px;
}

.readiness-card-brand strong {
  color: #1C2230;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.readiness-card-brand span,
.readiness-card-date,
.readiness-card-label,
.readiness-card-score-row span {
  color: #9AA3AE;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.readiness-card-brand span {
  direction: ltr;
  text-align: left;
}

.readiness-card-date {
  margin: 0;
  border-radius: 999px;
  background: rgba(245, 246, 248, 0.75);
  padding: 9px 14px;
  direction: rtl;
  letter-spacing: 0;
}

.readiness-card-intro {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.readiness-card-kicker {
  margin: 0;
  color: #1B6CA8;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.45;
}

.student-name-highlight {
  max-width: 100%;
  margin: 0;
  color: #2C3240;
  font-size: 58px;
  line-height: 1.35;
  font-weight: 500;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.subject-highlight {
  margin: 0;
  color: #4A5568;
  font-size: 32px;
  line-height: 1.6;
  font-weight: 400;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.achievement-score-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  margin: 0;
  border: 1px solid rgba(220, 234, 244, 0.88);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(230, 245, 238, 0.78), rgba(255, 255, 255, 0.88) 56%);
  padding: 46px 44px;
  text-align: right;
}

.achievement-card[data-readiness="steady"] .achievement-score-block {
  background:
    linear-gradient(135deg, rgba(232, 242, 251, 0.84), rgba(255, 255, 255, 0.9) 58%);
}

.achievement-card[data-readiness="review"] .achievement-score-block {
  background:
    linear-gradient(135deg, rgba(245, 246, 248, 0.92), rgba(255, 255, 255, 0.9) 58%);
}

.achievement-card[data-readiness="focused"] .achievement-score-block {
  background:
    linear-gradient(135deg, rgba(232, 242, 251, 0.78), rgba(255, 255, 255, 0.9) 58%);
}

.readiness-card-status {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.readiness-card-label {
  margin: 0;
  letter-spacing: 0;
  font-size: 18px;
}

#card-readiness-level {
  display: block;
  color: #1A7A4A;
  font-size: 82px;
  font-weight: 500;
  line-height: 1.28;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.achievement-card[data-readiness="steady"] #card-readiness-level {
  color: #2C3240;
}

.achievement-card[data-readiness="review"] #card-readiness-level {
  color: #1B6CA8;
}

.achievement-card[data-readiness="focused"] #card-readiness-level {
  color: #0D4470;
}

.readiness-card-score-row {
  display: inline-flex;
  flex-direction: column;
  align-items: baseline;
  gap: 8px;
  min-width: 154px;
  border: 1px solid rgba(232, 234, 237, 0.88);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  padding: 18px 20px;
}

#card-percentage {
  display: inline;
  color: #2C3240;
  font-size: 42px;
  line-height: 1.1;
  font-weight: 500;
}

#card-message {
  margin: 0;
  border-radius: 18px;
  background: rgba(245, 246, 248, 0.72);
  color: #4A5568;
  padding: 26px 30px;
  font-size: 30px;
  line-height: 1.7;
  font-weight: 400;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.achievement-card.is-capturing .achievement-frame {
  overflow: visible;
}

.achievement-card.is-capturing .student-name-highlight {
  font-size: clamp(42px, 5.2vw, 58px);
}

.achievement-card.is-capturing #card-readiness-level {
  font-size: clamp(58px, 7.4vw, 82px);
}

.achievement-card.is-capturing #card-message {
  font-size: clamp(24px, 2.8vw, 30px);
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px 10px 96px;
    align-items: start;
  }

  .platform-tools {
    right: 50%;
    left: auto;
    top: auto;
    bottom: 10px;
    flex-direction: row;
    gap: 4px;
    padding: 5px;
    border-radius: 18px;
    transform: translateX(50%);
  }

  .internal-test-panel {
    bottom: 62px;
    right: 10px;
    left: 10px;
    width: auto;
    border-radius: 16px;
    transform: none;
  }

  .internal-test-panel.is-expanded {
    inset: 12px 10px 76px;
    width: auto;
    max-height: none;
    transform: none;
  }

  .internal-test-panel.is-expanded .assistant-chat-messages {
    min-height: 180px;
    max-height: calc(100vh - 230px);
    max-height: calc(100dvh - 230px);
  }

  .assistant-chat-input {
    grid-template-columns: 1fr;
  }

  .assistant-chat-input .ai-test-btn {
    width: 100%;
  }

  .floating-glass-btn,
  .tool-chip {
    min-height: 36px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .tool-icon {
    width: 13px;
    height: 13px;
  }

  .modal-card {
    padding: 22px;
    border-radius: 22px;
  }

  .hero-panel {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .hero-card {
    min-height: auto;
    align-items: flex-start;
  }

  .student-grid,
  .result-grid,
  .result-details,
  .performance-card,
  .previous-results,
  .home-progress-summary,
  .home-units-list,
  .unit-test-control {
    grid-template-columns: 1fr;
  }

  .performance-card {
    gap: 12px;
  }

  .performance-card div {
    padding: 0;
  }

  .performance-card div + div {
    border-inline-start: 0;
    border-top: 1px solid color-mix(in srgb, var(--line) 78%, #fff);
    padding-top: 12px;
  }

  .topbar {
    flex-direction: column;
  }

  .units-topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
  }

  .units-topbar h2 {
    font-size: clamp(1.35rem, 6vw, 1.85rem);
  }

  .units-topbar .btn {
    min-height: 38px;
    padding-inline: 13px;
    white-space: nowrap;
  }

  .quiz-shell {
    width: 100%;
  }

  .quiz-topline {
    margin-bottom: 6px;
  }

  .quiz-header h2 {
    margin-bottom: 6px;
  }

  .quiz-progress-line {
    gap: 8px;
    margin-bottom: 10px;
  }

  .question-pill {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .quiz-progress-wrap {
    height: 13px;
  }

  #quiz-screen .quiz-progress-wrap {
    height: 4px;
  }

  .quiz-focus-panel {
    padding: 16px;
  }

  #quiz-screen .quiz-focus-panel {
    padding: var(--df-space-3);
  }

  .feedback {
    height: 96px;
  }

  #quiz-screen .feedback {
    height: 72px;
  }

  .question-box {
    margin-bottom: 12px;
    padding: 16px;
  }

  #question-text {
    font-size: 1.22rem;
    line-height: 1.65;
  }

  .options-list {
    gap: 10px;
    margin-top: 12px;
  }

  .option-btn {
    min-height: 54px;
    padding: 12px 16px;
    font-size: 1rem;
  }

  #quiz-screen .option-btn {
    min-height: 44px;
    padding: var(--df-space-2) var(--df-space-3);
  }

  #quiz-screen #question-text {
    font-size: 1.28rem;
  }

  .topbar-actions,
  .units-list,
  .home-units-list,
  .unit-inline-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  #welcome-screen .student-grid {
    grid-template-columns: 1fr;
  }

  #welcome-screen .start-review-card {
    width: 100%;
  }

  .flashcard-container,
  .flashcard,
  .card-face {
    min-height: 280px;
  }

  #review-screen .review-card-item {
    min-height: 260px;
  }

  .action-row,
  .btn {
    width: 100%;
  }

  #result-screen .result-score-summary {
    grid-template-columns: 1fr;
    gap: var(--df-space-3);
  }

  #result-screen .result-score-block {
    margin-inline: auto;
    width: clamp(166px, 54vw, 204px);
  }

  #result-screen .performance-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #result-screen .performance-card div,
  #result-screen .performance-card div:first-child {
    border-top: 0;
    border-inline-start: var(--df-divider);
    padding: var(--df-space-2);
  }

  #result-screen .performance-card div:first-child {
    border-inline-start: 0;
  }

  #result-screen .result-topic-row {
    grid-template-columns: 1fr;
    gap: var(--df-space-2);
  }

  #result-screen .result-topic-percent {
    justify-self: start;
  }

  #result-screen .result-secondary-actions {
    align-items: stretch;
  }

  #units-screen .units-topbar-actions,
  .attempt-history-head {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .attempt-summary-card {
    grid-template-columns: 1fr;
    border-block: 0;
    gap: var(--df-space-1);
  }

  .attempt-summary-card div {
    border: var(--df-divider);
    border-inline-start: 0;
    padding: var(--df-space-2);
  }

  .attempt-summary-card .btn {
    width: 100%;
    margin-inline-start: 0;
  }
}

#review-screen {
  --review-surface: #fff;
  --review-soft: color-mix(in srgb, var(--secondary) 38%, #fff);
  --review-border: color-mix(in srgb, var(--primary) 10%, var(--line));
  --review-border-strong: color-mix(in srgb, var(--primary) 30%, var(--line));
  --review-muted: color-mix(in srgb, var(--muted) 88%, var(--ink));
  --review-radius: 8px;
  --review-shadow: 0 10px 26px rgba(37, 99, 235, 0.055);
  max-width: 900px;
}

#review-screen .topbar {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--review-border);
  border-radius: var(--review-radius);
  background: var(--review-surface);
  box-shadow: var(--review-shadow);
  text-align: right;
}

#review-screen .topbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.16rem, 2.2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.55;
}

#review-screen #review-instruction,
#review-screen #card-counter {
  color: var(--review-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

#review-screen .review-focus-panel {
  margin-top: 0;
  border: 1px solid var(--review-border);
  border-radius: var(--review-radius);
  background: var(--review-surface);
  box-shadow: var(--review-shadow);
  padding: clamp(12px, 2.5vw, 18px);
}

#review-screen .review-cards-list {
  gap: 10px;
  margin-top: 0;
}

#review-screen .review-card-item {
  min-height: clamp(220px, 30vw, 280px);
}

#review-screen .review-card-inner {
  border-radius: var(--review-radius);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.055);
  transition: transform 280ms cubic-bezier(0.2, 0, 0, 1), box-shadow 160ms ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: none;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.075);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-face {
  border: 1px solid var(--review-border);
  border-radius: var(--review-radius);
  background: var(--review-surface);
  padding: clamp(50px, 6vw, 62px) clamp(18px, 3vw, 30px);
  align-items: center;
  justify-content: center;
  text-align: center;
}

#review-screen .review-card-face::before {
  inset: 0 0 auto;
  width: auto;
  height: 4px;
  border-radius: var(--review-radius) var(--review-radius) 0 0;
  background: var(--primary);
  opacity: 0.72;
}

#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-back {
  background: var(--review-surface);
}

#review-screen .review-card-number {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  border: 1px solid var(--review-border);
  border-radius: 999px;
  background: var(--review-soft);
  color: var(--primary-dark);
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 700;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: min(100%, 620px);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.08rem, 2.35vw, 1.42rem);
  font-weight: 700;
  line-height: 1.85;
}

#review-screen .review-card-back strong {
  color: var(--primary-dark);
  padding: 0;
  border: 0;
  background: transparent;
}

#review-screen .review-card-face small {
  position: absolute;
  right: 14px;
  bottom: 14px;
  margin: 0;
  border: 1px solid var(--review-border-strong);
  border-radius: var(--review-radius);
  background: var(--review-soft);
  color: var(--primary-dark);
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

#review-screen .style-scroll-end {
  margin-top: 12px;
  gap: 8px;
}

#review-screen .style-scroll-end .btn {
  min-height: 40px;
  border: 1px solid var(--review-border);
  border-radius: var(--review-radius);
  padding-inline: 16px;
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 600;
}

#review-screen .style-scroll-end .btn:hover {
  transform: none;
}

#review-screen .style-scroll-end .btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

#review-screen .style-scroll-end .btn.ghost,
#review-screen .style-scroll-end .btn.secondary {
  background: #fff;
  color: var(--review-muted);
}

@media (max-width: 820px) {
  #review-screen .review-card-item {
    min-height: 260px;
  }
}

#review-screen .review-focus-panel {
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

#review-screen .review-cards-list {
  gap: 10px;
}

#review-screen .review-card-item {
  min-height: 112px;
}

#review-screen .review-card-inner {
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.05);
}

#review-screen .review-card-face {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: stretch;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
  border-radius: 10px;
  background: #fff;
  padding: 16px 18px;
  text-align: right;
}

#review-screen .review-card-face::before,
#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-number {
  position: static;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 76%, #fff);
  color: var(--primary-dark);
  padding: 6px 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: auto;
  margin: 0;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.7;
  text-align: right;
}

#review-screen .review-card-back strong {
  color: var(--primary-dark);
}

#review-screen .review-card-face small {
  position: static;
  justify-self: end;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  padding: 8px 13px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: none;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.075);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg);
}

@media (max-width: 820px) {
  #review-screen .review-card-item {
    min-height: 168px;
  }

  #review-screen .review-card-face {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px;
  }

  #review-screen .review-card-face small {
    justify-self: stretch;
    text-align: center;
  }
}

#review-screen .review-focus-panel {
  border-radius: 8px;
  background: #fff;
  padding: clamp(12px, 2vw, 16px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.05);
}

#review-screen .review-cards-list {
  gap: 12px;
}

#review-screen .review-card-item {
  min-height: clamp(176px, 24vw, 220px);
}

#review-screen .review-card-inner {
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.055);
  transition: transform 280ms cubic-bezier(0.2, 0, 0, 1), box-shadow 160ms ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: none;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.075);
}

#review-screen .review-card-item.flipped .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-item.flipped:hover .review-card-inner {
  transform: rotateY(180deg);
}

#review-screen .review-card-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--line));
  border-radius: 8px;
  background: #fff;
  padding: 44px clamp(18px, 3vw, 30px);
  text-align: center;
  overflow: hidden;
}

#review-screen .review-card-face::before {
  display: block;
  content: "";
  position: absolute;
  inset: 0 0 auto;
  width: auto;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--primary) 72%, #fff);
  opacity: 0.78;
}

#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-back {
  background: linear-gradient(180deg, color-mix(in srgb, var(--secondary) 26%, #fff), #fff 46%);
}

#review-screen .review-card-number {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 62%, #fff);
  color: var(--primary-dark);
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

#review-screen .review-card-question,
#review-screen .review-card-back strong {
  width: min(100%, 620px);
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.08rem, 2.3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
}

#review-screen .review-card-back strong {
  display: block;
  color: var(--primary-dark);
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--line));
  border-radius: 8px;
  background: #fff;
  padding: clamp(14px, 2vw, 20px);
}

#review-screen .review-card-face small {
  position: absolute;
  right: 14px;
  bottom: 14px;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--secondary) 58%, #fff);
  color: var(--primary-dark);
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

@media (max-width: 820px) {
  #review-screen .review-card-item {
    min-height: 210px;
  }

  #review-screen .review-card-face {
    padding: 48px 16px 56px;
  }
}

/* Compact flashcards: aligned with quiz/result, independent from units styling. */
#review-screen {
  --primary: #1B6CA8;
  --primary-dark: #0D4470;
  --secondary: #E8F2FB;
  --bg: #F5F6F8;
  --card-bg: #FFFFFF;
  --ink: #2C3240;
  --muted: #8896A5;
  --line: #E8EAED;
  --review-flash-border: #E8EAED;
  --review-flash-answer: #F3F7FA;
  --review-flash-answer-border: #DCEAF4;
  --review-flash-shadow: 0 4px 14px rgba(44, 50, 64, 0.045);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  border-radius: 8px;
  padding: clamp(12px, 2vw, 18px);
}

#review-screen .topbar {
  margin-bottom: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#review-screen .topbar h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 1.28rem;
  font-weight: 500;
  line-height: 1.45;
}

#review-screen #review-instruction {
  margin: 0;
  color: #4A5568;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.7;
}

#review-screen #card-counter:empty {
  display: none;
}

#review-screen .review-focus-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

#review-screen .review-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
  gap: 10px;
  margin-top: 10px;
}

#review-screen .review-card-item {
  display: block;
  width: 100%;
  min-height: 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: none;
}

#review-screen .review-card-inner {
  position: static;
  width: 100%;
  min-height: 0;
  border-radius: 8px;
  box-shadow: var(--review-flash-shadow);
  transform: none;
  transform-style: flat;
  transition: border-color 160ms ease, background-color 160ms ease;
}

#review-screen .review-card-item:hover .review-card-inner {
  transform: none;
  box-shadow: 0 5px 16px rgba(44, 50, 64, 0.06);
}

#review-screen .review-card-item.is-open .review-card-inner {
  transform: none;
}

#review-screen .review-card-item.is-open:hover .review-card-inner {
  transform: none;
}

#review-screen .review-card-face {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  border: 1px solid var(--review-flash-border);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 12px 14px;
  text-align: right;
  overflow: hidden;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  transform: none;
}

#review-screen .review-card-face::before,
#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-front {
  background: var(--card-bg);
}

#review-screen .review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
}

#review-screen .review-card-number {
  position: static;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  direction: ltr;
}

#review-screen .review-card-question-area {
  border-top: 0.5px solid var(--review-flash-border);
  padding-top: 10px;
}

#review-screen .review-card-question {
  display: block;
  width: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.75;
  text-align: right;
}

#review-screen .review-answer-toggle {
  align-self: flex-start;
  min-height: 32px;
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  padding: 6px 14px;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

#review-screen .review-answer-toggle:focus-visible,
#review-screen .review-card-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

#review-screen .review-card-item.is-open .review-answer-toggle {
  background: var(--primary);
  color: #fff;
}

#review-screen .review-card-answer {
  display: none;
  margin-top: 0;
  border: 1px solid var(--review-flash-answer-border);
  border-radius: 8px;
  background: var(--review-flash-answer);
  padding: 10px 11px;
}

#review-screen .review-card-item.is-open .review-card-answer {
  display: block;
}

#review-screen .review-answer-label {
  display: block;
  margin-bottom: 5px;
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.5;
}

#review-screen .review-card-answer strong {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.75;
  text-align: right;
}

#review-screen .review-card-face small {
  position: static;
  margin: 8px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.7;
}

#review-screen .style-scroll-end {
  margin-top: 14px;
  gap: 10px;
}

#review-screen .style-scroll-end .btn {
  min-height: 40px;
  border-radius: 6px;
  border: 1.5px solid var(--primary);
  padding: 9px 18px;
  box-shadow: none;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
}

#review-screen .style-scroll-end .btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

#review-screen .style-scroll-end .btn.ghost,
#review-screen .style-scroll-end .btn.secondary {
  background: #fff;
  color: var(--primary);
}

@media (max-width: 820px) {
  #review-screen .review-cards-list {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #review-screen .review-card-face {
    padding: 12px;
  }

  #review-screen .review-card-question {
    font-size: 0.98rem;
  }

  #review-screen .style-scroll-end .btn {
    width: 100%;
  }
}

/* Sequential flashcards: one card, in-page navigation, no self-rating. */
#review-screen .review-cards-list {
  display: block;
  width: min(100%, 760px);
  margin: 16px auto 0;
}

#review-screen #card-counter {
  display: block;
  margin: 8px 0 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 500;
  direction: rtl;
}

#review-screen .review-carousel {
  display: grid;
  gap: 14px;
  width: 100%;
}

#review-screen .review-carousel-tools {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: -2px;
}

#review-screen .review-share-btn,
#review-screen .review-shuffle-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid var(--review-flash-border);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  padding: 0;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(44, 50, 64, 0.045);
}

#review-screen .review-share-btn:hover,
#review-screen .review-share-btn:focus-visible,
#review-screen .review-shuffle-btn:hover,
#review-screen .review-shuffle-btn:focus-visible {
  background: var(--secondary);
  outline: none;
}

#review-screen .review-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #DDE5EC;
}

#review-screen .review-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 220ms ease;
}

#review-screen .review-card-item {
  display: block;
  width: 100%;
  min-height: clamp(270px, 44vh, 390px);
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  perspective-origin: center center;
  overflow: hidden;
  isolation: isolate;
}

#review-screen .review-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: clamp(270px, 44vh, 390px);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(44, 50, 64, 0.08);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -webkit-transform: rotateY(0deg) translateZ(0);
  transform: rotateY(0deg) translateZ(0);
  transition: transform 520ms ease, box-shadow 180ms ease;
  will-change: transform;
}

#review-screen .review-card-item:hover .review-card-inner {
  box-shadow: 0 14px 32px rgba(44, 50, 64, 0.1);
}

#review-screen .review-card-item.is-flipped .review-card-inner {
  -webkit-transform: rotateY(180deg) translateZ(0);
  transform: rotateY(180deg) translateZ(0);
}

#review-screen .review-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100%;
  border: 1px solid var(--review-flash-border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: clamp(24px, 5vw, 42px);
  text-align: center;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -webkit-transform: rotateY(0deg) translateZ(0.1px);
  transform: rotateY(0deg) translateZ(0.1px);
  will-change: transform;
}

#review-screen .review-card-face::before,
#review-screen .review-card-face::after {
  display: none;
}

#review-screen .review-card-back {
  -webkit-transform: rotateY(180deg) translateZ(0.1px);
  transform: rotateY(180deg) translateZ(0.1px);
  border-color: #DCEAF4;
  background: #F1F7FC;
}

#review-screen .review-card-number {
  position: absolute;
  top: 18px;
  inset-inline-start: 18px;
  margin: 0;
  border: 1px solid var(--review-flash-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  padding: 5px 10px;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  direction: rtl;
}

#review-screen .review-face-label,
#review-screen .review-answer-label {
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
}

#review-screen .review-card-question {
  display: block;
  width: min(100%, 620px);
  margin: 0;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.85;
  text-align: center;
}

#review-screen .review-card-back strong {
  display: block;
  width: min(100%, 620px);
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 1.04rem;
  font-weight: 500;
  line-height: 1.9;
  text-align: center;
}

#review-screen .review-card-face small {
  position: absolute;
  bottom: 18px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.6;
}

#review-screen .review-nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

#review-screen .review-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--review-flash-border);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0;
  box-shadow: 0 5px 14px rgba(44, 50, 64, 0.055);
}

#review-screen .review-icon-btn span {
  display: block;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-1px);
}

#review-screen .review-icon-btn:hover:not(:disabled),
#review-screen .review-icon-btn:focus-visible {
  border-color: var(--primary);
  background: var(--secondary);
  color: var(--primary);
  outline: none;
}

#review-screen .review-nav-count {
  min-width: 72px;
  color: var(--ink);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  direction: rtl;
}

.review-complete-note {
  margin: 0;
  color: #1B6CA8;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
  text-align: center;
}

#review-screen .review-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 640px) {
  #review-screen .review-cards-list {
    margin-top: 14px;
  }

  #review-screen .review-card-item,
  #review-screen .review-card-inner {
    min-height: 300px;
  }

  #review-screen .review-card-face {
    padding: 46px 18px 42px;
  }

  #review-screen .review-card-question {
    font-size: 1.04rem;
  }

  #review-screen .review-card-back strong {
    font-size: 0.98rem;
  }

  #review-screen .review-nav-controls {
    gap: 12px;
  }

  #review-screen .review-icon-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }
}

/* Home screen: matched to the approved identity/login reference. */
body:has(#welcome-screen:not(.hidden)) {
  background: #F5F6F8;
}

#welcome-screen {
  --primary: #1B6CA8;
  --primary-dark: #0D4470;
  --secondary: #E8F2FB;
  --bg: #F5F6F8;
  --card-bg: #FFFFFF;
  --ink: #2C3240;
  --ink-2: #4A5568;
  --muted: #8896A5;
  --line: #E8EAED;
  min-height: calc(100vh - 136px);
  min-height: calc(100dvh - 136px);
  display: grid;
  place-items: center;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

#welcome-screen .hero-panel {
  width: min(100%, 560px);
  min-height: 0;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: none;
  padding: 24px;
  display: block;
}

#welcome-screen .hero-content {
  display: block;
  text-align: center;
}

#welcome-screen .hero-content::before {
  display: none;
}

.jadeer-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #1B6CA8;
  text-align: center;
}

.jadeer-brand-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  direction: ltr;
}

.jadeer-brand-mark {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.jadeer-brand-ar {
  color: #1B6CA8;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.jadeer-brand-en {
  display: block;
  margin-top: 3px;
  color: #9AA3AE;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.12em;
  direction: ltr;
}

.jadeer-mini-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #1C2230;
  direction: ltr;
}

.jadeer-mini-lockup img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.jadeer-mini-lockup span {
  color: #1C2230;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

#quiz-screen .quiz-topline .jadeer-mini-lockup {
  margin-bottom: 0;
}

#welcome-screen .jadeer-brand-lockup {
  margin: 0 auto 24px;
}

#welcome-screen .jadeer-brand-mark {
  width: 40px;
  height: 40px;
}

#welcome-screen .jadeer-brand-ar {
  font-size: 22px;
}

#result-screen .result-brand-lockup {
  margin: 0 auto var(--df-space-3);
}

#welcome-screen .welcome-brand-mark {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin: 0 auto 20px;
}

#welcome-screen #welcome-title {
  max-width: 100%;
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.45;
}

#welcome-screen #welcome-message {
  max-width: 100%;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
}

#welcome-screen .hero-card,
#welcome-screen .home-progress-summary,
#welcome-screen .home-units-preview,
#welcome-screen .path-preview {
  display: none !important;
}

#welcome-screen .student-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

#welcome-screen .student-grid div {
  border: 0;
  border-radius: 8px;
  background: var(--bg);
  box-shadow: none;
  padding: 10px;
  text-align: center;
}

#welcome-screen .student-grid span {
  margin: 0 0 3px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
}

#welcome-screen .student-grid strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

#welcome-screen .start-review-card {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: grid;
  gap: 16px;
}

#welcome-screen .student-code-box {
  display: block;
}

#welcome-screen .student-grid {
  grid-template-columns: minmax(0, 1fr);
}

#welcome-screen .student-code-box label,
#welcome-screen .subject-strip p {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: right;
}

#welcome-screen .student-code-box input {
  width: 100%;
  min-height: 42px;
  margin: 0 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  padding: 10px 14px;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

#welcome-screen .student-code-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: none;
}

#welcome-screen #student-name-input {
  direction: rtl;
  text-align: right;
  min-height: 36px;
  margin-bottom: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

#welcome-screen #student-name-input:disabled,
#welcome-screen .name-save-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#welcome-screen .optional-name-label {
  margin-top: 2px;
  font-size: 11px;
}

#welcome-screen .optional-name-input::placeholder {
  color: color-mix(in srgb, var(--muted) 76%, #fff);
}

#welcome-screen #student-code-input {
  direction: rtl;
  text-align: right;
}

#welcome-screen .start-save-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
}

#welcome-screen .save-status {
  min-height: 16px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

#welcome-screen .subject-strip {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

#welcome-screen #subject-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

#welcome-screen .subject-badge {
  min-height: 78px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

#welcome-screen .subject-badge-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

#welcome-screen .subject-badge small {
  color: var(--muted);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
}

#welcome-screen .subject-badge-action {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

#welcome-screen .subject-badge.active {
  border-color: var(--primary);
  background: var(--secondary);
}

#welcome-screen .subject-badge.active .subject-badge-name {
  color: var(--primary-dark);
}

#welcome-screen .subject-badge.active small {
  color: var(--primary);
}

#welcome-screen .start-action-row {
  margin: 0;
  display: grid;
  gap: 8px;
}

#welcome-screen .start-action-row .btn,
#welcome-screen #start-review-btn,
#welcome-screen #skip-to-quiz-btn {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  box-shadow: none;
  padding: 10px 24px;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

#welcome-screen #start-review-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

#welcome-screen #start-review-btn:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 1;
}

#welcome-screen #start-review-btn:hover {
  background: var(--primary-dark);
  transform: none;
}

#welcome-screen #start-review-btn:disabled:hover {
  background: var(--line);
}

#welcome-screen #skip-to-quiz-btn {
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
}

@media (max-width: 640px) {
  #welcome-screen {
    min-height: auto;
  }

  #welcome-screen .hero-panel {
    width: 100%;
    padding: 20px 16px;
  }

  #welcome-screen .welcome-brand-mark {
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
  }

  #welcome-screen .student-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Units screen: matched to the approved units reference. */
#units-screen {
  --primary: #1B6CA8;
  --primary-dark: #0D4470;
  --secondary: #E8F2FB;
  --bg: #F5F6F8;
  --card-bg: #FFFFFF;
  --ink: #2C3240;
  --ink-2: #4A5568;
  --muted: #8896A5;
  --line: #E8EAED;
  --unit-complete: var(--primary);
  max-width: 760px;
  margin-inline: auto;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body:has(#units-screen:not(.hidden)) {
  background: #F5F6F8;
}

#units-screen .units-topbar {
  margin-bottom: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#units-screen .units-topbar .eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
}

#units-screen .units-topbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 500;
  line-height: 1.45;
}

#units-screen .units-topbar .btn {
  min-height: 36px;
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  color: var(--primary);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 500;
}

#units-screen .units-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 10px;
}

#units-screen .unit-card {
  position: relative;
  display: block;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 4px 14px rgba(44, 50, 64, 0.035);
  color: var(--ink);
  padding: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

#units-screen .unit-card::before {
  display: none;
}

#units-screen .unit-card.is-complete::before {
  background: transparent;
}

#units-screen .unit-card.is-progress::before,
#units-screen .unit-card.active::before {
  background: var(--primary);
}

#units-screen .unit-card:hover,
#units-screen .unit-card:focus-visible {
  transform: none;
  border-color: #D5E3EE;
  box-shadow: 0 6px 18px rgba(44, 50, 64, 0.055);
  outline: none;
}

#units-screen .unit-card.active {
  border-color: rgba(27, 108, 168, 0.32);
  background: #F9FCFE;
  box-shadow: 0 7px 20px rgba(27, 108, 168, 0.075);
}

#units-screen .unit-card-header {
  display: block;
  margin: 0 0 4px;
}

#units-screen .unit-name,
#units-screen .unit-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.55;
}

#units-screen .unit-meta-line {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
}

#units-screen .unit-progress {
  display: grid;
  gap: 5px;
}

#units-screen .unit-bar-wrap {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

#units-screen .unit-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

#units-screen .unit-card.is-complete .unit-bar {
  background: var(--unit-complete);
}

#units-screen .unit-progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#units-screen .unit-status-text,
#units-screen .unit-pct {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
}

#units-screen .unit-pct {
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", Consolas, monospace;
  direction: ltr;
}

#units-screen .unit-card.is-complete .unit-status-text,
#units-screen .unit-card.is-complete .unit-pct {
  color: var(--primary);
}

#units-screen .unit-card.is-complete .unit-status-text {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 4px;
  background: #E6F5EE;
  color: #1A7A4A;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

#units-screen .unit-card.is-progress .unit-status-text,
#units-screen .unit-card.is-progress .unit-pct {
  color: var(--primary);
}

#units-screen .unit-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  border-top: 0.5px solid var(--line);
  padding-top: 12px;
}

#units-screen .unit-inline-actions .btn {
  min-height: 38px;
  border-radius: 6px;
  box-shadow: none;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 500;
}

#units-screen .unit-inline-actions .btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

#units-screen .unit-inline-actions .btn.secondary {
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
}

#units-screen .unit-resume-box {
  margin-top: 12px;
  border: 0.5px solid #DCEAF4;
  border-radius: 8px;
  background: #F3F7FA;
  padding: 10px;
}

#units-screen .unit-resume-box p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.7;
}

#units-screen .unit-chevron,
#units-screen .unit-meta,
#units-screen .unit-pill,
#units-screen .unit-progress-note {
  display: none;
}

#units-screen .unit-actions-panel {
  display: none !important;
}

@media (max-width: 640px) {
  #units-screen .units-topbar {
    flex-direction: row;
    align-items: center;
  }

  #units-screen .units-list {
    grid-template-columns: 1fr;
  }

  #units-screen .unit-inline-actions {
    grid-template-columns: 1fr;
  }
}

/* Quiz screen color alignment only. Layout and sizing stay unchanged. */
#quiz-screen {
  --df-color-background: #F5F6F8;
  --df-color-surface: #FFFFFF;
  --df-color-surface-muted: #E8F2FB;
  --df-color-border: #E8EAED;
  --df-color-border-strong: #1B6CA8;
  --df-color-text-primary: #2C3240;
  --df-color-text-secondary: #4A5568;
  --df-color-text-tertiary: #8896A5;
  --df-color-accent: #1B6CA8;
  --df-color-success: #1A7A4A;
  --df-color-success-surface: #E6F5EE;
  --df-color-error: #B52B2B;
  --df-color-error-surface: #FAEAEA;
  --primary: #1B6CA8;
  --primary-dark: #0D4470;
  --secondary: #E8F2FB;
  --ink: #2C3240;
  --muted: #8896A5;
  --line: #E8EAED;
  color: #2C3240;
}

body:has(#quiz-screen:not(.hidden)) {
  background: #F5F6F8;
}

#quiz-screen .quiz-focus-panel,
#quiz-screen .option-btn {
  background: #FFFFFF;
}

#quiz-screen .quiz-progress-wrap {
  background: #E8EAED;
}

#quiz-screen .quiz-progress-wrap .progress-fill {
  background: #1B6CA8;
}

#quiz-screen .btn.primary {
  border-color: #1B6CA8;
  background: #1B6CA8;
  color: #FFFFFF;
}

#quiz-screen .btn.secondary,
#quiz-screen .btn.ghost {
  border-color: #1B6CA8;
  background: #FFFFFF;
  color: #1B6CA8;
}

#quiz-screen .btn.secondary:hover,
#quiz-screen .btn.ghost:hover,
#quiz-screen .option-btn:hover:not(:disabled) {
  border-color: #1B6CA8;
  background: #E8F2FB;
}

/* Result screen identity alignment. Score circle structure stays unchanged. */
#result-screen {
  --primary: #1B6CA8;
  --primary-dark: #0D4470;
  --secondary: #E8F2FB;
  --success: #1A7A4A;
  --danger: #B52B2B;
  --ink: #2C3240;
  --muted: #8896A5;
  --line: #E8EAED;
  --df-color-surface: #FFFFFF;
  --df-color-surface-muted: #E8F2FB;
  --df-color-border: #E8EAED;
  --df-color-border-strong: #1B6CA8;
  --df-color-text-primary: #2C3240;
  --df-color-text-secondary: #4A5568;
  --df-color-text-tertiary: #8896A5;
  --df-color-success: #1A7A4A;
  --df-color-error: #B52B2B;
  --df-color-accent: #1B6CA8;
}

body:has(#result-screen:not(.hidden)) {
  background: #F5F6F8;
}

#result-screen .result-panel {
  border-color: #E8EAED;
  background: #FFFFFF;
  box-shadow: none;
}

#result-screen #result-kicker,
#result-screen .performance-card span,
#result-screen .result-topic-percent {
  color: #8896A5;
}

#result-screen #result-heading,
#result-screen .result-section:not(.mistakes-section) .section-head h3,
#result-screen .result-readiness-text,
#result-screen .performance-card strong {
  color: #2C3240;
}

#result-screen .result-score-sentence,
#result-screen .result-topic-name,
#result-screen .share-section .muted {
  color: #4A5568;
}

#result-screen .result-topic-track {
  background: #E8EAED;
}

#result-screen .result-topic-fill,
#result-screen .result-topic-row:nth-child(even) .result-topic-fill {
  background: #1B6CA8;
}

#result-screen .performance-card div:first-child strong {
  color: #1A7A4A;
}

#result-screen .performance-card div:nth-child(2) strong {
  color: #B52B2B;
}

#result-screen .performance-card div:nth-child(3) strong {
  color: #8896A5;
}

#result-screen .result-primary-step .btn {
  border-color: #1B6CA8;
  background: #1B6CA8;
  color: #FFFFFF;
  box-shadow: none;
}

#result-screen .result-secondary-actions .btn {
  border-color: #1B6CA8;
  background: #FFFFFF;
  color: #1B6CA8;
}

#result-screen .result-secondary-actions .btn.primary {
  border-color: #1B6CA8;
  background: #1B6CA8;
  color: #FFFFFF;
}

/* Absolute final override for the tools icon system. */
.platform-tools {
  right: auto !important;
  left: 12px !important;
  top: 12px !important;
  bottom: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 5px !important;
  width: auto !important;
  max-width: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  transform: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.platform-tools .tool-chip:not(.assistant-open-btn) {
  width: 34px !important;
  min-height: 34px !important;
  height: 34px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  padding: 0 !important;
  gap: 0 !important;
  font-size: 0 !important;
}

.platform-tools .tool-chip:not(.assistant-open-btn) > span:not(.tool-icon) {
  display: none !important;
}

.platform-tools .assistant-open-btn {
  position: fixed !important;
  left: 16px !important;
  bottom: 16px !important;
  top: auto !important;
  right: auto !important;
}

.platform-tools .theme-menu {
  top: 0 !important;
  right: auto !important;
  left: calc(100% + 8px) !important;
  border-radius: 8px !important;
}

.platform-tools .support-tool-btn {
  position: relative;
}

.platform-tools .support-tool-btn::after {
  content: "تواصل";
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  border-radius: 4px;
  background: var(--ink);
  color: var(--panel);
  padding: 3px 8px;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.platform-tools .support-tool-btn:hover::after,
.platform-tools .support-tool-btn:focus-visible::after {
  opacity: 1;
}

.assistant-open-btn,
.assistant-open-btn .assistant-open-text {
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
}

.assistant-open-btn {
  min-height: 42px !important;
  border-radius: 8px !important;
  padding: 9px 14px !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 22%, transparent) !important;
}

.assistant-open-btn.is-collapsed {
  width: 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  border-radius: 999px !important;
  padding: 0 !important;
}

.internal-test-panel {
  border: 0.5px solid var(--line) !important;
  border-radius: 12px !important;
  background: var(--panel) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08) !important;
  padding: 10px !important;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
}

.internal-test-header p {
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.assistant-window-btn {
  border-radius: 6px !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
}

.assistant-chat-messages {
  border-color: var(--line) !important;
  border-radius: 8px !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
}

.assistant-question-input {
  border-color: var(--line) !important;
  border-radius: 8px !important;
  background: var(--panel) !important;
  color: var(--ink) !important;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
}

.ai-test-btn {
  border-radius: 6px !important;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

.platform-tools .support-tool-btn {
  color: var(--primary) !important;
}

.platform-tools .assistant-open-btn {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.platform-tools .assistant-open-btn .ai-spark-icon {
  color: #fff !important;
}

.internal-test-panel {
  right: auto !important;
  left: 16px !important;
  bottom: 68px !important;
  transform: none !important;
}

.internal-test-panel.is-expanded {
  right: auto !important;
  left: 16px !important;
  bottom: 68px !important;
  width: min(520px, calc(100vw - 32px)) !important;
  max-height: min(78vh, 720px) !important;
  transform: none !important;
}

.platform-tools {
  left: 16px !important;
  top: auto !important;
  bottom: 66px !important;
  display: flex !important;
  flex-direction: column-reverse !important;
  align-items: flex-start !important;
  gap: 8px !important;
  pointer-events: none !important;
}

.platform-tools .support-tools {
  display: flex !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: auto !important;
}

.platform-tools .support-tool-btn {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  border: 1px solid #1B6CA8 !important;
  border-radius: 999px !important;
  background: #1B6CA8 !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(27, 108, 168, 0.22) !important;
  pointer-events: auto !important;
}

.platform-tools .support-tool-btn .contact-icon {
  width: 20px !important;
  height: 20px !important;
  color: #fff !important;
}

.platform-tools .support-tool-btn .contact-icon svg {
  stroke-width: 2 !important;
}

.platform-tools .support-tool-btn::after {
  content: "تواصل" !important;
}

.platform-tools .assistant-open-btn {
  background: #1B6CA8 !important;
  border-color: #1B6CA8 !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(27, 108, 168, 0.22) !important;
  pointer-events: auto !important;
}

.platform-tools .assistant-open-btn .ai-spark-icon {
  color: #fff !important;
}

.internal-test-panel {
  border-color: #E8EAED !important;
}

.internal-test-header p {
  color: #2C3240 !important;
}

.ai-test-btn {
  background: #1B6CA8 !important;
  border-color: #1B6CA8 !important;
  color: #fff !important;
}

/* Compact unit cards: reduce vertical height and emphasize the unit test CTA. */
#units-screen .unit-card {
  padding: 11px 12px !important;
}

#units-screen .unit-card-header {
  margin-bottom: 2px !important;
}

#units-screen .unit-name,
#units-screen .unit-card h3 {
  font-size: 0.92rem !important;
  line-height: 1.38 !important;
}

#units-screen .unit-meta-line {
  margin-bottom: 7px !important;
  font-size: 0.7rem !important;
  line-height: 1.35 !important;
}

#units-screen .unit-progress {
  gap: 3px !important;
}

#units-screen .unit-progress-footer {
  gap: 8px !important;
}

#units-screen .unit-status-text,
#units-screen .unit-pct {
  font-size: 0.72rem !important;
  line-height: 1.35 !important;
}

#units-screen .unit-inline-actions {
  gap: 7px !important;
  margin-top: 9px !important;
  padding-top: 9px !important;
}

#units-screen .unit-inline-actions .btn {
  min-height: 34px !important;
  padding: 7px 10px !important;
  font-size: 0.8rem !important;
}

#units-screen .unit-inline-actions .unit-inline-review {
  border: 1px solid var(--line) !important;
  background: #fff !important;
  color: var(--ink) !important;
}

#units-screen .unit-inline-actions .unit-inline-quiz {
  border-color: var(--primary) !important;
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent) !important;
}

#units-screen .unit-inline-actions .unit-inline-quiz:hover,
#units-screen .unit-inline-actions .unit-inline-quiz:focus-visible {
  border-color: var(--primary-dark) !important;
  background: var(--primary-dark) !important;
}

.jadeer-mini-lockup span,
.jadeer-brand-ar,
.brand-logotype strong,
.readiness-card-brand strong,
.result-jadeer-status-card strong {
  line-height: 1.35 !important;
  overflow: visible;
}

#review-screen .review-icon-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  overflow: visible;
}

.mobile-result-sections {
  display: none;
}

@media (max-width: 640px) {
  #result-screen .result-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  #result-screen .result-intro {
    order: 0;
  }

  #result-screen .result-outcome,
  #result-screen .result-topic-performance {
    display: none !important;
  }

  #mobile-result-sections {
    order: 1;
    display: grid;
    gap: 12px;
    width: 100%;
  }

  #result-screen .mobile-result-card,
  #result-screen .mistakes-section,
  #result-screen .attempt-summary-section {
    margin: 0 !important;
    border: var(--df-divider);
    border-radius: var(--df-radius-2);
    background: var(--df-color-surface);
    padding: var(--df-space-3);
    box-shadow: none;
  }

  #result-screen .mobile-result-card h3,
  #result-screen .mobile-result-card strong,
  #result-screen .mobile-result-card p {
    margin: 0;
  }

  #result-screen .mobile-result-card {
    display: grid;
    gap: 7px;
  }

  #result-screen .mobile-result-card h3 {
    color: var(--df-color-text-tertiary);
    font-family: var(--df-font-label);
    font-size: var(--df-text-label-size);
    font-weight: var(--df-text-label-weight);
    line-height: 1.5;
  }

  #result-screen .mobile-result-card strong {
    color: var(--df-color-text-primary);
    font-size: clamp(1.18rem, 5vw, 1.48rem);
    font-weight: 600;
    line-height: 1.72;
    overflow-wrap: anywhere;
    overflow: visible;
  }

  #result-screen .mobile-result-card p {
    color: var(--df-color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  #result-screen .mistakes-section {
    order: 5;
  }

  #result-screen .attempt-summary-section {
    order: 6;
  }

  #result-screen .result-secondary-actions {
    order: 7;
  }

  #result-screen .mistakes-section .section-head,
  #result-screen .attempt-summary-section .section-head {
    margin-bottom: 10px;
  }

  #result-screen .mistakes-section .section-head h3,
  #result-screen .attempt-summary-section .section-head h3 {
    font-size: 1.05rem !important;
  }
}

/* Mobile quiz compression: keep the question and choices inside the first viewport. */
@media (max-width: 640px) {
  body:has(#quiz-screen:not(.hidden)) .app-shell {
    align-items: start;
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #quiz-screen .quiz-shell {
    margin-bottom: 6px !important;
  }

  #quiz-screen .quiz-topline {
    gap: 6px !important;
    margin-bottom: 2px !important;
  }

  #quiz-screen .quiz-topline .jadeer-mini-lockup {
    gap: 5px !important;
    font-size: 0.88rem !important;
  }

  #quiz-screen .quiz-topline .jadeer-mini-lockup img {
    width: 22px !important;
    height: 22px !important;
  }

  #quiz-screen #quiz-exit-btn {
    min-height: 30px !important;
    width: auto !important;
    padding: 0 10px !important;
    font-size: 0.78rem !important;
  }

  #quiz-screen .quiz-header {
    margin-bottom: 3px !important;
  }

  #quiz-screen .quiz-header h2 {
    margin: 0 !important;
    font-size: 1.02rem !important;
    line-height: 1.32 !important;
  }

  #quiz-screen #quiz-kicker {
    margin-top: 1px !important;
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
  }

  #quiz-screen .quiz-progress-line {
    gap: 2px !important;
    margin-bottom: 6px !important;
  }

  #quiz-screen .question-pill {
    padding: 0 !important;
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
  }

  #quiz-screen .quiz-progress-wrap {
    height: 3px !important;
    margin-top: 2px !important;
  }

  #quiz-screen .quiz-focus-panel {
    padding: 10px !important;
  }

  #quiz-screen .question-box {
    margin-bottom: 8px !important;
    padding: 0 0 8px !important;
  }

  #quiz-screen #question-text {
    font-size: 1.02rem !important;
    line-height: 1.45 !important;
  }

  #quiz-screen .options-list {
    gap: 7px !important;
    margin-top: 8px !important;
  }

  #quiz-screen .option-btn {
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 0.9rem !important;
    line-height: 1.42 !important;
  }

  #quiz-screen .quiz-focus-panel .action-row {
    min-height: 36px !important;
    margin-top: 8px !important;
    gap: 7px !important;
  }
}

/* Mobile release fixes: behavior-only adjustments for assistant, contact tools, quiz meta, and results overflow. */
body:has(#review-screen:not(.hidden)) .platform-tools .support-tool-btn,
body:has(#quiz-screen:not(.hidden)) .platform-tools .support-tool-btn {
  display: none !important;
}

body:has(#welcome-screen:not(.hidden)) .platform-tools .support-tool-btn,
body:has(#units-screen:not(.hidden)) .platform-tools .support-tool-btn,
body:has(#result-screen:not(.hidden)) .platform-tools .support-tool-btn {
  display: inline-flex !important;
}

.platform-tools {
  bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
}

.platform-tools .assistant-open-btn {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
}

.internal-test-panel {
  bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.internal-test-panel.hidden {
  display: none !important;
  pointer-events: none !important;
}

.assistant-window-body {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.assistant-chat-messages {
  flex: 1 1 auto;
  min-height: 96px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.assistant-chat-input {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: 0 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--panel);
}

.attempt-history-table-wrap {
  overflow-x: hidden;
  max-width: 100%;
}

.attempt-history-cards {
  display: grid;
  gap: var(--df-space-2);
  max-width: 100%;
}

.attempt-history-card {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--df-space-2);
  border: var(--df-divider);
  border-radius: var(--df-radius-2);
  background: var(--df-color-surface);
  padding: var(--df-space-3);
}

.attempt-history-card div {
  min-width: 0;
}

.attempt-history-card span,
.attempt-history-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.attempt-history-card span {
  color: var(--df-color-text-tertiary);
  font-family: var(--df-font-label);
  font-size: var(--df-text-label-size);
  font-weight: var(--df-text-label-weight);
}

.attempt-history-card strong {
  color: var(--df-color-text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.6;
}

#result-screen,
#result-screen .result-panel,
#result-screen .result-section,
#result-screen .attempt-history-panel,
#result-screen #mistakes-list,
#result-screen .mistake-item,
#result-screen .mistake-content,
#result-screen .mistake-content p {
  max-width: 100%;
  overflow-x: hidden;
}

#result-screen .mistake-toggle,
#result-screen .mistake-question-text,
#result-screen .mistake-content p {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 640px) {
  html,
  body,
  .app-shell,
  .screen,
  #result-screen {
    max-width: 100%;
    overflow-x: hidden;
  }

  .internal-test-panel,
  .internal-test-panel.is-expanded {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-height: calc(100dvh - 94px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .assistant-window-body {
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom, 0px));
  }

  .assistant-chat-messages,
  .internal-test-panel.is-expanded .assistant-chat-messages {
    min-height: 120px !important;
    max-height: none !important;
  }

  .assistant-chat-input {
    grid-template-columns: 1fr !important;
    gap: 6px;
  }

  .platform-tools {
    left: 12px !important;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #quiz-screen .quiz-header {
    margin-bottom: var(--df-space-1);
  }

  #quiz-screen #quiz-kicker {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.7;
    text-transform: none;
    letter-spacing: 0;
  }

  #quiz-screen .quiz-progress-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: stretch;
  }

  #quiz-screen .question-pill {
    display: block;
    width: 100%;
    text-align: right;
    white-space: normal;
    line-height: 1.6;
    letter-spacing: 0;
    text-transform: none;
  }

  #quiz-screen .quiz-progress-wrap {
    width: 100%;
    margin-top: 4px;
  }

  #result-screen .result-panel {
    padding-inline: min(18px, 5vw);
  }

  .attempt-history-card {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .attempt-history-card div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: var(--df-divider);
    padding-bottom: 6px;
  }

  .attempt-history-card div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .attempt-history-card strong {
    text-align: left;
  }

  #result-screen .mistakes-section .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  #result-screen .mistake-toggle {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  #result-screen .result-secondary-actions {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Mobile UX polish for the subject units screen only. */
@media (max-width: 640px) {
  #units-screen {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  #units-screen .units-topbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 12px !important;
    padding: 12px 13px !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    background: var(--panel) !important;
    box-shadow: 0 6px 18px rgba(44, 50, 64, 0.045) !important;
  }

  #units-screen .units-topbar > div:first-child {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand subject"
      "brand title";
    column-gap: 10px;
    align-items: center;
    min-width: 0;
  }

  #units-screen .jadeer-mini-lockup {
    grid-area: brand;
    margin: 0 !important;
    align-self: center;
  }

  #units-screen .jadeer-mini-lockup img {
    width: 32px;
    height: 32px;
  }

  #units-screen .jadeer-mini-lockup span {
    display: none;
  }

  #units-screen .units-topbar .eyebrow {
    grid-area: subject;
    margin: 0 !important;
    min-width: 0;
    color: var(--muted) !important;
    font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere;
  }

  #units-screen .units-topbar h2 {
    grid-area: title;
    margin: 0 !important;
    color: var(--ink) !important;
    font-size: 1.16rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
  }

  #units-screen .units-topbar-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: center !important;
    gap: 7px !important;
    width: 100% !important;
  }

  #units-screen .units-topbar .btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 30px !important;
    border-width: 1px !important;
    border-radius: 999px !important;
    padding: 5px 10px !important;
    background: var(--panel) !important;
    box-shadow: none !important;
    color: var(--primary) !important;
    font-size: 0.74rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
  }

  #units-screen .units-list {
    gap: 9px !important;
    padding-bottom: 4px;
  }

  #units-screen .unit-card {
    border-radius: 10px !important;
    padding: 13px 13px 12px !important;
    border-color: color-mix(in srgb, var(--primary) 12%, var(--line)) !important;
    background: var(--panel) !important;
    box-shadow: 0 7px 18px rgba(44, 50, 64, 0.045) !important;
  }

  #units-screen .unit-card.active {
    border-color: color-mix(in srgb, var(--primary) 34%, var(--line)) !important;
    background: color-mix(in srgb, var(--secondary) 18%, var(--panel)) !important;
    box-shadow: 0 10px 24px rgba(27, 108, 168, 0.08) !important;
  }

  #units-screen .unit-card-header {
    margin-bottom: 4px !important;
  }

  #units-screen .unit-name,
  #units-screen .unit-card h3 {
    font-size: 1.02rem !important;
    font-weight: 700 !important;
    line-height: 1.42 !important;
    overflow-wrap: anywhere;
  }

  #units-screen .unit-meta-line {
    margin-bottom: 9px !important;
    color: var(--muted) !important;
    font-family: "IBM Plex Sans Arabic", system-ui, sans-serif !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
  }

  #units-screen .unit-progress {
    gap: 5px !important;
  }

  #units-screen .unit-bar-wrap {
    height: 4px !important;
  }

  #units-screen .unit-progress-footer {
    align-items: center !important;
  }

  #units-screen .unit-status-text,
  #units-screen .unit-pct {
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
  }

  #units-screen .unit-inline-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
  }

  #units-screen .unit-inline-actions .btn {
    min-height: 36px !important;
    padding: 7px 8px !important;
    border-radius: 7px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    white-space: normal !important;
  }

  body:has(#units-screen:not(.hidden)) .platform-tools .assistant-open-btn {
    width: 48px !important;
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 999px !important;
    padding: 0 !important;
    gap: 0 !important;
    opacity: 1 !important;
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(27, 108, 168, 0.2) !important;
  }

  body:has(#units-screen:not(.hidden)) .platform-tools .assistant-open-btn .tool-icon {
    opacity: 1 !important;
  }

  body:has(#units-screen:not(.hidden)) .platform-tools .assistant-open-btn .assistant-open-text {
    display: none !important;
  }
}

/* Unified floating action button group across desktop and mobile. */
.platform-tools {
  --fab-size: 48px;
  --fab-gap: 14px;
  --fab-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  position: fixed !important;
  left: 18px !important;
  right: auto !important;
  top: auto !important;
  bottom: var(--fab-bottom) !important;
  z-index: 124 !important;
  display: flex !important;
  flex-direction: column-reverse !important;
  align-items: flex-start !important;
  gap: var(--fab-gap) !important;
  width: auto !important;
  max-width: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  transform: none !important;
  pointer-events: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.platform-tools .support-tools {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: var(--fab-gap) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
}

.platform-tools .tool-chip,
.platform-tools .assistant-open-btn,
.platform-tools .assistant-open-btn.is-collapsed,
.platform-tools .support-tool-btn {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: var(--fab-size) !important;
  height: var(--fab-size) !important;
  min-width: var(--fab-size) !important;
  min-height: var(--fab-size) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  border: 1px solid var(--primary) !important;
  border-radius: 999px !important;
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(27, 108, 168, 0.2) !important;
  padding: 0 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none !important;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease !important;
}

.platform-tools .tool-chip:hover,
.platform-tools .tool-chip:focus-visible,
.platform-tools .assistant-open-btn:hover,
.platform-tools .assistant-open-btn:focus-visible,
.platform-tools .support-tool-btn:hover,
.platform-tools .support-tool-btn:focus-visible {
  outline: none !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 24px rgba(27, 108, 168, 0.24) !important;
}

.platform-tools .tool-chip:active,
.platform-tools .assistant-open-btn:active,
.platform-tools .support-tool-btn:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: 0 5px 14px rgba(27, 108, 168, 0.2) !important;
}

.platform-tools .tool-icon,
.platform-tools .assistant-open-btn .tool-icon,
.platform-tools .support-tool-btn .tool-icon,
.platform-tools .support-tool-btn .contact-icon {
  width: 20px !important;
  height: 20px !important;
  color: currentColor !important;
  opacity: 1 !important;
}

.platform-tools .tool-icon svg,
.platform-tools .support-tool-btn .contact-icon svg {
  stroke-width: 2 !important;
}

.platform-tools .assistant-open-text,
.platform-tools .tool-chip > span:not(.tool-icon) {
  display: none !important;
}

.platform-tools .hidden,
.platform-tools .tool-chip.hidden {
  display: none !important;
}

body:has(#quiz-screen:not(.hidden)) .platform-tools {
  display: none !important;
}

/* Launch polish: clearer, roomier units list on student mobile. */
#units-screen .unit-card {
  display: grid;
  gap: 10px;
}

#units-screen .unit-card-header {
  min-width: 0;
}

#units-screen .unit-name {
  overflow-wrap: anywhere;
}

#units-screen .unit-meta-line {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 54%, #fff);
  padding: 4px 10px;
}

#units-screen .unit-inline-actions .btn {
  white-space: normal;
}

@media (max-width: 640px) {
  #units-screen {
    max-width: none;
    padding-inline: 14px;
  }

  #units-screen .units-topbar {
    gap: 12px !important;
    padding: 14px !important;
  }

  #units-screen .units-topbar-actions {
    grid-template-columns: 1fr 1fr !important;
  }

  #units-screen .units-topbar .btn {
    min-height: 38px !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
  }

  #units-screen .units-list {
    gap: 12px !important;
  }

  #units-screen .unit-card {
    gap: 11px !important;
    padding: 16px 15px !important;
    border-radius: 12px !important;
  }

  #units-screen .unit-name,
  #units-screen .unit-card h3 {
    font-size: 1.04rem !important;
  }

  #units-screen .unit-progress-footer {
    gap: 12px !important;
  }

  #units-screen .unit-status-text {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #units-screen .unit-inline-actions {
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  #units-screen .unit-inline-actions .btn {
    min-height: 42px !important;
    justify-content: center;
    font-size: 0.84rem !important;
  }
}

body .platform-tools #sound-toggle-btn,
body:has(#welcome-screen:not(.hidden)) .platform-tools #sound-toggle-btn,
body:has(#units-screen:not(.hidden)) .platform-tools #sound-toggle-btn,
body:has(#result-screen:not(.hidden)) .platform-tools #sound-toggle-btn,
body:has(#review-screen:not(.hidden)) .platform-tools #sound-toggle-btn,
body:has(#quiz-screen:not(.hidden)) .platform-tools #sound-toggle-btn {
  display: none !important;
}

body:has(#welcome-screen:not(.hidden)) .platform-tools,
body:has(#units-screen:not(.hidden)) .platform-tools,
body:has(#review-screen:not(.hidden)) .platform-tools,
body:has(#result-screen:not(.hidden)) .platform-tools {
  display: flex !important;
}

.internal-test-panel,
.internal-test-panel.is-expanded {
  left: 18px !important;
  right: auto !important;
  bottom: calc(var(--fab-size, 48px) + 30px + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 640px) {
  .platform-tools {
    --fab-size: 48px;
    --fab-gap: 12px;
    --fab-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px !important;
  }

  .internal-test-panel,
  .internal-test-panel.is-expanded {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* FAB group hardening: override older support-tool specific rules. */
.platform-tools .support-tools .support-tool-btn,
.platform-tools .tool-chip:not(.assistant-open-btn) {
  position: relative !important;
  width: var(--fab-size) !important;
  height: var(--fab-size) !important;
  min-width: var(--fab-size) !important;
  min-height: var(--fab-size) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--primary) !important;
  border-radius: 999px !important;
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(27, 108, 168, 0.2) !important;
  padding: 0 !important;
  opacity: 1 !important;
  font-size: 0 !important;
  pointer-events: auto !important;
}

.platform-tools .support-tools .support-tool-btn.hidden,
.platform-tools .tool-chip.hidden,
.platform-tools #sound-toggle-btn.hidden {
  display: none !important;
}

body:has(#quiz-screen:not(.hidden)) .platform-tools {
  display: none !important;
}

/* Final assistant panel fixes — before launch */
.internal-test-panel,
.internal-test-panel.is-expanded {
  opacity: 1 !important;
}

.assistant-question-input {
  min-height: 36px !important;
  max-height: 120px !important;
  resize: none !important;
  overflow-y: hidden !important;
  transition: height 0.12s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.assistant-actions button[data-assistant-action="copy"].is-copied {
  background: color-mix(in srgb, var(--panel) 60%, #d1fae5) !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

.assistant-window-btn {
  width: 28px !important;
  height: 28px !important;
}

@media (max-width: 640px) {
  .assistant-chat-input {
    grid-template-columns: 1fr auto !important;
    align-items: end !important;
    gap: 6px !important;
  }

  .assistant-chat-input .ai-test-btn {
    width: auto !important;
    min-height: 44px !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
    font-size: 0.78rem !important;
  }

  .assistant-window-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.82rem !important;
  }
}

.internal-test-header p {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
}

.internal-test-header p img {
  width: 20px !important;
  height: 20px !important;
  object-fit: contain !important;
}

/* Final readiness card polish */
.achievement-frame::before {
  display: none !important;
}

.readiness-card-accent {
  position: absolute !important;
  inset-block: 0 auto !important;
  inset-inline: 0 !important;
  width: 100% !important;
  height: 12px !important;
  border-radius: 34px 34px 0 0 !important;
  background: #1B6CA8 !important;
}

.achievement-card[data-readiness="success"] .readiness-card-accent {
  background: #1A7A4A !important;
}

.achievement-card[data-readiness="steady"] .readiness-card-accent {
  background: #1B6CA8 !important;
}

.achievement-card[data-readiness="review"] .readiness-card-accent {
  background: #7C8A99 !important;
}

.achievement-card[data-readiness="focused"] .readiness-card-accent {
  background: #0D4470 !important;
}

.achievement-score-block {
  background: rgba(232, 242, 251, 0.72) !important;
}

.achievement-card[data-readiness="success"] .achievement-score-block {
  background: rgba(230, 245, 238, 0.78) !important;
}

.achievement-card[data-readiness="review"] .achievement-score-block {
  background: rgba(245, 246, 248, 0.9) !important;
}

.achievement-card[data-readiness="focused"] .achievement-score-block {
  background: rgba(232, 242, 251, 0.82) !important;
}

/* Final readiness card redesign — clean share image */
.achievement-card {
  background: #F5F6F8 !important;
}

.achievement-frame {
  border: 0 !important;
  border-radius: 34px !important;
  background: #ffffff !important;
  box-shadow: 0 28px 80px rgba(27, 39, 55, 0.08) !important;
  padding: 64px !important;
  gap: 34px !important;
  justify-content: flex-start !important;
  overflow: hidden !important;
}

.achievement-frame::before {
  display: none !important;
}

.readiness-card-accent {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 14px !important;
  border-radius: 34px 34px 0 0 !important;
  background: #1B6CA8 !important;
}

.readiness-card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
  padding-bottom: 26px !important;
  border-bottom: 1px solid #E8EAED !important;
}

.readiness-card-brand {
  background: transparent !important;
  padding: 0 !important;
  gap: 14px !important;
}

.readiness-card-brand img {
  width: 52px !important;
  height: 52px !important;
}

.readiness-card-brand strong {
  color: #1C2230 !important;
  font-size: 30px !important;
  font-weight: 500 !important;
}

.readiness-card-brand span {
  color: #9AA3AE !important;
  font-size: 14px !important;
  letter-spacing: 0.14em !important;
}

.readiness-card-date {
  background: #F5F6F8 !important;
  color: #8896A5 !important;
  border-radius: 999px !important;
  padding: 12px 18px !important;
  font-size: 18px !important;
}

.readiness-card-intro {
  margin-top: 18px !important;
  gap: 12px !important;
}

.readiness-card-kicker {
  color: #1B6CA8 !important;
  font-size: 34px !important;
  font-weight: 500 !important;
}

.student-name-highlight {
  color: #2C3240 !important;
  font-size: 60px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
}

.subject-highlight {
  color: #4A5568 !important;
  font-size: 30px !important;
  line-height: 1.6 !important;
}

.achievement-score-block {
  display: grid !important;
  grid-template-columns: 260px 1fr !important;
  align-items: center !important;
  gap: 34px !important;
  margin-top: 10px !important;
  border: 0 !important;
  border-radius: 28px !important;
  background: #F3F7FA !important;
  padding: 42px !important;
}

.readiness-card-score-row {
  width: 220px !important;
  height: 220px !important;
  min-width: 220px !important;
  border: 10px solid #DCEAF4 !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 18px 42px rgba(27, 108, 168, 0.14) !important;
}

.readiness-card-score-row span {
  color: #8896A5 !important;
  font-size: 18px !important;
  font-family: "IBM Plex Sans Arabic", Arial, sans-serif !important;
  letter-spacing: 0 !important;
}

#card-percentage {
  color: #1B6CA8 !important;
  font-size: 62px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.readiness-card-status {
  gap: 12px !important;
}

.readiness-card-label {
  color: #1B6CA8 !important;
  font-family: "IBM Plex Sans Arabic", Arial, sans-serif !important;
  font-size: 22px !important;
  letter-spacing: 0 !important;
}

#card-readiness-level {
  color: #0D4470 !important;
  font-size: 74px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
}

#card-message {
  margin-top: auto !important;
  border-radius: 24px !important;
  background: #F5F6F8 !important;
  color: #4A5568 !important;
  padding: 30px 34px !important;
  font-size: 30px !important;
  line-height: 1.75 !important;
  font-weight: 400 !important;
}

/* Mobile result: keep desktop structure, only scale spacing */
@media (max-width: 640px) {
  #mobile-result-sections {
    display: none !important;
  }

  #result-screen .result-outcome,
  #result-screen .result-topic-performance {
    display: block !important;
  }

  #result-screen .result-panel {
    padding: 16px !important;
    border-radius: 14px !important;
  }

  #result-screen .result-score-summary {
    display: grid !important;
    grid-template-columns: 96px minmax(0, 1fr) !important;
    gap: 14px !important;
    align-items: center !important;
  }

  #result-screen .result-score-block {
    width: 96px !important;
    margin: 0 !important;
  }

  #result-screen .result-score-block strong {
    font-size: 2rem !important;
  }

  #result-screen .result-readiness-text {
    font-size: 1rem !important;
  }

  #result-screen .performance-card {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    border: 0 !important;
  }

  #result-screen .performance-card div {
    border: 0 !important;
    border-radius: 8px !important;
    background: #F8FAFC !important;
    text-align: center !important;
  }

  #result-screen .result-topic-row {
    grid-template-columns: minmax(90px, 1fr) minmax(90px, 1.4fr) 38px !important;
    gap: 8px !important;
    align-items: center !important;
  }

  #result-screen .result-secondary-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  #result-screen #new-session-btn {
    grid-column: 1 / -1 !important;
    order: -1 !important;
  }
}

/* تحسين ظهور المساعد الدراسي وحوافه */
#ai-assistant-test-panel {
  border: 1px solid rgba(27, 108, 168, 0.22);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.96);
}

#ai-assistant-test-panel.is-minimized {
  border-color: rgba(27, 108, 168, 0.35);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

#ai-assistant-test-panel .assistant-header,
#ai-assistant-test-panel .internal-test-header {
  border-bottom: 1px solid rgba(27, 108, 168, 0.20);
  background: #1B6CA8;
  color: #ffffff;
}

#ai-assistant-test-panel .assistant-header *,
#ai-assistant-test-panel .internal-test-header * {
  color: #ffffff;
}

/* أزرار النافذة: أيقونات شفافة هادئة بلا مربعات، واضحة على الرأس الأزرق */
#ai-assistant-test-panel .assistant-window-btn {
  color: #ffffff !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#ai-assistant-test-panel .assistant-window-btn:hover,
#ai-assistant-test-panel .assistant-window-btn:focus-visible {
  /* تلميح خفيف عند التفاعل فقط، بدون مربع ثقيل */
  background: rgba(255, 255, 255, 0.16) !important;
  outline: none !important;
}

#ai-assistant-test-panel .assistant-window-btn svg {
  stroke: #ffffff !important;
  color: #ffffff !important;
}

/* عنوان "المساعد الدراسي" بنفس لون الأيقونات (أبيض على الرأس الأزرق) */
#ai-assistant-test-panel .internal-test-header p,
#ai-assistant-test-panel .assistant-header p {
  color: #ffffff !important;
}

#ai-assistant-open-btn {
  color: #1B6CA8;
  border-color: rgba(27, 108, 168, 0.28);
  box-shadow: 0 10px 28px rgba(27, 108, 168, 0.16);
}

#ai-assistant-open-btn svg,
#ai-assistant-open-btn i {
  color: #1B6CA8;
  stroke: #1B6CA8;
}

#ai-assistant-test-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1B6CA8;
  color: #fff;
  box-shadow: 0 6px 16px rgba(27, 108, 168, 0.20);
}

#ai-assistant-test-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(27, 108, 168, 0.26);
}

#ai-assistant-test-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

#ai-assistant-test-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}

.achievement-card {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1080px;
  height: 1350px;
  direction: rtl;
  font-family: "IBM Plex Sans Arabic", "Almarai", system-ui, sans-serif;
  background: #f4f8fb;
  color: #102436;
  overflow: hidden;
  z-index: -1;
  visibility: hidden;
  pointer-events: none;
}

.achievement-card.is-capturing {
  visibility: visible;
}

.achievement-frame {
  position: relative;
  width: 1080px;
  height: 1350px;
  box-sizing: border-box;
  padding: 74px;
  background:
    radial-gradient(circle at 15% 10%, rgba(27, 108, 168, 0.13), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
  border: 1px solid rgba(27, 108, 168, 0.16);
  overflow: hidden;
}

.readiness-card-top-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 18px;
  background: linear-gradient(90deg, #1B6CA8, #66A6D8);
}

.readiness-card-watermark {
  position: absolute;
  left: 38px;
  bottom: 110px;
  font-size: 170px;
  font-weight: 800;
  color: rgba(27, 108, 168, 0.045);
  transform: rotate(-8deg);
  pointer-events: none;
}

.readiness-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 92px;
}

.readiness-card-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.readiness-card-brand img {
  width: 58px;
  height: 58px;
}

.readiness-card-brand strong {
  display: block;
  font-size: 34px;
  line-height: 1.1;
  color: #123047;
  font-weight: 800;
}

.readiness-card-brand span {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.22em;
  color: #6c7f8e;
  font-family: "IBM Plex Mono", monospace;
}

.readiness-card-date-box {
  min-width: 210px;
  padding: 16px 20px;
  border: 1px solid rgba(27, 108, 168, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.readiness-card-date-box span {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
  color: #6c7f8e;
}

.readiness-card-date-box strong {
  font-size: 24px;
  color: #17364d;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", monospace;
}

.readiness-card-hero {
  padding: 44px 0 54px;
  border-top: 1px solid rgba(27, 108, 168, 0.14);
  border-bottom: 1px solid rgba(27, 108, 168, 0.14);
}

.readiness-card-kicker {
  width: fit-content;
  margin: 0 0 28px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(27, 108, 168, 0.10);
  color: #1B6CA8;
  font-size: 24px;
  font-weight: 700;
}

.student-name-highlight {
  margin: 0;
  font-size: 76px;
  line-height: 1.18;
  color: #102436;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subject-highlight {
  margin: 22px 0 0;
  font-size: 32px;
  color: #516b7f;
  font-weight: 600;
}

.readiness-card-score-panel {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 28px;
  margin-top: 54px;
}

.readiness-card-status,
.readiness-card-percentage {
  min-height: 230px;
  border-radius: 34px;
  background: #ffffff;
  border: 1px solid rgba(27, 108, 168, 0.14);
  box-shadow: 0 26px 70px rgba(16, 36, 54, 0.08);
  box-sizing: border-box;
}

.readiness-card-status {
  padding: 38px 42px;
}

.readiness-card-label,
.readiness-card-percentage span {
  display: block;
  margin: 0 0 22px;
  font-size: 25px;
  color: #6c7f8e;
  font-weight: 600;
}

.readiness-card-status strong {
  display: block;
  font-size: 56px;
  line-height: 1.2;
  color: #1B6CA8;
  font-weight: 800;
}

.readiness-card-percentage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.readiness-card-percentage strong {
  font-size: 72px;
  line-height: 1;
  color: #102436;
  font-weight: 800;
  font-family: "IBM Plex Mono", "IBM Plex Sans Arabic", monospace;
}

.readiness-card-message-box {
  margin-top: 34px;
  padding: 34px 38px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(27, 108, 168, 0.10), rgba(255, 255, 255, 0.88));
  border: 1px solid rgba(27, 108, 168, 0.15);
}

.readiness-card-message-box span {
  display: block;
  margin-bottom: 14px;
  color: #1B6CA8;
  font-size: 22px;
  font-weight: 800;
}

.readiness-card-summary {
  margin: 0;
  font-size: 34px;
  line-height: 1.75;
  color: #17364d;
  font-weight: 600;
}

.readiness-card-footer {
  position: absolute;
  right: 74px;
  left: 74px;
  bottom: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid rgba(27, 108, 168, 0.14);
  color: #6c7f8e;
  font-size: 22px;
}

.readiness-card-footer strong {
  color: #1B6CA8;
  font-size: 24px;
  letter-spacing: 0.08em;
  font-family: "IBM Plex Mono", monospace;
}

/* إصلاح أزرار المساعد/الخروج العائمة */
.platform-tools {
  left: 16px !important;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
  gap: 10px !important;
  align-items: flex-start !important;
}

.platform-tools .assistant-open-btn,
.platform-tools .assistant-open-btn.is-collapsed {
  width: auto !important;
  min-width: 118px !important;
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  padding: 0 14px !important;
  gap: 8px !important;
  background: #1B6CA8 !important;
  color: #fff !important;
}

.platform-tools .assistant-open-btn .assistant-open-text {
  display: inline !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.platform-tools #session-exit-btn {
  width: auto !important;
  min-width: 74px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 999px !important;
  padding: 0 12px !important;
  background: #fff !important;
  color: #0D4470 !important;
  border: 1px solid #DCEAF4 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
  font-size: 12px !important;
}

.platform-tools #session-exit-btn > span:not(.tool-icon) {
  display: inline !important;
  font-size: 12px !important;
}

.platform-tools .support-tool-btn {
  background: #fff !important;
  color: #1B6CA8 !important;
  border-color: #DCEAF4 !important;
}

#session-exit-btn.tool-chip {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  right: auto;
  bottom: auto;
  z-index: 80;

 width: max-content;
 max-width: 160px;
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;

  background: #ffffff;
  color: #1B6CA8;
  border: 1px solid rgba(27, 108, 168, 0.28);
  box-shadow: 0 8px 18px rgba(16, 36, 54, 0.08);
}

#session-exit-btn.tool-chip .assistant-open-text {
  display: inline;
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  #session-exit-btn.tool-chip {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
  }
}

/* Result screen scroll fix - only when result screen is active.
   body ليس حاوية تمرير: المستند (html) هو الحاوية الوحيدة، مثل باقي الشاشات،
   لتفادي تنافس html/body على اللمس في iOS Safari. */
body:has(#result-screen:not(.hidden)) {
  min-height: 100dvh !important;
  height: auto !important;
  overflow: visible !important;
}

body:has(#result-screen:not(.hidden)) #result-screen {
  width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

body:has(#result-screen:not(.hidden)) #result-screen .result-panel {
  width: 100% !important;
  max-width: 920px !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  margin: 0 auto !important;
}

/* Mobile app-like scrolling for result screen */
@media (max-width: 640px) {
  body:has(#result-screen:not(.hidden)) {
    min-height: 100dvh !important;
    height: auto !important;
    overflow: visible !important;
  }

  body:has(#result-screen:not(.hidden)) #student-app-shell {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    align-items: initial !important;
    place-items: initial !important;
    padding-top: 10px !important;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body:has(#result-screen:not(.hidden)) #result-screen {
    position: relative !important;
    width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body:has(#result-screen:not(.hidden)) #result-screen .result-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
  }
}

/* زر المساعد — الحالة الموسّعة: نص + أيقونة (حبة بيضاوية) */
.platform-tools .assistant-open-btn {
  width: auto !important;
  min-width: 118px !important;
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  padding: 0 14px !important;
  gap: 8px !important;
}

.platform-tools .assistant-open-btn .assistant-open-text {
  display: inline !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

/* الحالة المطوية: أيقونة فقط داخل دائرة صغيرة (يُضاف is-collapsed تلقائيًا بعد ثوانٍ) */
.platform-tools .assistant-open-btn.is-collapsed {
  width: 48px !important;
  min-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 !important;
  gap: 0 !important;
  justify-content: center !important;
}

/* الزر يبقى دائرة بالأيقونة فقط دائمًا — لا توسيع نصي عند hover/focus */
.platform-tools .assistant-open-btn.is-collapsed .assistant-open-text {
  display: none !important;
}

/* Keep assistant textarea scrollable when text is long */
.assistant-question-input {
  max-height: 96px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Patch: زر تحقق — أبيض قبل التحقق، مخفي بعده */
body:not(.is-code-verified) #welcome-screen #start-review-btn {
  background: #fff !important;
  color: #1B6CA8 !important;
  border: 1.5px solid #1B6CA8 !important;
  box-shadow: none !important;
}

/* Patch: إخفاء عناصر ما بعد التحقق قبل التحقق في صفحة الدخول */
#welcome-screen .student-grid.hidden,
#welcome-screen .subject-strip.hidden {
  display: none !important;
}

/* ============================================================
   Mobile & iPad — scoped UX fixes
   ============================================================ */

/* 1. iPad (≤820px): منع التمرير الأفقي على html */
@media (max-width: 820px) {
  html {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* 2. welcome-screen (≤640px): padding-bottom يمنع FAB من تغطية زر تحقق
      + align-items: start لضمان إمكانية التمرير للأعلى لو فاض المحتوى */
@media (max-width: 640px) {
  body:has(#welcome-screen:not(.hidden)) .app-shell {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: start !important;
  }

  #welcome-screen {
    place-items: start;
  }
}

/* 3. units-screen (≤640px): padding-bottom لمنع FAB من تغطية آخر بطاقة وحدة */
@media (max-width: 640px) {
  body:has(#units-screen:not(.hidden)) .app-shell {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* 4. review-screen (≤640px): padding-bottom لمنع FAB من تغطية أزرار التنقل */
@media (max-width: 640px) {
  body:has(#review-screen:not(.hidden)) .app-shell {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* 5. result-screen (≤640px): إلغاء overflow-x:hidden على العناصر الداخلية
      لمنع iOS Safari من إنشاء scroll context ضمني يحجب إيماءات اللمس */
@media (max-width: 640px) {
  body:has(#result-screen:not(.hidden)) #result-screen .result-section,
  body:has(#result-screen:not(.hidden)) #result-screen .attempt-history-panel,
  body:has(#result-screen:not(.hidden)) #result-screen #mistakes-list,
  body:has(#result-screen:not(.hidden)) #result-screen .mistake-item,
  body:has(#result-screen:not(.hidden)) #result-screen .mistake-content,
  body:has(#result-screen:not(.hidden)) #result-screen .mistake-content p {
    overflow: visible !important;
    max-height: none !important;
    touch-action: pan-y !important;
  }
}

/* 6. أيقونة زر "المساعد" — خلفية الزر زرقاء، فيجب أن تكون الأيقونة بيضاء
      (كانت زرقاء على زرقاء فاختفت بسبب #ai-assistant-open-btn svg) */
.platform-tools #ai-assistant-open-btn .ai-spark-icon,
.platform-tools #ai-assistant-open-btn .ai-spark-icon svg,
.platform-tools #ai-assistant-open-btn .tool-icon svg {
  color: #ffffff !important;
  fill: #ffffff !important;
  stroke: none !important;
  opacity: 1 !important;
}

/* 7. زر الخروج من الجلسة — زر أيقونة صغير ثابت أعلى يسار الشاشة، غير عائم
      أسفل زر المساعد، وقابل للنقر رغم pointer-events:none على .platform-tools.
      (زر المساعد ولوحته في أسفل اليسار، وأعلى اليسار خالٍ) */
.platform-tools #session-exit-btn,
#session-exit-btn.tool-chip {
  position: fixed !important;
  top: calc(env(safe-area-inset-top, 0px) + 14px) !important;
  left: 14px !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 130 !important;
  pointer-events: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #0D4470 !important;
  border: 1px solid rgba(27, 108, 168, 0.28) !important;
  box-shadow: 0 6px 16px rgba(16, 36, 54, 0.10) !important;
}

/* النص مخفي بصريًا (يبقى aria-label للقارئ الصوتي)؛ تظهر الأيقونة فقط */
.platform-tools #session-exit-btn > span:not(.tool-icon),
#session-exit-btn.tool-chip .assistant-open-text {
  display: none !important;
}

.platform-tools #session-exit-btn .exit-icon {
  width: 18px !important;
  height: 18px !important;
  color: currentColor !important;
  opacity: 1 !important;
}

.platform-tools #session-exit-btn .exit-icon svg {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
}

@media (max-width: 640px) {
  .platform-tools #session-exit-btn,
  #session-exit-btn.tool-chip {
    top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
    left: 10px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
  }
}

/* إخفاء زر الخروج قبل الدخول/بعد الخروج (يحترم كلاس hidden رغم قواعد العرض أعلاه) */
.platform-tools #session-exit-btn.hidden,
#session-exit-btn.tool-chip.hidden {
  display: none !important;
}

/* ============================================================
   تحسينات واجهة المساعد والاختبار (حواف أهدأ، زر إرسال سهمي)
   ============================================================ */

/* دائرة المساعد: بلا حدّ أزرق ثقيل، ظل خفيف هادئ */
.platform-tools .assistant-open-btn {
  border-color: transparent !important;
  box-shadow: 0 6px 16px rgba(27, 108, 168, 0.18) !important;
}

/* زر الإرسال (سهم) داخل نافذة المساعد: مربع صغير متوازن مع الحقل */
.assistant-chat-input .ai-test-btn,
#ai-assistant-test-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
}

@media (max-width: 640px) {
  .assistant-chat-input .ai-test-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    font-size: 0 !important;
  }
}

/* إجابات الاختبار: حالات أهدأ بحدود أرفع مع إبقاء وضوح الصحيح/الخاطئ/المحدد */
#quiz-screen .option-btn.is-selected {
  border-width: 1px !important;
  border-inline-start-width: 3px !important;
  box-shadow: none !important;
}

#quiz-screen .option-btn.correct {
  border-inline-start-width: 3px !important;
}

#quiz-screen .option-btn.wrong {
  border-inline-start-width: 3px !important;
}

/* هوية الجهة المتعاونة (طبقة B2B) — تظهر تحت هوية جدير دون استبدالها */
.org-identity {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
  padding: 10px 18px 10px 14px;
  border: 1px solid rgba(27, 108, 168, 0.22);
  border-radius: 18px;
  background: rgba(27, 108, 168, 0.07);
  box-shadow: 0 2px 10px rgba(27, 108, 168, 0.08);
}

.org-identity.hidden {
  display: none;
}

.org-identity-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  box-shadow: 0 1px 4px rgba(13, 68, 112, 0.12);
}

.org-identity-logo[hidden] {
  display: none;
}

.org-identity-textwrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: start;
}

.org-identity-text {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0D4470;
  line-height: 1.35;
}

/* سطر هوية الجهة في بطاقة الجاهزية */
.readiness-card-org {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1B6CA8;
}

.readiness-card-org.hidden {
  display: none;
}

/* ===== التجربة الموقّعة للجهة (B2B) ===== */

/* لون تمييز الجهة: يُطبَّق فقط داخل تجربتها، ولا يمس /app ولا /demo */
body[data-org="mubtaker"] {
  --color-primary: var(--org-primary, #4F2D8F);
  --color-primary-dark: var(--org-primary-dark, #3B1F6E);
  --color-primary-light: color-mix(in srgb, var(--org-secondary, #C23B7A) 12%, #fff);
  --primary: var(--org-primary, #4F2D8F);
  --primary-dark: var(--org-primary-dark, #3B1F6E);
  --secondary: color-mix(in srgb, var(--org-secondary, #C23B7A) 12%, #fff);
  --accent: var(--org-secondary, #C23B7A);
}

/* هيدر ثابت راقٍ داخل الشاشات الداخلية للجهة */
.org-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 7%, #ffffff);
  backdrop-filter: saturate(1.1) blur(2px);
  box-shadow: 0 2px 8px rgba(20, 38, 58, 0.06);
}

.org-header.hidden {
  display: none;
}

.org-header-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.org-header-logo[hidden] {
  display: none;
}

.org-header-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
  line-height: 1;
}

.org-header-name {
  font-weight: 700;
  color: var(--primary-dark);
}

.org-header-x {
  color: var(--muted);
  font-weight: 600;
}

.org-header-jadeer {
  font-weight: 600;
  color: var(--ink);
}

/* شعار الترحيب يتلوّن بهوية الجهة */
.org-identity-text {
  color: var(--primary-dark);
}

.readiness-card-org {
  color: var(--primary-dark);
}

/* شارة المادة (نموذج مبتكر) بجانب العنوان */
.subject-badge-titlerow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.subject-badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: color-mix(in srgb, var(--primary) 13%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
}

/* عبارات صفحة النتيجة الخاصة بالجهة */
.result-org-session {
  margin: 8px 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.result-org-session.hidden,
.result-org-footer.hidden {
  display: none;
}

.result-org-footer {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

/* هوية الجهة في ترويسة بطاقة الجاهزية */
.readiness-card-org-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.readiness-card-org-brand.hidden {
  display: none;
}

.readiness-card-org-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.readiness-card-org-logo[hidden] {
  display: none;
}

.readiness-card-org-brand strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* ===== محرك الأسئلة المرن — أنواع متعددة ===== */

.question-image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
  margin-top: 12px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #f9fafb;
}
.question-image.hidden { display: none; }

.text-answer-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  margin-top: 4px;
}

.text-answer-box .btn {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

.text-answer-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  color: var(--color-text, #1a2026);
  outline: none;
  transition: border-color 0.15s;
  text-align: right;
  direction: rtl;
}

@media (max-width: 640px) {
  .text-answer-box {
    flex-direction: column;
  }

  .text-answer-box .btn {
    width: 100%;
  }
}
.text-answer-input:focus {
  border-color: var(--primary, #4a90d9);
}
.text-answer-input.correct {
  border-color: var(--color-success, #16a34a);
  background: #f0fdf4;
}
.text-answer-input.wrong {
  border-color: var(--color-danger, #dc2626);
  background: #fef2f2;
}
.text-answer-input:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.option-btn.multi-selected {
  border-color: var(--primary, #4a90d9);
  background: color-mix(in srgb, var(--primary, #4a90d9) 10%, #fff);
  color: var(--primary-dark, #2563eb);
}

.multi-select-confirm {
  margin-top: 14px;
  width: 100%;
  justify-content: center;
}

/* ===== تعديلات بصرية حصرية لتجربة مبتكر ===== */
/* ⚠️ كل قاعدة هنا مسبوقة بـ body[data-org="mubtaker"] ولا تمس /app أو /demo */

/* 1. brand-footer: تُدار من JS — تظهر في الترحيب فقط، تختفي في الشاشات الداخلية */
.brand-footer.org-footer-hidden {
  display: none;
}

/* 2. إخفاء شعار جدير الصغير في شريط الوحدات */
body[data-org="mubtaker"] .jadeer-mini-lockup {
  display: none;
}

/* 3. إخفاء شعار جدير الكبير في الترحيب (org-identity يحلّ محله) */
body[data-org="mubtaker"] #welcome-screen .jadeer-brand-lockup {
  display: none;
}

/* 4. Header مؤسسي نظيف وأضيق */
body[data-org="mubtaker"] .org-header {
  padding: 6px 14px;
  margin: 0 0 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(20, 38, 58, 0.04);
  backdrop-filter: none;
}

body[data-org="mubtaker"] .org-header-logo {
  width: 22px;
  height: 22px;
}

body[data-org="mubtaker"] .org-header-lockup {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

body[data-org="mubtaker"] .org-header-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #3B1F6E;
  line-height: 1.2;
}

body[data-org="mubtaker"] .org-header-x[hidden] {
  display: none;
}

body[data-org="mubtaker"] .org-header-jadeer {
  font-size: 0.68rem;
  font-weight: 500;
  color: #6b7280;
  line-height: 1;
}

/* 5. شعار مبتكر في الترحيب: بلا حاوية بارزة */
body[data-org="mubtaker"] .org-identity {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

body[data-org="mubtaker"] .org-identity-logo {
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(79, 45, 143, 0.14);
}

/* 6. subtitle أسفل اسم المادة (مشترك — يظهر فقط عند activeOrg من JS) */
.subject-badge-subtitle {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #6b7280;
  margin-top: 2px;
  white-space: normal;
  line-height: 1.3;
}

/* بطاقة المادة داخل مبتكر: حد وخلفية بنفسجية فاتحة */
body[data-org="mubtaker"] .subject-badge {
  border-color: color-mix(in srgb, var(--org-primary, #4F2D8F) 22%, var(--line));
  background: color-mix(in srgb, var(--org-primary, #4F2D8F) 4%, #ffffff);
}

body[data-org="mubtaker"] .subject-badge.active {
  border-color: var(--org-primary, #4F2D8F);
  background: linear-gradient(135deg, var(--org-primary, #4F2D8F), var(--org-primary-dark, #3B1F6E));
}

/* 7. result-org-session: "نتيجتك — مبتكر × جدير" */
body[data-org="mubtaker"] .result-org-session {
  font-size: 0.86rem;
  font-weight: 700;
  color: #3B1F6E;
  letter-spacing: 0.01em;
}

/* 8. ترويسة بطاقة الجاهزية في مبتكر:
      جدير الكامل (أيقونة + جدير + JADEER) في طرف
      شعار مبتكر الصوري فقط في الطرف المقابل
      لا شيء في المنتصف سوى التاريخ */

/* إخفاء اسم الجهة النصي فقط — الشعار الصوري يبقى */
body[data-org="mubtaker"] #card-org-name {
  display: none;
}

/* شعار مبتكر بحجم مناسب لجوار لوكاب جدير */
body[data-org="mubtaker"] .readiness-card-org-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(79, 45, 143, 0.18);
}

/* ترتيب flex في RTL: جدير يمين (order 0, افتراضي) ← التاريخ وسط ← مبتكر يسار */
body[data-org="mubtaker"] .readiness-card-date-box { order: 1; }
body[data-org="mubtaker"] #card-org-brand { order: 2; }

/* تقريب الشعارين من الداخل قليلًا */
body[data-org="mubtaker"] .readiness-card-header {
  padding-inline: 20px;
}

/* 9. حلقة النتيجة: ظل بنفسجي بدل أزرق جدير */
body[data-org="mubtaker"] #result-screen .result-score-block {
  box-shadow: 0 16px 38px color-mix(in srgb, var(--org-primary, #4F2D8F) 22%, transparent);
}

/* 9. شاشة الاختبار: ألوان مبتكر (تتجاوز القيم المثبّتة في #quiz-screen) */
body[data-org="mubtaker"] #quiz-screen {
  --df-color-accent: var(--org-primary, #4F2D8F);
  --df-color-border-strong: var(--org-primary, #4F2D8F);
  --df-color-accent-surface: color-mix(in srgb, var(--org-primary, #4F2D8F) 9%, #fff);
  --df-color-surface-muted: color-mix(in srgb, var(--org-primary, #4F2D8F) 6%, #fff);
  --primary: var(--org-primary, #4F2D8F);
  --primary-dark: var(--org-primary-dark, #3B1F6E);
  --secondary: color-mix(in srgb, var(--org-primary, #4F2D8F) 7%, #fff);
}
