@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --ink: #101827;
  --ink-soft: #273247;
  --muted: #718096;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --line: #e5eaf2;
  --blue: #5b7cfa;
  --blue-deep: #3d5ee8;
  --blue-pale: #eef1ff;
  --green: #1f9d72;
  --green-pale: #eaf8f2;
  --coral: #e7785e;
  --coral-pale: #fff0ec;
  --mono: 'DM Mono', monospace;
  --radius-lg: 26px;
  --radius-md: 16px;
  --shadow: 0 22px 65px rgba(16, 24, 39, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: 'Tajawal', system-ui, sans-serif; }
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(91, 124, 250, .38); outline-offset: 3px; }
[hidden] { display: none !important; }
.ambient { position: fixed; z-index: -1; width: 38vw; height: 38vw; border-radius: 50%; filter: blur(1px); pointer-events: none; opacity: .55; }
.ambient--one { top: -20vw; right: -12vw; background: radial-gradient(circle, rgba(91,124,250,.16), transparent 69%); }
.ambient--two { bottom: -28vw; left: -13vw; background: radial-gradient(circle, rgba(231,120,94,.11), transparent 69%); }
.app-shell { min-height: 100vh; }
.screen { min-height: 100vh; }
.screen--start { display: flex; flex-direction: column; padding: 42px 6.5vw 28px; }
.start-layout { flex: 1; width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(330px, .8fr); grid-template-rows: auto 1fr; column-gap: clamp(60px, 9vw, 150px); align-items: center; }
.brand-mark { display: inline-flex; align-items: center; gap: 11px; width: fit-content; direction: rtl; }
.brand-mark__icon { position: relative; display: grid; place-items: center; width: 31px; height: 31px; border: 2px solid var(--blue); border-radius: 8px 8px 8px 2px; transform: rotate(-8deg); }
.brand-mark__icon::before, .brand-mark__icon::after { content: ''; position: absolute; width: 16px; height: 2px; background: var(--blue); border-radius: 2px; transform: rotate(-46deg); }
.brand-mark__icon::after { width: 8px; background: var(--coral); transform: rotate(42deg) translate(3px, 1px); }
.brand-mark__icon span { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); z-index: 1; }
.brand-mark__word { font-weight: 800; font-size: 17px; letter-spacing: -.03em; }
.brand-mark__word em { color: var(--blue); font-style: normal; }
.start-layout > .brand-mark { grid-column: 1 / -1; align-self: start; }
.start-copy { grid-column: 1; align-self: center; padding-bottom: 35px; }
.eyebrow { display: flex; align-items: center; gap: 11px; margin: 0 0 21px; color: var(--blue-deep); font-family: var(--mono); font-size: 11px; letter-spacing: .03em; }
.eyebrow__line { width: 24px; height: 1px; display: inline-block; background: var(--blue); }
.eyebrow--small { margin-bottom: 10px; font-size: 10px; }
.start-copy h1, .result-hero h1 { margin: 0; font-size: clamp(46px, 6.1vw, 86px); line-height: 1.2; letter-spacing: -.055em; font-weight: 800; }
.start-copy h1 span, .result-hero h1 span { color: var(--blue); }
.start-lead { max-width: 510px; margin: 24px 0 30px; color: #5f6d82; font-size: 17px; line-height: 1.85; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 48px; padding: 0 23px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease; }
.button:hover { transform: translateY(-2px); }
.button--primary { color: white; background: var(--ink); box-shadow: 0 11px 25px rgba(16,24,39,.15); }
.button--primary:hover { background: var(--blue-deep); box-shadow: 0 14px 28px rgba(61,94,232,.22); }
.button--large { min-height: 58px; padding: 0 27px; border-radius: 12px; font-size: 16px; }
.button__arrow { font-size: 20px; line-height: 1; transition: transform .2s ease; }
.button:hover .button__arrow { transform: translateX(-4px); }
.keyboard-hint { margin: 18px 0 0; color: #68768a; font-size: 11px; }
@media (hover: none), (pointer: coarse) { .keyboard-hint { display: none !important; } }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border: 1px solid #d5dce8; border-radius: 4px; background: #fff; color: var(--ink-soft); font-family: var(--mono); font-size: 10px; }
.keyboard-hint span { padding: 0 7px; color: #c7ceda; }
.start-card { grid-column: 2; align-self: center; min-height: 390px; padding: 30px; border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius-lg); background: linear-gradient(145deg, #19253a, #0f1727); color: white; box-shadow: 0 25px 60px rgba(16,24,39,.19); overflow: hidden; position: relative; }
.start-card::after { content: ''; position: absolute; width: 220px; height: 220px; bottom: -110px; left: -70px; border-radius: 50%; border: 1px solid rgba(91,124,250,.24); box-shadow: 0 0 0 22px rgba(91,124,250,.05), 0 0 0 44px rgba(91,124,250,.04); }
.start-card__topline, .rail-label-row, .breakdown-card__heading { display: flex; align-items: center; justify-content: space-between; color: #aeb9ca; font-family: var(--mono); font-size: 10px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: #9de0c3; }
.status-dot i { display: block; width: 6px; height: 6px; border-radius: 50%; background: #55d69c; box-shadow: 0 0 0 4px rgba(85,214,156,.11); }
.start-card__title { position: relative; z-index: 1; margin-top: 58px; font-size: 34px; font-weight: 700; line-height: 1.25; letter-spacing: -.06em; }
.start-card__meta { margin-top: 10px; color: #8490a5; font-size: 13px; }
.start-card__divider { width: 100%; height: 1px; margin: 30px 0 22px; background: rgba(255,255,255,.1); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 5px; }
.stat strong { font-family: var(--mono); font-size: 25px; font-weight: 500; color: #fff; }
.stat span { color: #8290a6; font-size: 11px; }
.start-card__note { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; margin-top: 31px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.1); color: #b9c4d5; font-size: 12px; line-height: 1.5; }
.note-icon { color: #92a9ff; font-family: var(--mono); font-size: 17px; }
.start-footer { width: min(1180px, 100%); margin: 30px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 18px; color: #9aa6b8; font-family: var(--mono); font-size: 9px; }
.admin-entry { color: var(--blue-deep); text-decoration: none; font-family: 'Tajawal', sans-serif; font-size: 11px; }
.admin-entry:hover { text-decoration: underline; }

/* Quiz */
.screen--quiz { background: var(--paper); }
.topbar { min-height: 81px; padding: 0 4.5vw; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: rgba(245,247,251,.82); backdrop-filter: blur(13px); }
.nav-back { display: inline-flex; align-items: center; justify-self: start; gap: 8px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); cursor: pointer; font-size: 12px; font-weight: 700; }
.nav-back:hover { border-color: #b7c4f8; color: var(--blue-deep); }
.nav-back span { font-size: 18px; }
.nav-back--light { background: transparent; }
.brand-mark--compact .brand-mark__word { font-size: 14px; }
.brand-mark--compact .brand-mark__icon { width: 26px; height: 26px; border-radius: 6px 6px 6px 2px; }
.topbar__center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.topbar__label { color: #95a0b1; font-family: var(--mono); font-size: 9px; }
.topbar__center strong { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.text-button { justify-self: end; padding: 10px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.text-button span { display: inline-block; margin-left: 7px; color: #a4adbc; font-size: 19px; vertical-align: -2px; }
.quiz-layout { width: min(1390px, 100%); min-height: calc(100vh - 81px); margin: 0 auto; display: grid; grid-template-columns: 285px minmax(0, 1fr); direction: ltr; }
.study-rail { direction: rtl; padding: 57px 36px 40px; border-left: 1px solid var(--line); background: #f8f9fc; }
.rail-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.rail-section--intro { padding-top: 0; }
.rail-section--intro h2 { margin: 0; font-size: 22px; line-height: 1.38; letter-spacing: -.05em; }
.rail-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.rail-label-row { color: #7d8798; }
.rail-label-row strong { color: var(--blue-deep); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.progress-track { overflow: hidden; height: 7px; border-radius: 99px; background: #e5e9f1; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #91a5ff); transition: width .4s ease; }
.progress-track--rail { height: 5px; margin: 13px 0 11px; }
.rail-caption { margin: 0; color: #9ca7b7; font-size: 10px; }
.question-map { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; max-height: 190px; overflow: auto; margin-top: 14px; padding: 2px; scrollbar-width: thin; }
.rail-section--map summary { list-style: none; cursor: pointer; }
.rail-section--map summary::-webkit-details-marker { display: none; }
.map-dot { width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid #dce2ec; border-radius: 4px; background: #fff; color: #9ea8b8; cursor: pointer; font-family: var(--mono); font-size: 8px; }
.map-dot:hover { border-color: var(--blue); color: var(--blue); }
.map-dot.is-current { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 0 0 2px rgba(91,124,250,.17); }
.map-dot.is-answered:not(.is-current) { border-color: #acdcca; background: var(--green-pale); color: var(--green); }
.map-legend { display: inline-flex; align-items: center; gap: 5px; color: #98a3b3; font-size: 9px; }
.map-legend i { width: 6px; height: 6px; border-radius: 2px; background: #acdcca; }
.rail-quote { padding-top: 27px; color: #8c98aa; }
.quote-mark { display: block; height: 21px; color: var(--blue); font-family: Georgia, serif; font-size: 38px; line-height: 1; }
.rail-quote p { margin: 0; font-size: 12px; line-height: 1.8; }
.quote-line { display: block; width: 25px; height: 2px; margin-top: 15px; background: var(--coral); }
.question-area { direction: rtl; width: min(760px, calc(100% - 80px)); margin: 0 auto; padding: 62px 0 70px; }
.question-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 22px; }
.question-head__lesson { margin: 0; color: var(--ink-soft); font-size: 15px; font-weight: 700; }
.question-number { direction: ltr; color: var(--ink); font-family: var(--mono); font-size: 38px; line-height: .9; letter-spacing: -.1em; }
.question-number small { color: #a2acbb; font-size: 13px; letter-spacing: 0; }
.progress-track--main { height: 3px; margin-bottom: 28px; }
.question-card { position: relative; overflow: hidden; min-height: 440px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.question-card__accent { position: absolute; right: 0; top: 0; width: 5px; height: 100%; background: linear-gradient(180deg, var(--blue), #93a7ff 60%, rgba(147,167,255,0)); }
.question-card__content { padding: 43px 48px 35px; }
.question-card__tag { display: inline-flex; align-items: center; min-height: 25px; padding: 0 10px; border-radius: 5px; background: var(--blue-pale); color: var(--blue-deep); font-family: var(--mono); font-size: 9px; }
.question-card h1 { margin: 25px 0 31px; max-width: 650px; font-size: clamp(20px, 2.25vw, 27px); line-height: 1.7; letter-spacing: -.04em; }
.answers-list { display: grid; gap: 10px; }
.answer-option { position: relative; display: flex; align-items: center; gap: 15px; min-height: 56px; padding: 9px 13px 9px 17px; border: 1px solid #e2e7ef; border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.answer-option:hover { border-color: #a9b9fa; background: #fafbff; transform: translateX(-2px); }
.answer-option.is-selected { border-color: var(--blue); background: var(--blue-pale); }
.answer-option__key { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #f1f3f7; color: #8c97a8; font-family: var(--mono); font-size: 11px; }
.answer-option.is-selected .answer-option__key { background: var(--blue); color: #fff; }
.answer-option__text { color: #39465b; font-size: 14px; line-height: 1.65; }
.answer-option input { position: absolute; opacity: 0; pointer-events: none; }
.source-note { min-height: 21px; margin-top: 22px; color: #a0aaba; font-size: 10px; }
.source-note strong { color: #818d9f; font-weight: 500; }
.source-note--review { color: #c77866; }
.question-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 25px; }
.button--ghost { padding: 0 5px; color: #8a96a7; background: transparent; }
.button--ghost:hover { color: var(--ink); }
.button--finish { color: #fff; background: var(--green); box-shadow: 0 11px 25px rgba(31,157,114,.18); }
.button--finish:hover { background: #16865f; }
.action-status { margin: 0 auto; color: #a0aabb; font-size: 11px; }

/* Results */
.screen--result { padding: 42px 6vw 80px; }
.result-shell { width: min(1060px, 100%); margin: 0 auto; }
.result-header { display: flex; justify-content: space-between; align-items: center; }
.result-header__label { color: #9aa5b5; font-family: var(--mono); font-size: 10px; }
.result-hero { margin: 86px 0 45px; }
.result-hero h1 { font-size: clamp(42px, 6vw, 70px); }
.result-lead { margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.result-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 18px; }
.score-card, .breakdown-card { min-height: 280px; padding: 31px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.score-card { display: flex; align-items: center; justify-content: center; gap: clamp(25px, 5vw, 70px); background: linear-gradient(140deg, #fff, #f4f6ff); }
.score-ring { --score: 0%; display: grid; place-items: center; width: 190px; height: 190px; border-radius: 50%; background: conic-gradient(var(--blue) var(--score), #e5e9f2 0); transform: rotate(-25deg); }
.score-ring__inner { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 145px; height: 145px; border-radius: 50%; background: #fff; transform: rotate(25deg); }
.score-ring__inner strong { color: var(--ink); font-family: var(--mono); font-size: 34px; font-weight: 500; letter-spacing: -.1em; }
.score-ring__inner span { margin-top: 5px; color: #9ca6b5; font-size: 11px; }
.score-copy { display: flex; flex-direction: column; gap: 6px; }
.score-copy__label { color: var(--blue-deep); font-family: var(--mono); font-size: 10px; }
.score-copy strong { font-family: var(--mono); font-size: 46px; font-weight: 500; letter-spacing: -.1em; }
.score-copy strong small { color: #a4aebe; font-size: 15px; letter-spacing: 0; }
.score-copy > span:last-child { color: #929eaf; font-size: 12px; }
.breakdown-card { display: flex; flex-direction: column; }
.breakdown-card__heading { padding-bottom: 20px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-family: 'Tajawal', sans-serif; font-size: 13px; font-weight: 700; }
.breakdown-card__heading span:last-child { color: var(--blue-deep); font-family: var(--mono); font-size: 9px; font-weight: 400; }
.breakdown-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid #f0f2f6; color: #7f8a9b; font-size: 12px; }
.breakdown-row strong { color: var(--ink); font-family: var(--mono); font-size: 14px; font-weight: 500; }
.breakdown-dot { display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; }
.breakdown-dot--correct { background: var(--green); }.breakdown-dot--wrong { background: var(--coral); }.breakdown-dot--empty { background: #aab4c2; }
.button--full { width: 100%; margin-top: auto; min-height: 46px; }
.review-section { margin-top: 65px; }
.review-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 19px; }
.review-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.05em; }
.review-count { color: #96a1b1; font-family: var(--mono); font-size: 10px; }
.review-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-item { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.7); }
.review-item__status { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font-family: var(--mono); font-size: 12px; }
.review-item--correct .review-item__status { color: var(--green); background: var(--green-pale); }.review-item--wrong .review-item__status { color: var(--coral); background: var(--coral-pale); }.review-item--empty .review-item__status { color: #8c98a8; background: #eef1f5; }
.review-item__body { min-width: 0; }.review-item__number { color: #9ba6b6; font-family: var(--mono); font-size: 9px; }.review-item__question { overflow: hidden; margin: 6px 0 7px; color: #39465b; font-size: 12px; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }.review-item__answer { color: #7e8999; font-size: 10px; line-height: 1.6; }.review-item__answer strong { color: var(--ink-soft); font-weight: 700; }

@media (max-width: 900px) {
  .start-layout { column-gap: 45px; }.start-copy h1 { font-size: clamp(43px, 7vw, 64px); }.start-card { padding: 25px; }.quiz-layout { grid-template-columns: 220px minmax(0, 1fr); }.study-rail { padding: 45px 23px 30px; }.question-area { width: min(680px, calc(100% - 48px)); }.question-card__content { padding: 35px 32px 27px; }
}
@media (max-width: 700px) {
  .screen--start { overflow-x: clip; padding: 27px 22px 21px; }.start-layout { display: flex; width: 100%; min-width: 0; flex-direction: column; align-items: stretch; gap: 37px; }.start-layout > * { min-width: 0; max-width: 100%; }.start-layout > .brand-mark { align-self: start; }.start-copy { width: 100%; padding: 0; }.start-copy h1 { font-size: clamp(43px, 14vw, 61px); }.start-lead { margin: 20px 0 25px; font-size: 15px; line-height: 1.75; }.start-card { width: 100%; min-height: 0; padding: 24px; }.start-card__title { margin-top: 33px; font-size: 29px; }.start-card__divider { margin: 22px 0 17px; }.start-card__note { margin-top: 21px; padding-top: 13px; }.start-footer { flex-direction: column; gap: 8px; margin-top: 28px; font-size: 8px; }.keyboard-hint { display: none; }
  .topbar { min-height: 70px; padding: 0 18px; }.brand-mark--compact .brand-mark__word { font-size: 12px; }.topbar__center { display: none; }.text-button { font-size: 10px; }.text-button span { margin-left: 3px; }.quiz-layout { display: block; min-height: calc(100vh - 70px); }.study-rail { padding: 16px 18px 14px; border-left: 0; border-bottom: 1px solid var(--line); }.rail-section--intro, .rail-quote, .rail-section--map { display: none; }.rail-section { padding: 0; border: 0; }.rail-caption { display: inline; margin-right: 9px; }.progress-track--rail { display: inline-block; width: 43%; margin: 0 9px; vertical-align: 2px; }.rail-label-row { display: inline-flex; width: 100%; }.rail-label-row > span:first-child { font-size: 10px; }.question-area { width: 100%; padding: 30px 18px 45px; }.question-head { margin-bottom: 17px; }.question-number { font-size: 29px; }.question-card { min-height: 0; border-radius: 18px; }.question-card__content { padding: 28px 22px 24px; }.question-card h1 { margin: 19px 0 23px; font-size: 19px; line-height: 1.75; }.answer-option { min-height: 54px; gap: 11px; padding: 8px 10px 8px 12px; }.answer-option__text { font-size: 13px; }.question-actions { flex-wrap: wrap; padding-top: 18px; }.action-status { order: -1; width: 100%; margin: 0 0 2px; text-align: center; }.question-actions .button { min-height: 43px; padding: 0 12px; font-size: 12px; }.button--ghost { padding: 0 5px !important; }
  .screen--result { padding: 27px 18px 55px; }.result-header__label { font-size: 8px; }.result-hero { margin: 66px 0 32px; }.result-hero h1 { font-size: 47px; }.result-lead { font-size: 14px; }.result-grid { grid-template-columns: 1fr; }.score-card, .breakdown-card { min-height: 0; padding: 23px; }.score-card { gap: 18px; justify-content: space-around; }.score-ring { width: 145px; height: 145px; }.score-ring__inner { width: 110px; height: 110px; }.score-ring__inner strong { font-size: 26px; }.score-copy strong { font-size: 37px; }.review-section { margin-top: 43px; }.review-heading h2 { font-size: 22px; }.review-list { grid-template-columns: 1fr; }.review-item__question { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }


/* Subject picker */
.start-card--subjects { min-height: 0; }
.subject-picker-title { margin-top: 18px; color: #fff; font-size: 21px; font-weight: 700; letter-spacing: -.04em; }
.picker-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 16px; }
.picker-field { display: grid; gap: 6px; min-width: 0; color: #d0d8e5; font-size: 11px; font-weight: 700; }
.picker-field[hidden] { display: none; }
.picker-field--subject { grid-column: 1 / -1; }
.grade-select { display: block; width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: #202d42; color: #f8faff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.grade-select:focus-visible { outline: 3px solid rgba(120,143,255,.55); outline-offset: 2px; }
.grade-select option { background: #202d42; color: #f8faff; }
.grade-panel__hint { margin: 10px 2px 0; color: #c3cddd; font-size: 11px; line-height: 1.6; }
.start-card--subjects .status-dot { color: #f5cf8b; }
.start-card--subjects .status-dot i { background: #e8b957; box-shadow: 0 0 0 4px rgba(232,185,87,.14); }
.start-card--subjects .start-card__note { color: #d2dae6; }
.start-card--subjects .note-icon { color: #f0c66f; }
@media (max-width: 700px) {
  .start-card--subjects { min-height: 0; }
  .subject-picker-title { margin-top: 15px; font-size: 19px; }
  .picker-fields { grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
  .grade-select { min-height: 46px; padding: 0 9px; font-size: 11px; }
  .grade-panel__hint { margin-top: 10px; }
  .rail-section--map { display: block; padding: 0 0 10px; }
  .rail-section--map[open] { padding-top: 5px; }
  .rail-section--map .question-map { max-height: 114px; grid-template-columns: repeat(10, minmax(22px, 1fr)); margin-top: 9px; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 7px; }
  .topbar__center { display: flex; min-width: 0; }
  .topbar__label { font-size: 8px; }
  .topbar__center strong { font-size: 10px; }
  .nav-back { min-height: 36px; padding: 0 9px; font-size: 10px; }
  .text-button { max-width: 108px; font-size: 9px; }
  .result-header__label { font-size: 8px; }
}


/* Progress resume and unit picker */
#start-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#selected-note.is-error { color: #ffd0c5; }
#start-button:disabled, #unit-select-button:disabled { cursor: wait; opacity: .72; transform: none; }
#start-actions .button--ghost { min-height: 42px; padding: 0 14px; border: 1px solid #dfe5ef; }
.resume-box { width: 100%; margin-top: 18px; padding: 16px; border: 1px solid #dfe5ef; border-radius: 14px; background: rgba(255,255,255,.75); box-shadow: 0 12px 30px rgba(16,24,39,.06); }
.resume-box__text { display: flex; flex-direction: column; gap: 4px; color: var(--ink); font-size: 13px; }
.resume-box__text span { color: var(--muted); font-size: 11px; }
.resume-box__actions { display: flex; gap: 8px; margin-top: 12px; }
.resume-box__actions .button { min-height: 38px; padding: 0 14px; font-size: 12px; }
.unit-picker { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(16,24,39,.46); backdrop-filter: blur(4px); }
.unit-picker__box { width: min(560px, 100%); max-height: 84vh; overflow: hidden; padding: 22px; border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(16,24,39,.25); }
.unit-picker__header { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.unit-picker__header strong { color: var(--ink); font-size: 20px; }
.unit-picker__header span { color: var(--muted); font-size: 12px; }
.unit-picker__search-label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 11px; }
.unit-picker__search { width: 100%; min-height: 44px; margin-bottom: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f9fc; color: var(--ink); font: inherit; font-size: 13px; }
.unit-picker__search:focus { outline: 2px solid rgba(91,124,250,.3); border-color: var(--blue); }
.unit-picker__list { display: grid; gap: 8px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.unit-picker__button { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; width: 100%; min-height: 58px; padding: 8px 14px; border: 1px solid var(--line); color: var(--ink-soft); background: #fff; text-align: right; font-size: 12px; }
.unit-picker__button small { color: var(--muted); font-size: 10px; }
.unit-picker__button:hover { border-color: var(--blue); background: var(--blue-pale); color: var(--blue-deep); }
.unit-picker__empty { margin: 12px 0; color: var(--muted); text-align: center; font-size: 12px; }
.unit-picker__close { width: 100%; margin-top: 14px; color: var(--muted); }
@media (max-width: 700px) {
  #start-actions { align-items: stretch; flex-direction: column; }
  #start-actions .button { width: 100%; }
  .resume-box__actions { flex-direction: column; }
  .resume-box__actions .button { width: 100%; }
  .unit-picker__box { padding: 17px; }
}
