/* Achieving English. Shared accessible light/dark display for all portal pages.
   This sheet is loaded after the base CSS, and theme-qualified selectors also
   override legacy per-template dark colours in editor, lessons and catalog.
   No lesson, answer, grade, upload or navigation logic is modified here. */

.header-tools{display:flex;gap:18px;align-items:center;justify-content:flex-end}
.theme-switch{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:40px;padding:8px 12px;border:1px solid var(--line);
  border-radius:11px;background:var(--card);color:var(--text);
  font:600 14px/1.3 Arial,sans-serif;cursor:pointer;white-space:nowrap}
.theme-switch:hover{border-color:var(--red)}
.theme-switch:focus-visible{outline:3px solid #d44c4c;outline-offset:3px}
.theme-switch-icon{font-size:19px;line-height:1}
@media(max-width:700px){
  .header-tools{gap:8px}
  .header-slogan{display:none}
  .theme-switch{padding:8px 10px}
  .theme-switch-text{font-size:12px}
}

html[data-theme="light"]{
  color-scheme:light;
  --bg:#f7f8fa;
  --card:#ffffff;
  --muted:#5b6371;
  --text:#1d2531;
  --red:#bd393b;
  --line:#d8dee7;
  --ae-surface:#f0f3f7;
  --ae-soft:#e9edf3;
  --ae-input:#ffffff;
  --ae-border:#ccd3dd;
  --ae-link:#a5262d;
  --ae-success-bg:#e5f5eb;
  --ae-success-text:#17633f;
}
html[data-theme="light"] body{background:var(--bg);color:var(--text)}
html[data-theme="light"] header{background:rgba(247,248,250,.96);border-color:var(--line)}
html[data-theme="light"] .theme-switch{background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme="light"] a{color:inherit}
html[data-theme="light"] .muted{color:var(--muted)}
html[data-theme="light"] .card,
html[data-theme="light"] .block,
html[data-theme="light"] .lesson-row,
html[data-theme="light"] .lesson-content .block{
  background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .pill{
  background:var(--ae-soft);color:#334155}
html[data-theme="light"] .btn{background:var(--red);color:#fff}
html[data-theme="light"] .secondary-btn{background:#e5eaf1;color:#273344}
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select{
  background:var(--ae-input);color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{color:#687383}
html[data-theme="light"] button:disabled{opacity:.55}
html[data-theme="light"] :focus-visible{outline-color:#ad3439}
html[data-theme="light"] .lesson-prose a,
html[data-theme="light"] .media-link{color:var(--ae-link)}
html[data-theme="light"] .lesson-prose th,
html[data-theme="light"] .lesson-prose td{border-color:var(--ae-border)}
html[data-theme="light"] .lesson-prose blockquote{
  background:var(--ae-surface);border-color:var(--red)}
html[data-theme="light"] .lesson-content .answer-block{
  background:#fff5f4;border-color:#e2b7b7}
html[data-theme="light"] .save-status,
html[data-theme="light"] .saved-note{
  background:var(--ae-success-bg);color:var(--ae-success-text);border-color:#9fcdb2}
html[data-theme="light"] .speed-label select{background:var(--ae-soft);color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] .lesson-progress-card,
html[data-theme="light"] .self-check-card,
html[data-theme="light"] .grammar-card,
html[data-theme="light"] .vocabulary-card,
html[data-theme="light"] .task-card,
html[data-theme="light"] .tenth-review,
html[data-theme="light"] .tenth-review-part{
  background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .progress-track{background:var(--ae-soft)}
html[data-theme="light"] .task-instruction,
html[data-theme="light"] .task-prose,
html[data-theme="light"] .task-meta,
html[data-theme="light"] .score-line,
html[data-theme="light"] .progress-caption,
html[data-theme="light"] .vocab-translation,
html[data-theme="light"] .media-caption{color:var(--muted)}
html[data-theme="light"] .choice-btn,
html[data-theme="light"] .inline-choice-btn,
html[data-theme="light"] .emoji-choice-btn,
html[data-theme="light"] .match-chip,
html[data-theme="light"] .order-chip,
html[data-theme="light"] .self-check-btn,
html[data-theme="light"] .ae-game-tile,
html[data-theme="light"] .ae-game-category,
html[data-theme="light"] .ae-game-reset{
  background:var(--ae-surface);color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] .choice-btn.selected,
html[data-theme="light"] .inline-choice-btn.selected,
html[data-theme="light"] .ae-game-tile.selected,
html[data-theme="light"] .ae-game-category.selected{
  background:#efe4f8;border-color:#9475ad;color:#41245e}
html[data-theme="light"] .ae-game-tile.paired,
html[data-theme="light"] .ae-game-tile.assigned{background:#e0f3e9;border-color:#62a484;color:#18543d}
html[data-theme="light"] .ae-game-built,
html[data-theme="light"] .matching-slot,
html[data-theme="light"] .fill-blank-line,
html[data-theme="light"] .inline-text-row{border-color:var(--ae-border)}
html[data-theme="light"] .task-transcript,
html[data-theme="light"] .task-transcript-body,
html[data-theme="light"] .upload-fallback,
html[data-theme="light"] .grammar-explanation,
html[data-theme="light"] .grammar-reference-details{
  background:var(--ae-surface);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .external-practice-links a,
html[data-theme="light"] .lesson-content nav a{color:var(--ae-link)}

/* Main catalog, course and level pages. */
html[data-theme="light"] .catalog-card,
html[data-theme="light"] .level-card,
html[data-theme="light"] .lesson-line{
  background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .catalog-card p,
html[data-theme="light"] .catalog-group>p,
html[data-theme="light"] .course-lead,
html[data-theme="light"] .lesson-level-intro,
html[data-theme="light"] .lesson-info,
html[data-theme="light"] .level-card .muted{color:var(--muted)}
html[data-theme="light"] .catalog-status{background:#e4f4e9;color:#206540}
html[data-theme="light"] .catalog-status.pending{background:var(--ae-soft);color:#475569}
html[data-theme="light"] .lesson-line.available{border-color:#86b69b}
html[data-theme="light"] .lesson-action{background:var(--ae-soft);color:#25344a}
html[data-theme="light"] .lesson-line.available .lesson-action{background:#ae3638;color:#fff}
html[data-theme="light"] .lesson-path a,
html[data-theme="light"] .course-back{color:var(--ae-link)}

/* Constructor. Keep full contrast between contenteditable, controls and media. */
html[data-theme="light"] .editor-meta-card,
html[data-theme="light"] .editor-block,
html[data-theme="light"] .editor-student-preview{
  background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .editor-block-head{background:var(--ae-surface);border-color:var(--line)}
html[data-theme="light"] .editor-block-body{background:var(--card);color:var(--text)}
html[data-theme="light"] .editor-field label,
html[data-theme="light"] .block-summary{color:var(--text)}
html[data-theme="light"] .block-order-label,
html[data-theme="light"] .current-media,
html[data-theme="light"] .task-advanced summary,
html[data-theme="light"] .vocab-column-labels,
html[data-theme="light"] .media-width-label{color:var(--muted)}
html[data-theme="light"] .block-type-select,
html[data-theme="light"] .editor-block input,
html[data-theme="light"] .editor-block textarea,
html[data-theme="light"] .editor-block select,
html[data-theme="light"] .editor-meta-card input,
html[data-theme="light"] .editor-meta-card select{
  background:var(--ae-input);color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] .rich-editor{
  background:#fff;color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] .format-toolbar button,
html[data-theme="light"] .format-color,
html[data-theme="light"] .block-collapse,
html[data-theme="light"] .media-action,
html[data-theme="light"] .media-resize-handle,
html[data-theme="light"] .author-add,
html[data-theme="light"] .plus-trigger,
html[data-theme="light"] .palette-item{
  background:var(--ae-surface);color:var(--text);border-color:var(--ae-border)}
html[data-theme="light"] .block-palette{
  background:var(--card);border-color:var(--line);box-shadow:0 12px 32px #1d253125}
html[data-theme="light"] .grammar-editor,
html[data-theme="light"] .vocab-editor,
html[data-theme="light"] .inline-media-editor,
html[data-theme="light"] .task-config,
html[data-theme="light"] .visual-task-builder,
html[data-theme="light"] .editor-media-attachments,
html[data-theme="light"] .add-block-panel,
html[data-theme="light"] .editor-empty{
  background:var(--ae-surface);color:var(--text);border-color:var(--line)}
html[data-theme="light"] .editor-student-preview iframe{border-color:var(--line)}
html[data-theme="light"] .block-delete,
html[data-theme="light"] .author-remove,
html[data-theme="light"] .media-action.media-danger{
  background:#fff0f0;color:#a62d33;border-color:#e8b4b6}
html[data-theme="light"] .block-restore{background:#e3f4e9;color:#176b45;border-color:#a3d2b6}
html[data-theme="light"] .editor-message{background:#e2f4eb;color:#19583e;border-color:#a1cdb7}
html[data-theme="light"] .primary-move-label{color:var(--text)}
html[data-theme="light"] .inline-media-edit-row{border-color:var(--line)}
html[data-theme="light"] .blank-author-preview,
html[data-theme="light"] .blank-preview-input{background:#fff;border-color:var(--ae-border);color:var(--text)}
html[data-theme="light"] .media-trash-row{border-color:var(--line)}
html[data-theme="light"] .resizable-media-shell video,
html[data-theme="light"] .editor-video-preview{background:#10151c}

/* Reduce abrupt color shifts for users sensitive to animation. */
@media(prefers-reduced-motion:reduce){
  .theme-switch,.catalog-card,.level-card{transition:none!important}
}
