// Генератор physics_10_hub.html на основе algebra_11_hub.html 'use strict'; const fs = require('fs'); const path = require('path'); const SRC = path.join(__dirname, '..', '..', 'frontend', 'textbooks', 'algebra_11_hub.html'); const DST = path.join(__dirname, '..', '..', 'frontend', 'textbooks', 'physics_10_hub.html'); let h = fs.readFileSync(SRC, 'utf8'); // === 1. Palette + dark mode === h = h.replace( /:root\{[\s\S]*?--bg:#ecfdf5; --card:#fff;[\s\S]*?--sh-h:0 12px 36px rgba\(13,148,136,\.18\);[\s\S]*?\}/, `:root{ --bg:#fffbeb; --card:#fff; --text:#0f172a; --muted:#475569; --border:#fde68a; --pri:#ca8a04; --pri-d:#a16207; --pri-soft:#fef3c7; --ch1:#2563eb; --ch1-d:#1d4ed8; --ch2:#059669; --ch2-d:#047857; --ch3:#7c3aed; --ch3-d:#6d28d9; --ch4:#db2777; --ch4-d:#be185d; --ch5:#0891b2; --ch5-d:#0e7490; --ch6:#10b981; --ch6-d:#059669; --sh:0 4px 16px rgba(202,138,4,.10); --sh-h:0 12px 36px rgba(202,138,4,.18); }`); h = h.replace( /html\.dark\{[\s\S]*?--pri-soft:rgba\(13,148,136,\.16\);[\s\S]*?\}/, `html.dark{ --bg:#1a1500; --card:#2a2410; --text:#fef3c7; --muted:#d4b88f; --border:#3d2f0a; --pri-soft:rgba(202,138,4,.16); }`); // === 2. Header === h = h.replace( /\.hdr\{position:relative;background:linear-gradient\(110deg,#115e59 0%,#0d9488 55%,#5eead4 100%\)[^}]*\}/, `.hdr{position:relative;background:linear-gradient(110deg,#713f12 0%,#ca8a04 55%,#fde047 100%);color:#fff;padding:32px 24px 28px;overflow:hidden;border-bottom:2px solid rgba(254,243,199,.18)}`); h = h.replace(/АЛГЕБРА/g, 'ФИЗИКА'); h = h.replace(/rgba\(204,251,241,\.12\)/g, 'rgba(254,243,199,.12)'); // === 3. po-icon gradient === h = h.replace( /\.po-icon\{[^}]*background:linear-gradient\(135deg,#0d9488,#5eead4\)[^}]*\}/, `.po-icon{width:46px;height:46px;border-radius:12px;background:linear-gradient(135deg,#ca8a04,#fde047);color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-family:'Outfit',sans-serif;font-size:1.4rem;font-weight:900;font-style:italic}`); h = h.replace(/\.po-bar\{height:8px;background:rgba\(13,148,136,\.14\)/, '.po-bar{height:8px;background:rgba(202,138,4,.14)'); h = h.replace(/\.po-fill\{height:100%;background:linear-gradient\(90deg,var\(--pri\),#5eead4\)/, '.po-fill{height:100%;background:linear-gradient(90deg,var(--pri),#fde047)'); h = h.replace(/\.po-xp\{[^}]*background:linear-gradient\(135deg,#f59e0b,var\(--pri\)\)[^}]*\}/, ".po-xp{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;background:linear-gradient(135deg,#f59e0b,var(--pri));color:#fff;border-radius:99px;font-size:.8rem;font-weight:800;font-family:'Unbounded',sans-serif;letter-spacing:.02em;box-shadow:0 4px 12px rgba(202,138,4,.24)}"); // === 4. Chapter grid: 3 → 6 cards === h = h.replace( /\.ch-grid\{display:grid;grid-template-columns:1fr;gap:18px;margin-bottom:30px\}\s*@media\(min-width:680px\)\{\.ch-grid\{grid-template-columns:1fr 1fr\}\}\s*@media\(min-width:1000px\)\{\.ch-grid\{grid-template-columns:repeat\(3,1fr\)\}\}/, `.ch-grid{display:grid;grid-template-columns:1fr;gap:18px;margin-bottom:30px} @media(min-width:680px){.ch-grid{grid-template-columns:1fr 1fr}} @media(min-width:1000px){.ch-grid{grid-template-columns:repeat(3,1fr)}}`); // Replace cover gradients (ch1 ch2 ch3) and add ch4 ch5 ch6 h = h.replace( /\.ch-cover\.ch1\{background:[^}]+\}\s*\.ch-cover\.ch2\{background:[^}]+\}\s*\.ch-cover\.ch3\{background:[^}]+\}/, `.ch-cover.ch1{background:linear-gradient(135deg,#1e3a8a,#2563eb 60%,#60a5fa)} .ch-cover.ch2{background:linear-gradient(135deg,#064e3b,#059669 60%,#34d399)} .ch-cover.ch3{background:linear-gradient(135deg,#3b0764,#7c3aed 60%,#a78bfa)} .ch-cover.ch4{background:linear-gradient(135deg,#831843,#db2777 60%,#f472b6)} .ch-cover.ch5{background:linear-gradient(135deg,#164e63,#0891b2 60%,#22d3ee)} .ch-cover.ch6{background:linear-gradient(135deg,#064e3b,#10b981 60%,#6ee7b7)}`); // Replace chN-card progress fill and action gradients h = h.replace( /\.ch-card\.ch1-card \.ch-prog-fill\{background:linear-gradient\(90deg,var\(--ch1\),var\(--ch1-d\)\)\}\s*\.ch-card\.ch2-card \.ch-prog-fill\{background:linear-gradient\(90deg,var\(--ch2\),var\(--ch2-d\)\)\}\s*\.ch-card\.ch3-card \.ch-prog-fill\{background:linear-gradient\(90deg,var\(--ch3\),var\(--ch3-d\)\)\}/, `.ch-card.ch1-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch1),var(--ch1-d))} .ch-card.ch2-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch2),var(--ch2-d))} .ch-card.ch3-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch3),var(--ch3-d))} .ch-card.ch4-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch4),var(--ch4-d))} .ch-card.ch5-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch5),var(--ch5-d))} .ch-card.ch6-card .ch-prog-fill{background:linear-gradient(90deg,var(--ch6),var(--ch6-d))}`); h = h.replace( /\.ch-card\.ch1-card \.ch-action\{background:linear-gradient\(135deg,var\(--ch1\),#fbbf24\)\}\s*\.ch-card\.ch2-card \.ch-action\{background:linear-gradient\(135deg,var\(--ch2\),#a78bfa\)\}\s*\.ch-card\.ch3-card \.ch-action\{background:linear-gradient\(135deg,var\(--ch3\),#22d3ee\)\}/, `.ch-card.ch1-card .ch-action{background:linear-gradient(135deg,var(--ch1),#60a5fa)} .ch-card.ch2-card .ch-action{background:linear-gradient(135deg,var(--ch2),#34d399)} .ch-card.ch3-card .ch-action{background:linear-gradient(135deg,var(--ch3),#a78bfa)} .ch-card.ch4-card .ch-action{background:linear-gradient(135deg,var(--ch4),#f472b6)} .ch-card.ch5-card .ch-action{background:linear-gradient(135deg,var(--ch5),#22d3ee)} .ch-card.ch6-card .ch-action{background:linear-gradient(135deg,var(--ch6),#6ee7b7)}`); // Final header gradient h = h.replace( /\.final-head\{padding:18px 22px;background:linear-gradient\(135deg,#115e59 0%,#0d9488 55%,#0891b2 100%\)/, '.final-head{padding:18px 22px;background:linear-gradient(135deg,#713f12 0%,#ca8a04 55%,#f59e0b 100%)'); // title h = h.replace(/