/* ===== Substanțe anorganice – stil comun ===== */
:root {
  color-scheme: light;
  --antet: #0b2545;            /* bara de sus */
  --titlu: #0b2545;            /* titluri */
  --titlu-2: #13315c;
  --turcoaz: #13a89e;          /* accent */
  --turcoaz-inchis: #0b7a72;   /* text accentuat, linkuri */
  --fond: #f4f8fb;             /* fundalul paginii */
  --panou: #ffffff;            /* fundalul conținutului */
  --panou-2: #eef7f6;          /* casete evidențiate */
  --chip: #e0f4f2;             /* butoane-filă */
  --buton: #0b2545; --buton-text: #ffffff;
  --text: #1c2733;
  --text-2: #4a5a6a;
  --linie: #d9e3ec;
  --linie-2: #eef2f5;
  --rosu: #b3261e;
  --verde: #2e7d32;
  --umbra: 0 2px 10px rgba(11, 37, 69, .08);
  --nav-text: #dbe7f3;
  --card-jos: #f6fbfb;
  --lit: #e6edf2;
  --ales: #eef3f9;
  --bine: #f4fbf6; --bine-linie: #7cc49a; --corect: #e7f6ec;
  --gresit-q: #fdf6f5; --gresit-linie: #e7a3a0; --gresit: #fbe9e7;
}
/* tema întunecată: urmează setarea dispozitivului, dacă nu s-a ales altfel din buton */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --antet: #071425; --titlu: #e7eef6; --titlu-2: #b7cbe2; --turcoaz: #2ac2b6; --turcoaz-inchis: #5fd8cd;
  --fond: #0c1520; --panou: #142131; --panou-2: #17303a; --chip: #1c3a40; --buton: #275a8c; --buton-text: #ffffff;
  --text: #dbe5ee; --text-2: #9fb1c2; --linie: #2a3b4e; --linie-2: #1f2e3e; --rosu: #ff8a80; --verde: #7fd99a;
  --umbra: 0 2px 14px rgba(0, 0, 0, .45); --nav-text: #c9d6e3; --card-jos: #19293a; --lit: #23364b; --ales: #1d3350;
  --bine: #13301f; --bine-linie: #2f7a4c; --corect: #1b4a2c; --gresit-q: #351c1c; --gresit-linie: #8a3a36; --gresit: #4d2220;
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --antet: #071425; --titlu: #e7eef6; --titlu-2: #b7cbe2; --turcoaz: #2ac2b6; --turcoaz-inchis: #5fd8cd;
  --fond: #0c1520; --panou: #142131; --panou-2: #17303a; --chip: #1c3a40; --buton: #275a8c; --buton-text: #ffffff;
  --text: #dbe5ee; --text-2: #9fb1c2; --linie: #2a3b4e; --linie-2: #1f2e3e; --rosu: #ff8a80; --verde: #7fd99a;
  --umbra: 0 2px 14px rgba(0, 0, 0, .45); --nav-text: #c9d6e3; --card-jos: #19293a; --lit: #23364b; --ales: #1d3350;
  --bine: #13301f; --bine-linie: #2f7a4c; --corect: #1b4a2c; --gresit-q: #351c1c; --gresit-linie: #8a3a36; --gresit: #4d2220;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--fond); color: var(--text);
  font: 17px/1.6 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { max-width: 100%; height: auto; }
a { color: var(--turcoaz-inchis); }
sub, sup { font-size: .72em; line-height: 0; }

/* ---------- antet + meniu ---------- */
.antet { background: var(--antet); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.antet-in { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 60px; }
.sigla { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.sigla-semn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--turcoaz); font-size: 1.1rem; }
.nav { margin-left: auto; }
.nav > ul { list-style: none; margin: 0; padding: 0; display: flex; }
.nav-el { position: relative; }
.nav-titlu {
  display: flex; align-items: center; gap: 5px; padding: 18px 9px; white-space: nowrap; color: var(--nav-text); background: none; border: 0;
  font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none; border-bottom: 3px solid transparent;
}
.nav-titlu:hover, .nav-el.deschis > .nav-titlu { color: #fff; }
.nav-el.activ > .nav-titlu { color: #fff; border-bottom-color: var(--turcoaz); }
.nav-titlu.acasa { color: #9fd9d4; }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.sub {
  display: none; position: absolute; left: 0; top: 100%; background: var(--panou); color: var(--text);
  border-radius: 0 0 10px 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 16px 20px; gap: 28px; min-width: 260px;
}
.nav-el.deschis > .sub { display: flex; }
.nav-el:nth-last-child(-n+5) > .sub { left: auto; right: 0; }
.sub-col { min-width: 200px; }
.sub h3 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--turcoaz-inchis); }
.sub a { display: block; padding: 5px 8px; margin: 0 -8px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .95rem; }
.sub a:hover { background: var(--fond); }
.sub a.pagina-curenta { background: var(--chip); color: var(--turcoaz-inchis); font-weight: 600; }
.buton-meniu { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.buton-meniu span { display: block; width: 24px; height: 2px; background: #fff; margin: 5px 0; }

/* ---------- conținut ---------- */
.continut {
  max-width: 980px; margin: 28px auto; padding: 32px 40px 24px; background: var(--panou);
  border-radius: 14px; box-shadow: var(--umbra);
}
.continut h1 { color: var(--titlu); font-size: 1.9rem; line-height: 1.25; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 3px solid var(--turcoaz); }
.continut h2 { color: var(--titlu-2); font-size: 1.4rem; margin: 32px 0 12px; }
.continut section + section { border-top: 1px solid var(--linie); margin-top: 28px; }
.continut p { margin: .45em 0; }

/* culorile vechi, păstrate ca accente */
.c1 { color: var(--titlu-2); }
.c2 { color: var(--turcoaz-inchis); }
.c3 { color: var(--rosu); }
.c4 { color: var(--verde); }
.b { font-weight: 700; }

/* tabele (ecuații, formule) */
.tabel { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.tabel table { border-collapse: collapse; min-width: 100%; }
.tabel td { padding: 6px 10px; vertical-align: top; }
.tabel table.grila { min-width: 0; margin: 0 auto; }
.tabel table.grila td { border: 1px solid var(--linie); text-align: center; padding: 10px 18px; }

/* săgeată de reacție cu condiții deasupra */
.sageata { display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: -0.15em; margin: 0 4px; min-width: 3.6em; line-height: 1; }
.sageata span { font-weight: 400; font-size: .72em; color: var(--text-2); text-align: center; padding: 0 6px 2px 2px; white-space: nowrap; }
.sageata::after { content: ""; height: 10px; background:
  linear-gradient(currentColor, currentColor) left center / calc(100% - 6px) 2px no-repeat,
  conic-gradient(from -120deg at right, currentColor 60deg, transparent 0) right center / 9px 10px no-repeat; }

/* fișe: cuprins */
.cuprins { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; position: sticky; top: 60px; background: var(--panou); padding: 10px 0; z-index: 5; }
.cuprins a { padding: 5px 12px; border-radius: 999px; background: var(--chip); color: var(--turcoaz-inchis); text-decoration: none; font-size: .9rem; font-weight: 600; }
.cuprins a:hover { background: var(--turcoaz); color: #fff; }
.cuprins a.activ { background: var(--buton); color: var(--buton-text); }
.cuprins a.toata { background: none; border: 1px dashed #9cc9c4; }
.cuprins a.toata.activ { background: var(--buton); border-color: var(--buton); }
.cu-file section.ascuns { display: none; }
.cu-file section + section { border-top: 0; margin-top: 0; }
.cu-file.toata-fisa section + section { border-top: 1px solid var(--linie); margin-top: 28px; }
.cu-file section > h2:first-child { margin-top: 18px; }
.sectiuni-vecine { display: none; justify-content: space-between; gap: 10px; margin-top: 26px; }
.cu-file:not(.toata-fisa) .sectiuni-vecine { display: flex; }
.sectiuni-vecine a { padding: 7px 14px; border-radius: 999px; background: var(--chip); color: var(--turcoaz-inchis); text-decoration: none; font-weight: 600; font-size: .92rem; }
.sectiuni-vecine a.urm { margin-left: auto; background: var(--buton); color: var(--buton-text); }
.sectiuni-vecine a:hover { background: var(--turcoaz); color: #fff; }
@media print { .cu-file section.ascuns { display: block; } .sectiuni-vecine { display: none !important; } }

/* pagina de start */
.carduri { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 0 0 28px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--linie);
  text-decoration: none; color: var(--text); background: linear-gradient(180deg, var(--panou), var(--card-jos)); transition: .15s; }
.card:hover { border-color: var(--turcoaz); transform: translateY(-2px); box-shadow: var(--umbra); }
.card strong { color: var(--titlu); font-size: 1.1rem; }
.card small { color: var(--text-2); }
.card-nr { font-size: .8rem; font-weight: 700; color: var(--turcoaz-inchis); }
figure { margin: 12px 0; text-align: center; }
.resurse li { margin: 6px 0; }

/* înapoi / înainte */
.pagini-vecine { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--linie); }
.pagini-vecine a { display: flex; flex-direction: column; text-decoration: none; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--linie); color: var(--titlu); font-weight: 600; max-width: 48%; }
.pagini-vecine a:hover { border-color: var(--turcoaz); }
.pagini-vecine small { color: var(--text-2); font-weight: 400; }
.pagini-vecine .inainte { text-align: right; margin-left: auto; }

/* subsol */
.subsol { color: var(--text-2); font-size: .88rem; text-align: center; padding: 8px 16px 28px; }
.subsol p { margin: 4px 0; }

/* ---------- telefon / tabletă ---------- */
@media (max-width: 1180px) {
  .buton-meniu { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--antet); max-height: calc(100vh - 60px); overflow-y: auto; }
  .nav.deschis { display: block; }
  .nav > ul { flex-direction: column; padding-bottom: 10px; }
  .nav-titlu { width: 100%; padding: 12px 16px; justify-content: space-between; border-bottom: 0; border-left: 3px solid transparent; }
  .nav-el.activ > .nav-titlu { border-left-color: var(--turcoaz); }
  .sub { position: static; border-radius: 0; box-shadow: none; flex-direction: column; gap: 10px; padding: 8px 16px 14px 28px; }
}
@media (max-width: 760px) {
  .cuprins { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 10px 16px; }
  .cuprins::-webkit-scrollbar { display: none; }
  .cuprins a { flex: none; }
  .continut { margin: 0; border-radius: 0; padding: 20px 16px; box-shadow: none; }
  .continut h1 { font-size: 1.5rem; }
}
@media print {
  .antet, .pagini-vecine, .cuprins, .subsol { display: none; }
  .continut { box-shadow: none; margin: 0; }
}

/* ---------- animații ---------- */
.animatie { margin: 18px 0 22px; border: 1px solid var(--linie); border-radius: 14px; overflow: hidden; background: var(--panou); box-shadow: var(--umbra); }
.anim-antet { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 10px 16px; background: var(--panou-2); border-bottom: 1px solid var(--linie); }
.anim-tip { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--turcoaz-inchis); }
.anim-ec { font-weight: 700; color: var(--titlu); }
.anim-scena canvas { display: block; width: 100%; aspect-ratio: 2 / 1; }
.anim-bara { height: 4px; background: var(--linie-2); }
.anim-bara span { display: block; height: 100%; width: 0; background: var(--turcoaz); }
.anim-jos { display: flex; align-items: flex-start; gap: 14px; padding: 12px 16px 14px; }
.anim-buton { flex: none; font: inherit; font-weight: 700; font-size: .92rem; color: var(--buton-text); background: var(--buton); border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; min-width: 118px; }
.anim-buton:hover { background: var(--turcoaz-inchis); }
.anim-text { margin: 4px 0 0 !important; color: var(--text-2); font-size: .95rem; line-height: 1.45; }
@media (max-width: 560px) { .anim-jos { flex-direction: column; gap: 8px; } }
@media print { .animatie { display: none; } }

/* ---------- tabele cu indicatori: celula are culoarea indicatorului ---------- */
.tabel td.ind { font-weight: 700; text-align: center; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--panou); }
.ind-rosu { background: #d8352e !important; color: #fff; }
.ind-albastru { background: #2f62c9 !important; color: #fff; }
.ind-galben { background: #f5d227 !important; color: #3d3200; }
.ind-violet { background: #c2178c !important; color: #fff; }
.ind-portocaliu { background: #f08a24 !important; color: #fff; }
.ind-violet-t { background: #7b4bb5 !important; color: #fff; }
.ind-incolor { background: var(--panou) !important; color: var(--text-2); outline: 2px dashed #8fa3b6; outline-offset: -6px; }

/* ---------- teste ---------- */
.test-info { background: var(--panou-2); border-left: 4px solid var(--turcoaz); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.test-lista { list-style: none; counter-reset: q; padding: 0; margin: 18px 0; }
.test-q { counter-increment: q; border: 1px solid var(--linie); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; }
.test-q.q-bine { border-color: var(--bine-linie); background: var(--bine); }
.test-q.q-gresit { border-color: var(--gresit-linie); background: var(--gresit-q); }
.test-enunt { font-weight: 600; color: var(--titlu); margin: 0 0 10px !important; }
.test-enunt::before { content: counter(q) ". "; color: var(--turcoaz-inchis); }
.test-variante { display: grid; gap: 8px; }
.test-v { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--linie); border-radius: 10px; cursor: pointer; background: var(--panou); }
.test-v:hover { border-color: var(--turcoaz); }
.test-v input { position: absolute; opacity: 0; pointer-events: none; }
.test-v input:focus-visible + .test-lit { outline: 3px solid var(--turcoaz); outline-offset: 2px; }
.test-lit { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--lit); color: var(--titlu); }
.test-v.ales { border-color: var(--buton); background: var(--ales); }
.test-v.ales .test-lit { background: var(--buton); color: #fff; }
.test-v.corect { border-color: #2e8b57; background: var(--corect); }
.test-v.corect .test-lit { background: #2e8b57; color: #fff; }
.test-v.gresit { border-color: #c0392b; background: var(--gresit); }
.test-v.gresit .test-lit { background: #c0392b; color: #fff; }
.test-v input:disabled ~ * { cursor: default; }
.test-expl { margin: 10px 0 0 !important; font-size: .95rem; color: var(--text-2); }
.test-jos { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.test-buton { font: inherit; font-weight: 700; color: var(--buton-text); background: var(--buton); border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; }
.test-buton:hover { background: var(--turcoaz-inchis); }
.test-progres { color: var(--text-2); font-size: .92rem; }
.test-rezultat { margin-top: 18px; padding: 16px 18px; border-radius: 12px; background: var(--panou-2); border: 1px solid var(--linie); }
.test-scor { display: flex; align-items: center; gap: 14px; color: var(--titlu); }
.test-puncte { font-size: 2.4rem; font-weight: 800; color: var(--turcoaz-inchis); }
.test-puncte small { font-size: 1.2rem; color: var(--text-2); }
.test-rezultat p { margin: 8px 0 0 !important; }
@media print { .test-buton, .test-progres { display: none; } }

/* ---------- scheme recapitulative (SVG) ---------- */
.schema { overflow-x: auto; margin: 10px 0 6px; border: 1px solid var(--linie); border-radius: 12px; background: #ffffff; padding: 10px; -webkit-overflow-scrolling: touch; }
.schema svg { display: block; width: 100%; min-width: 720px; height: auto; }
.exemple-titlu { font-size: 1.05rem; color: var(--turcoaz-inchis); margin: 18px 0 4px; }
.tabel table.exemple td:first-child { color: var(--text-2); width: 38%; }
.tabel table.exemple tr + tr td { border-top: 1px solid var(--linie-2); }
@media (max-width: 760px) { .schema::after { content: "← glisează pentru a vedea toată schema →"; display: block; text-align: center; font-size: .8rem; color: var(--text-2); margin-top: 6px; } }

/* ---------- buton temă (zi / noapte) ---------- */
.buton-tema { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
  color: #fff; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; margin-left: 6px; }
.buton-tema:hover { background: rgba(255,255,255,.18); }
@media (max-width: 1180px) { .buton-tema { margin-left: auto; } .buton-tema + .buton-meniu { margin-left: 0; } }
/* în modul întunecat, imaginile, schemele și animațiile rămân pe fond deschis (planșe) */
:root[data-theme="dark"] .continut img { background: #fff; border-radius: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .continut img { background: #fff; border-radius: 8px; } }
