:root{font-family:"Trebuchet MS","Segoe UI",system-ui,sans-serif;color:#103f55;background:#bceff1;--deep:#075c73;--sea:#0b8fa1;--foam:#f8fff9;--coral:#ef6f87;--gold:#ffd456;--green:#54bd7c;--shadow:0 16px 48px rgba(8,69,88,.22)}
*{box-sizing:border-box}html,body{margin:0;min-width:0;min-height:100%;overflow-x:hidden}body{min-height:100vh;min-height:100dvh;background:radial-gradient(circle at 10% 5%,#fff9 0 5%,transparent 23%),linear-gradient(145deg,#dafcf5,#aceaf0 54%,#fff0bd)}button,a{font:inherit}button{cursor:pointer;touch-action:manipulation}button:focus-visible,a:focus-visible{outline:4px solid #ffb92e;outline-offset:3px}.app{width:min(100%,1320px);margin:auto;padding:clamp(8px,2vw,26px)}
.topbar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px}.back,.tools button,.soft{min-height:48px;border:2px solid #075b7338;border-radius:15px;background:#fffffff2;color:var(--deep);font-weight:900;text-decoration:none;padding:10px 14px}.brand{display:flex;align-items:center;gap:9px;font-family:Georgia,serif;font-size:clamp(1rem,2.4vw,1.7rem);color:var(--deep)}.brand span{display:grid;place-items:center;width:44px;height:44px;border-radius:14px;background:var(--deep);color:#fff}.tools{justify-self:end;display:flex;gap:6px}.tools button{min-width:48px;padding:8px}.journey{display:flex;align-items:center;justify-content:center;gap:12px;margin:12px 0}.lives{display:flex;gap:3px;padding:7px 11px;border-radius:999px;background:#ffffffc7}.heart{font-size:1.3rem;color:var(--coral);transition:.2s}.heart.empty{opacity:.2;filter:grayscale(1);transform:scale(.8)}.chapters-progress{display:flex;max-width:76vw;overflow:hidden}.chapter-dot{display:grid;place-items:center;width:34px;height:34px;border:3px solid #fff;border-radius:50%;background:#72b9c5;color:#fff;font-weight:1000;box-shadow:0 3px 0 #075b7330}.chapter-dot+.chapter-dot{margin-left:4px}.chapter-dot.done{background:var(--gold);color:#684800}.chapter-dot.current{outline:4px solid #fff4a8;transform:scale(1.08)}
#stage{min-height:590px;border:3px solid #ffffffdf;border-radius:28px;overflow:hidden;background:#ffffffc2;box-shadow:var(--shadow)}.primary{min-height:56px;border:0;border-radius:18px;padding:13px 24px;background:linear-gradient(145deg,#f4778e,#d95371);color:#fff;font-weight:1000;box-shadow:0 5px 0 #b53d58}.primary:active{transform:translateY(3px);box-shadow:0 2px 0 #b53d58}.giant{font-size:1.2rem;min-width:min(100%,310px)}
.start-gate{position:fixed;z-index:50;inset:0;display:grid;place-items:center;padding:16px;background:linear-gradient(145deg,#075b73ee,#0b9aa6ee)}.start-gate.hidden{display:none}.start-card{width:min(94vw,680px);max-height:94vh;overflow:auto;padding:clamp(18px,4vw,34px);border:4px solid #fff;border-radius:30px;background:#fffffff5;text-align:center;box-shadow:0 35px 100px #003c}.start-card img{width:min(100%,520px);max-height:42vh;object-fit:cover;object-position:top;border-radius:20px;animation:intro-arrive 1.2s ease-out both,float 2s 1.2s ease-in-out infinite alternate}.start-card h1{font-family:Georgia,serif;color:var(--deep);font-size:clamp(1.8rem,5vw,3.4rem);line-height:1.04;margin:16px 0 10px}.start-card p{font-weight:800}
.map{position:relative;min-height:650px;display:grid;grid-template-columns:minmax(280px,.65fr) minmax(500px,1.35fr);background:#087b91}.map-copy{z-index:2;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;padding:clamp(22px,5vw,58px);background:linear-gradient(90deg,#fffffff6,#ffffffcb)}h1,h2,h3,p{margin-top:0}.map h1,.scene h1{font-family:Georgia,serif;color:var(--deep);font-size:clamp(2rem,4vw,4rem);line-height:1.02}.map-copy p{font-size:1.08rem;line-height:1.5}.map-art{position:relative;min-height:650px;background:url("/index.php?p=games%2Fkind-balls-v1%2Fassets%2Fmap.webp") center/cover no-repeat}.map-art::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,#087b9150,transparent)}.chapter-grid{position:absolute;z-index:1;inset:0;display:grid;grid-template-columns:repeat(3,1fr);align-content:center;gap:13px;padding:25px}.chapter-card{min-height:104px;border:4px solid #fff3b4;border-radius:24px;background:#ffffffe8;color:var(--deep);font-weight:1000;box-shadow:0 8px 0 #064c6170;backdrop-filter:blur(4px);padding:9px}.chapter-card span{display:block;font-size:2rem}.chapter-card.locked{opacity:.58;filter:grayscale(.7)}.chapter-card.done{background:#fff3ac}.chapter-card.current{outline:5px solid #ffdc5b}.chapter-card:nth-child(8){grid-column:2}.chapter-card:nth-child(9){grid-column:3}
.scene{min-height:650px;background:linear-gradient(#073f5575,#073f5575),var(--bg) center/cover no-repeat;padding:clamp(10px,3vw,28px)}.scene-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:17px;border-radius:22px;background:#fffffff1}.scene-head h1{font-size:clamp(1.55rem,4vw,3rem);margin-bottom:6px}.scene-head p{margin:0;font-size:1.02rem}.scene-body{display:grid;grid-template-columns:minmax(320px,1fr) minmax(250px,340px);gap:18px;margin-top:18px}.play,.coach{border:3px solid #fff;border-radius:25px;background:#fffffff0;box-shadow:var(--shadow);padding:clamp(14px,3vw,26px)}.play{min-height:430px;display:grid;place-items:center;align-content:center}.coach{display:flex;flex-direction:column;justify-content:center;gap:12px}.coach img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:17px}.task-title{text-align:center;font-size:clamp(1.2rem,2.5vw,1.75rem)}.task-index{font-weight:1000;color:#0b8497}.status{min-height:2em;text-align:center;font-size:1.05rem;font-weight:1000;color:#08758b;margin:14px 0 0}.status.error{color:#b13a54}.status.ok{color:#23844c}.demo{font-size:clamp(2.3rem,7vw,4.8rem);text-align:center;margin:10px}
.choices,.select-grid,.objects,.lights,.collect-zone{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.choice,.select-item,.count-choice{min-width:78px;min-height:68px;border:3px solid #0c8798;border-radius:18px;background:#fff;color:var(--deep);font-size:1.35rem;font-weight:1000;padding:10px}.choice:hover,.select-item:hover,.count-choice:hover{background:#e9ffff}.select-item{width:92px;height:92px;border-radius:28px;font-size:2.4rem}.select-item.selected{background:#dbffdf;border-color:#49a56d;transform:translateY(-4px);box-shadow:0 7px 0 #398758}.choice.wrong,.select-item.wrong{animation:bump .25s}.object{font-size:clamp(2.6rem,8vw,5rem)}.count-choice{letter-spacing:.15em;font-size:1rem}.count-choice span{display:inline-block;width:12px;height:12px;margin:2px;border-radius:50%;background:#e5ad1e}
.grid-maze{--n:5;position:relative;display:grid;grid-template:repeat(5,1fr)/repeat(5,1fr);width:min(82vw,440px);aspect-ratio:1;gap:5px;padding:8px;border:6px solid #075b73;border-radius:20px;background:#075b73}.maze-cell{min-width:0;aspect-ratio:1;border-radius:9px;background:#eafff7}.maze-cell.wall{background:#ec7187}.maze-cell.wall::after{content:"✦";display:grid;place-items:center;height:100%;color:#fff;font-size:1.8rem}.maze-cell.goal{background:radial-gradient(circle,#fff 0 12%,#ffe774 32%,#e9ad2e)}.maze-actor{position:absolute;top:8px;left:8px;width:calc((100% - 36px)/5);height:calc((100% - 36px)/5);display:grid;place-items:center;font-size:clamp(1.6rem,7vw,3.2rem);transition:transform .2s;z-index:2}.maze-actor img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 4px 3px #0638)}.dpad{display:grid;grid-template:repeat(3,62px)/repeat(3,62px);gap:7px;justify-content:center;margin-top:14px}.dpad button{border:0;border-radius:17px;background:linear-gradient(#20a7b3,#08758b);color:#fff;font-size:2rem;font-weight:1000;box-shadow:0 5px 0 #075368}.dpad [data-d=up]{grid-column:2}.dpad [data-d=left]{grid-row:2}.dpad [data-d=right]{grid-row:2;grid-column:3}.dpad [data-d=down]{grid-row:3;grid-column:2}
.board{position:relative;width:min(82vw,440px);aspect-ratio:1;display:grid;grid-template:repeat(5,minmax(0,1fr))/repeat(5,minmax(0,1fr));border:7px solid #755b31;border-radius:16px;overflow:hidden;contain:layout paint}.square{position:relative;min-width:0;min-height:0;border:0;border-radius:0;background:#f8e6ad}.square.dark{background:#75a86b}.square.valid::after{content:"";position:absolute;inset:28%;border-radius:50%;background:#ffe168;box-shadow:0 0 0 4px #fff9}.square.target::before{content:"🔑";position:absolute;inset:0;display:grid;place-items:center;font-size:clamp(1.2rem,5vw,2.5rem)}.piece-layer{position:absolute;inset:0;pointer-events:none}.piece{position:absolute;inset:0 auto auto 0;width:20%;height:20%;display:grid;place-items:center;font-size:clamp(2rem,8vw,4.1rem);transition:transform .35s;filter:drop-shadow(0 3px 1px #fff)}
.light{width:72px;height:72px;border:5px solid #fff;border-radius:50%;opacity:.48;box-shadow:0 5px 15px #1745}.light.on,.light.collected{opacity:1;transform:scale(1.14);box-shadow:0 0 30px currentColor}.share-board{display:grid;grid-template-columns:1fr 1fr;gap:16px;width:min(100%,540px)}.stars{grid-column:1/-1;display:flex;justify-content:center;gap:10px}.star{font-size:3rem;border:0;background:transparent}.star.picked{opacity:.25}.friend-bucket{min-height:130px;border:4px dashed #5aa9b4;border-radius:25px;background:#e9ffff;display:grid;place-items:center;font-size:2.5rem}.friend-bucket.active{outline:5px solid #ffd456}.bridge{width:min(100%,520px);height:250px;position:relative;border-radius:25px;background:linear-gradient(#b9efff 0 48%,#328da7 48%);overflow:hidden}.bridge-deck{position:absolute;left:10%;right:10%;top:48%;height:42px;background:#885a31;transform-origin:left;transform:rotate(-22deg);transition:.6s}.bridge.open .bridge-deck{transform:rotate(0)}.levers{display:flex;gap:18px;justify-content:center;margin-top:14px}.lever{min-width:100px;min-height:72px;border:4px solid #555;border-radius:18px;background:#ddd;font-size:2rem}.lever.on{background:#9effa8}.collectible{width:86px;height:86px;border:0;border-radius:50%;background:radial-gradient(circle,#fff,#ffe66d 40%,#f3a300);font-size:2.3rem;animation:float 1.4s ease-in-out infinite alternate}.collectible.collected{opacity:.2;transform:scale(.4);pointer-events:none}
.rescue,.finale{min-height:650px;position:relative;overflow:hidden;display:grid;place-items:center;text-align:center;background:linear-gradient(#073f5544,#073f5570),var(--bg) center/cover no-repeat;padding:25px}.rescue-copy,.finale-copy{position:relative;z-index:3;width:min(94%,720px);padding:24px;border:4px solid #fff;border-radius:28px;background:#ffffffe8;box-shadow:var(--shadow)}.cars-stage{position:relative;width:min(100%,850px);height:260px;margin:12px auto}.car{position:absolute;bottom:12px;width:min(31%,250px);object-fit:contain;filter:drop-shadow(0 8px 5px #1238)}.car.red{left:-35%;animation:drive-red 2.5s ease-out forwards}.car.light-blue{right:-35%;animation:drive-blue 2.5s .25s ease-out forwards}.car.dark-blue{left:50%;transform:translateX(-50%);animation:headlights 1.2s .7s ease-in-out infinite alternate}.finale .car.red{left:4%;animation:bounce 1.5s infinite alternate}.finale .car.light-blue{right:4%;animation:bounce 1.5s .3s infinite alternate}.finale .car.dark-blue{left:50%;animation:bounce 1.5s .6s infinite alternate}.team-photo{width:min(100%,520px);max-height:250px;object-fit:cover;object-position:top;border-radius:22px}.confetti{font-size:clamp(2rem,8vw,5rem);letter-spacing:.15em;animation:float 1s ease-in-out infinite alternate}
footer{display:flex;flex-wrap:wrap;justify-content:center;gap:9px;margin-top:14px}.repeat{background:#fff4bd}.soft.danger{color:#96314d}dialog{width:min(92vw,500px);border:0;border-radius:26px;padding:28px;text-align:center;color:var(--deep);box-shadow:0 30px 100px #002d}dialog::backdrop{background:#073f5588}.paused{filter:blur(3px);pointer-events:none}
@keyframes intro-arrive{from{opacity:0;transform:translateY(18px) scale(.97)}to{opacity:1;transform:none}}@keyframes bump{25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}@keyframes float{to{transform:translateY(-10px)}}@keyframes drive-red{to{left:18%}}@keyframes drive-blue{to{right:18%}}@keyframes headlights{to{filter:drop-shadow(0 8px 5px #1238) drop-shadow(0 0 18px #fff56c)}}@keyframes bounce{to{transform:translateY(-10px)}}
@media(max-width:900px){.topbar{grid-template-columns:1fr auto}.brand{grid-row:2;grid-column:1/-1;justify-self:center}.map{grid-template-columns:1fr}.map-copy{min-height:300px}.map-art{min-height:610px}.scene-body{grid-template-columns:1fr}.coach{min-height:230px}.play{min-height:390px}}
@media(max-width:560px){.app{padding:7px}.back{font-size:.78rem;padding:7px}.brand{font-size:1.05rem}.brand span{display:none}.tools button{min-width:44px;min-height:44px;padding:5px}.journey{gap:6px}.chapter-dot{width:29px;height:29px;font-size:.78rem}.chapter-dot+.chapter-dot{margin-left:1px}#stage{border-radius:21px;min-height:510px}.map-copy{padding:20px}.map-art{min-height:650px}.chapter-grid{padding:14px;gap:8px}.chapter-card{min-height:94px;font-size:.7rem}.chapter-card span{font-size:1.5rem}.scene{padding:7px}.scene-head{display:block;padding:14px}.scene-head h1{font-size:1.55rem}.scene-head .soft{margin-top:8px}.scene-body{margin-top:8px;gap:8px}.play,.coach{border-radius:19px;padding:12px}.play{min-height:340px}.coach{display:none}.grid-maze,.board{width:min(92vw,420px)}.dpad{grid-template:repeat(3,58px)/repeat(3,58px)}.choice,.select-item{min-height:62px}.share-board{gap:8px}.friend-bucket{min-height:105px}.cars-stage{height:190px}footer{gap:5px}.soft{min-height:46px;padding:7px 9px;font-size:.82rem}}
@media(max-width:360px){.back{max-width:108px}.lives{padding:5px}.heart{font-size:1rem}.chapter-dot{width:27px;height:27px}.chapter-grid{gap:6px}.chapter-card{min-height:84px}.dpad{grid-template:repeat(3,54px)/repeat(3,54px)}.select-item{width:76px;height:76px}.light{width:60px;height:60px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.001ms!important;transition-duration:.001ms!important;animation-iteration-count:1!important}}
