:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-deep: #040a12;
  --surface: #0d1b2b;
  --surface-2: #122438;
  --surface-3: #172d45;
  --line: #28425e;
  --line-soft: #1d344d;
  --text: #f2f7fb;
  --muted: #9fb1c5;
  --cyan: #34d5e7;
  --cyan-dark: #0a8fa6;
  --blue: #5c8cff;
  --green: #3ddc97;
  --amber: #ffbd59;
  --red: #ff6b79;
  --shadow: 0 18px 50px rgba(0, 0, 0, .24);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(52, 213, 231, .10), transparent 28rem),
    radial-gradient(circle at 92% 20%, rgba(92, 140, 255, .10), transparent 32rem),
    var(--bg);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #8aebf4; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(52, 213, 231, .55);
  outline-offset: 2px;
}

.site-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgba(80, 112, 145, .28);
  background: rgba(5, 13, 23, .86);
  backdrop-filter: blur(18px);
  padding-top: var(--safe-top);
}
.header-inner {
  width: min(1200px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { color: var(--text); display: inline-flex; align-items: center; gap: 12px; }
.brand:hover { color: var(--text); }
.brand > span:last-child { display: grid; line-height: 1.1; }
.brand strong { font-size: 1rem; letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: .74rem; margin-top: 4px; text-transform: uppercase; letter-spacing: .12em; }
.brand-mark { position: relative; width: 38px; height: 38px; border: 1px solid rgba(52, 213, 231, .5); border-radius: 10px; display: block; background: linear-gradient(145deg, rgba(52,213,231,.16), rgba(92,140,255,.08)); }
.brand-mark span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(52,213,231,.55); }
.brand-mark span:nth-child(1) { left: 8px; top: 15px; }
.brand-mark span:nth-child(2) { right: 8px; top: 8px; }
.brand-mark span:nth-child(3) { right: 8px; bottom: 7px; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; height: 1px; width: 17px; left: 12px; background: rgba(52,213,231,.7); transform-origin: left center; }
.brand-mark::before { top: 17px; transform: rotate(-27deg); }
.brand-mark::after { top: 20px; transform: rotate(27deg); }
.account-nav { display: flex; align-items: center; gap: 18px; font-size: .9rem; }
.account-nav a, .link-button { color: var(--muted); }
.account-nav a:hover, .link-button:hover { color: var(--text); }
.account-name { border-left: 1px solid var(--line); padding-left: 18px; color: var(--text); font-weight: 700; }
.account-nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; cursor: pointer; }

.page-shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 64px; min-height: calc(100vh - 142px); }
.site-footer { width: min(1200px, calc(100% - 32px)); margin: 0 auto; min-height: 70px; padding: 20px 0 calc(20px + var(--safe-bottom)); border-top: 1px solid rgba(80,112,145,.22); color: #7e93a9; font-size: .82rem; display: flex; justify-content: space-between; gap: 20px; }
.site-footer a { color: #9fb1c5; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.03; letter-spacing: -.045em; margin-bottom: 16px; }
h2 { font-size: 1.45rem; letter-spacing: -.025em; }
.eyebrow { display: inline-block; color: var(--cyan); font-size: .75rem; text-transform: uppercase; letter-spacing: .16em; font-weight: 800; margin-bottom: 11px; }
.muted { color: var(--muted); }
.centered { text-align: center; }
.panel, .auth-card { background: linear-gradient(155deg, rgba(18,36,56,.96), rgba(10,24,39,.96)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 26px; }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button {
  min-height: 43px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 760;
  font-size: .9rem;
  line-height: 1;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.button:hover { color: var(--text); transform: translateY(-1px); }
.button.primary { color: #021217; background: linear-gradient(135deg, #58e4ef, #27bdd2); box-shadow: 0 8px 20px rgba(41,190,210,.18); }
.button.primary:hover { background: linear-gradient(135deg, #8cecf4, #3ad0e2); }
.button.secondary { border-color: #3a5877; background: #162a41; }
.button.secondary:hover { border-color: var(--cyan-dark); background: #1a334f; }
.button.ghost { color: #b8c7d6; border-color: var(--line-soft); background: rgba(9,22,36,.45); }
.button.ghost span { color: var(--cyan); }
.button.danger-outline { color: #ff9ca7; border-color: rgba(255,107,121,.45); background: rgba(255,107,121,.08); }
.button.danger, .danger { color: var(--red); }
.button.wide { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.message-stack { position: fixed; top: calc(82px + var(--safe-top)); right: 20px; z-index: 50; display: grid; gap: 10px; width: min(390px, calc(100% - 40px)); }
.message { padding: 13px 16px; border-radius: 10px; background: #18304a; border: 1px solid #3a5877; box-shadow: var(--shadow); }
.message.success { border-color: rgba(61,220,151,.5); }
.message.error { border-color: rgba(255,107,121,.5); }

/* Authentication */
.auth-page .page-shell { display: grid; place-items: center; min-height: calc(100vh - 142px); }
.auth-layout { width: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 470px); gap: clamp(40px, 8vw, 110px); align-items: center; }
.auth-layout.single-card { grid-template-columns: minmax(320px, 520px); justify-content: center; }
.auth-intro { padding: 24px 0; }
.auth-intro p { color: #b3c3d3; font-size: 1.08rem; max-width: 620px; }
.auth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 36px; }
.auth-metrics span { padding: 16px; border: 1px solid var(--line-soft); background: rgba(11,27,44,.55); border-radius: 12px; display: grid; color: var(--muted); font-size: .78rem; }
.auth-metrics strong { color: var(--text); font-size: 1.35rem; }
.auth-card { padding: clamp(25px, 5vw, 38px); }
.auth-card h1 { font-size: 2rem; }
.auth-card h2 { font-size: 1.75rem; margin-bottom: 7px; }
.auth-card form { margin-top: 26px; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; color: #d8e4ef; font-weight: 700; font-size: .88rem; }
.field input, .field select, .inline-control select {
  width: 100%; min-height: 46px; padding: 10px 12px; color: var(--text); background: #081726; border: 1px solid #35516d; border-radius: 9px;
}
.field input:focus, .field select:focus, .inline-control select:focus { border-color: var(--cyan); }
.field .errorlist, .form-errors .errorlist { list-style: none; margin: 7px 0 0; padding: 0; color: #ff9da8; font-size: .84rem; }
.form-errors { padding: 11px 13px; margin-bottom: 18px; border: 1px solid rgba(255,107,121,.45); background: rgba(255,107,121,.08); border-radius: 9px; }
.help-text { color: #849ab0; font-size: .78rem; margin-top: 6px; }
.help-text ul { margin: 5px 0 0; padding-left: 19px; }
.auth-links { display: flex; justify-content: space-between; gap: 20px; margin-top: 20px; font-size: .87rem; }
.status-icon { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; color: #062018; background: var(--green); font-weight: 900; font-size: 1.4rem; }
.narrow-panel { width: min(620px, 100%); margin: 0 auto; }

/* Dashboard */
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.dashboard-heading h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 10px; }
.dashboard-heading p { color: var(--muted); margin-bottom: 0; }
.heading-stat { min-width: 160px; text-align: right; display: grid; color: var(--muted); font-size: .78rem; }
.heading-stat strong { color: var(--text); font-size: 2.2rem; line-height: 1; }
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.course-card { position: relative; overflow: hidden; background: linear-gradient(155deg, rgba(17,35,54,.98), rgba(8,21,35,.98)); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.course-accent { position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--blue), transparent 80%); }
.course-encor .course-accent { background: linear-gradient(90deg, var(--blue), #a379ff, transparent 80%); }
.course-card-head { display: flex; justify-content: space-between; gap: 22px; }
.course-card h2 { margin: 8px 0 4px; }
.course-card-head p { color: var(--muted); font-size: .84rem; }
.exam-code { color: var(--cyan); font-weight: 850; letter-spacing: .08em; font-size: .75rem; }
.course-encor .exam-code { color: #a9b8ff; }
.score-orb { flex: 0 0 77px; height: 77px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #0b1b2c; border: 5px solid #29445f; }
.score-orb.ready { border-color: var(--green); }
.score-orb strong { font-size: 1.2rem; line-height: 1; }
.score-orb span { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; }
.domain-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 22px; }
.domain-strip span { padding: 5px 8px; border-radius: 6px; color: #aebed0; background: rgba(35,59,83,.55); font-size: .7rem; }
.exam-actions { display: grid; gap: 14px; }
.action-block { padding: 16px; background: rgba(5,17,30,.55); border: 1px solid var(--line-soft); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.action-block strong, .action-block small { display: block; }
.action-block small { color: var(--muted); margin-top: 2px; font-size: .76rem; }
.action-block.compact { align-items: end; }
.drill-form { flex: 1; }
.drill-form label { display: block; font-size: .76rem; font-weight: 800; margin-bottom: 6px; }
.inline-control { display: flex; gap: 8px; }
.inline-control select { min-width: 0; min-height: 42px; }
.inline-control .button { flex: 0 0 auto; }
.active-attempt { padding: 17px; border: 1px solid rgba(52,213,231,.36); border-radius: 12px; background: rgba(24,83,96,.18); display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.active-attempt > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 9px; }
.active-attempt small { grid-column: 2; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(52,213,231,.1); }
.latest-result { margin: 18px -28px -28px; padding: 14px 28px; border-top: 1px solid var(--line-soft); background: rgba(4,14,24,.42); display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.latest-result:hover { background: rgba(8,23,38,.8); }
.latest-result strong { color: var(--text); }
.latest-result.empty { color: #72879b; }
.history-section { margin-top: 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 0; }
.privacy-chip { padding: 6px 9px; color: var(--muted); border: 1px solid var(--line-soft); border-radius: 999px; font-size: .72rem; }
.history-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.history-table { width: 100%; min-width: 790px; border-collapse: collapse; background: rgba(10,25,41,.75); }
.history-table th { text-align: left; padding: 12px 16px; color: #7f96ac; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; background: #0a1726; }
.history-table td { padding: 15px 16px; border-top: 1px solid var(--line-soft); color: #c4d1de; font-size: .86rem; }
.history-table td strong, .history-table td span { display: block; }
.history-table td span { color: var(--muted); font-size: .74rem; }
.result-chip { display: inline-flex !important; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .72rem !important; font-weight: 800; }
.result-chip.pass { color: var(--green); background: rgba(61,220,151,.1); }
.result-chip.review { color: var(--amber); background: rgba(255,189,89,.1); }
.table-link { font-weight: 800; }
.empty-state { text-align: center; color: var(--muted); }
.history-import { margin-top: 14px; padding: 17px 20px; box-shadow: none; }
.history-import summary { cursor: pointer; color: #c8d6e3; font-weight: 800; }
.history-import p { max-width: 780px; color: var(--muted); font-size: .84rem; margin: 12px 0; }
.history-import form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.history-import input[type="file"] { max-width: 100%; padding: 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: #081725; }

/* Exam workspace */
.exam-page .page-shell { width: min(1460px, calc(100% - 28px)); padding-top: 20px; }
.exam-page .site-footer { display: none; }
.exam-toolbar { position: sticky; top: 10px; z-index: 15; min-height: 70px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(8,21,35,.94); backdrop-filter: blur(18px); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.exam-identity { display: flex; align-items: center; gap: 13px; }
.exam-identity .exam-code { padding: 9px; border: 1px solid rgba(52,213,231,.3); border-radius: 8px; }
.exam-identity div { display: grid; }
.exam-identity small { color: var(--muted); font-size: .74rem; }
.exam-statuses { display: flex; align-items: center; gap: 12px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; }
.save-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.save-state.saving span { background: var(--amber); }
.save-state.offline { color: #ffb3bb; }
.save-state.offline span { background: var(--red); }
.timer { min-width: 120px; height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: #071522; font-variant-numeric: tabular-nums; }
.timer.warning { color: var(--amber); border-color: rgba(255,189,89,.55); }
.timer.critical { color: var(--red); border-color: rgba(255,107,121,.55); }
.exam-progress { height: 4px; margin: 10px 4px 20px; overflow: hidden; border-radius: 999px; background: #172b40; }
.exam-progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--blue)); transition: width .2s ease; }
.exam-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 20px; }
.question-sidebar { position: sticky; top: 105px; max-height: calc(100vh - 120px); align-self: start; overflow: auto; padding: 17px; background: rgba(10,25,41,.8); border: 1px solid var(--line); border-radius: 14px; }
.sidebar-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: .78rem; }
.sidebar-summary span { color: var(--muted); }
.question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.question-number { width: 100%; aspect-ratio: 1; border: 1px solid #314d69; border-radius: 7px; color: #a9bbcd; background: #0b1c2d; cursor: pointer; font-size: .72rem; }
.question-number:hover:not(:disabled) { border-color: var(--cyan); }
.question-number.current { color: #03141b; border-color: var(--cyan); background: var(--cyan); font-weight: 900; }
.question-number.answered:not(.current) { color: var(--green); border-color: rgba(61,220,151,.55); background: rgba(61,220,151,.08); }
.question-number.locked { opacity: .34; cursor: not-allowed; }
.strict-note { margin: 14px 0 0; color: #8599ad; font-size: .73rem; }
.question-workspace { min-width: 0; }
.question-card { min-height: 500px; padding: clamp(24px, 4vw, 43px); background: linear-gradient(150deg, rgba(16,34,53,.98), rgba(8,22,36,.98)); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.question-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.question-meta span { padding: 5px 9px; color: #9fb3c8; border: 1px solid #2e4965; border-radius: 999px; background: rgba(9,24,39,.55); font-size: .7rem; }
.question-stem { color: #eef6fc; font-size: clamp(1.08rem, 2vw, 1.28rem); line-height: 1.65; }
.question-stem p:last-child { margin-bottom: 0; }
.rich-text pre, .question-exhibit pre { padding: 17px; overflow: auto; color: #d9f7fa; background: #030a11; border: 1px solid #263f58; border-radius: 10px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: .85rem; line-height: 1.55; white-space: pre-wrap; }
.rich-text code { padding: 2px 5px; color: #b7f4f8; background: #07121d; border-radius: 4px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
.rich-text pre code { padding: 0; background: transparent; }
.question-exhibit { margin: 20px 0; }
.answer-area { margin-top: 28px; display: grid; gap: 11px; }
.answer-option { position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: 58px; padding: 15px; color: #d4e0ea; border: 1px solid #304d69; border-radius: 11px; background: rgba(8,23,37,.72); cursor: pointer; transition: border-color .14s ease, background .14s ease; }
.answer-option:hover { border-color: #4b708f; background: rgba(14,35,54,.9); }
.answer-option.selected { border-color: var(--cyan); background: rgba(32,108,122,.18); }
.answer-option input { position: absolute; opacity: 0; pointer-events: none; }
.option-marker { flex: 0 0 25px; height: 25px; display: grid; place-items: center; border: 1px solid #4a6885; border-radius: 50%; color: transparent; font-size: .72rem; }
.answer-option.multi .option-marker { border-radius: 6px; }
.answer-option.selected .option-marker { color: #04161b; border-color: var(--cyan); background: var(--cyan); }
.selection-help { color: var(--muted); font-size: .8rem; margin: 0 0 6px; }
.match-layout { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(0, 1.25fr); gap: 12px 18px; align-items: stretch; }
.match-token, .match-target { min-height: 60px; padding: 13px; border-radius: 10px; }
.match-token { color: #d7e3ec; border: 1px solid #35526e; background: #0b1e30; cursor: pointer; text-align: left; font-weight: 700; }
.match-token.selected { color: #06161b; border-color: var(--cyan); background: var(--cyan); }
.match-token.assigned:not(.selected) { border-color: rgba(61,220,151,.5); }
.match-target { border: 1px dashed #405f7c; background: rgba(8,22,35,.58); cursor: pointer; }
.match-target:hover { border-color: var(--cyan); }
.match-target strong { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.match-target span { display: block; margin-top: 5px; color: #cddae5; }
.match-target .assigned-label { color: var(--cyan); font-weight: 800; }
.order-list { display: grid; gap: 9px; }
.order-item { min-height: 62px; padding: 11px 13px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 11px; align-items: center; border: 1px solid #34516d; border-radius: 10px; background: #0a1d2f; }
.order-position { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: #06161b; background: var(--cyan); font-weight: 900; font-size: .78rem; }
.order-controls { display: flex; gap: 5px; }
.order-controls button { width: 38px; height: 38px; padding: 0; border: 1px solid #3d5d79; border-radius: 7px; color: var(--text); background: #142b42; cursor: pointer; }
.order-controls button:disabled { opacity: .3; cursor: default; }
.exam-nav { position: sticky; bottom: calc(10px + var(--safe-bottom)); z-index: 12; margin-top: 14px; padding: 12px; display: flex; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,19,31,.94); backdrop-filter: blur(16px); }
.question-loading { min-height: 500px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.question-loading span { width: 36px; height: 36px; border: 3px solid #29445f; border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-alert { padding: 12px 14px; margin-bottom: 12px; border-radius: 9px; }
.inline-alert.error { color: #ffd6da; border: 1px solid rgba(255,107,121,.45); background: rgba(255,107,121,.1); }
.csrf-holder { display: none; }

/* Results */
.result-hero { padding: clamp(27px, 5vw, 48px); display: flex; justify-content: space-between; align-items: center; gap: 40px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(16,37,56,.98), rgba(7,20,33,.98)); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.result-hero::after { content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%; right: -80px; top: -110px; border: 45px solid rgba(255,189,89,.06); }
.result-hero.passed::after { border-color: rgba(61,220,151,.06); }
.result-hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 9px; }
.result-hero p { color: var(--muted); }
.result-score { position: relative; z-index: 1; flex: 0 0 230px; min-height: 180px; padding: 24px; display: grid; place-content: center; text-align: center; border: 1px solid rgba(255,189,89,.4); border-radius: 15px; background: rgba(255,189,89,.07); }
.passed .result-score { border-color: rgba(61,220,151,.4); background: rgba(61,220,151,.07); }
.result-score strong { color: var(--amber); font-size: 3rem; line-height: 1; }
.passed .result-score strong { color: var(--green); }
.result-score span { margin-top: 8px; font-weight: 800; }
.result-score small { color: var(--muted); margin-top: 4px; }
.result-grid { margin-top: 20px; display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); gap: 20px; }
.domain-results { display: grid; gap: 16px; }
.domain-result { display: grid; grid-template-columns: minmax(180px,1.3fr) minmax(100px,1fr) 56px; gap: 15px; align-items: center; }
.domain-result > div:first-child { display: grid; }
.domain-result span { color: var(--muted); font-size: .76rem; }
.domain-result b { text-align: right; }
.mini-bar { height: 7px; border-radius: 999px; overflow: hidden; background: #20364c; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.score-context dl { margin: 8px 0 18px; }
.score-context dl div { padding: 10px 0; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 18px; }
.score-context dt { color: var(--muted); }
.score-context dd { margin: 0; font-weight: 800; }
.score-context p { color: #8398ad; font-size: .77rem; }
.review-section { margin-top: 44px; }
.review-filters { display: flex; gap: 7px; }
.filter-button { min-height: 37px; padding: 8px 12px; border: 1px solid #34516d; border-radius: 8px; color: var(--muted); background: #0c1f31; cursor: pointer; }
.filter-button.active { color: #04151b; border-color: var(--cyan); background: var(--cyan); font-weight: 800; }
.review-list { display: grid; gap: 12px; }
.review-item { border: 1px solid var(--line); border-radius: 12px; background: rgba(11,27,44,.78); overflow: hidden; }
.review-item summary { cursor: pointer; list-style: none; padding: 16px 18px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; }
.review-item summary::-webkit-details-marker { display: none; }
.review-index { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: #1b334b; font-weight: 800; font-size: .78rem; }
.review-title { display: grid; }
.review-title strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.review-title span { color: var(--muted); font-size: .75rem; }
.credit-chip { padding: 5px 9px; border-radius: 999px; color: var(--red); background: rgba(255,107,121,.1); font-size: .72rem; font-weight: 800; }
.credit-chip.correct { color: var(--green); background: rgba(61,220,151,.1); }
.review-body { padding: 0 18px 20px 72px; }
.review-answer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 17px 0; }
.answer-review { padding: 13px; border: 1px solid var(--line-soft); border-radius: 9px; background: #081725; }
.answer-review strong { color: var(--muted); display: block; margin-bottom: 7px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.answer-review ul, .answer-review ol { margin: 0; padding-left: 20px; }
.answer-review p { margin-bottom: 5px; }
.explanation { padding: 14px; border-left: 3px solid var(--cyan); background: rgba(52,213,231,.05); }

@media (max-width: 980px) {
  .course-grid, .result-grid { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; max-width: 650px; margin: 0 auto; }
  .auth-intro { text-align: center; }
  .auth-intro p { margin-left: auto; margin-right: auto; }
  .exam-layout { grid-template-columns: 1fr; }
  .question-sidebar { position: static; max-height: none; }
  .question-grid { grid-template-columns: repeat(10, 1fr); }
}

@media (max-width: 680px) {
  .header-inner, .page-shell, .site-footer { width: min(100% - 22px, 1200px); }
  .header-inner { min-height: 62px; }
  .account-nav > a, .account-name { display: none; }
  .page-shell { padding: 28px 0 45px; }
  .site-footer { flex-direction: column; gap: 5px; }
  .auth-page .site-footer { display: none; }
  .auth-metrics { grid-template-columns: 1fr; }
  .auth-metrics span { display: flex; align-items: baseline; gap: 8px; }
  .dashboard-heading { align-items: start; }
  .heading-stat { display: none; }
  .course-card { padding: 21px; }
  .course-card-head { align-items: start; }
  .score-orb { flex-basis: 68px; height: 68px; }
  .action-block, .action-block.compact, .active-attempt { align-items: stretch; flex-direction: column; }
  .latest-result { margin: 18px -21px -21px; padding: 13px 21px; }
  .privacy-chip { display: none; }
  .exam-page .site-header { display: none; }
  .exam-page .page-shell { width: 100%; padding: var(--safe-top) 0 calc(86px + var(--safe-bottom)); }
  .exam-toolbar { top: 0; min-height: 64px; border-radius: 0; border-left: 0; border-right: 0; padding: 9px 11px; }
  .exam-identity small, .save-state, .exam-toolbar .danger-outline { display: none; }
  .exam-statuses { margin-left: auto; }
  .timer { min-width: 106px; }
  .exam-progress { margin: 0; border-radius: 0; }
  .exam-layout { gap: 0; }
  .question-sidebar { padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #081726; }
  .question-grid { display: none; }
  .sidebar-summary { margin: 0; }
  .strict-note { display: none; }
  .question-card { min-height: calc(100vh - 195px); padding: 22px 16px 100px; border: 0; border-radius: 0; box-shadow: none; }
  .question-loading { min-height: calc(100vh - 195px); }
  .exam-nav { position: fixed; inset: auto 0 0; margin: 0; padding: 10px 12px calc(10px + var(--safe-bottom)); border-radius: 0; border-left: 0; border-right: 0; }
  .exam-nav .button { flex: 1; min-height: 48px; }
  .match-layout { grid-template-columns: 1fr; }
  .match-token { min-height: 52px; }
  .match-target { margin-bottom: 5px; }
  .result-hero { align-items: stretch; flex-direction: column; }
  .result-score { flex-basis: auto; min-height: 145px; }
  .domain-result { grid-template-columns: minmax(0,1fr) 52px; }
  .domain-result .mini-bar { grid-column: 1 / -1; grid-row: 2; }
  .section-heading { align-items: start; flex-direction: column; }
  .review-filters { width: 100%; }
  .filter-button { flex: 1; }
  .review-item summary { grid-template-columns: 38px minmax(0,1fr); }
  .credit-chip { grid-column: 2; width: fit-content; }
  .review-body { padding: 0 14px 18px; }
  .review-answer-grid { grid-template-columns: 1fr; }
}

@media print {
  :root { color-scheme: light; }
  body { color: #111; background: #fff; }
  .site-header, .site-footer, .result-hero .button-row, .review-filters { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  .result-hero, .panel, .review-item { color: #111; background: #fff; border-color: #bbb; box-shadow: none; }
  .review-item { break-inside: avoid; }
  .review-item details { open: true; }
}
