/* PRIORIDADE 3 - PERSONALIZAÇÃO DE TEMA E LEITURA */
.p3-theme-control{display:flex;align-items:center;gap:8px;margin-left:auto}.p3-theme-label{font-size:.82rem;font-weight:700;color:inherit!important}.p3-theme-select{min-height:40px!important;padding:7px 34px 7px 12px!important;border-radius:10px!important;border:1px solid rgba(255,255,255,.45)!important;background:#fff!important;color:#172437!important;font-size:16px!important;font-weight:700}.p3-theme-select:focus-visible{outline:3px solid #ffbf00!important;outline-offset:3px!important}.p3-theme-note{position:fixed;right:16px;bottom:16px;z-index:9999;padding:10px 14px;border-radius:10px;background:#0b2c55;color:#fff;font-size:.85rem;box-shadow:0 8px 26px rgba(0,0,0,.22)}

/* Escala de leitura opcional */
html[data-font-size="large"]{font-size:18px}html[data-font-size="extra-large"]{font-size:20px}.p3-reading-control{display:flex;align-items:center;gap:6px}.p3-reading-button{min-width:40px!important;min-height:40px!important;padding:6px 10px!important;border:1px solid rgba(255,255,255,.45)!important;background:#fff!important;color:#172437!important;border-radius:9px!important;font-weight:800!important}

/* Tema escuro só é usado por escolha explícita ou pelo modo automático */
html[data-resolved-theme="dark"]{color-scheme:dark;--page-bg:#0b1120;--surface:#161e30;--surface-soft:#1d2740;--surface-highlight:#202b43;--text-primary:#e8eef8;--text-secondary:#b7c5d9;--text-muted:#9aacc4;--brand-navy:#0b1f3a;--brand-blue:#60a5fa;--brand-blue-hover:#3b82f6;--brand-green:#39c99f;--border:#33435e;--border-strong:#617592;--success-bg:#123c33;--warning-bg:#443912;--danger-bg:#421d25;--info-bg:#152e50;--shadow:0 5px 18px rgba(0,0,0,.32);--bg:#0b1120;--bg-deep:#0b1120;--bg-card:#161e30;--bg-surface:#1d2740;--card:#161e30;--panel:#161e30;--text:#e8eef8;--text-main:#e8eef8;--text-muted:#b7c5d9;--muted:#b7c5d9;--line:#33435e;--accent:#60a5fa;--primary:#60a5fa}
html[data-resolved-theme="dark"],html[data-resolved-theme="dark"] body{background:#0b1120!important;color:#e8eef8!important}
html[data-resolved-theme="dark"] .app-container,html[data-resolved-theme="dark"] main,html[data-resolved-theme="dark"] section{color:#e8eef8!important}
html[data-resolved-theme="dark"] .card,html[data-resolved-theme="dark"] .panel,html[data-resolved-theme="dark"] .box,html[data-resolved-theme="dark"] .widget,html[data-resolved-theme="dark"] .stat-card,html[data-resolved-theme="dark"] .metric-card,html[data-resolved-theme="dark"] .dashboard-card,html[data-resolved-theme="dark"] .subject-card,html[data-resolved-theme="dark"] .topic-card,html[data-resolved-theme="dark"] .flashcard,html[data-resolved-theme="dark"] .flash-card,html[data-resolved-theme="dark"] .quiz-card,html[data-resolved-theme="dark"] .question-card,html[data-resolved-theme="dark"] .theory-card,html[data-resolved-theme="dark"] .review-card,html[data-resolved-theme="dark"] .backup-card,html[data-resolved-theme="dark"] .modal-content,html[data-resolved-theme="dark"] dialog,html[data-resolved-theme="dark"] fieldset,html[data-resolved-theme="dark"] article,html[data-resolved-theme="dark"] .p2-today,html[data-resolved-theme="dark"] .p2-progress,html[data-resolved-theme="dark"] .p2-attention{background:#161e30!important;color:#e8eef8!important;border-color:#33435e!important}
html[data-resolved-theme="dark"] h1,html[data-resolved-theme="dark"] h2,html[data-resolved-theme="dark"] h3,html[data-resolved-theme="dark"] h4,html[data-resolved-theme="dark"] h5,html[data-resolved-theme="dark"] h6,html[data-resolved-theme="dark"] .title,html[data-resolved-theme="dark"] .section-title,html[data-resolved-theme="dark"] .card-title{color:#f3f7fc!important}
html[data-resolved-theme="dark"] p,html[data-resolved-theme="dark"] li,html[data-resolved-theme="dark"] label,html[data-resolved-theme="dark"] small,html[data-resolved-theme="dark"] .description,html[data-resolved-theme="dark"] .subtitle,html[data-resolved-theme="dark"] .meta{color:#b7c5d9!important}
html[data-resolved-theme="dark"] input,html[data-resolved-theme="dark"] select:not(.p3-theme-select),html[data-resolved-theme="dark"] textarea,html[data-resolved-theme="dark"] .answer-option,html[data-resolved-theme="dark"] .option,html[data-resolved-theme="dark"] .quiz-option,html[data-resolved-theme="dark"] .p2-task,html[data-resolved-theme="dark"] .p2-attention-item,html[data-resolved-theme="dark"] .p2-metric{background:#202b43!important;color:#e8eef8!important;border-color:#617592!important}
html[data-resolved-theme="dark"] .tabs,html[data-resolved-theme="dark"] .tab-list,html[data-resolved-theme="dark"] .filters,html[data-resolved-theme="dark"] .segmented-control,html[data-resolved-theme="dark"] .tabs-wrap{background:#121a2b!important;border-color:#33435e!important}
html[data-resolved-theme="dark"] .tab.active,html[data-resolved-theme="dark"] .tab-btn.active,html[data-resolved-theme="dark"] [role="tab"][aria-selected="true"]{background:#263754!important;color:#fff!important;border-color:#60a5fa!important}
html[data-resolved-theme="dark"] .theory-content,html[data-resolved-theme="dark"] .theory-body,html[data-resolved-theme="dark"] .reading-panel,html[data-resolved-theme="dark"] .lesson-content,html[data-resolved-theme="dark"] .article-content,html[data-resolved-theme="dark"] .modal-theory,html[data-resolved-theme="dark"] [data-view="theory"]{background:#161e30!important;color:#e8eef8!important;border-color:#33435e!important}
html[data-resolved-theme="dark"] .theory-content p,html[data-resolved-theme="dark"] .theory-body p,html[data-resolved-theme="dark"] .reading-panel p,html[data-resolved-theme="dark"] .lesson-content p,html[data-resolved-theme="dark"] .article-content p{color:#d6e0ee!important}
html[data-resolved-theme="dark"] table{background:#161e30!important;color:#e8eef8!important}html[data-resolved-theme="dark"] th{background:#263754!important;color:#fff!important}html[data-resolved-theme="dark"] td,html[data-resolved-theme="dark"] th{border-color:#33435e!important}
html[data-resolved-theme="dark"] a{color:#8bc4ff}html[data-resolved-theme="dark"] .btn-secondary,html[data-resolved-theme="dark"] .button-secondary,html[data-resolved-theme="dark"] button:not(.primary):not(.btn-primary):not(.button-primary){background:#202b43!important;color:#f3f7fc!important;border-color:#617592!important}

@media(max-width:720px){.header-top{flex-wrap:wrap}.p3-theme-control{width:100%;justify-content:flex-end;margin-top:8px}.p3-theme-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.p3-theme-select{flex:1;max-width:180px}}
@media(prefers-reduced-motion:reduce){.p3-theme-note{display:none}}
