.pipe-game{max-width:960px;margin:auto}.game-toolbar,.game-palette,.game-stats{display:flex;gap:12px;flex-wrap:wrap;align-items:center}.game-toolbar select{font:inherit;padding:10px}.game-palette button{background:#fff;border:2px solid #50616b;border-radius:8px;padding:10px 16px;font:inherit;min-height:48px;color:#182d38}.game-palette button[aria-pressed=true]{border-color:#392d7b;background:#edeaf8}.game-stats{justify-content:space-between;margin:20px 0;font-weight:700}.game-board{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:min(100%,560px);margin:auto;background:#182d38;border:8px solid #182d38;border-radius:12px;gap:3px}.game-cell{aspect-ratio:1;position:relative;background:#263e4b;border:0;padding:0;min-width:0;color:white}.game-cell.editable{background:#3d395b;box-shadow:inset 0 0 0 2px #b7afe4;cursor:pointer}.game-cell svg{width:100%;height:100%;display:block}.game-cell:focus-visible{outline:3px solid #fff;outline-offset:-5px;z-index:1}.game-cell.wet{background:#12495b}.game-cell.leak{box-shadow:inset 0 0 0 3px #fbb369}.game-tank{display:flex;align-items:center;flex-direction:column;gap:6px;margin:10px auto;font-weight:700}.tank-shell{width:160px;height:65px;border:4px solid #50616b;border-top:0;border-radius:0 0 18px 18px;position:relative;overflow:hidden;background:#e1e7e8}.tank-liquid{position:absolute;bottom:0;left:0;right:0;background:#007ca8;height:0;transition:height .15s linear}.pipe-game #game-status{padding:16px;background:#e1e7e8;font-weight:700;border-radius:8px}.game-cell .water{stroke:#50d9ff;stroke-width:8;stroke-dasharray:9 5;animation:pipe-flow .8s linear infinite}.game-cell .cap{stroke:#f5f4f0;stroke-width:7}@keyframes pipe-flow{to{stroke-dashoffset:-28}}@media(prefers-reduced-motion:reduce){.game-cell .water{animation:none}.tank-liquid{transition:none}}@media(max-width:480px){.game-palette button{padding:9px}.game-board{border-width:4px}.game-toolbar{gap:8px}}
.game-board{gap:0;border:6px solid #182d38;box-shadow:0 12px 30px #182d3820}.game-cell{background:linear-gradient(135deg,#223844,#192e3a);box-shadow:inset 0 0 0 .5px #38505c}.game-cell.editable{background:linear-gradient(135deg,#403d59,#2d2c43);box-shadow:inset 0 0 0 1px #9490b6}.game-cell.wet{background:linear-gradient(135deg,#234754,#193a48)}.game-cell.leak{box-shadow:inset 0 0 0 2px #fbb369}.game-palette button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 14px;border-width:1px;touch-action:none;user-select:none;cursor:grab}.game-palette button svg{width:56px;height:56px;background:#203541;border-radius:6px}.game-palette button:active{cursor:grabbing}.game-cell.drop-target{box-shadow:inset 0 0 0 3px #73e0b1;background:#23574c}.game-drag-ghost{position:fixed;width:76px;height:76px;transform:translate(-50%,-50%);pointer-events:none;z-index:10000;background:#263e4bee;border:2px solid #73e0b1;border-radius:8px;box-shadow:0 5px 20px #0005}.game-drag-ghost svg{width:100%;height:100%}.game-cell .water{stroke-width:5;stroke-dasharray:6 4}.tank-shell{border-width:2px;background:linear-gradient(90deg,#b6c6cf,#f2f6f8 25%,#d4e0e6 75%,#9fb3bf);box-shadow:inset 0 0 0 2px #fff6}.tank-liquid{background:linear-gradient(90deg,#087ea6,#4dc5e5 50%,#087ea6);border-top:2px solid #9ce7f6}@media(max-width:480px){.game-palette{gap:8px}.game-palette button{padding:8px 10px}.game-palette button svg{width:44px;height:44px}}
body:has(#pipe-game){overflow:hidden}body:has(#pipe-game) .utility,body:has(#pipe-game) .header,body:has(#pipe-game) footer,body:has(#pipe-game) .back-top{display:none}body:has(#pipe-game) main{height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr);max-width:1200px;margin:auto}.game-intro{padding:10px 16px;border-bottom:1px solid #bac8ce;display:flex;align-items:center;gap:12px}.game-intro .eyebrow,.game-intro .lead{display:none}.game-intro h1{font-size:clamp(20px,3vw,30px);line-height:1.1;margin:0}.game-home{margin-left:auto;white-space:nowrap;font-size:16px;min-height:36px;display:flex;align-items:center}.pipe-game{width:100%;max-width:none;min-height:0;padding:10px 16px;display:flex;flex-direction:column;gap:6px}.game-toolbar{gap:8px}.game-toolbar .button,.game-toolbar .text-link,.game-toolbar select{padding:5px 10px;min-height:36px;font-size:16px}.game-toolbar label{font-size:16px}.game-instructions{font-size:16px;position:relative}.game-instructions summary{cursor:pointer}.game-instructions[open] p{position:absolute;top:24px;left:0;right:0;z-index:40;background:#f5f4f0;border:1px solid #50616b;padding:14px;font-size:16px;max-height:40dvh;overflow:auto}.game-workspace{display:grid;grid-template-columns:180px minmax(0,1fr);gap:16px;flex:1;min-height:0}.game-palette{display:grid;grid-template-columns:1fr 1fr;align-content:center;gap:6px;min-height:0}.game-palette button{padding:4px;min-height:0;font-size:14px;line-height:1.2;gap:2px}.game-palette button svg{width:42px;height:42px}.game-stage{display:flex;flex-direction:column;min-height:0;gap:3px}.game-stats{margin:0;font-size:16px;gap:6px;flex-shrink:0}.game-tank{flex-direction:row;justify-content:center;gap:8px;margin:0;font-size:14px;flex-shrink:0}.game-tank>span[aria-hidden]{display:none}.tank-shell{width:100px;height:30px;flex-shrink:0;border-radius:0 0 10px 10px}.game-board-frame{flex:1;min-height:0;container-type:size;display:grid;place-items:center}.game-board{width:min(100cqw,100cqh);height:min(100cqw,100cqh);max-width:100%;max-height:100%;margin:0;border-width:4px;grid-template-rows:repeat(5,minmax(0,1fr));box-shadow:none}.game-cell{min-height:0;aspect-ratio:auto}.pipe-game #game-status{margin:0;padding:6px 10px;font-size:16px;line-height:1.25;flex-shrink:0}.pipe-game>.caption{display:none}@media(max-width:600px){.game-intro{padding:8px 10px}.pipe-game{padding:6px 10px;gap:4px}.game-workspace{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;gap:6px}.game-stage{grid-row:1}.game-palette{grid-row:2;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.game-palette button{font-size:12px;flex-direction:row;flex-wrap:wrap;justify-content:center}.game-palette button svg{width:32px;height:32px}.game-palette button span{width:100%}.game-toolbar .button,.game-toolbar .text-link,.game-toolbar select{font-size:14px;padding:4px 6px;min-height:32px}.game-toolbar label{font-size:14px}.game-stats,.game-instructions,.pipe-game #game-status{font-size:14px}.game-tank{font-size:12px}.tank-shell{width:74px;height:24px}}@media(max-height:500px) and (min-width:601px){.game-palette button{flex-direction:row;font-size:12px}.game-palette button svg{width:26px;height:26px}.game-workspace{grid-template-columns:210px minmax(0,1fr)}.tank-shell{height:20px}.game-intro h1{font-size:20px}.game-intro{padding:4px 12px}}
.pipe-game{height:100%;margin:0}.game-intro{width:100%;margin:0}
@media(max-height:650px) and (max-width:600px){.game-palette button svg{width:24px;height:24px}.game-palette button{font-size:10px;padding:3px 1px;line-height:1.1}.pipe-game #game-status{font-size:12px;padding:4px 6px}.game-instructions summary{font-size:12px;line-height:1.2}.game-intro h1{font-size:18px}.game-intro{padding:4px 10px}.game-stats{font-size:12px}.tank-shell{height:18px}.game-tank{font-size:10px}.game-toolbar label{font-size:0}.game-toolbar select{font-size:12px}.game-toolbar .button,.game-toolbar .text-link{font-size:12px;padding:4px 8px}}
.game-instructions summary{padding:0;min-height:0;font-weight:600;line-height:20px}.game-instructions{border:0;margin:0}.game-instructions[open]{padding:0}.game-instructions summary::after{display:none}
.game-tank{position:relative;min-height:30px}.game-tank>span:not([aria-hidden]){position:absolute;max-width:calc(50% - 65px);white-space:nowrap}.game-tank:first-of-type>span:first-child{right:calc(50% + 60px)}.game-tank>span:first-child:not([aria-hidden]){right:calc(50% + 60px)}.game-tank>span:last-child:not([aria-hidden]){left:calc(50% + 60px)}@media(max-width:600px){.game-tank{min-height:24px}.game-tank>span:not([aria-hidden]){max-width:calc(50% - 45px);white-space:normal;line-height:1.1}.game-tank>span:first-child:not([aria-hidden]){right:calc(50% + 42px)}.game-tank>span:last-child:not([aria-hidden]){left:calc(50% + 42px)}}@media(max-height:650px){.game-tank{min-height:20px}}
.game-demo-piece{position:absolute;inset:0;background:#403d59;pointer-events:none;z-index:2}.demo-cell{outline:3px solid #73e0b1;outline-offset:-3px;z-index:3}.demo-cell::after{content:'☝';position:absolute;right:2%;bottom:0;color:white;font-size:clamp(20px,3vw,38px);line-height:1;z-index:4;pointer-events:none;text-shadow:0 2px 3px #000;animation:demo-click 1.8s ease-in-out infinite}.demo-cell .game-demo-piece svg{animation:demo-turn 1.8s ease-in-out infinite}@keyframes demo-click{0%,65%,100%{transform:translate(6px,5px) scale(1)}75%{transform:translate(0,0) scale(.85)}85%{transform:translate(0,0) scale(1)}}@keyframes demo-turn{0%,80%,100%{opacity:1}90%{opacity:.65}}@media(prefers-reduced-motion:reduce){.demo-cell::after,.demo-cell .game-demo-piece svg{animation:none}}
.game-board{width:min(100cqw,100cqh,360px);height:min(100cqw,100cqh,360px)}body:has(#pipe-game) main{max-width:1000px}.game-instructions summary{display:inline-flex;align-items:center;background:#392d7b;color:white;border:1px solid #392d7b;border-radius:6px;padding:7px 14px;min-height:38px;font-size:16px;line-height:1.2}.game-instructions summary:hover{background:#281e5b}.game-instructions[open] summary{background:#182d38}.game-instructions[open] p{top:42px;box-shadow:0 8px 28px #182d3833;line-height:1.6;border-radius:6px;max-width:700px}.pipe-game #game-over{margin:auto;padding:28px;border:1px solid #667e8b;border-radius:14px;background:#f5f4f0;color:#182d38;max-width:min(420px,calc(100vw - 32px));box-shadow:0 18px 60px #0005}.pipe-game #game-over::backdrop{background:#0d202bbd}.pipe-game #game-over h2{font-size:38px;margin:0 0 12px;color:#392d7b}.pipe-game #game-over p{font-size:18px;line-height:1.5;margin-bottom:22px}.pipe-game #game-over .button{min-height:44px}@media(max-height:650px){.game-instructions summary{min-height:30px;padding:5px 10px;font-size:13px}.game-instructions[open] p{top:34px}}
.pipe-game #game-over .game-exit{margin-left:10px;background:transparent;color:#392d7b;border:1px solid #392d7b}.pipe-game #game-over .game-exit:hover{background:#e9e5f4}
.pipe-game{position:relative;isolation:isolate}.game-celebration{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:60;border-radius:12px;display:grid;place-items:center;background:#182d3833}.game-success-card{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:8px;max-width:90%;padding:22px 36px;background:#fffbea;border:4px solid #e9b630;border-radius:24px;box-shadow:0 8px 30px #182d3840;text-align:center;color:#182d38}.game-success-thumb{display:block;font-size:clamp(80px,14vw,150px);line-height:1.15}.game-success-card strong{font-size:clamp(28px,5vw,48px);line-height:1.1}.game-success-stars{color:#956500;font-size:32px;letter-spacing:6px;line-height:1}.game-success-card>span:last-child{font-size:18px}.game-confetti{position:absolute;width:10px;height:18px;border-radius:2px}@media(max-height:500px){.game-success-card{gap:3px;padding:12px 24px}.game-success-thumb{font-size:70px}.game-success-stars{font-size:24px}.game-success-card strong{font-size:28px}}
