:root {
  color-scheme: light;
  --student-ink: #172743;
  --student-navy: #14243e;
  --student-blue: #204f81;
  --student-muted: #4e607b;
  --student-line: #d9e3ef;
  --student-gold: #f4b53f;
  --student-gold-pale: #fff1d5;
  --student-paper: #f4f7fb;
  --student-white: #fff;
  --student-shadow: 0 12px 30px -22px rgb(20 36 62 / 30%);
  font-family: Inter, system-ui, sans-serif;
}

html[dir="rtl"] { font-family: "Noto Sans Arabic", system-ui, sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  display: flex;
  min-block-size: 100vh;
  flex-direction: column;
  margin: 0;
  background: var(--student-paper);
  color: var(--student-ink);
  line-height: 1.55;
}

h1, h2, h3, p { margin-block: 0; }
h1, h2, h3 { line-height: 1.22; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5vw, 3.3rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.85rem); letter-spacing: -.027em; }
h3 { font-size: 1.125rem; letter-spacing: -.016em; }
[dir="rtl"] :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.42; }
a { color: var(--student-blue); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
img { max-inline-size: 100%; display: block; }
:focus-visible { outline: 3px solid #276ba5; outline-offset: 3px; }

.student-shell {
  inline-size: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.student-header {
  background: var(--student-white);
  border-block-end: 1px solid var(--student-line);
}

.student-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-block-size: 78px;
  padding-block: 10px;
}

.student-brand { flex: none; display: block; }
.student-brand img { inline-size: 154px; block-size: auto; }

.student-nav, .student-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.student-nav { justify-content: flex-end; }
.student-nav form { margin: 0; }
.student-nav > a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  font-weight: 700;
  text-decoration: none;
}

.student-nav > a:hover { text-decoration: underline; text-underline-offset: 4px; }
.student-nav > a[aria-current="page"] { color: var(--student-ink); }

.student-locale {
  position: relative;
  font-size: .875rem;
}

.student-locale a, .student-locale summary {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  border-radius: 8px;
  padding-inline: 8px;
  text-decoration: none;
}

.student-locale summary {
  border: 1px solid var(--student-line);
  cursor: pointer;
  font-weight: 750;
  justify-content: center;
  min-inline-size: 46px;
}
.student-locale summary::-webkit-details-marker { display: none; }
.student-locale ul {
  position: absolute;
  z-index: 3;
  inset-inline-end: 0;
  margin: 5px 0 0;
  padding: 5px;
  border: 1px solid var(--student-line);
  border-radius: 10px;
  background: var(--student-white);
  box-shadow: var(--student-shadow);
  list-style: none;
}
.student-locale li > a { display: flex; }
.student-locale a:is(:hover, [aria-current]) { background: #eaf1fa; color: var(--student-ink); }

.student-main { flex: 1; padding-block: 34px 64px; }
.student-main > * + * { margin-block-start: 28px; }

.student-footer {
  border-block-start: 1px solid var(--student-line);
  background: var(--student-white);
  color: var(--student-muted);
  padding-block: 20px;
  font-size: .875rem;
}

.student-footer .student-shell { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 18px; }

.student-kicker {
  display: block;
  margin-block-end: 10px;
  color: #8b5914;
  font-size: .875rem;
  font-weight: 750;
}

.student-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-inline-size: 0;
  padding: clamp(24px, 4vw, 48px);
  border-radius: 20px;
  background: var(--student-navy);
  background-image: radial-gradient(circle at 80% 30%, #243d60, transparent 55%);
  color: var(--student-white);
}

.student-hero-copy { position: relative; z-index: 1; min-inline-size: 0; }
.student-hero .student-kicker { color: #ffd993; }
.student-hero .student-lede, .student-hero .student-muted { color: #dce5f4; }

.student-hero-mark {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: clamp(100px, 15vw, 170px);
  aspect-ratio: 1;
  border: 1px solid #ffffff24;
  border-radius: 28px;
  transform: rotate(8deg);
  background-color: #ffffff09;
  background-image: radial-gradient(#ffffff25 1px, transparent 1px);
  background-size: 13px 13px;
  color: #ffd28c;
}

[dir="rtl"] .student-hero-mark { transform: rotate(-8deg); }
.student-hero-mark svg { inline-size: 44%; block-size: auto; }
.student-hero-mark img { inline-size: 74%; block-size: auto; }
.student-hero-mark:empty::before {
  content: "";
  inline-size: 44%;
  block-size: 56%;
  border: 2px solid #ffd28c;
  border-inline-start-width: 6px;
  border-radius: 5px 9px 9px 5px;
  background: repeating-linear-gradient(180deg, transparent 0 9px, #ffd28c60 9px 10px);
}

.student-lede {
  max-inline-size: 68ch;
  margin-block-start: 12px;
  color: var(--student-muted);
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.student-login-grid, .student-grid {
  display: grid;
  gap: clamp(14px, 2vw, 22px);
}

.student-login-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  align-items: stretch;
  max-inline-size: 940px;
  margin-inline: auto;
  padding-block: clamp(16px, 6vw, 72px);
}

.student-login-grid .student-hero {
  display: grid;
  align-content: center;
  gap: 0;
  min-block-size: 320px;
}
.student-login-grid .student-hero-mark { display: none; }
.student-login-card { display: grid; align-content: center; gap: 14px; }

.student-card {
  min-inline-size: 0;
  border: 1px solid var(--student-line);
  border-radius: 16px;
  background: var(--student-white);
  padding: clamp(17px, 2.5vw, 26px);
  box-shadow: var(--student-shadow);
}

.student-form { display: grid; gap: 16px; }
.student-field { display: grid; gap: 6px; min-inline-size: 0; font-weight: 700; }
.student-field :is(input, select, textarea),
.student-order-fallback select {
  inline-size: 100%;
  min-block-size: 46px;
  min-inline-size: 0;
  padding: 9px 12px;
  border: 1px solid #aebed1;
  border-radius: 9px;
  background: var(--student-white);
  color: var(--student-ink);
  font-weight: 500;
}
.student-field textarea { resize: vertical; min-block-size: 112px; }
.student-field [aria-invalid="true"] { border-color: #a3312e; }

.student-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--student-gold);
  color: #182338;
  font-size: .9375rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.student-button:hover { background: #ffc963; }
.student-button-outline {
  border-color: #b5c4d6;
  background: var(--student-white);
  color: var(--student-ink);
}

.student-button-outline:hover { border-color: var(--student-blue); background: #edf4fc; }
.student-button-small { min-block-size: 44px; padding: 8px 13px; font-size: .875rem; }
.student-button svg, .student-icon-button svg { flex: none; inline-size: 18px; block-size: 18px; }

.student-error {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #f0c2ba;
  border-radius: 10px;
  background: #fff0ec;
  color: #8c2723;
  overflow-wrap: anywhere;
}

.student-error ul { padding-inline-start: 24px; margin-block: 4px 0; }
ul.student-error { padding-inline-start: 37px; }

.student-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.student-filter .student-field { flex: 0 1 270px; }
.student-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.student-exercise-card {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 12px;
}

.student-exercise-card h3 { margin-block: 10px 6px; }
.student-exercise-card p { color: var(--student-muted); white-space: pre-line; overflow-wrap: anywhere; }
.student-exercise-card .student-button { margin-block-start: auto; }
.student-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.student-card-top:has(.student-filter) { justify-content: space-between; margin-block-end: 17px; }
.student-hero-copy .student-chip { margin-block-start: 12px; }

.student-chip, .student-question-type {
  display: inline-flex;
  align-items: center;
  max-inline-size: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf1fa;
  color: #264d77;
  font-size: .875rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.student-hero .student-chip { background: #dce8fa; }
.student-empty { grid-column: 1 / -1; text-align: center; color: var(--student-muted); }
.student-empty h2 { margin-block-end: 8px; color: var(--student-ink); }
.student-questions { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.student-question { min-inline-size: 0; }
.student-question-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-block-end: 12px; }
.student-question-number {
  display: inline-grid;
  place-items: center;
  min-inline-size: 32px;
  min-block-size: 32px;
  padding-inline: 9px;
  border-radius: 8px;
  background: var(--student-gold-pale);
  color: #754809;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.student-question h3 { white-space: pre-line; margin-block-end: 12px; }
.student-options { display: grid; gap: 9px; margin-block-start: 12px; }
.student-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-block-size: 46px;
  border-radius: 9px;
  border: 1px solid var(--student-line);
  color: var(--student-ink);
  background: #f8fafd;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.student-option:hover { border-color: #94adc9; }
.student-option:has(input:checked) { border-color: #275988; background: #edf4fd; }
.student-option input { accent-color: #275988; inline-size: 18px; block-size: 18px; flex: none; margin: 0; }

.student-order-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.student-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-inline-size: 0;
  gap: 8px;
  padding-block: 6px;
  padding-inline: 12px 8px;
  border: 1px solid var(--student-line);
  border-radius: 9px;
  background: #f8fafd;
}

.student-order-item[draggable="true"] { cursor: grab; }
.student-order-item.is-dragging { cursor: grabbing; opacity: .58; }
.student-order-item.is-drop-target { border-color: #2d6195; box-shadow: inset 0 2px #2d6195; }
.student-order-label { min-inline-size: 0; overflow-wrap: anywhere; }
.student-order-actions { display: flex; align-items: center; gap: 4px; flex: none; }

.student-icon-button {
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 1px solid #b8c8da;
  border-radius: 8px;
  background: var(--student-white);
  color: var(--student-blue);
  font-weight: 750;
}
.student-icon-button:hover:not(:disabled) { border-color: var(--student-blue); background: #eaf1fa; }
.student-icon-button:disabled { color: #8996a7; border-color: #dce4ef; background: #f6f8fb; }

.student-order-fallback { display: grid; gap: 8px; margin-block-start: 12px; }
.student-order-fallback label { display: grid; gap: 4px; }

.student-score {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #e6ca93;
  border-radius: 16px;
  padding: clamp(16px, 3vw, 25px);
  background: #fff6e4;
}

.student-score-number {
  color: #69430c;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.student-correction { display: grid; gap: 16px; margin-block-start: 16px; }
.student-correction [data-correct] { border-inline-start: 4px solid #a85825; }
.student-correction [data-correct="true"] { border-inline-start-color: #477c62; }
.student-correction [data-correct="true"] .student-chip { background: #e8f6ee; color: #22583e; }
.student-correction [data-correct="false"] .student-chip { background: #fff0ec; color: #8c2723; }
.student-answer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 12px; }
.student-answer > * { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.student-answer dt { font-weight: 750; }
.student-answer dd { margin: 4px 0 0; }
.student-answer dd :is(ul,ol) { margin-block: 0; padding-inline-start: 22px; }
.student-order-enhanced .student-actions { margin-block-start: 12px; }
.student-order-status:not(:empty) { margin-block-start: 8px; }

.student-history h2 { margin-block-end: 8px; }
.student-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-block-size: 47px;
  padding-block: 8px;
  border-block-end: 1px solid var(--student-line);
}
.student-history-row:last-child { border-block-end: 0; }
.student-history-row time { color: var(--student-muted); }
.student-history-row strong { font-variant-numeric: tabular-nums; }

.student-pagination { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.student-pagination a, .student-pagination [aria-current] { display: inline-grid; align-items: center; min-block-size: 44px; padding-inline: 12px; border-radius: 8px; }
.student-pagination [aria-current] { background: #eaf1fa; color: var(--student-ink); font-weight: 700; }
.student-muted { color: var(--student-muted); }
.student-text-link {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.student-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.student-skip:focus {
  z-index: 5;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  inline-size: auto;
  block-size: auto;
  margin: 0;
  padding: 12px 16px;
  clip-path: none;
  background: var(--student-white);
  border-radius: 8px;
  font-weight: 750;
}

@media (max-width: 900px) {
  .student-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .student-shell { inline-size: calc(100% - 28px); }
  .student-main { padding-block: 22px 42px; }
  .student-main > * + * { margin-block-start: 22px; }
  .student-header-inner { min-block-size: 64px; gap: 8px; flex-wrap: wrap; }
  .student-brand img { inline-size: 124px; }
  .student-nav { gap: 7px; }
  .student-nav > a { font-size: .875rem; }
  .student-hero { gap: 14px; border-radius: 16px; }
  .student-hero-mark { display: none; }
  .student-login-grid, .student-grid { grid-template-columns: minmax(0, 1fr); }
  .student-login-grid .student-hero { min-block-size: auto; }
  .student-answer { grid-template-columns: minmax(0, 1fr); }
}
