/* Preferences are opt-in; the existing light appearance remains the default. */
.settings-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(480px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid #d3d5da;
  border-radius: 14px;
  background: #fff;
  color: #20212b;
  font: 14px/1.5 'Montserrat', sans-serif;
  box-shadow: 0 20px 60px #0003;
}
.settings-dialog::backdrop { background: #10102080; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.settings-heading h2 { font-size: 22px; }
.settings-close { border: 0; background: transparent; color: inherit; font: inherit; font-size: 28px; min-width: 44px; min-height: 44px; cursor: pointer; }
.settings-description { margin-bottom: 20px; }
.settings-dialog fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.settings-dialog legend { font-weight: 700; margin-bottom: 6px; }
.settings-option { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 0; border-bottom: 1px solid #e3e4eb; cursor: pointer; }
.settings-option span { min-width: 0; }
.settings-option small { display: block; margin-top: 3px; font-size: 12px; opacity: .8; }
.settings-option input { width: 22px; height: 22px; flex-shrink: 0; accent-color: #4e4f89; cursor: pointer; }
.settings-reset { padding: 10px 14px; background: #eeeefe; color: #363577; border: 1px solid #c8cbea; border-radius: 6px; font: inherit; cursor: pointer; }
.settings-status { min-height: 24px; margin-top: 12px; font-size: 12px; }
:where(button, a, input, summary):focus-visible { outline: 3px solid #6865da; outline-offset: 3px; }
.pref-highlightLinks .app-shell a { text-decoration: underline !important; text-underline-offset: 3px; }
.pref-reducedMotion *, .pref-reducedMotion *::before, .pref-reducedMotion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.pref-largeText .app-shell :is(.test-date, .student-id, .validity-item, .validity-title, .test-center-header, .cap, .score-out-of, .date-tag, .best-subtitle, .best-as-of, .best-cefr, .meta, .score-expiry, .my-tests-subtitle, .my-tests-table, .register-subtitle, .more-info-section, .info-list, .kv b, .kv .k, .foot, .btn) { font-size: 17px !important; }
.pref-largeText .app-shell :is(.num, .gauge-value strong, .best-total-box strong) { font-size: 25px !important; }
.pref-largeText .gauge-value span { font-size: 15px; }
.pref-largeText #page-results .skill-label-image { height: calc(var(--skill-label-height, 25px) * 1.2); }
.pref-largeText .settings-dialog { font-size: 17px; }
.pref-largeText .settings-option small { font-size: 15px; }
.pref-largeText .best-summary-heading, .pref-largeText .best-skill-heading { min-height: 84px !important; }
.pref-contrast .app-shell :is(.card, .mys, .myb, .sk, .register-card, .test-info, .certificate-validity) { border: 2px solid #30304b !important; }
.pref-contrast .app-shell :is(.student-id, .test-date, .meta, .cap, .date-tag, .best-subtitle, .score-out-of, .my-tests-subtitle, .register-subtitle, .foot, .kv .k) { color: #161622 !important; }
.pref-contrast .btn { font-weight: 700; }
.pref-dark { color-scheme: dark; }
.pref-dark body { --background: #000; --surface: #111; --header: #191923; --text-primary: #f5f5fa; --text-secondary: #dedee8; --text-muted: #bfc0d2; --border: #555563; --chrome-divider: #444451; background: #000; color: #f5f5fa; }
.pref-dark .app-shell,
.pref-dark #page-cover .cover,
.pref-dark #page-results,
.pref-dark #page-results .results { background: #000 !important; }
.pref-dark .app-shell :is(.card, .mys, .myb, .register-card, .additional-info, .best-total-box) { background: #111 !important; border-color: #555563 !important; box-shadow: none !important; }
.pref-dark .app-shell :is(h2,h3,p,div,span,b,strong,th,td) { color: #ededf4; }
.pref-dark .header .page-title, .pref-dark .sidebar-button, .pref-dark .mobile-menu-toggle { color: #f2f2fa; }
.pref-dark .sidebar-button:hover, .pref-dark .mobile-menu-toggle:hover, .pref-dark .sidebar-button.is-selected { background: #393951; }
.pref-dark .header .toefl-logo { filter: invert(1); }
.pref-dark .skill-label-image, .pref-dark .mybest-label-image { filter: invert(1); mix-blend-mode: screen; }
.pref-dark .mys .sk, .pref-dark .test-info { background: #292644 !important; border-color: #7771b2 !important; }
.pref-dark .myb .sk { background: #452c21 !important; }
.pref-dark .best-total-box { border-color: #ff9867 !important; }
.pref-dark .certificate-validity { background: #10291e; }
.pref-dark .score-expiry { background: #343d14; color: #f0ffab; }
.pref-dark .score-expiry strong, .pref-dark .score-expiry span { color: #f0ffab; }
.pref-dark .my-tests-table th { background: #222; }
.pref-dark .status-available { background: #143c28; border-color: #327b50; }
.pref-dark .status-completed { background: #172d4b; border-color: #385f92; }
.pref-dark .app-shell :is(a, .btn.tertiary) { color: #c6c2ff; }
.pref-dark .btn.secondary, .pref-dark .settings-reset { background: #292644; border-color: #696184; color: #eeeaff; }
.pref-dark .btn.primary { color: #fff; }
.pref-dark .progress-indicator { background: #191923; border-color: #555563; }
.pref-dark .settings-dialog { background: #141419; color: #f5f5fa; border-color: #555563; }
.pref-dark .settings-option { border-color: #444451; }
.pref-dark.pref-contrast .app-shell :is(.card, .mys, .myb, .sk, .register-card, .test-info, .certificate-validity) { border-color: #e0defa !important; }
.pref-dark.pref-contrast .app-shell :is(.student-id, .test-date, .meta, .cap, .date-tag, .best-subtitle, .score-out-of, .my-tests-subtitle, .register-subtitle, .foot, .kv .k) { color: #fff !important; }
@media (prefers-reduced-motion: reduce) {
  html:not(.pref-reducedMotion) .settings-dialog { scroll-behavior: auto; }
}
@media (max-width: 760px) {
  .settings-dialog { padding: 18px; }
  .pref-largeText .mys .info { grid-template-columns: 1fr; }
}
