/* Max Exam Lab theme system: dark-first, accessible light alternative */
:root{
  color-scheme:dark;
  --max-bg:#07131c;
  --max-surface:#0f1b29;
  --max-surface-elevated:#132437;
  --max-text:#eefaff;
  --max-text-secondary:#a8b7c0;
  --max-text-muted:#8fa2ad;
  --max-border:rgba(79,238,241,.22);
  --max-accent:#4feef1;
  --max-accent-strong:#20cfd4;
  --max-highlight:#9ee493;
  --max-highlight-text:#07131c;
  --max-shadow:0 18px 45px rgba(0,0,0,.28);
  --max-success:#39e58c;
  --max-success-bg:rgba(57,229,140,.14);
  --max-danger:#ff5f6d;
  --max-danger-bg:rgba(255,95,109,.14);
}
html[data-theme="light"]{
  color-scheme:light;
  --max-bg:#f5f9fb;
  --max-surface:#ffffff;
  --max-surface-elevated:#edf4f7;
  --max-text:#10232e;
  --max-text-secondary:#526873;
  --max-text-muted:#637985;
  --max-border:#bfd1d9;
  --max-accent:#087f89;
  --max-accent-strong:#066a73;
  --max-highlight:#a8e59b;
  --max-highlight-text:#07131c;
  --max-shadow:0 16px 40px rgba(16,35,46,.12);
  --max-success:#087a4b;
  --max-success-bg:#e5f7ef;
  --max-danger:#b42335;
  --max-danger-bg:#fdebed;
}
body{background:var(--max-bg);color:var(--max-text)}

/* Header label safety: only one responsive label may render at a time. */
.account-btn .short-label{display:none!important}
@media(max-width:720px){
  .account-btn .wide-label{display:none!important}
  .account-btn .short-label{display:inline!important}
}

/* Shared theme control */
.max-theme-toggle{
  width:38px;height:38px;flex:0 0 38px;display:inline-grid;place-items:center;
  border:1px solid var(--max-border);border-radius:999px;
  background:color-mix(in srgb,var(--max-surface) 88%,transparent);color:var(--max-text);
  box-shadow:0 8px 24px rgba(0,0,0,.12);cursor:pointer;
  transition:transform .16s ease,border-color .16s ease,background .16s ease;
}
.max-theme-toggle:hover{transform:translateY(-1px);border-color:var(--max-accent)}
.max-theme-toggle:focus-visible{outline:3px solid color-mix(in srgb,var(--max-accent) 45%,transparent);outline-offset:2px}
.max-theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}

/* Required exam copy must never look disabled. */
.view-versions .versions-sub,
.view-versions .version-card p,
.view-versions .version-card .description,
.view-exam .instructions,.view-exam .instruction,.view-exam .question-instructions,
.view-exam .section-instructions,.view-exam .exam-instructions,.view-exam .context-sub,
.view-exam .question-type-instruction,#view-ielts-exam .instructions,#view-ielts-exam .instruction,
#view-ielts-exam .question-instructions,#view-ielts-exam .section-instructions,
#view-ielts-exam .exam-instructions{
  color:var(--max-text-secondary)!important;opacity:1!important;
}

/* Inactive IELTS navigation is inactive, not disabled. */
#view-ielts-exam .nav-section:not(.active),#view-ielts-exam .ielts-nav-section:not(.active),
#view-ielts-exam .section-tab:not(.active),#view-ielts-exam .skill-tab:not(.active),
#view-ielts-exam .nav-item:not(.active),#ieltsNavigator button:not(.active):not(:disabled){
  color:var(--max-text-secondary)!important;opacity:1!important;
}
#view-ielts-exam [aria-disabled="true"],#view-ielts-exam :disabled{opacity:.55!important}

/* One highlight appearance for live selection and saved highlights. */
.reading-passage-pane ::selection,#view-ielts-exam .passage ::selection,
#view-ielts-exam .reading-passage ::selection,#view-ielts-exam .ielts-reading-passage ::selection{
  background:var(--max-highlight)!important;color:var(--max-highlight-text)!important;
  -webkit-text-fill-color:var(--max-highlight-text)!important;
}
.max-reading-highlight,#view-ielts-exam mark,#view-ielts-exam .reading-highlight,
#view-ielts-exam .ielts-highlight,#view-ielts-exam [data-reading-highlight]{
  background:var(--max-highlight)!important;color:var(--max-highlight-text)!important;
  -webkit-text-fill-color:var(--max-highlight-text)!important;
}
.max-reading-highlight:hover{background:#8bd77f!important;color:var(--max-highlight-text)!important}

/* Light-mode foundations for shared SPA surfaces and IELTS. */
html[data-theme="light"] .site-header,html[data-theme="light"] .context-row,
html[data-theme="light"] .navigator,html[data-theme="light"] .exam-content,
html[data-theme="light"] .auth-card,html[data-theme="light"] .account-panel,
html[data-theme="light"] .performance-modal{
  background-color:var(--max-surface)!important;color:var(--max-text)!important;border-color:var(--max-border)!important;
}
html[data-theme="light"] .view-exam,html[data-theme="light"] #view-ielts-exam,
html[data-theme="light"] .layout{background:var(--max-bg)!important;color:var(--max-text)!important}
html[data-theme="light"] .site-header a,html[data-theme="light"] .site-header button,
html[data-theme="light"] .navigator button{color:inherit}
html[data-theme="light"] .context-sub,html[data-theme="light"] .account-meta,
html[data-theme="light"] .book-description,html[data-theme="light"] .exam-description{color:var(--max-text-secondary)!important}
html[data-theme="light"] input,html[data-theme="light"] textarea,html[data-theme="light"] select{
  background:#fff;color:var(--max-text);border-color:var(--max-border);
}
html[data-theme="light"] .header-quick-link.active,html[data-theme="light"] .nav-item.active,
html[data-theme="light"] .section-tab.active,html[data-theme="light"] .skill-tab.active{color:var(--max-accent)!important}

/* GRE: theme the actual full-screen GRE application. */
html[data-theme="light"] #greApp{
  background:radial-gradient(circle at 75% 20%,rgba(8,127,137,.08),transparent 28%),linear-gradient(135deg,#f5f9fb,#edf5f7 45%,#f8fbfc 100%)!important;
  color:var(--max-text)!important;
}
html[data-theme="light"] #greApp .gre-topbar,
html[data-theme="light"] #greApp .gre-panel,
html[data-theme="light"] #greApp .gre-test-card,
html[data-theme="light"] #greApp .gre-section,
html[data-theme="light"] #greApp .gre-premium-column,
html[data-theme="light"] #greApp .gre-premium-topic,
html[data-theme="light"] #greApp .gre-premium-test-card,
html[data-theme="light"] #greApp .gre-premium-tests-note,
html[data-theme="light"] #greApp .gre-free-value{
  background:var(--max-surface)!important;color:var(--max-text)!important;border-color:var(--max-border)!important;
  box-shadow:var(--max-shadow)!important;
}
html[data-theme="light"] #greApp .gre-premium-preview,
html[data-theme="light"] #greApp .gre-premium-tests{
  background:linear-gradient(145deg,rgba(112,84,190,.06),rgba(255,255,255,.96))!important;
  border-color:#c9bce8!important;color:var(--max-text)!important;
}
html[data-theme="light"] #greApp .gre-intro p,
html[data-theme="light"] #greApp .gre-measure p,
html[data-theme="light"] #greApp .gre-stat span,
html[data-theme="light"] #greApp .gre-practice-head p,
html[data-theme="light"] #greApp .gre-test-card .meta,
html[data-theme="light"] #greApp .gre-test-breakdown li,
html[data-theme="light"] #greApp .gre-premium-hero p,
html[data-theme="light"] #greApp .gre-premium-column-head span,
html[data-theme="light"] #greApp .gre-premium-topic span,
html[data-theme="light"] #greApp .gre-premium-footer span,
html[data-theme="light"] #greApp .gre-premium-tests-head p,
html[data-theme="light"] #greApp .gre-premium-test-card .meta,
html[data-theme="light"] #greApp .gre-premium-tests-note span,
html[data-theme="light"] #greApp .gre-brand span{color:var(--max-text-secondary)!important}
html[data-theme="light"] #greApp .gre-option,
html[data-theme="light"] #greApp .gre-textarea,
html[data-theme="light"] #greApp .gre-nav-grid button{
  background:var(--max-surface-elevated)!important;color:var(--max-text)!important;border-color:var(--max-border)!important;
}
html[data-theme="light"] #greApp .gre-option:hover,
html[data-theme="light"] #greApp .gre-option.selected{
  background:rgba(8,127,137,.09)!important;border-color:var(--max-accent)!important;
}
html[data-theme="light"] #greApp .gre-nav-grid button.current{
  background:var(--max-accent)!important;color:#fff!important;border-color:var(--max-accent-strong)!important;
}
html[data-theme="light"] #greApp .gre-btn{background:#fff!important;color:var(--max-text)!important;border-color:var(--max-border)!important}
html[data-theme="light"] #greApp .gre-btn.primary{background:linear-gradient(135deg,#087f89,#0a9aa5)!important;color:#fff!important;border-color:#066a73!important}
html[data-theme="light"] #greApp .gre-kicker,
html[data-theme="light"] #greApp .gre-intro h2,
html[data-theme="light"] #greApp .gre-measure small,
html[data-theme="light"] #greApp .gre-stat b,
html[data-theme="light"] #greApp .gre-score b,
html[data-theme="light"] #greApp .gre-summary b,
html[data-theme="light"] #greApp .gre-test-breakdown strong{color:var(--max-accent)!important}

/* ===== Shared header: theme-safe logo and auth controls ===== */
html[data-theme="light"] .site-header,
html[data-theme="light"] .sitebar,
html[data-theme="light"] .topbar{
  background:rgba(255,255,255,.94)!important;
  border-bottom-color:#d7e3e8!important;
  box-shadow:0 4px 18px rgba(16,35,46,.10)!important;
}
html[data-theme="light"] .brand-wordmark strong,
html[data-theme="light"] .brand-wordmark .brand-max{color:#10232e!important;text-shadow:none!important}
html[data-theme="light"] .brand-wordmark .brand-examlab{color:#087f89!important;text-shadow:none!important}
html[data-theme="light"] .brand-wordmark small,
html[data-theme="light"] .brand-wordmark .brand-tagline{color:#5c7480!important;text-shadow:none!important}
html[data-theme="light"] .header-quick-link,
html[data-theme="light"] .sitebar .nav a,
html[data-theme="light"] .topbar a:not(.max-brand-lockup){color:#607681!important;text-shadow:none!important}
html[data-theme="light"] .header-quick-link.active,
html[data-theme="light"] .header-quick-link:hover{color:#087f89!important;background:#e8f5f6!important;text-shadow:none!important}
html[data-theme="light"] .account-btn:not(.primary),
html[data-theme="light"] .language-menu-toggle{
  background:#fff!important;color:#18323e!important;border-color:#b9cbd3!important;text-shadow:none!important;
}
html[data-theme="light"] .account-btn:not(.primary):hover{color:#087f89!important;border-color:#087f89!important;background:#eef8f8!important}
html[data-theme="light"] .profile-trigger{background:#edf4f7!important;color:#10232e!important;border-color:#b9cbd3!important}
html[data-theme="light"] .profile-trigger-copy strong,
html[data-theme="light"] #accountChip{color:#10232e!important}
html[data-theme="light"] .profile-trigger-copy small{color:#526873!important}

/* ===== Shared exam shell: coherent dark mode ===== */
html[data-theme="dark"] .view-exam,
html[data-theme="dark"] #view-ielts-exam{background:#07131c!important;color:#eefaff!important}
html[data-theme="dark"] .exam-content,
html[data-theme="dark"] .question-card,
html[data-theme="dark"] .question-block,
html[data-theme="dark"] .ielts-qblock,
html[data-theme="dark"] .navigator{color:#eefaff!important}
html[data-theme="dark"] .option,
html[data-theme="dark"] .answer-option,
html[data-theme="dark"] .choice-option,
html[data-theme="dark"] .mcq-option,
html[data-theme="dark"] label.option,
html[data-theme="dark"] .q-option,
html[data-theme="dark"] .option-row{
  color:#eefaff!important;-webkit-text-fill-color:#eefaff!important;
}
html[data-theme="dark"] .option span,
html[data-theme="dark"] .answer-option span,
html[data-theme="dark"] .choice-option span,
html[data-theme="dark"] .mcq-option span,
html[data-theme="dark"] .q-option span,
html[data-theme="dark"] .option-row span{color:inherit!important;-webkit-text-fill-color:inherit!important}

/* ===== Shared exam shell: complete light mode, not white frame + dark cards ===== */
html[data-theme="light"] .view-exam,
html[data-theme="light"] #view-ielts-exam,
html[data-theme="light"] .layout{background:#f5f9fb!important;color:#10232e!important}
html[data-theme="light"] .exam-content,
html[data-theme="light"] .question-card,
html[data-theme="light"] .question-block,
html[data-theme="light"] .ielts-qblock,
html[data-theme="light"] .reading-passage-pane,
html[data-theme="light"] .reading-question-pane,
html[data-theme="light"] .ielts-notes,
html[data-theme="light"] .ielts-table,
html[data-theme="light"] .navigator,
html[data-theme="light"] .nav-section,
html[data-theme="light"] .nav-group{
  background:#fff!important;color:#10232e!important;border-color:#c7d6dd!important;box-shadow:none!important;
}
html[data-theme="light"] .question-card,
html[data-theme="light"] .question-block,
html[data-theme="light"] .ielts-qblock{box-shadow:0 4px 14px rgba(16,35,46,.06)!important}
html[data-theme="light"] .question-card p,
html[data-theme="light"] .question-block p,
html[data-theme="light"] .ielts-qblock p,
html[data-theme="light"] .reading-passage-pane p,
html[data-theme="light"] .reading-question-pane p{color:#10232e!important}
html[data-theme="light"] .option,
html[data-theme="light"] .answer-option,
html[data-theme="light"] .choice-option,
html[data-theme="light"] .mcq-option,
html[data-theme="light"] label.option,
html[data-theme="light"] .q-option,
html[data-theme="light"] .option-row{
  background:#f8fbfc!important;color:#10232e!important;-webkit-text-fill-color:#10232e!important;border-color:#aebfc8!important;
}
html[data-theme="light"] .option span,
html[data-theme="light"] .answer-option span,
html[data-theme="light"] .choice-option span,
html[data-theme="light"] .mcq-option span,
html[data-theme="light"] .q-option span,
html[data-theme="light"] .option-row span{color:inherit!important;-webkit-text-fill-color:inherit!important}
html[data-theme="light"] .option:hover,
html[data-theme="light"] .answer-option:hover,
html[data-theme="light"] .choice-option:hover,
html[data-theme="light"] .mcq-option:hover,
html[data-theme="light"] .q-option:hover,
html[data-theme="light"] .option-row:hover{background:#edf7f8!important;border-color:#087f89!important}
html[data-theme="light"] .selected:not(.correct):not(.wrong),
html[data-theme="light"] [aria-checked="true"]:not(.correct):not(.wrong){border-color:#087f89!important;background:#e8f5f6!important;color:#10232e!important}

/* Light-mode exam instructions and secondary copy */
html[data-theme="light"] .instructions,
html[data-theme="light"] .instruction,
html[data-theme="light"] .question-instructions,
html[data-theme="light"] .section-instructions,
html[data-theme="light"] .exam-instructions,
html[data-theme="light"] .rp-instructions,
html[data-theme="light"] .rp-subtitle,
html[data-theme="light"] .question-meta,
html[data-theme="light"] .section-meta{color:#526873!important;opacity:1!important}
html[data-theme="light"] .rp-title,
html[data-theme="light"] .section-title,
html[data-theme="light"] .question-title{color:#10232e!important}

/* Navigator hierarchy: calm teal in light mode, readable cyan in dark mode. */
html[data-theme="light"] .navigator .nav-header,
html[data-theme="light"] .navigator .nav-section-title,
html[data-theme="light"] .navigator .nav-group-title,
html[data-theme="light"] .navigator .skill-heading,
html[data-theme="light"] #ieltsNavigator .nav-header,
html[data-theme="light"] #ieltsNavigator .ielts-nav-heading{
  color:#17616a!important;background:#e8f3f4!important;border-color:#c6dadd!important;text-shadow:none!important;
}
html[data-theme="light"] .navigator button:not(.active):not(:disabled),
html[data-theme="light"] .navigator .nav-item:not(.active){color:#405d69!important;opacity:1!important}
html[data-theme="light"] .navigator .active,
html[data-theme="light"] .navigator button.active{color:#075f67!important;border-color:#087f89!important;background:#e6f5f6!important}
html[data-theme="dark"] .navigator .nav-header,
html[data-theme="dark"] .navigator .nav-section-title,
html[data-theme="dark"] .navigator .nav-group-title{color:#84fbf6!important}

/* Timers and analysis cards follow the theme instead of remaining dark in light mode. */
html[data-theme="light"] .ielts-timer-widget,
html[data-theme="light"] .timer-widget,
html[data-theme="light"] .analysis-card,
html[data-theme="light"] .performance-card,
html[data-theme="light"] .nav-analysis,
html[data-theme="light"] .nav-stats-card{
  background:#f1f7f9!important;color:#10232e!important;border-color:#bfd1d9!important;
}
html[data-theme="light"] .ielts-timer-widget *,
html[data-theme="light"] .timer-widget *{color:inherit}

/* Clean answer states across IELTS, YDS, YOKDIL and shared exams. */
.correct,
.is-correct,
[data-result="correct"],
.answer-correct{
  border-color:var(--max-success)!important;background:var(--max-success-bg)!important;color:var(--max-success)!important;
  -webkit-text-fill-color:var(--max-success)!important;box-shadow:none!important;
}
.wrong,
.incorrect,
.is-wrong,
[data-result="wrong"],
[data-result="incorrect"],
.answer-wrong{
  border-color:var(--max-danger)!important;background:var(--max-danger-bg)!important;color:var(--max-danger)!important;
  -webkit-text-fill-color:var(--max-danger)!important;box-shadow:none!important;
}
.correct span,.is-correct span,[data-result="correct"] span,.answer-correct span,
.wrong span,.incorrect span,.is-wrong span,[data-result="wrong"] span,[data-result="incorrect"] span,.answer-wrong span{
  color:inherit!important;-webkit-text-fill-color:inherit!important;
}

/* Keep the IELTS audio transport deliberately dark as a stable media console. */
html[data-theme="light"] .ielts-audio-player,
html[data-theme="light"] .audio-player,
html[data-theme="light"] .listening-audio,
html[data-theme="light"] .ielts-listening-player{background:#0f1b29!important;color:#eefaff!important;border-color:#1f4a56!important}

/* Cambridge 16 Test 4 Q1-6: vertical answer rows below an unobstructed diagram. */
.cam16-qanat-overlay{padding-bottom:410px!important}
.cam16-qanat-overlay .ielts-diagram-gap{
  left:2%!important;right:2%!important;width:96%!important;min-width:0!important;max-width:none!important;
  height:auto!important;transform:none!important;background:var(--max-surface)!important;color:var(--max-text)!important;
  border:1.5px solid var(--max-border)!important;border-radius:9px!important;box-shadow:none!important;padding:8px 10px 8px 42px!important;
}
.cam16-qanat-overlay .ielts-diagram-gap::before{
  position:absolute!important;left:12px!important;top:50%!important;transform:translateY(-50%)!important;
  font:800 12px/1 Inter,sans-serif!important;color:var(--max-accent)!important;
}
.cam16-qanat-overlay .q1{bottom:338px!important}.cam16-qanat-overlay .q1::before{content:'1'}
.cam16-qanat-overlay .q2{bottom:282px!important}.cam16-qanat-overlay .q2::before{content:'2'}
.cam16-qanat-overlay .q3{bottom:226px!important}.cam16-qanat-overlay .q3::before{content:'3'}
.cam16-qanat-overlay .q4{bottom:170px!important}.cam16-qanat-overlay .q4::before{content:'4'}
.cam16-qanat-overlay .q5{bottom:114px!important}.cam16-qanat-overlay .q5::before{content:'5'}
.cam16-qanat-overlay .q6{bottom:58px!important}.cam16-qanat-overlay .q6::before{content:'6'}
.cam16-qanat-overlay .ielts-diagram-gap .gap-input,
.cam16-qanat-overlay .ielts-diagram-gap input{width:100%!important;max-width:none!important;color:var(--max-text)!important;background:transparent!important}
.cam16-qanat-overlay .answer-feedback,
.cam16-qanat-overlay .gap-feedback,
.cam16-qanat-overlay .correct-answer,
.cam16-qanat-overlay .feedback{white-space:normal!important;overflow:visible!important;max-width:none!important;margin-left:8px!important}

/* GRE toggle belongs inside GRE's own top action bar. */
#greApp .gre-top-actions{display:flex!important;align-items:center!important;gap:10px!important}
#greApp .max-theme-toggle-gre{position:static!important;margin:0!important;background:rgba(255,255,255,.05)!important;color:#eefaff!important;border-color:rgba(79,238,241,.28)!important}
html[data-theme="light"] #greApp .max-theme-toggle-gre{background:#fff!important;color:#10232e!important;border-color:#bfd1d9!important}

@media(max-width:760px){
  .max-theme-toggle{width:36px;height:36px;flex-basis:36px}
  .cam16-qanat-overlay{padding-bottom:410px!important}
  .cam16-qanat-overlay .ielts-diagram-gap{left:2%!important;right:2%!important;width:96%!important}
}
