/* chem8-textbook.css — фреймворк интерактивных учебников «Химия 8».
   Палитра amber; структура и классы повторяют учебники физики. */

:root{
  --bg:#fffbeb; --card:#fff; --card-soft:#fef9ec; --text:#1c1917; --muted:#78716c; --border:#f0e6cf;
  --pri:#d97706; --pri-d:#b45309; --pri-l:#fbbf24; --pri-soft:#fef3c7;
  --sec-acc:#d97706; --sec-acc-d:#b45309; --sec-acc-soft:#fef3c7;
  --ok:#15803d; --ok-bg:#dcfce7; --fail:#b91c1c; --fail-bg:#fee2e2; --warn:#b45309; --warn-bg:#fef3c7;
  --sh:0 1px 3px rgba(120,80,10,.07); --sh2:0 8px 28px rgba(120,80,10,.13);
  --mono:'JetBrains Mono',ui-monospace,monospace;
}
html.dark{
  --bg:#1c1410; --card:#271c14; --card-soft:#2e2118; --text:#fef3c7; --muted:#c9ab82; --border:#4a3520;
  --pri-soft:rgba(217,119,6,.18); --sec-acc-soft:rgba(217,119,6,.18);
  --ok-bg:rgba(21,128,61,.2); --fail-bg:rgba(185,28,28,.2); --warn-bg:rgba(180,83,9,.2);
}
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{min-height:100vh}
body{font-family:'Inter',system-ui,sans-serif;background:var(--bg);color:var(--text);line-height:1.6;transition:background .25s,color .25s}
a{color:inherit;text-decoration:none}
.ic{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}

/* HEADER */
.hdr{position:relative;background:linear-gradient(110deg,#92400e 0%,#d97706 55%,#fbbf24 100%);color:#fff;padding:26px 24px;overflow:hidden;border-bottom:2px solid rgba(255,255,255,.18)}
.hdr::before{content:'ХИМИЯ';position:absolute;right:-10px;top:50%;transform:translateY(-50%);font-family:'Unbounded',sans-serif;font-size:clamp(3rem,11vw,8rem);font-weight:900;letter-spacing:-.04em;color:transparent;-webkit-text-stroke:1.5px rgba(255,255,255,.12);line-height:1;pointer-events:none;user-select:none;z-index:0}
.hdr-row{position:relative;z-index:1;max-width:1240px;margin:0 auto;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.hdr h1{font-family:'Outfit',sans-serif;font-size:1.4rem;font-weight:900;letter-spacing:-.01em}
.hdr-sub{font-size:.84rem;opacity:.9;margin-top:3px;max-width:640px}
.hdr-side{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.hdr-btn{padding:8px 12px;background:rgba(255,255,255,.16);border:none;color:#fff;border-radius:9px;cursor:pointer;font-weight:600;font-size:.82rem;display:inline-flex;align-items:center;gap:6px;transition:background .15s;font-family:inherit;text-decoration:none}
.hdr-btn:hover{background:rgba(255,255,255,.26)}

/* LAYOUT */
.main{max-width:1240px;margin:0 auto;padding:22px 24px 60px;display:grid;grid-template-columns:1fr 290px;gap:26px;align-items:start}
@media(max-width:980px){.main{grid-template-columns:1fr;padding:16px}}
.col-main{min-width:0}
.col-side{position:sticky;top:14px;display:flex;flex-direction:column;gap:14px}
@media(max-width:980px){.col-side{position:static}}

/* HERO */
.hero{background:linear-gradient(135deg,var(--pri-soft),rgba(251,191,36,.1));border:1px solid var(--border);border-radius:18px;padding:22px 24px;margin-bottom:22px;position:relative;overflow:hidden}
.hero h2{font-family:'Outfit',sans-serif;font-size:1.4rem;font-weight:800;color:var(--pri-d);margin-bottom:8px}
html.dark .hero h2{color:var(--pri-l)}
.hero p{font-size:.92rem;color:var(--text);opacity:.86;max-width:640px;margin-bottom:14px}
.hero-row{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.btn-primary{padding:11px 20px;background:linear-gradient(135deg,var(--pri),var(--pri-l));color:#fff;border:0;border-radius:11px;font-weight:700;font-size:.92rem;display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-family:inherit;box-shadow:var(--sh2)}
.btn-primary:hover{filter:brightness(1.07)}
.hero-progress{flex:1;min-width:180px}
.hp-label{font-size:.74rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
.hp-bar{height:8px;background:rgba(217,119,6,.16);border-radius:5px;overflow:hidden;margin:5px 0}
.hp-fill{height:100%;background:linear-gradient(90deg,var(--pri),var(--pri-l));width:0;transition:width .5s}
.hp-text{font-size:.8rem;font-weight:700;color:var(--pri-d)}
.hero-xp-badge{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;background:linear-gradient(135deg,#f59e0b,var(--pri));color:#fff;border-radius:99px;font-size:.8rem;font-weight:800;font-family:'Unbounded',sans-serif}

/* PARA-SELECTOR */
.psel{margin-bottom:24px}
.psel-title{font-family:'Outfit',sans-serif;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:10px}
.psel-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}
.psel-card{position:relative;background:var(--card);border:1.5px solid var(--border);border-radius:13px;padding:13px 14px 16px;cursor:pointer;transition:transform .16s,box-shadow .16s,border-color .16s;overflow:hidden}
.psel-card:hover{transform:translateY(-3px);box-shadow:var(--sh2);border-color:var(--pri)}
.psel-card.active{border-color:var(--pri);box-shadow:0 0 0 2px var(--pri-soft)}
.psel-card.final{background:linear-gradient(135deg,var(--pri-soft),var(--card))}
.psel-num{font-family:'Outfit';font-weight:800;color:var(--pri);font-size:.84rem;margin-bottom:4px}
.psel-name{font-size:.86rem;font-weight:700;line-height:1.3}
.psel-sub{font-size:.74rem;color:var(--muted);margin-top:3px}
.psel-prog{height:5px;background:rgba(0,0,0,.07);border-radius:3px;overflow:hidden;margin-top:9px}
.psel-prog-fill{height:100%;width:0;background:linear-gradient(90deg,var(--pri),var(--pri-l));transition:width .5s}
.psel-done{position:absolute;top:9px;right:9px;width:20px;height:20px;border-radius:50%;background:var(--ok);display:none;align-items:center;justify-content:center}
.psel-done svg{width:12px;height:12px;stroke:#fff;fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.psel-card.done .psel-done{display:flex}

/* SECTIONS */
.sec{display:none}
.sec.active{display:block;animation:fadeIn .25s}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.sec-header{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.sec-num{background:linear-gradient(135deg,var(--pri),var(--pri-l));color:#fff;font-family:'Outfit';font-weight:800;font-size:.9rem;padding:6px 13px;border-radius:10px;flex-shrink:0}
.sec-h{font-family:'Outfit',sans-serif;font-size:1.25rem;font-weight:800;line-height:1.25}

/* PARA-HERO */
.para-hero{border-radius:16px;padding:20px 22px;color:#fff;position:relative;overflow:hidden;margin-bottom:18px}
.para-hero::after{content:'';position:absolute;right:-28px;top:-28px;width:140px;height:140px;border-radius:50%;opacity:.14;background:#fff}
.ph-label{font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;opacity:.8;margin-bottom:5px;position:relative;z-index:1}
.para-hero h2{font-family:'Outfit',sans-serif;font-size:1.25rem;font-weight:800;margin-bottom:9px;line-height:1.25;position:relative;z-index:1}
.ph-formula{display:inline-block;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.25);border-radius:10px;padding:6px 15px;font-weight:700;margin-bottom:10px;position:relative;z-index:1}
.ph-desc{font-size:.88rem;opacity:.92;line-height:1.6;margin-bottom:11px;max-width:680px;position:relative;z-index:1}
.ph-tags{display:flex;flex-wrap:wrap;gap:6px;position:relative;z-index:1}
.ph-tag{background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.25);border-radius:20px;padding:3px 11px;font-size:.72rem;font-weight:700}
.ph-1{background:linear-gradient(135deg,#92400e,#d97706 55%,#fbbf24)}
.ph-2{background:linear-gradient(135deg,#134e4a,#0d9488 55%,#2dd4bf)}
.ph-3{background:linear-gradient(135deg,#3730a3,#4f46e5 55%,#818cf8)}
.ph-4{background:linear-gradient(135deg,#1e3a8a,#2563eb 55%,#60a5fa)}
.ph-5{background:linear-gradient(135deg,#064e3b,#059669 55%,#34d399)}
.ph-6{background:linear-gradient(135deg,#7c2d12,#ea580c 55%,#fb923c)}
.ph-7{background:linear-gradient(135deg,#164e63,#0891b2 55%,#22d3ee)}
.ph-8{background:linear-gradient(135deg,#581c87,#9333ea 55%,#c084fc)}
.ph-9{background:linear-gradient(135deg,#831843,#db2777 55%,#f472b6)}
.ph-pr{background:linear-gradient(135deg,#7c2d12,#c2410c 55%,#fb923c)}
.ph-final{background:linear-gradient(135deg,#92400e,#d97706 55%,#f59e0b)}

/* CARDS */
.card{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:0;box-shadow:var(--sh);margin-bottom:14px;overflow:hidden}
.card-header{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border);background:var(--card-soft)}
.card-icon{width:32px;height:32px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#fff}
.card-icon.theory{background:linear-gradient(135deg,#2563eb,#60a5fa)}
.card-icon.example{background:linear-gradient(135deg,#059669,#34d399)}
.card-icon.rule{background:linear-gradient(135deg,#d97706,#fbbf24)}
.card-icon.lab{background:linear-gradient(135deg,#db2777,#f472b6)}
.card-icon .ic{width:17px;height:17px;stroke:#fff}
.card-title{font-family:'Outfit',sans-serif;font-weight:800;font-size:.96rem;flex:1}
.card-num{font-family:'Outfit';font-weight:800;color:var(--muted);font-size:.82rem}
.card-body{padding:15px 17px;font-size:.93rem}
.card-body p{margin-bottom:9px}.card-body p:last-child{margin-bottom:0}
.card-body ul,.card-body ol{margin:6px 0 9px 20px}
.card-body li{margin-bottom:4px}
.card-body b{color:var(--pri-d)}
html.dark .card-body b{color:var(--pri-l)}

.section-title{font-family:'Outfit';font-weight:800;font-size:1rem;margin:14px 0 10px;color:var(--pri-d)}
html.dark .section-title{color:var(--pri-l)}
.formula-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin:10px 0}
.fcard{background:var(--card-soft);border:1.5px solid var(--border);border-radius:12px;padding:13px 15px}
.fcard.highlight{border-color:var(--pri);background:var(--pri-soft)}
.fcard h3{font-family:'Outfit';font-size:.9rem;font-weight:800;margin-bottom:6px}
.main-f{font-size:1.05rem;font-weight:700;color:var(--pri-d);font-family:var(--mono)}
html.dark .main-f{color:var(--pri-l)}

.def-box{background:var(--pri-soft);border-left:4px solid var(--pri);border-radius:0 10px 10px 0;padding:12px 16px;margin:10px 0;font-size:.91rem;line-height:1.7}
.def-box b{color:var(--pri-d)}html.dark .def-box b{color:var(--pri-l)}
.remember-box{background:linear-gradient(135deg,var(--warn-bg),var(--pri-soft));border:1.5px solid var(--pri-l);border-radius:13px;padding:14px 17px;margin:14px 0}
.remember-box-title{font-weight:800;font-size:.86rem;color:#92400e;margin-bottom:8px;display:flex;align-items:center;gap:7px}
html.dark .remember-box-title{color:#fde68a}
.remember-box ul{margin:0 0 0 18px;font-size:.88rem}
.remember-box li{margin-bottom:5px}
.insight-box{background:linear-gradient(135deg,rgba(79,70,229,.07),rgba(139,92,246,.04));border:2px solid rgba(79,70,229,.2);border-radius:13px;padding:13px 16px;margin:14px 0}
.insight-title{font-weight:800;font-size:.82rem;color:#4f46e5;margin-bottom:7px;display:flex;align-items:center;gap:7px}
html.dark .insight-title{color:#a5b4fc}
.insight-box p{font-size:.85rem;line-height:1.75;margin-bottom:5px}
.note-safe{display:flex;gap:9px;background:var(--warn-bg);border:1px solid var(--pri-l);border-radius:10px;padding:10px 13px;font-size:.86rem;margin:10px 0}
.note-safe svg{stroke:var(--pri-d);margin-top:2px;width:18px;height:18px;fill:none;stroke-width:2}

/* life-grid */
.life-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin:14px 0}
.life-item{background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:13px 11px;text-align:center}
.li-icon{display:flex;justify-content:center;margin-bottom:7px}
.li-icon svg{width:26px;height:26px;stroke:var(--pri);fill:none;stroke-width:1.8}
.li-title{font-size:.82rem;font-weight:800;margin-bottom:3px}
.li-desc{font-size:.74rem;color:var(--muted);line-height:1.5}

/* q-list */
.q-list{margin:8px 0 0 20px;font-size:.9rem}
.q-list li{margin-bottom:7px;line-height:1.6}

/* TASKS */
.legacy-tasks{margin-top:20px;padding:16px 18px;background:var(--card);border:1.5px solid var(--border);border-radius:14px}
.lt-head{display:flex;gap:10px;align-items:center;margin-bottom:10px;flex-wrap:wrap}
.lt-title{font-weight:800;font-family:'Outfit'}
.chip{padding:3px 11px;border-radius:99px;font-weight:700;font-size:.8rem}
.chip-ok{margin-left:auto;background:var(--ok-bg);color:var(--ok)}
.chip-tot{background:rgba(120,80,10,.08);color:var(--muted)}
.lt-reset{padding:5px 11px;font-size:.78rem}
.prog-wrap{height:5px;background:rgba(0,0,0,.07);border-radius:3px;overflow:hidden;margin-bottom:10px}
.prog-fill{height:100%;width:0;background:linear-gradient(90deg,var(--pri),var(--pri-l));transition:width .4s}
.nav-dots{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:12px}
.nav-dot{min-width:30px;height:30px;padding:0 6px;border-radius:8px;border:2px solid var(--border);background:var(--card);font-size:.74rem;font-weight:700;cursor:pointer;display:grid;place-items:center;color:var(--muted);font-family:var(--mono);transition:.15s}
.nav-dot:hover{border-color:var(--pri);color:var(--pri)}
.nav-dot.nd-cur{background:var(--pri);border-color:var(--pri);color:#fff}
.nav-dot.nd-ok{background:var(--ok-bg);border-color:var(--ok);color:var(--ok)}
.nav-dot.nd-fail{background:var(--fail-bg);border-color:var(--fail);color:var(--fail)}
.task-card{background:var(--card-soft);border:1px solid var(--border);border-radius:12px;padding:14px 16px}
.task-num{font-size:.74rem;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}
.task-text{font-size:.94rem;line-height:1.65;margin-bottom:11px}
.task-hint{display:flex;gap:7px;align-items:flex-start;background:var(--warn-bg);border-radius:9px;padding:8px 12px;font-size:.84rem;margin-bottom:11px;color:var(--text)}
.task-hint svg{stroke:var(--pri-d);width:15px;height:15px;flex-shrink:0;margin-top:2px}
.ans-row{display:flex;gap:9px;align-items:center;flex-wrap:wrap}
.ans-row label{font-weight:700;font-size:.88rem}
.ans-inp{padding:8px 12px;border:1.5px solid var(--border);border-radius:9px;background:var(--card);color:var(--text);font-family:var(--mono);width:120px;font-size:.95rem}
.ans-inp:focus{outline:0;border-color:var(--pri);box-shadow:0 0 0 3px var(--pri-soft)}
.unit-lbl{font-size:.86rem;color:var(--muted);font-weight:600}
.mcq-opts{display:flex;flex-direction:column;gap:8px}
.mcq-opt{width:100%;text-align:left;padding:11px 15px;border:2px solid var(--border);border-radius:10px;background:var(--card);color:var(--text);font-size:.9rem;cursor:pointer;transition:.16s;line-height:1.5;font-family:inherit}
.mcq-opt:hover:not(:disabled){border-color:var(--pri);background:var(--pri-soft)}
.mcq-let{font-weight:800;margin-right:6px;color:var(--pri)}
.mcq-opt.mcq-cor{border-color:var(--ok)!important;background:var(--ok-bg)!important;color:var(--ok)!important;font-weight:700}
.mcq-opt.mcq-wrong{border-color:var(--fail)!important;background:var(--fail-bg)!important;color:var(--fail)!important}
.feedback{display:none;padding:11px 14px;border-radius:10px;font-size:.89rem;margin-top:10px;line-height:1.55}
.feedback.show{display:block}
.feedback.fb-ok{background:var(--ok-bg);color:var(--ok);border-left:4px solid var(--ok)}
.feedback.fb-fail{background:var(--fail-bg);color:var(--fail);border-left:4px solid var(--fail)}
.feedback b{font-weight:800}
.lt-foot{display:flex;justify-content:flex-end;margin-top:10px}
.summary{display:none;text-align:center;padding:16px;margin-top:12px;background:linear-gradient(135deg,var(--pri-soft),var(--card));border-radius:12px}
.summary.show{display:block}
.sum-t{font-weight:800;margin-bottom:5px;font-family:'Outfit'}
.big-score{font-size:1.6rem;font-weight:900;color:var(--pri-d)}
html.dark .big-score{color:var(--pri-l)}
.sum-grade{margin-top:5px;color:var(--muted);font-size:.88rem}

/* BUTTONS */
.btn{font-family:inherit;font-weight:700;font-size:.88rem;padding:8px 15px;border-radius:9px;border:1.5px solid var(--border);background:var(--card);color:var(--text);cursor:pointer;transition:.15s;display:inline-flex;align-items:center;gap:7px}
.btn:hover{border-color:var(--pri);background:var(--pri-soft)}
.btn.primary{background:linear-gradient(135deg,var(--pri),var(--pri-l));color:#fff;border-color:transparent}
.btn.primary:hover{filter:brightness(1.08)}
.sec-nav{display:flex;justify-content:space-between;gap:12px;margin-top:20px}
.read-wrap{margin-top:18px;display:flex;justify-content:center}

/* SIDEBAR cards */
.sidecard{background:var(--card);border:1px solid var(--border);border-radius:13px;padding:14px 16px;box-shadow:var(--sh)}
.sidecard h4{font-family:'Outfit';font-size:.86rem;font-weight:800;margin-bottom:9px;display:flex;align-items:center;gap:6px}
.sidecard h4 svg{width:14px;height:14px}
.sidecard-row{font-size:.85rem;padding:5px 0;border-bottom:1px dashed var(--border);line-height:1.5}
.sidecard-row:last-child{border-bottom:0}
.sidecard-row b{color:var(--pri-d);font-weight:700}
html.dark .sidecard-row b{color:var(--pri-l)}
.sidecard-row.done{color:var(--ok);border-bottom:0;padding:3px 0}
.sidecard.tip{background:linear-gradient(135deg,var(--warn-bg),var(--pri-soft));border-color:var(--pri-l)}
.sidecard.tip h4{color:#92400e}html.dark .sidecard.tip h4{color:#fde68a}
.xp-card{background:linear-gradient(135deg,var(--pri),var(--pri-d));color:#fff;border-radius:13px;padding:14px 16px;box-shadow:var(--sh)}
.xp-card-title{display:flex;justify-content:space-between;font-size:.78rem;font-weight:700;margin-bottom:8px}
.xp-level{background:rgba(255,255,255,.22);padding:2px 9px;border-radius:99px;font-weight:800}
.xp-bar{height:7px;background:rgba(255,255,255,.25);border-radius:4px;overflow:hidden}
.xp-fill{height:100%;background:#fff;transition:width .5s}
.xp-nums{display:flex;justify-content:space-between;font-size:.72rem;margin-top:5px;opacity:.9}

/* FLAGSHIP */
.flag-card{position:relative;background:linear-gradient(135deg,var(--card),var(--pri-soft));border:2px solid var(--pri);border-radius:16px;padding:18px 20px;margin:16px 0}
.flag-card::before{content:'★ ФЛАГМАН';position:absolute;top:12px;right:14px;background:linear-gradient(135deg,#fbbf24,#f59e0b);color:#fff;padding:4px 11px;border-radius:99px;font-weight:800;font-size:.66rem;letter-spacing:.03em}
.flag-title{font-family:'Outfit';font-weight:800;font-size:1.02rem;color:var(--pri-d);margin-bottom:4px;padding-right:90px}
html.dark .flag-title{color:var(--pri-l)}
.flag-help{font-size:.84rem;color:var(--muted);margin-bottom:12px}

/* WIDGET shell (общий для виджетов §) */
.wgt{background:var(--card);border:1.5px solid var(--pri-soft);border-radius:14px;padding:16px 18px;box-shadow:var(--sh);margin:14px 0}
.wgt-h{font-family:'Outfit';font-size:.94rem;font-weight:800;color:var(--pri-d);margin-bottom:10px;display:flex;align-items:center;gap:8px}
html.dark .wgt-h{color:var(--pri-l)}
.wgt-h svg{stroke:var(--pri);width:18px;height:18px;fill:none;stroke-width:2}
.fld{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}
.fld label{font-size:.85rem;font-weight:600;color:var(--muted)}
.wgt input[type=text],.wgt input[type=number],.wgt select{font-family:inherit;font-size:.94rem;padding:8px 11px;border:1.5px solid var(--border);border-radius:9px;background:var(--card);color:var(--text)}
.wgt input:focus,.wgt select:focus{outline:0;border-color:var(--pri);box-shadow:0 0 0 3px var(--pri-soft)}
.out{margin-top:10px;padding:11px 14px;border-radius:10px;font-size:.92rem;background:var(--card-soft);border:1px solid var(--border)}
.out.ok{background:var(--ok-bg);border-color:#86efac;color:var(--ok)}
.out.bad{background:var(--fail-bg);border-color:#fca5a5;color:var(--fail)}
.bd{font-family:var(--mono);font-size:.88rem;line-height:1.75}

/* mole triangle */
.mtri{display:grid;grid-template-columns:170px 1fr;gap:16px;align-items:center}
@media(max-width:560px){.mtri{grid-template-columns:1fr}}
.mtri-svg{width:170px;height:128px;color:var(--pri)}
.mtri-fields{display:flex;flex-direction:column;gap:9px}
.mtri-f{display:flex;flex-direction:column;gap:3px}
.mtri-lab{font-size:.78rem;font-weight:700;color:var(--muted)}
.mtri-f input{width:100%;padding:8px 11px;border:1.5px solid var(--border);border-radius:9px;background:var(--card);color:var(--text);font-family:var(--mono)}
.mtri-f input:focus{outline:0;border-color:var(--pri);box-shadow:0 0 0 3px var(--pri-soft)}
.mtri-out{grid-column:1/-1;padding:10px 13px;border-radius:10px;background:var(--card-soft);border:1px solid var(--border);font-size:.9rem}
.mtri-out.ok{background:var(--ok-bg);border-color:#86efac;color:var(--ok)}
.mtri-out b{display:block;font-size:1.02rem}
.mtri-form{display:block;font-family:var(--mono);font-size:.83rem;opacity:.85;margin-top:3px}

/* equation balancer */
.ceqb-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:1.05rem;font-weight:600;margin-bottom:12px}
.ceqb-sp{display:inline-flex;align-items:center;gap:3px}
.ceqb-coef{width:46px;text-align:center;padding:6px 4px;font-weight:800;border:1.5px solid var(--border);border-radius:8px;background:var(--card);color:var(--text);font-family:var(--mono)}
.ceqb-coef:focus{outline:0;border-color:var(--pri);box-shadow:0 0 0 3px var(--pri-soft)}
.ceqb-f{font-weight:700}
.ceqb-plus,.ceqb-arrow{color:var(--muted);font-weight:800;padding:0 2px}
.ceqb-arrow{color:var(--pri);font-size:1.2rem}
.ceqb-actions{display:flex;gap:8px;flex-wrap:wrap}
.ceqb-out{margin-top:10px}
.ceqb-msg{font-weight:700;margin-bottom:6px}
.ceqb-out.ok .ceqb-msg{color:var(--ok)}
.ceqb-out.bad .ceqb-msg{color:var(--fail)}
.ceqb-tab{border-collapse:collapse;font-size:.84rem;font-family:var(--mono)}
.ceqb-tab th,.ceqb-tab td{border:1px solid var(--border);padding:4px 12px;text-align:center}
.ceqb-tab tr.ne td{background:var(--fail-bg);color:var(--fail)}
.ceqb-tab tr.eq td{background:var(--ok-bg);color:var(--ok)}
.ceqb-btn{font-family:inherit;font-weight:700;font-size:.86rem;padding:7px 14px;border-radius:9px;border:1.5px solid var(--border);background:var(--card);color:var(--text);cursor:pointer}
.ceqb-btn.primary{background:linear-gradient(135deg,var(--pri),var(--pri-l));color:#fff;border-color:transparent}

/* element grid */
.el-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(52px,1fr));gap:6px;margin-top:8px}
.el-cell{aspect-ratio:1;border:1px solid var(--border);border-radius:8px;background:var(--card);display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;transition:.12s;padding:2px}
.el-cell:hover,.el-cell.on{background:var(--pri-soft);border-color:var(--pri);transform:translateY(-2px)}
.el-cell .z{font-size:.58rem;color:var(--muted)}
.el-cell .s{font-size:1.02rem;font-weight:800;color:var(--pri-d)}
html.dark .el-cell .s{color:var(--pri-l)}
.el-cell .a{font-size:.54rem;color:var(--muted)}
.el-info{margin-top:10px;padding:12px 14px;border-radius:10px;background:var(--card-soft);border:1px solid var(--border);font-size:.92rem;min-height:46px}

/* DnD */
.dnd-pool{display:flex;flex-wrap:wrap;gap:8px;border:1.5px dashed var(--border);border-radius:10px;padding:10px;min-height:48px;margin-bottom:10px}
.dnd-chip{padding:7px 13px;border:1.5px solid var(--border);border-radius:10px;cursor:grab;background:var(--card);font-size:.86rem;font-weight:600;user-select:none}
.dnd-chip.placed{background:var(--pri-soft);border-color:var(--pri)}
.dnd-zones{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.drop-box{border:1.5px dashed var(--border);border-radius:10px;padding:10px;min-height:80px;background:var(--card-soft)}
.drop-box.over{border-color:var(--pri);background:var(--pri-soft);border-style:solid}
.drop-box h5{font-size:.8rem;font-weight:800;margin-bottom:8px;text-align:center;color:var(--pri-d)}
html.dark .drop-box h5{color:var(--pri-l)}

/* testTube */
.tt-svg{color:var(--pri);vertical-align:bottom}
.tt-row{display:flex;gap:18px;flex-wrap:wrap;align-items:flex-end;margin:10px 0}
.tt-cap{font-size:.84rem;color:var(--muted);text-align:center;max-width:120px}

/* indicatorScale */
.ind-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.ind-row label{font-size:.85rem;font-weight:600;color:var(--muted)}
.ind-strip{height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:.92rem;border:1px solid var(--border);transition:background .25s}
.ind-label{margin-top:8px;font-size:.9rem}
.ind-label b{color:var(--pri-d)}html.dark .ind-label b{color:var(--pri-l)}

/* classifier */
.cls-chip.on{border-color:var(--pri);box-shadow:0 0 0 3px var(--pri-soft)}
.cls-chip.cls-ok{background:var(--ok-bg);border-color:var(--ok);color:var(--ok)}
.cls-chip.cls-bad{background:var(--fail-bg);border-color:var(--fail);color:var(--fail)}
.cls-items{display:flex;flex-wrap:wrap;gap:6px;min-height:24px}

/* solubilityTable */
.sol-wrap{overflow-x:auto}
.sol-tab{border-collapse:collapse;font-size:.78rem;font-family:var(--mono);min-width:520px}
.sol-tab th,.sol-tab td{border:1px solid var(--border);padding:4px 6px;text-align:center;cursor:pointer}
.sol-tab thead th{background:var(--card-soft);font-weight:800}
.sol-tab th[data-an]{background:var(--card-soft);font-weight:800}
.sol-tab td.sP{background:rgba(37,99,235,.12);color:#1d4ed8}
.sol-tab td.sM{background:rgba(245,158,11,.18);color:#b45309}
.sol-tab td.sH{background:rgba(220,38,38,.14);color:#b91c1c}
.sol-tab td.sX{background:rgba(120,120,120,.12);color:var(--muted)}
.sol-tab td.sol-dim,.sol-tab th.sol-dim{opacity:.3}
.sol-tab td.sol-hot{outline:3px solid var(--pri);outline-offset:-3px;font-weight:900}
.sol-out{margin-top:10px}

/* activitySeries */
.act-row{display:flex;flex-wrap:wrap;gap:4px;align-items:center}
.act-cell{font-family:var(--mono);font-weight:800;font-size:.82rem;padding:7px 9px;border:1.5px solid var(--border);border-radius:8px;background:var(--card);color:var(--text);cursor:pointer;transition:.12s}
.act-cell:hover{border-color:var(--pri)}
.act-cell.act-h{background:var(--card-soft);color:var(--muted);cursor:default;font-size:.74rem}
.act-cell.act-on{background:var(--pri);border-color:var(--pri);color:#fff}
.act-cell.act-disp{background:var(--ok-bg);border-color:var(--ok);color:var(--ok)}
.act-axis{display:flex;justify-content:space-between;font-size:.72rem;color:var(--muted);margin:6px 2px}
.act-out{margin-top:8px}

/* miniPeriodic */
.pt-wrap{overflow-x:auto;padding-bottom:6px}
.pt-grid{display:grid;grid-template-columns:repeat(18,minmax(30px,1fr));grid-auto-rows:34px;gap:2px;min-width:600px}
.pt-cell{position:relative;border:1px solid var(--border);border-radius:5px;background:var(--card);cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:1px;transition:.1s;overflow:hidden}
.pt-cell:hover{transform:scale(1.12);z-index:2;border-color:var(--pri)}
.pt-z{font-size:.5rem;color:var(--muted);line-height:1}
.pt-s{font-size:.74rem;font-weight:800;line-height:1.05}
.pt-metal{background:rgba(13,148,136,.12)}
.pt-nonmetal{background:rgba(245,158,11,.16)}
.pt-metalloid{background:rgba(124,58,237,.13)}
.pt-noble{background:rgba(37,99,235,.13)}
.pt-lanth,.pt-act{background:rgba(219,39,119,.12)}
.pt-lanth .pt-z,.pt-act .pt-z{font-size:.44rem}
.pt-cell.pt-hot{outline:2.5px solid var(--pri);outline-offset:-2px;z-index:1;box-shadow:0 0 0 3px var(--pri-soft)}
.pt-cell.pt-sel{background:var(--pri);border-color:var(--pri)}
.pt-cell.pt-sel .pt-s,.pt-cell.pt-sel .pt-z{color:#fff}
.pt-info{margin-top:10px;padding:11px 14px;border-radius:10px;background:var(--card-soft);border:1px solid var(--border);font-size:.92rem}
.pt-info b{color:var(--pri-d)}html.dark .pt-info b{color:var(--pri-l)}
.pt-legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:8px;font-size:.76rem;color:var(--muted)}
.pt-legend span{display:inline-flex;align-items:center;gap:5px}
.pt-legend i{width:12px;height:12px;border-radius:3px;display:inline-block}
.pt-modes{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}

/* модель атома (§29,33) */
.as-svg{width:100%;max-width:320px;height:auto;color:var(--pri);display:block;margin:8px auto}
.as-stage{display:flex;justify-content:center}
.as-cfg{margin-top:6px}
.as-zl{font-weight:800;color:var(--pri-d)}html.dark .as-zl{color:var(--pri-l)}

/* паспорт элемента (§35) */
.passport{margin-top:10px;padding:13px 16px;border-radius:11px;background:var(--card-soft);border:1px solid var(--border)}
.passport h4{font-family:'Outfit';font-weight:800;margin-bottom:8px;color:var(--pri-d)}
html.dark .passport h4{color:var(--pri-l)}
.passport-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;font-size:.85rem}
.passport-grid div{padding:6px 9px;background:var(--card);border:1px solid var(--border);border-radius:8px}
.passport-grid b{color:var(--pri-d)}html.dark .passport-grid b{color:var(--pri-l)}

/* тип связи (§37,38) */
.bt-svg{width:100%;max-width:280px;height:auto;color:var(--text);display:block;margin:8px auto}
.bt-stage{display:flex;justify-content:center}
.bt-out.ok{background:var(--ok-bg);border-color:#86efac}
.bt-out.bad{background:var(--fail-bg);border-color:#fca5a5}

/* решётки (§41) */
.lat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px;margin:10px 0}
.lat-card{border:1.5px solid var(--border);border-radius:12px;padding:13px 15px;background:var(--card-soft)}
.lat-card h4{font-family:'Outfit';font-weight:800;font-size:.92rem;margin-bottom:6px;color:var(--pri-d)}
html.dark .lat-card h4{color:var(--pri-l)}
.lat-card .lat-ex{font-family:var(--mono);font-size:.82rem;color:var(--muted);margin-bottom:4px}
.lat-card ul{margin:4px 0 0 16px;font-size:.82rem}

/* орбитали (§32) — статичные SVG */
.orb-row{display:flex;gap:18px;flex-wrap:wrap;justify-content:center;margin:10px 0}
.orb-item{text-align:center}
.orb-item svg{width:90px;height:90px;color:var(--pri)}
.orb-item .orb-lab{font-size:.82rem;font-weight:700;margin-top:4px}

/* амфотерность (§25) */
.amph-row{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.amph-stage{display:flex;justify-content:center;margin:8px 0}
.amph-out{margin-top:6px}

/* 3D-модели молекул/решёток (§38,41) */
.mol-cv{background:#0b1220;cursor:grab;border:1px solid var(--border)}
.mol-cv:active{cursor:grabbing}
.mol-info{margin-top:8px}

/* геном-карта классов (§22) */
.gm-svg{width:100%;max-width:440px;height:auto;color:var(--text);display:block;margin:4px auto}
.gm-out{margin-top:8px}
.gm-edge{transition:stroke .15s,stroke-width .15s}

/* диссоциация/растворение (§47) */
.ds-svg{width:100%;max-width:300px;height:auto;display:block;margin:6px auto}
.ds-stage{display:flex;justify-content:center}
.ds-out{margin-top:6px}

/* exa-step (разбор примеров) */
.exa-step{font-family:var(--mono);font-size:.9rem;background:var(--card-soft);border-left:3px solid var(--pri);border-radius:0 8px 8px 0;padding:8px 12px;margin:6px 0}

/* FOOTER + popup */
.foot{text-align:center;padding:24px 16px;color:var(--muted);font-size:.78rem;border-top:1px solid var(--border)}
.ach-popup{position:fixed;bottom:22px;left:50%;transform:translateX(-50%) translateY(130px);background:var(--card);border:1.5px solid var(--pri);color:var(--text);padding:12px 20px;border-radius:13px;font-weight:700;box-shadow:var(--sh2);z-index:60;transition:transform .35s;display:flex;align-items:center;gap:10px;font-size:.9rem;max-width:90vw}
.ach-popup svg{width:20px;height:20px;stroke:var(--pri);fill:none;stroke-width:2}
.ach-popup.show{transform:translateX(-50%) translateY(0)}
.ach-popup.gold{background:linear-gradient(135deg,#fbbf24,#f59e0b);color:#fff;border-color:transparent}
.ach-popup.gold svg{stroke:#fff}
