/* Extra Chemistry chapters: Liquids, Gases (inserted after Chapter 6) */
(() => {
const { mc, inp, ord } = window.QH;
const PTRI = { f: { top: ['F', 'force', 'N'], l: ['p', 'pressure', 'Pa'], r: ['A', 'area', 'm²'], vals: { F: 600, p: 200, A: 3 } } };
const CH = [
{ id: 'sL', subj: 'science', n: 'L', title: 'Liquids: pressure and purity', strand: 'Chemistry', codes: ['8Pf.06', '8Pf.05', '8Cm.04'],
  secs: [
    { n: 'L.1', t: 'Particles and pressure in liquids', w: 'liqparticles',
      intro: 'Move the pressure probe deeper into the liquid and try different liquids. Watch the arrows and the particles above the probe.',
      tasks: [['Move the probe right to the bottom', s => s.depth >= 0.95], ['Compare a shallow and a deep reading', (s, H) => H('depthBand', 'low') && H('depthBand', 'high')], ['Try a denser liquid (salt water or honey)', s => s.liquid === 'salt' || s.liquid === 'honey']],
      extra: [['liquidp', {}, 'Water jets at different depths'], ['sort', { bins: ['True for liquid particles', 'Not true'], items: [['Touching each other', 0], ['Far apart', 1], ['Slide past each other', 0], ['Easily squashed together', 1], ['Move about randomly', 0], ['Fixed in one place', 1]] }, 'Liquid particle facts']],
      notice: [<>Liquid particles are <b>close together and touching</b>, but they can <b>slide past</b> each other.</>, <>Pressure in a liquid comes from particles <b>colliding</b> with surfaces and the <b>weight of liquid above</b>, so pressure <b>increases with depth</b>.</>, <>Liquid pressure acts <b>in all directions</b>, and liquids are almost impossible to squash because the particles are already touching.</>],
      check: [mc('Why is the pressure greater at the bottom of a swimming pool?', ['The water is colder there', 'There is more water above pushing down', 'The particles are bigger there', 'Light cannot reach it'], 1, 'More liquid above means more weight and more collisions on any surface.'), mc('Why can\'t you squash water in a sealed syringe?', ['Water is heavy', 'The particles are already touching, so there is no space', 'Water particles don\'t move', 'Water is a gas'], 1, 'There is almost no empty space between liquid particles.')] },
    { n: 'L.2', t: 'Pressure = force ÷ area in liquids', w: 'hydraulic',
      intro: 'Push on the small piston of the hydraulic jack. The liquid passes the pressure to the big piston. Can you lift the car?',
      tasks: [['Lift the car', s => s.lifted], ['Make the pressure exactly 50 N/cm²', s => Math.abs(s.p - 50) < 0.01], ['Lift the car pushing with less than 100 N', s => s.lifted && s.F1 < 100]],
      extra: [['triangle3', PTRI, 'Pressure formula triangle'], ['pblock', {}, 'Same force, different area']],
      notice: [<><b>Pressure = force ÷ area</b>. It is measured in pascals: 1 Pa = 1 N/m² (or in N/cm²).</>, <>A liquid passes pressure on <b>equally in all directions</b>, because its particles are touching and can't be squashed.</>, <>A small force on a small area makes a pressure that produces a <b>large force on a large area</b>. This is how hydraulic car brakes and jacks work.</>],
      check: [inp('A force of 120 N pushes on a piston of area 4 cm². What is the pressure in N/cm²?', '30', 'p = F ÷ A = 120 ÷ 4 = 30 N/cm².', 'N/cm²'), mc('In a hydraulic jack, why is the force on the big piston larger?', ['The liquid adds energy', 'The same pressure acts on a bigger area', 'The big piston is heavier', 'The liquid gets hotter'], 1, 'F = p × A, so a bigger area gives a bigger force.')] },
    { n: 'L.3', t: 'Purity', w: 'purity',
      intro: 'Change the amount of salt and impurities in the sample. Watch the purity meter and the melting point.',
      tasks: [['Make a 100% pure sample', s => s.purity >= 99.99], ['Make a sample that is about 80% pure', s => s.purity >= 78 && s.purity <= 82], ['See the melting point of an impure sample', (s, H) => H('band', 'impure') && H('band', 'pure')]],
      extra: [['heatcurve', {}, 'Boiling: pure vs impure'], ['sort', { bins: ['Pure substance', 'Impure (mixture)'], items: [['Distilled water', 0], ['Sea water', 1], ['24-carat gold', 0], ['Tap water', 1], ['Lab-grade copper sulfate', 0], ['Rock salt', 1]] }, 'Pure or impure?'], ['chroma', {}, 'Chromatography purity test']],
      notice: [<><b>Purity</b> describes how much of a <b>specific chemical</b> is in a mixture.</>, <><b>% purity = mass of the chemical ÷ total mass × 100</b>. A pure substance is 100% one chemical.</>, <>A pure substance melts and boils at <b>exact temperatures</b>. Impurities lower the melting point and spread it over a <b>range</b>. Medicines and foods must be very pure.</>],
      check: [inp('A 50 g sample contains 45 g of salt. What is its % purity?', '90', '45 ÷ 50 × 100 = 90%.', '%'), mc('A solid melts between 74 °C and 79 °C. What does this suggest?', ['It is pure', 'It is impure', 'It is a gas', 'It is a metal'], 1, 'Pure substances melt at one sharp temperature.')] },
  ],
  practice: [inp('A force of 600 N acts on 3 m². Pressure?', '200', '600 ÷ 3 = 200 Pa.', 'Pa'), mc('Liquid pressure acts…', ['only downwards', 'only sideways', 'in all directions', 'only upwards'], 2, 'Particles collide with surfaces in every direction.'), inp('20 g of a 25 g sample is aspirin. % purity?', '80', '20 ÷ 25 × 100.', '%'), mc('Which is the purest?', ['Melts at 120 °C exactly', 'Melts at 112–118 °C', 'Melts at 100–115 °C', 'Does not melt'], 0, 'A sharp melting point means pure.')],
  challenge: [mc('Dams are built much thicker at the bottom than at the top. Use the particle model to explain why.', ['To look stronger', 'Water pressure increases with depth because of the weight of water above', 'Fish live at the bottom', 'The bottom is colder'], 1, 'Deeper water means greater pressure on the dam wall.'), inp('A car jack: 50 N on a small piston of 2 cm² makes pressure on a big piston of 80 cm². What force acts on the big piston?', '2000', 'p = 50 ÷ 2 = 25 N/cm²; F = 25 × 80 = 2000 N.', 'N'), mc('Why must medicines be very pure?', ['To make them cheaper', 'Impurities could be harmful or change how the medicine works', 'Pure things taste better', 'It makes them bigger'], 1, 'Unknown chemicals in medicine could be dangerous.')],
  recap: { points: ['Liquid particles touch but slide past each other, so liquids flow but can\'t be squashed.', 'Liquid pressure increases with depth and acts in all directions.', 'Pressure = force ÷ area; liquids pass pressure on (hydraulics).', 'Purity = how much of one chemical is in a mixture; % purity = chemical mass ÷ total mass × 100.'], terms: [['Pressure', 'Force acting on each unit of area (Pa).'], ['Hydraulic', 'Using a liquid to pass on pressure.'], ['Purity', 'How much of a specific chemical a sample contains.']] } },

{ id: 'sG', subj: 'science', n: 'G', title: 'Gases: pressure and diffusion', strand: 'Chemistry', codes: ['8Pf.06', '8Pf.07', '8Pf.05'],
  secs: [
    { n: 'G.1', t: 'Particles and pressure in gases', w: 'balloon',
      intro: 'Pump gas particles into the balloon and change the temperature. Watch the wall hits (yellow flashes) and the size of the balloon.',
      tasks: [['Pump in at least 40 particles', s => s.n >= 40], ['Heat the gas to 80 °C or more', s => s.T >= 80], ['Cool the gas below 0 °C', s => s.T < 0]],
      extra: [['gasbox', {}, 'Gas particles in a box'], ['sort', { bins: ['Increases gas pressure', 'Decreases gas pressure'], items: [['Heating the gas', 0], ['Cooling the gas', 1], ['Adding more gas', 0], ['Letting gas out', 1], ['Squashing it into a smaller space', 0], ['Moving it into a bigger container', 1]] }, 'What changes gas pressure?']],
      notice: [<>Gas particles are <b>far apart</b> and move <b>fast</b> in <b>random</b> directions.</>, <>Gas pressure is caused by particles <b>colliding with the walls</b> of their container.</>, <><b>More particles</b>, a <b>higher temperature</b> or a <b>smaller volume</b> all mean more collisions, so the pressure is <b>higher</b>.</>],
      check: [mc('What causes the pressure inside a balloon?', ['Air being heavy', 'Gas particles hitting the inside walls', 'The rubber squeezing', 'Light'], 1, 'Collisions with the walls push outwards.'), mc('Why does a football feel harder on a hot day?', ['The leather shrinks', 'The particles move faster and hit the walls harder and more often', 'More air gets in', 'It doesn\'t'], 1, 'Higher temperature means faster particles and more pressure.')] },
    { n: 'G.2', t: 'Diffusion in gases', w: 'diffuse',
      intro: 'Two gases are kept apart by a barrier. Remove it and watch them intermingle. Then try a different temperature.',
      tasks: [['Remove the barrier', s => s.removed], ['Wait until the gases are 90% mixed', s => s.mix >= 90], ['Try diffusion at 60 °C or hotter', s => s.removed && s.T >= 60]],
      extra: [['gasbox', {}, 'Diffusion in a box'], ['order', { rounds: [{ p: 'How does the smell of perfume reach the back of the room?', items: ['Perfume evaporates into a gas', 'Its particles move randomly and collide with air particles', 'They spread from high to low concentration', 'Eventually they are spread evenly through the room', 'You smell it at the back'] }] }, 'How a smell spreads']],
      notice: [<><b>Diffusion</b> is the <b>intermingling</b> of substances caused by the <b>random movement of particles</b>.</>, <>Particles spread from a <b>high concentration</b> to a <b>low concentration</b> until they are evenly mixed. No stirring is needed!</>, <>Diffusion is <b>faster when hotter</b>, because particles move faster. It is faster in gases than in liquids.</>],
      check: [mc('Which is an example of diffusion in a gas?', ['Ice melting', 'The smell of cooking spreading through a house', 'Water freezing', 'A ball rolling'], 1, 'Smell particles spread through the air by random movement.'), mc('How can you make a gas diffuse faster?', ['Cool it', 'Heat it', 'Add a lid', 'Make it darker'], 1, 'Faster particles intermingle sooner.')] },
    { n: 'G.3', t: 'Gas pressure = force ÷ area', w: 'gaspiston',
      intro: 'Squash the gas in the syringe and watch the collisions. Then calculate the pressure of the gas on the piston.',
      tasks: [['Squash the gas to its smallest volume', s => s.V <= 0.35], ['Compare a big and a small volume', (s, H) => H('Vband', 'big') && H('Vband', 'small')], ['Make the pressure exactly 5000 Pa', s => Math.abs(s.p - 5000) < 0.5]],
      extra: [['triangle3', PTRI, 'Pressure formula triangle'], ['pressure', {}, 'Pressure in everyday life']],
      notice: [<>A gas pushes on <b>every surface</b> it touches. That push is caused by particle collisions.</>, <><b>Pressure = force ÷ area</b> (Pa). So the <b>force</b> of a gas on a surface = pressure × area.</>, <>Squash a gas into a smaller volume and the particles collide more often, so <b>pressure rises</b>. That is why a squeezed syringe pushes back.</>],
      check: [inp('Gas pushes with a force of 300 N on a piston of area 0.1 m². What is the pressure?', '3000', '300 ÷ 0.1 = 3000 Pa.', 'Pa'), mc('You push the plunger of a sealed syringe of air. What happens to the pressure inside?', ['It goes down', 'It goes up', 'It stays the same', 'It becomes zero'], 1, 'Smaller volume means more collisions.')] },
  ],
  practice: [mc('Gas particles are…', ['touching in rows', 'touching but sliding', 'far apart and moving fast', 'not moving'], 2, 'Gases have lots of space.'), inp('Pressure = 400 N ÷ 0.02 m² = ? Pa', '20000', '400 ÷ 0.02.', 'Pa'), mc('Diffusion happens because particles…', ['are pushed by wind', 'move randomly', 'are attracted to the nose', 'are heavy'], 1, 'Random motion.'), mc('Which change lowers gas pressure in a closed tank?', ['Heating', 'Adding gas', 'Cooling', 'Shrinking the tank'], 2, 'Slower particles hit less.')],
  challenge: [mc('An aerosol can says "Do not heat". Use the particle model to explain.', ['It might melt', 'Heating makes particles hit the walls harder and more often; the pressure could burst the can', 'It changes colour', 'It loses its smell'], 1, 'Pressure rises with temperature.'), mc('Ammonia gas and hydrogen chloride gas are released at opposite ends of a tube. They meet nearer the hydrogen chloride end. What does this show?', ['Hydrogen chloride particles move faster', 'Ammonia particles diffuse faster', 'Both are equally fast', 'Gases don\'t diffuse'], 1, 'The ammonia travelled further in the same time.'), inp('A gas exerts 2000 Pa on a lid of area 0.05 m². What force acts on the lid?', '100', 'F = p × A = 2000 × 0.05 = 100 N.', 'N')],
  recap: { points: ['Gas particles are far apart and move quickly and randomly.', 'Gas pressure = collisions of particles with the walls.', 'More particles, higher temperature or smaller volume give higher pressure.', 'Diffusion: intermingling by random particle movement, from high to low concentration; faster when hot.', 'Pressure = force ÷ area; force = pressure × area.'], terms: [['Diffusion', 'Spreading and mixing of particles by random movement.'], ['Concentration', 'How many particles there are in a given space.'], ['Collision', 'When particles hit each other or a surface.']] } },
];
const i6 = BOOK.findIndex(c => c.id === 's6');
BOOK.splice(i6 + 1, 0, ...CH);
})();
