/* Shared interface contrast contract. Loaded after each section's legacy CSS.
   Keep medical images, 3D materials and authored card frames unfiltered. */
html[data-study-palette]{
 --success-bg:#e1efdf;--success-text:#1c5942;--danger-bg:#f9ebe5;--danger-text:#752820;
 --info-bg:#e2eafa;--info-text:#294e7a;
}
html[data-study-palette][data-theme=dark]{
 --success-bg:#24473d;--success-text:#e1ffef;--danger-bg:#492e32;--danger-text:#ffe8e3;
 --info-bg:#303e5e;--info-text:#eaf2ff;
}
html[data-study-palette] :is(input,select,textarea){color-scheme:inherit}
html[data-study-palette] :is(select,option,optgroup){background-color:var(--panel)!important;color:var(--text)!important}
html[data-study-palette] option:checked{background-color:var(--accent)!important;color:var(--on-accent)!important}
html[data-study-palette] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
html[data-study-palette] :is(button,input,select,textarea):disabled{
 opacity:1!important;cursor:not-allowed;-webkit-text-fill-color:currentColor;
}
html[data-study-palette] :is(button,.button,.lab-btn):disabled{border-style:dashed}
html[data-study-palette] :is(button,.button,.lab-btn) :is(span,small,strong,b,em,p,label,h2,h3,h4,kbd){color:inherit!important}
/* Selected controls keep the same pair on hover, focus and touch. */
html[data-study-palette] :is(button,.button,.lab-btn,[role=option],[role=tab]):is(.active,.selected,.chosen,[aria-pressed=true],[aria-selected=true],[aria-current=page],[aria-current=step],[aria-current=true]):not(:where(.model-pin,.model-anchor,.quiz-pin,.model-callout,.correct,.incorrect)){
 background:var(--soft)!important;color:var(--text)!important;border-color:var(--accent)!important;
}
html[data-study-palette] :is(.panel-tabs,.ma-tabs,.da-tabs,.pt-tabs,.pathway-tabs,.phase-buttons,.course-section-tabs,.journey-tabs,.editor-tabs) :is(button[aria-selected=true],button[aria-pressed=true]),
html[data-study-palette] header nav button[aria-current=page],
html[data-study-palette] :is(.primary,.primary-button,.atlas-color-card.is-current>button){
 background:var(--accent)!important;color:var(--on-accent)!important;border-color:var(--accent)!important;filter:none;
}
html[data-study-palette] :is(.primary,.primary-button):hover{box-shadow:inset 0 0 0 2px currentColor;filter:none}
html[data-study-palette] :is(.layer-row,.check,.lab-checks label,.lab-choice-list label,.lt-choice):has(input:checked){
 background:var(--soft)!important;color:var(--text)!important;border-color:var(--accent)!important;
}
html[data-study-palette] :is(.layer-row,.check,.lab-checks label,.lab-choice-list label,.lt-choice):has(input:checked) :is(span,small,strong,b,em,p){color:inherit!important}
html[data-study-palette] :is(.quiz-options button,.quiz-choice).correct{background:var(--success-bg)!important;color:var(--success-text)!important;border-color:var(--success-text)!important}
html[data-study-palette] :is(.quiz-options button,.quiz-choice).incorrect{background:var(--danger-bg)!important;color:var(--danger-text)!important;border-color:var(--danger-text)!important}
html[data-study-palette] :is(.quiz-options button,.quiz-choice)>span{background:transparent!important;border-color:currentColor;color:inherit!important}
html[data-study-palette] :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible,
html[data-study-palette] label:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:3px}
html[data-study-palette] ::selection{background:var(--accent);color:var(--on-accent)}
html[data-study-palette] :is(.skip,.skip-link){background:var(--panel);color:var(--text);border:1px solid var(--line)}
html[data-study-palette] :is(.pt-tabs,.journey-tabs) button>span{background:transparent;color:inherit}
html[data-study-palette] .danger.subtle{color:var(--danger)!important}
html[data-study-palette] .danger.subtle:hover{background:var(--danger-bg)!important;color:var(--danger-text)!important}

/* Legacy section labels and controls must use the current palette too. */
html[data-atlas-appearance]{--amber:var(--soft);--lab-pink:var(--accent)}
html[data-atlas-appearance] :is(.edition,.search-box kbd,.layer-tip strong,.range-label,.range-label output,.context-option,.related-list span,.study-checklist,.attachment-list summary,.bone-term-facts dt,.bone-location-source,.bone-location-source strong,.bone-mapped,.bone-missing,.bone-profile-note,.bone-checklist-summary,.detail-section details summary,.guide-meta,.lab-count,.lab-number){color:var(--text)}
html[data-atlas-appearance] :is(.attachment-facts dd,.attachment-facts dt,.attachment-facts dt.insertion,.attachment-facts dt.action){color:var(--text)}
html[data-atlas-appearance] :is(.search-box kbd,.lab-count,.bone-profile-note,.bone-location-button,.atlas-view-bar,.atlas-focus-close,.quiz-review .review-answer,.quiz-view-notice,.lab-pill,.pill,.connections-dialog pre){background:var(--soft);color:var(--text);border-color:var(--line)}
html[data-atlas-appearance] .quiz-note-prompt{background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-atlas-appearance] :is(.bone-variant,.pt-chip.warn,.pt-pass-dot.started,.pt-notice.is-error){background:var(--warning-bg);color:var(--warning-text);border-color:var(--warning-text)}
html[data-atlas-appearance] .pt-chip.overdue{background:var(--danger-bg);color:var(--danger-text);border-color:var(--danger-text)}
html[data-atlas-appearance] :is(.atlas-focus-view,.atlas-focus-view.reader){background:var(--bg)!important;color:var(--text);box-shadow:0 0 0 30px var(--bg)}
html[data-atlas-appearance] .atlas-view-bar :is(label,button,select){background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-atlas-appearance] :is(.atlas-explorer .view-tools button,.atlas-explorer .anatomy-tools button,.atlas-explorer .result-item,.atlas-explorer .lab-landmark):hover{background:var(--soft);color:var(--text);border-color:var(--accent)}
html[data-atlas-appearance] .atlas-explorer .stage :is(.orientation,.orientation-note,.stage-footer){background:var(--panel);color:var(--text);border-radius:6px}
html[data-atlas-appearance] .atlas-explorer .stage-footer{padding:8px 10px}
html[data-atlas-appearance] .atlas-explorer :is(.axis-label,.hover-label,.selected-label){background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-atlas-appearance] .atlas-explorer .model-callout:not(.origin):not(.insertion){background:var(--panel);color:var(--text);border-color:var(--accent)}
html[data-atlas-appearance] .atlas-explorer .model-callout:is(.active,:hover):not(.origin):not(.insertion){background:var(--accent)!important;color:var(--on-accent)!important;border-color:var(--on-accent)}
html[data-atlas-appearance] .model-callout :is(small,span,strong){color:inherit!important}
html[data-atlas-appearance] :is(.female-orient>span,.female-list .female-empty,.pathway-legend,.pathway-step-controls span,.step-navigation span,.cycle-scrubber,.map-mobile-hint,.clinical-card dt,.flow-brand span){color:var(--text)}
html[data-atlas-appearance] :is(.pathway-3d,.canvas-launch){background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-atlas-appearance] .pathway-diagram .cycle-scrubber{color:#eff7f2}
html[data-atlas-appearance] :is(.selection-symbol,header .brand span,#canvas-course-badge){color:var(--text)}
html[data-atlas-appearance] :is(#cycle-sound,#clinical-phase,#heart-volume-value,#sound-error,#heart-sound-status){color:var(--text)}
html[data-atlas-appearance] :is(.valve-states strong,.valve-states .closed strong){color:var(--text)}
html[data-atlas-appearance] :is(.phase-heading,.route-line>span,.stage-summary,.note-grid ol,.system-detail li,.map-card td,.recall-answer,.energy-ledger p,.quiz-note-prompt strong,.quiz-results .lab-stats strong,.quiz-pool-summary strong){color:var(--text)}
html[data-atlas-appearance] :is(.state-banner,.ma-status)>:is(h3,p,span){color:var(--on-accent)}
html[data-atlas-appearance] .state-banner .state-signal{background:var(--soft);color:var(--text)}
html[data-atlas-appearance] :is(.search-label,.filters label,.result-heading,.contents summary,.text-transcript summary,.reader-tools label,.text-transcript pre,.connection small,.empty-results,.type-label,.connection-label,.loading-message,.source-links,.access-steps span){color:var(--text)}
html[data-atlas-appearance] :is(#image-status,#connection-count){color:var(--text)}
html[data-atlas-appearance] .learning .dialog-heading{background:var(--panel);color:var(--text)}
html[data-atlas-appearance] :is(.lab-error,.error-text,.message.error){color:var(--danger)}
html[data-atlas-appearance] .message.success{color:var(--text)}
html[data-atlas-appearance] :is(.quiz-feedback,.clinical-note,.notice,.setup-note) :is(p,h3,h4,li,strong,b,em,span){color:inherit}
html[data-atlas-appearance] :is(.quiz-feedback,.clinical-note,.notice,.setup-note) a:not(.button):not(.lab-btn){color:inherit;text-decoration:underline}
html[data-atlas-appearance] .quiz-feedback .lab-btn{background:var(--panel);color:var(--text)}
/* Public Study keeps rating meanings with mode-specific readable surfaces. */
html[data-study-palette]:not([data-atlas-appearance]) a:not(.button){color:var(--accent)}
html[data-study-palette]:not([data-atlas-appearance]) :is(.ratings .again,.rating-1){background:var(--danger-bg);color:var(--danger-text)}
html[data-study-palette]:not([data-atlas-appearance]) :is(.ratings .hard,.rating-2){background:var(--warning-bg);color:var(--warning-text)}
html[data-study-palette]:not([data-atlas-appearance]) :is(.ratings .good,.rating-3){background:var(--success-bg);color:var(--success-text)}
html[data-study-palette]:not([data-atlas-appearance]) :is(.ratings .easy,.rating-4){background:var(--info-bg);color:var(--info-text)}
html[data-study-palette] .timer-dock.is-break #timer-dock-label{color:var(--text)}
@media(forced-colors:active){
 html[data-study-palette] :is(button,.button,.lab-btn,select,input,textarea){forced-color-adjust:auto}
 html[data-study-palette] :is(button,.button,.lab-btn):is([aria-pressed=true],[aria-selected=true],[aria-current=page],.active){outline:2px solid Highlight;outline-offset:2px}
}
