/* Prova de tema: s'aplica només a la còpia web-usuari-cursos-temes. */
.theme-preference { margin:7px 0 2px; padding:9px 10px; border-top:1px solid #edf1ef; border-bottom:1px solid #edf1ef; }
.theme-preference-title { display:block; margin-bottom:6px; color:#2c3e50; font-size:.72rem; font-weight:900; letter-spacing:.05em; text-transform:uppercase; }
.theme-options { display:flex; gap:4px; }
.theme-options button { flex:1; width:auto !important; padding:5px 4px !important; border:1px solid #d5dce0 !important; border-radius:999px !important; background:#fff !important; color:#637581 !important; font-size:.7rem !important; font-weight:900 !important; line-height:1.1; text-align:center !important; }
.theme-options button.selected { border-color:#218c4f !important; background:#218c4f !important; color:#fff !important; }
.theme-preference small { display:block; margin-top:6px; color:#71818a; font-size:.68rem; line-height:1.25; }

html.theme-dark { color-scheme:dark; }
html.theme-dark body { background:#101a16 !important; color:#e8f2ed !important; }
html.theme-dark :where(header, .guia-cap, .header, .section, .card, .guide-card, .help-card, .stats-card, .stats-panel, .modal-card, .course-card, .station, .station-card, .path, aside, .gate section, .question-card, .question-panel, .result-card, .home-main, .premium-card, .account-card, .table-wrap, .mini-table, .faq-item) { background-color:#17251f !important; color:#e8f2ed !important; border-color:#385247 !important; }
html.theme-dark :where(input, textarea, select) { background:#0f1a15 !important; color:#f2faf5 !important; border-color:#527060 !important; }
html.theme-dark :where(.top-menu-toggle,.account-toggle,.guia-account,.guia-menu-toggle) { background:#1c2c25 !important; border-color:#526d5e !important; color:#8fe0b2 !important; }
html.theme-dark :where(.top-menu-panel,.guia-menu-panel,.menu,.account-menu-panel) { background:#1b2b24 !important; border-color:#50685a !important; box-shadow:0 14px 34px rgba(0,0,0,.42) !important; }
html.theme-dark :where(.top-menu-item,.guia-menu-panel a,.guia-menu-panel button,.guia-menu-language,.top-menu-language) { color:#e8f2ed !important; background-color:transparent !important; border-color:#385247 !important; }
html.theme-dark :where(.top-menu-language-label,.guia-menu-language-label) { color:#dce9e2 !important; }
html.theme-dark :where(.top-menu-item:hover,.guia-menu-panel a:hover,.guia-menu-panel button:hover) { background:#273b31 !important; }
html.theme-dark :where(.theme-preference) { border-color:#385247; }
html.theme-dark :where(.theme-preference-title,.theme-preference small) { color:#bbcec2 !important; }
html.theme-dark .theme-options button { background:#14211c !important; color:#c5d3cc !important; border-color:#4d6758 !important; }
html.theme-dark .theme-options button.selected { background:#218c4f !important; border-color:#36b96d !important; color:#fff !important; }
html.theme-dark :where(.journey-track-base,.path-line,.progress-track) { stroke:#405a4d !important; background:#405a4d !important; }
html.theme-dark :where(.journey-node,.station.locked,.station.is-locked) { background:#26362e !important; border-color:#627a6c !important; }
html.theme-dark :where(.help-modal,.modal,.overlay) { background:rgba(0,0,0,.67) !important; }
html.theme-dark :where(hr,.divider) { border-color:#385247 !important; }
html.theme-dark svg text { fill:#e8f2ed; }

/* Portada: cada bloc té colors explícits per no perdre contrast. */
html.theme-dark .home-shell { background:#17251f; border-color:#385247; box-shadow:0 22px 60px rgba(0,0,0,.35); }
html.theme-dark .brand-logo { background:#20332a !important; border-color:#405c4d !important; box-shadow:0 12px 30px rgba(0,0,0,.28) !important; }
html.theme-dark #home p.sub { color:#f0f8f3; }
html.theme-dark #home p.intro { color:#bfd0c5; }
html.theme-dark .selector-card { background:#20332a; border-color:#405c4d; }
html.theme-dark #home p.prompt { color:#b7c9be; }
html.theme-dark .tria-btn { background:#182820; border-color:#456052; color:#f0f8f3; box-shadow:0 8px 22px rgba(0,0,0,.24); }
html.theme-dark .tria-btn small { color:#bdcec3; }
html.theme-dark .courses-entry { background:#1d3027; border-color:#405c4d; }
html.theme-dark .courses-entry h2 { color:#f0f8f3; }
html.theme-dark .courses-entry p { color:#bfd0c5; }
html.theme-dark .home-guide-link { color:#a7d6ba; border-color:#668b76; }

/* Configuradors d'examen, tant d'orgànica com d'inorgànica. */
html.theme-dark #pantalla-inici,
html.theme-dark #config-screen .card { background:#17251f !important; border-color:#385247 !important; color:#e8f2ed; }
html.theme-dark #pantalla-inici h3,
html.theme-dark #config-screen h3,
html.theme-dark #config-screen label b,
html.theme-dark .config-subtitle { color:#c5d3cc !important; }
html.theme-dark :where(.btn-mode,.btn-menu,.btn-difficulty,.chip,.exam-mode) { background:#1a2a22 !important; color:#e8f2ed !important; border-color:#557264 !important; }
html.theme-dark :where(.btn-mode.selected,.btn-menu.selected,.btn-difficulty.selected,.chip.sel,.exam-mode.selected) { background:#218c4f !important; color:#fff !important; border-color:#39b86d !important; }
html.theme-dark :where(.btn-mode small,.btn-difficulty small) { color:#bfd0c5 !important; }
html.theme-dark #taula-config-container { background:#1b2c24 !important; border-color:#405c4d !important; box-shadow:none !important; }
html.theme-dark #taula-config-container > div[style*="margin-top"] { color:#bdcec3 !important; }
html.theme-dark #taula-config-container > div[style*="margin-top"] b { color:#e1ece6 !important; }
html.theme-dark .taula-config { background:#17251f !important; }
html.theme-dark .taula-config td,
html.theme-dark .taula-config td:first-child,
html.theme-dark .taula-config tbody tr:nth-child(even) td:not(:first-child) { background:#17251f !important; color:#e8f2ed !important; border-color:#385247 !important; }
html.theme-dark .config-qty select { background:#14211c !important; color:#e8f2ed !important; border-color:#557264 !important; }
html.theme-dark .config-actions { background:rgba(23,37,31,.98) !important; border-color:#405c4d !important; box-shadow:0 -4px 12px rgba(0,0,0,.28) !important; }

/* Pantalla de preguntes inorgànica. */
html.theme-dark #test-screen .pregunta-card { background:#17251f !important; color:#e8f2ed !important; border-left-color:#70b9df !important; box-shadow:0 2px 12px rgba(0,0,0,.3) !important; }
html.theme-dark #test-screen .pregunta-count,
html.theme-dark #test-screen .input-grup span { color:#d4e3db !important; }
html.theme-dark #test-screen .dada-donada { background:#263d50 !important; color:#f4fbf7 !important; }
html.theme-dark #test-screen input.res-input { background:#0f1a15 !important; color:#f4fbf7 !important; border-color:#527d69 !important; }
html.theme-dark #test-screen .feedback { color:#dce9e2 !important; }
html.theme-dark #test-screen .feedback div[style*="color:#555"] { color:#dce9e2 !important; }
html.theme-dark :where(.btn-help-answer,.pregunta-help-btn) { background:#14211c !important; color:#d8e6df !important; border-color:#456052 !important; }

/* Preguntes d'orgànica: el dibuix no pot conservar un llenç blanc amb els
   àtoms ja adaptats al tema fosc. */
html.theme-dark .molecule-display { background:#101a16 !important; border-color:#527060 !important; box-shadow:inset 0 0 0 1px rgba(255,255,255,.025) !important; }
html.theme-dark #visualitzador :is(svg line,svg polyline,svg polygon,svg path,svg rect) { stroke:#dce9e2 !important; }
html.theme-dark #visualitzador svg text { fill:#e8f2ed !important; }
html.theme-dark :where(.pregunta-info-text,body.course-mode-organica .dibuix-objectiu-inline > span) { color:#c9d8d0 !important; }
html.theme-dark :where(#feedback-box,#dibuix-feedback,#isomeria-feedback) { background:#1b2d25 !important; color:#dce9e2 !important; border-color:#4b7561 !important; }
html.theme-dark #feedback-box :where(p,small) { color:#dce9e2 !important; }
html.theme-dark #feedback-box b[style*="color:#155724"] { color:#8fe0b2 !important; }
html.theme-dark #feedback-box b[style*="color:#721c24"] { color:#ff9e95 !important; }
html.theme-dark #feedback-box > div[style*="background"] { background:#101a16 !important; color:#dce9e2 !important; border-color:#55a9d8 !important; }
html.theme-dark #feedback-box > div[style*="background"] p { color:#70b9df !important; }
html.theme-dark #feedback-box .molecula-grid :is(svg line,svg polyline,svg polygon,svg path,svg rect) { stroke:#dce9e2 !important; }
html.theme-dark #feedback-box .molecula-grid svg text { fill:#e8f2ed !important; }
html.theme-dark #dibuix-feedback :where(p,small) { color:#dce9e2 !important; }
html.theme-dark #dibuix-feedback b[style*="color:#155724"] { color:#8fe0b2 !important; }
html.theme-dark #dibuix-feedback b[style*="color:#721c24"] { color:#ff9e95 !important; }
html.theme-dark #dibuix-feedback b[style*="color:#856404"] { color:#ffd47a !important; }
html.theme-dark #dibuix-feedback > div[style*="background"] { background:#101a16 !important; color:#dce9e2 !important; border:1px solid #4b7561 !important; }
html.theme-dark #dibuix-feedback .molecula-grid :is(svg line,svg polyline,svg polygon,svg path,svg rect) { stroke:#dce9e2 !important; }
html.theme-dark #dibuix-feedback .molecula-grid svg text { fill:#e8f2ed !important; }

/* Resums finals d'orgànica (nom, dibuix i isomeria). */
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) { background:#17251f !important; color:#e8f2ed !important; border-color:#4b7561 !important; box-shadow:0 8px 24px rgba(0,0,0,.3) !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) > p { color:#dce9e2 !important; }
html.theme-dark .nota-consultes-organica { background:#20342a !important; color:#dce9e2 !important; border-color:#4b7561 !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) div[style*="border-top"] { border-color:#4b7561 !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) div[style*="background:#fafafa"] { background:#1b2d25 !important; color:#e8f2ed !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) div[style*="color:#555"],
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) div[style*="color:#666"] { color:#c5d6cc !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) .molecula-grid :is(svg line,svg polyline,svg polygon,svg path,svg rect) { stroke:#dce9e2 !important; }
html.theme-dark :where(#resum-final,#resum-final-isomeria,.resum-final-dibuix) .molecula-grid svg text { fill:#e8f2ed !important; }

/* Editor de dibuix orgànic. */
html.theme-dark .ed-lienzo { background:#101a16 !important; border-color:#527060 !important; }
html.theme-dark .ed-lienzo .ed-bond { stroke:#dce9e2 !important; }
html.theme-dark .ed-lienzo text { fill:#e8f2ed !important; }
html.theme-dark .ed-lienzo rect { fill:#20342a !important; stroke:#dce9e2 !important; }
html.theme-dark .ed-lienzo .ed-branch-slot { fill:#20342a !important; stroke:#e67e22 !important; }
html.theme-dark .ed-lienzo .ed-branch-plus { fill:#ffb15c !important; }
html.theme-dark :where(.toolbar button,.ed-toolbar button,.sizes button,.ed-chip,.chip) { background:#1b2d25 !important; color:#e8f2ed !important; border-color:#527060 !important; }
html.theme-dark :where(.toolbar button,.ed-toolbar button,.sizes button,.ed-chip,.chip) svg :is(line,polygon,polyline,path) { stroke:currentColor !important; }
html.theme-dark :where(.toolbar button,.ed-toolbar button,.sizes button,.ed-chip,.chip) svg text { fill:currentColor !important; }
html.theme-dark :where(.toolbar button.selected-tool,.sizes button.on,.ed-chip.sel,.chip.sel,.chip.opcio-selector-triada) { background:#218c4f !important; color:#fff !important; border-color:#39b86d !important; }
/* Codi de color propi d'orgànica: les seleccions són taronges. */
html.theme-dark body.app-organica :where(.btn-mode.selected,.btn-menu.selected,.btn-difficulty.selected,.chip.sel,.toolbar button.selected-tool,.sizes button.on,.ed-chip.sel,.chip.opcio-selector-triada) { background:#c96217 !important; color:#fff !important; border-color:#ffad57 !important; }
html.theme-dark .toolbar button.danger { background:#2e211e !important; color:#ffaaa1 !important; border-color:#e76b61 !important; }
html.theme-dark :where(.seccio,.ed-seccio-titol,.hint,.ed-hint) { color:#c5d6cc !important; }

/* Finestres de consulta d'orgànica: grups, prefixos, passes i isomeria. */
html.theme-dark .consulta-grups-modal { background:rgba(0,0,0,.72) !important; }
html.theme-dark .consulta-grups-card { background:#17251f !important; color:#e8f2ed !important; border-color:#4b7561 !important; box-shadow:0 20px 54px rgba(0,0,0,.5) !important; }
html.theme-dark .consulta-grups-card h2 { color:#ffb15c !important; }
html.theme-dark .consulta-grups-close { background:#293d33 !important; color:#e8f2ed !important; }
html.theme-dark .consulta-ajuda-nota { color:#c5d6cc !important; }
html.theme-dark .consulta-grups-table { color:#dce9e2 !important; }
html.theme-dark .consulta-grups-table th,
html.theme-dark .consulta-grups-table td { background:#17251f !important; color:#dce9e2 !important; border-color:#405c4d !important; }
html.theme-dark .consulta-grups-table th { background:#263c31 !important; color:#ffbf7a !important; }
html.theme-dark .fg-rep { background:#20342a !important; color:#e8f2ed !important; border-color:#4b7561 !important; }
html.theme-dark .fg-rep-sep { color:#c5d6cc !important; }
/* Aplicació explícita a la consulta de grups funcionals. */
html.theme-dark #consulta-grups-organica-modal .consulta-grups-card { background:#17251f !important; color:#e8f2ed !important; border-color:#4b7561 !important; }
html.theme-dark #consulta-grups-organica-modal .consulta-grups-table th { background:#263c31 !important; color:#ffbf7a !important; }
html.theme-dark #consulta-grups-organica-modal .consulta-grups-table td { background:#17251f !important; color:#dce9e2 !important; border-color:#405c4d !important; }
html.theme-dark .fg-dibuix { background:#20342a !important; border-color:#4b7561 !important; }
html.theme-dark .fg-svg line { stroke:#dce9e2 !important; }
html.theme-dark .fg-svg text { fill:#e8f2ed !important; }

/* Selectors que s'obren en tocar un punt + de l'editor. */
html.theme-dark :where(#rama-modal,#radical-lineal-modal,#anell-substituent-modal) { background:rgba(0,0,0,.72) !important; }
html.theme-dark :where(#rama-modal,#radical-lineal-modal,#anell-substituent-modal) > div { background:#17251f !important; color:#e8f2ed !important; border:1px solid #4b7561 !important; box-shadow:0 20px 54px rgba(0,0,0,.5) !important; }
html.theme-dark :where(#rama-modal,#radical-lineal-modal,#anell-substituent-modal) h3 { color:#ffb15c !important; }
html.theme-dark :where(#rama-modal,#radical-lineal-modal,#anell-substituent-modal) :is(p,div[style*="color:#7f8c8d"]) { color:#c5d6cc !important; }
html.theme-dark :where(#rama-modal,#radical-lineal-modal,#anell-substituent-modal) .btn-sec { background:#50615e !important; color:#fff !important; }

/* Isomeria orgànica. */
html.theme-dark :where(.isomeria-enunciat,.isomeria-respostes label) { color:#dce9e2 !important; }
html.theme-dark .isomeria-afegits { background:#1b2d25 !important; color:#c5d6cc !important; border-color:#405c4d !important; }
html.theme-dark .isomeria-afegits strong { color:#f2faf5 !important; }
html.theme-dark #isomeria-feedback :where(p,small) { color:#dce9e2 !important; }
html.theme-dark #isomeria-feedback b[style*="color:#155724"] { color:#8fe0b2 !important; }
html.theme-dark #isomeria-feedback b[style*="color:#721c24"] { color:#ff9e95 !important; }
html.theme-dark #isomeria-feedback li[style*="color:#155724"] { color:#8fe0b2 !important; }
html.theme-dark #isomeria-feedback li[style*="color:#721c24"] { color:#ff9e95 !important; }
html.theme-dark #isomeria-feedback span[style*="color:#555"] { color:#c5d6cc !important; }
/* Les fórmules de les parelles d'isomeria es generen amb colors en línia
   pensats per al llenç blanc. En tema fosc els substituïm també aquí. */
html.theme-dark .isomeria-mol .molecula-grid [style*="color: black"] { color:#e8f2ed !important; }
html.theme-dark .isomeria-mol .molecula-grid :is(svg line,svg polyline,svg polygon,svg path,svg rect) { stroke:#dce9e2 !important; }
html.theme-dark .isomeria-mol .molecula-grid svg text { fill:#e8f2ed !important; }

/* Cursos d'Orgànica i d'Inorgànica: panells, lliçons i resultats. */
html.theme-dark :where(.learning-path,.summary-stats,.course-intro-card,.course-confirm-card,.lesson-panel,.practice-shell,.practice-header,.block-result,.course-achievement-summary,.inorganic-achievement,.inline-stats-summary,.intro-grid article,.concept-card,.rule-list li,.roots-table,.next-unit-card,.next-card) { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark :where(.lesson-header,.lesson-footer,.practice-header,.course-intro-card,.course-confirm-card,.block-result) { border-color:#405c4d !important; }
/* Els peus de les lliçons són superfícies pròpies; no han de conservar el blanc
   original quan la resta de la finestra ja és fosca. */
html.theme-dark :where(.lesson-footer,.practice footer) { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark :where(#intro > section,#practice > section,#result > section) { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark .block-result .result-icon { background:#1f4a31 !important; color:#b9f2cf !important; border:2px solid #5ac884 !important; box-shadow:0 0 0 5px rgba(90,200,132,.12) !important; }
/* Resum i controls propis del curs d'inorgànica. */
html.theme-dark #course-app .summary div { background:#1b2d25 !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark #course-app .summary b { color:#8dcbe9 !important; }
html.theme-dark #course-app .summary span { color:#c5d6cc !important; }
html.theme-dark #course-app :is(#how,#reset) { background:#263c31 !important; color:#e8f2ed !important; border-color:#527060 !important; }
html.theme-dark #practice .prompt { color:#c5d6cc !important; }
html.theme-dark #practice .element { color:#8dcbe9 !important; }
/* Resultat final del curs d'inorgànica. */
html.theme-dark #result .result-icon { background:#1e3d50 !important; color:#9bd6f1 !important; border:2px solid #5da9d1 !important; box-shadow:0 0 0 5px rgba(93,169,209,.12) !important; }
html.theme-dark #result .eyebrow { color:#8dcbe9 !important; }
html.theme-dark #result #result-score { color:#dce9e2 !important; }
html.theme-dark #result .result-stars { color:#ffd260 !important; }
html.theme-dark #result .inorganic-achievement p { color:#c5d6cc !important; }
html.theme-dark :where(.lesson-content .explanation,.lesson-footer p,.block-result > p:not(.eyebrow),.course-unit-guides,.course-unit-guides p,.course-unit-guides a,.summary-stats span,.next-card small,.next-unit-card small,.next-unit-card span,.intro-points article p,.stats-card small,.stats-card span,.stats-save-help,.stats-switch-row p) { color:#c5d6cc !important; }
html.theme-dark :where(.course-intro-modal,.course-confirm-modal,.lesson-modal,.practice-modal,.inline-stats-modal,.course-exit-confirm,.level-intro-modal) { background:rgba(0,0,0,.72) !important; }
html.theme-dark :where(.close-button,.help-close,.course-confirm-cancel,.course-exit-cancel,.how-button) { background:#293d33 !important; color:#e8f2ed !important; border-color:#527060 !important; }
html.theme-dark .level-intro-modal > section { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark .level-intro-modal h2 { color:#f2faf5 !important; }
html.theme-dark .level-intro-modal .level-intro-text { color:#c5d6cc !important; }
html.theme-dark .level-intro-modal .level-intro-example span { color:#e8f2ed !important; }
html.theme-dark .level-intro-modal .close { background:#293d33 !important; color:#e8f2ed !important; }
html.theme-dark .course-exit-confirm > section { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark .course-exit-confirm p { color:#c5d6cc !important; }
html.theme-dark :where(.option,.roots-table td,.stats-card,.achievement-grid div,.inorganic-achievement div,.level-guide-links a,.level-intro-example,.special-compound) { background:#1b2d25 !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark .stats-card small { color:#dce9e2 !important; }
html.theme-dark .stats-card :is(b,span) { color:#9bd6f1 !important; }
html.theme-dark .option.selected { background:#203d2d !important; border-color:#39b86d !important; }
html.theme-dark .option.correct { background:#1f4a31 !important; border-color:#39b86d !important; }
html.theme-dark .option.incorrect { background:#452725 !important; border-color:#e76b61 !important; }
html.theme-dark .roots-table td:nth-child(2),
html.theme-dark .roots-table td:nth-child(4) { background:#20342a !important; color:#9ad8b5 !important; }
html.theme-dark :where(.stats-table th,.stats-table td,.inline-stats-table th,.inline-stats-table td) { color:#dce9e2 !important; border-color:#405c4d !important; }
html.theme-dark :where(.stats-table .stats-group td,.stats-table .stats-group-total td) { background:#20342a !important; color:#9ad8b5 !important; border-color:#405c4d !important; }
html.theme-dark :where(.course-unit-guides,.level-guide-links a,.level-intro-example,.special-compound,.course-achievement-summary,.inorganic-achievement,.inline-stats-summary) { background:#20342a !important; border-color:#4b7561 !important; }
html.theme-dark :where(.course-unit-guides a,.level-guide-links a,.level-intro-example b,.special-compound b,.inorganic-achievement strong,.inline-stats-summary b,.achievement-grid strong) { color:#9ad8b5 !important; }
html.theme-dark :where(.journey-stop i,.journey button>i) { border-color:#101a16 !important; background:#31443a !important; box-shadow:0 0 0 2px #526d5e !important; }
html.theme-dark :where(.journey-stop.completed i,.journey button.done>i) { background:#e3ad36 !important; box-shadow:0 0 0 3px #b78113 !important; }
html.theme-dark :where(.journey-stop.active i,.journey button.active>i) { background:#30a969 !important; box-shadow:0 0 0 3px #23824e !important; }
html.theme-dark .journey-stop small { color:#c5d6cc !important; }
html.theme-dark .journey-stop .ketone-svg { color:#c5d6cc !important; }
html.theme-dark .journey-stop .ketone-svg path { stroke:currentColor !important; fill:none !important; }
html.theme-dark .journey-stop .ketone-svg text { fill:currentColor !important; }
html.theme-dark :where(.level-node.locked,.journey button.locked>i) { background:#31443a !important; color:#9eb3a7 !important; border-color:#526d5e !important; box-shadow:none !important; }
html.theme-dark :where(.practice-shell,#practice-frame,.practice-loading) { background:#101a16 !important; color:#dce9e2 !important; }

/* Taula de valències. */
html.theme-dark body.taula-valencies-standalone,
html.theme-dark .taula-valencies-main { background:#17251f !important; color:#e8f2ed !important; }
html.theme-dark .taula-valencies-main h1 { color:#f2faf5 !important; }
html.theme-dark .taula-valencies-close { background:#293d33 !important; color:#d6e7de !important; }
html.theme-dark .periodic-legend { color:#c5d3cc !important; }
html.theme-dark .element-cell { background:#fbfdfc !important; border-color:#dfe7e2 !important; box-shadow:0 1px 3px rgba(0,0,0,.18) !important; }
html.theme-dark .element-cell.metall { background:#d7ecff !important; border-color:#2f80c0 !important; }
html.theme-dark .element-cell.transicio { background:#eadcff !important; border-color:#7d5ac7 !important; }
html.theme-dark .element-cell.no-metall,
html.theme-dark .element-cell.halogen,
html.theme-dark .element-cell.gas,
html.theme-dark .element-cell.semimetall { background:#ffe4bd !important; border-color:#d77b16 !important; }
html.theme-dark .element-cell b { color:#2c3e50 !important; }
html.theme-dark .element-cell span { color:#52616a !important; }
html.theme-dark .element-cell small { color:#1f7f45 !important; }
html.theme-dark .terminacions-valencies { gap:1px !important; background:#9fb5a8 !important; border-color:#9fb5a8 !important; box-shadow:0 1px 4px rgba(0,0,0,.18) !important; }
html.theme-dark .terminacions-valencies b { padding:2px 3px; background:#edf4f0 !important; color:#2c3e50 !important; }
html.theme-dark .terminacions-valencies div,
html.theme-dark .terminacions-valencies span { background:#fff !important; color:#2c3e50 !important; }
html.theme-dark .terminacions-valencies div { background:#edf4f0 !important; color:#486154 !important; }
html.theme-dark .consulta-modal { background:rgba(0,0,0,.72) !important; }
html.theme-dark .consulta-card,
html.theme-dark body.consulta-embedded .consulta-modal { background:#101a16 !important; color:#e8f2ed !important; }
html.theme-dark .consulta-head h3 { color:#f2faf5 !important; }
html.theme-dark .consulta-close { background:#293d33 !important; color:#dce9e2 !important; }

/* Avís d'ajuda obert amb l'interrogant. */
html.theme-dark .app-alert { background:#17251f !important; color:#e8f2ed !important; border-color:#405c4d !important; box-shadow:0 18px 46px rgba(0,0,0,.5) !important; }
html.theme-dark .app-alert-body { color:#d2dfd8 !important; }
html.theme-dark .app-alert-close { background:#293d33 !important; color:#e8f2ed !important; }

/* Explicacions mostrades després de corregir una pregunta del curs. */
html.theme-dark .question-explanation { background:#1b2d25 !important; color:#dce9e2 !important; border-color:#4b7561 !important; }
html.theme-dark .question-explanation>b { color:#9ad8b5 !important; }
html.theme-dark .question-explanation p { color:#dce9e2 !important; }

/* Resum final de l'examen inorgànic. */
html.theme-dark #resultat-final { background:#17251f !important; color:#e8f2ed !important; border-color:#4b7561 !important; }
html.theme-dark #resultat-final h2 { color:#f2faf5 !important; }
html.theme-dark #resultat-final > p { color:#dce9e2 !important; }
html.theme-dark #resultat-final .nota-consultes { background:#20342a !important; color:#dce9e2 !important; border-color:#4b7561 !important; }
html.theme-dark #resultat-final div[style*="border-top"] { border-color:#4b7561 !important; }
html.theme-dark #resultat-final div[style*="background:#fafafa"] { background:#1d3027 !important; color:#e8f2ed !important; }
html.theme-dark #resultat-final div[style*="color:#666"],
html.theme-dark #resultat-final div[style*="color:#555"] { color:#c5d6cc !important; }
html.theme-dark #resultat-final :where(b, strong) { color:inherit; }

/* Guies: taules, exemples i avisos. */
html.theme-dark .guia-cap { background:rgba(23,37,31,.96) !important; border-color:#385247 !important; }
html.theme-dark .section { background:#17251f !important; border-color:#385247 !important; box-shadow:0 10px 25px rgba(0,0,0,.22) !important; }
html.theme-dark .card,
html.theme-dark .example,
html.theme-dark .mini-table div,
html.theme-dark .faq div { background:#1b2d25 !important; border-color:#405c4d !important; color:#e8f2ed !important; }
html.theme-dark :where(.rule,.warning) { background:#332a1e !important; color:#f3e7ca !important; border-color:#e67e22 !important; }
html.theme-dark :where(.rule,.warning) :is(p,strong,b) { color:inherit !important; }
html.theme-dark .guide-table-wrap { border-color:#405c4d !important; }
html.theme-dark .guide-table { background:#1b2d25 !important; }
html.theme-dark .guide-table th,
html.theme-dark .guide-table td { background:#1b2d25 !important; color:#dce9e2 !important; border-color:#405c4d !important; }
html.theme-dark .guide-table thead th { background:#263c31 !important; color:#f2faf5 !important; }
html.theme-dark :where(.organic-structure,.semi-developed-formula,.semi-developed-molecule,.alkene-example-molecule,.alkane-tie-diagram,.cyclic-example-wrap) { background:#1b2d25 !important; color:#e8f2ed !important; border-color:#405c4d !important; }
html.theme-dark :where(.organic-structure,.semi-developed-formula,.semi-developed-molecule,.alkene-example-molecule,.alkane-tie-diagram,.cyclic-example-wrap) :is(i,.branch) { color:#c9d8d0 !important; }
html.theme-dark .radical-sketch { color:#dce9e2 !important; }
/* Els connectors verticals i horitzontals de les fórmules semidesenvolupades
   comparteixen el mateix gris. Els fem de 2 px per evitar un tint visual per
   l'antialiàsing dels traços d'1,5 px sobre el fons fosc. */
html.theme-dark :where(.semi-main > i,.alkene-example-main > i,.alkane-main-chain > i) { color:#dce9e2 !important; }
html.theme-dark main :where(.semi-branch::after,.alkene-branch-carbon > b::after,.branch::before) { background-color:#dce9e2 !important; width:2px !important; box-shadow:none !important; }
html.theme-dark .alkane-tie-diagram .branch::before { background-color:#dce9e2 !important; }
/* Regles explícites: alguns navegadors no apliquen de manera fiable un
   pseudoelement inclòs dins :where(). */
html.theme-dark main .semi-branch::after { background:#dce9e2 !important; width:2px !important; box-shadow:none !important; }
html.theme-dark main .alkene-branch-carbon b::after { background:#dce9e2 !important; width:2px !important; box-shadow:none !important; }
html.theme-dark main .branch::before { background:#dce9e2 !important; width:2px !important; box-shadow:none !important; }
html.theme-dark :where(.cyclic-bonds,.cycle-sketch,.unsaturation-sketch,.aromatic-sketch,.ether-structure-sketch,.naphthalene-sketch,.anthracene-sketch) :is(polygon,polyline,line,rect) { stroke:#dce9e2 !important; }
/* Alguns esquemes de les guies duen els enllaços directament dins l'SVG, sense
   una classe comuna. Per això tots els traços moleculars del contingut comparteixen
   aquest mateix gris clar, tant si són verticals com horitzontals. */
html.theme-dark main svg :is(line,polyline,polygon,path,rect) { stroke:#dce9e2 !important; }
html.theme-dark :where(.cyclic-groups,.unsaturation-sketch text,.aromatic-sketch text,.ether-structure-sketch text) { fill:#e8f2ed !important; }
html.theme-dark .periodic-family { background:#29473a !important; color:#f0f6f2 !important; font-size:.78rem !important; font-weight:700 !important; line-height:1.18 !important; letter-spacing:.02em; text-shadow:0 1px 1px rgba(0,0,0,.24); }
html.theme-dark .periodic-element { background:#243a30 !important; color:#e1ece6 !important; border-color:#507061 !important; }
html.theme-dark .periodic-element.nonmetal { background:#4b391b !important; border-color:#a98442 !important; }
html.theme-dark .periodic-element.noble { background:#293d54 !important; border-color:#6384a6 !important; }
html.theme-dark .periodic-element.transition { background:#392c50 !important; border-color:#7f63a5 !important; }
html.theme-dark .diatomic-map::before { border-color:#405c4d !important; background-image:linear-gradient(to right,#405c4d 1px,transparent 1px),linear-gradient(to bottom,#405c4d 1px,transparent 1px) !important; }
html.theme-dark .diatomic-head { color:#c5d6cc !important; }
html.theme-dark .diatomic-cell { background:#1b2d25 !important; color:#b8c8bf !important; border-color:#527061 !important; }
