/* Color Sort Puzzle: main styles. The game is a portrait 333:592 canvas sized in container units (cqw), so the same
 * layout scales from a 320 px phone to a desktop column. Landscape, short screens and lite mode: css/responsive.css. */
@font-face{font-family:Nunito;src:url('../assets/fonts/Nunito.woff2') format('woff2');font-weight:200 1000;font-display:swap}
:root{color-scheme:dark;--pink:#fc68de;--violet:#100536;--focus:#75fff0}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:#080319;color:#fffbed;font-family:Nunito,'Arial Rounded MT Bold','Trebuchet MS',Arial,sans-serif;-webkit-text-size-adjust:100%;overscroll-behavior:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button:focus-visible{outline:2px solid var(--focus);outline-offset:3px}
button:disabled{opacity:.35;cursor:default}
button img{pointer-events:none;-webkit-user-drag:none}
@media(hover:hover){button:hover:not(:disabled){filter:brightness(1.12)}}
[hidden]{display:none!important}
#bottle-defs{position:absolute;width:0;height:0;overflow:hidden}

.layout{min-height:100dvh;display:grid;place-items:center;overflow:hidden}
.game{container-type:inline-size;position:relative;isolation:isolate;width:min(100vw,56.25dvh);aspect-ratio:333/592;background:linear-gradient(#0c0334 7%,#160b4d 41%,#2f2787 100%);overflow:hidden;box-shadow:0 0 100px #5140b12b;user-select:none;-webkit-user-select:none}
.space-dust{position:absolute;inset:0;z-index:-1;background-image:radial-gradient(circle at 12% 15%,#6b24b8 0 1px,transparent 1.4px),radial-gradient(circle at 69% 34%,#643ca6 0 .8px,transparent 1.2px),radial-gradient(circle at 38% 70%,#21658d 0 .7px,transparent 1.2px);background-size:67px 101px,93px 87px,81px 63px;opacity:.7}
.space-dust:after{content:'✦      ·           ✧                 ⋆';position:absolute;left:6%;top:16%;font-size:4cqw;letter-spacing:7cqw;color:#7133b5;line-height:30cqw;width:90%;word-break:break-all;opacity:.55}

/* Round buttons (settings, home). */
.round{width:11.5cqw;height:11.5cqw;min-width:44px;min-height:44px;border-radius:50%;background:radial-gradient(circle at 40% 30%,#ada0ff,#7964ee 55%,#4631ab 85%);box-shadow:inset 0 0 0 1cqw #ffffff16,0 1cqw 1cqw #05011a;color:#fff;display:grid;place-items:center;padding:0;flex-shrink:0}
.round img{width:62%;height:62%;filter:drop-shadow(0 .5cqw 0 #4d2bbd)}
.round.small{width:9.5cqw;height:9.5cqw}
/* The Home button: the same glossy violet as Settings with a pink ring, a white house with a pink roof, and a soft
 * press. 44 px minimum touch target. */
.home-btn{background:radial-gradient(circle at 40% 28%,#c3b7ff,#8a74f5 50%,#4b33b5 86%);box-shadow:inset 0 0 0 .8cqw #ffffff22,0 0 0 .7cqw #ff8be3aa,0 1.2cqw 1.2cqw #05011a;transition:transform .12s}
.home-btn img{width:66%;height:66%;filter:drop-shadow(0 .45cqw 0 #3b1f9e)}
.home-btn:active{transform:scale(.92)}

/* Top bar */
.topbar{position:absolute;top:3.7%;left:5%;right:5%;height:7%;display:flex;gap:2.5cqw;align-items:flex-start;z-index:4}
.wallet{position:relative;display:flex;align-items:center;justify-content:flex-end;margin-top:2cqw;margin-left:auto;margin-right:6cqw;height:7.8cqw;min-width:19cqw;border:1px solid #8152ce;border-radius:2.7cqw;background:linear-gradient(#25105b,#17083f);font-size:3.1cqw;font-weight:1000;padding:0 1.4cqw 0 9cqw;box-shadow:inset 0 0 .8cqw #c963fb55}
.heart{position:absolute;left:-5cqw;top:-4.5cqw;color:#ff7fba;font-size:15cqw;line-height:1;text-shadow:0 .6cqw #b12974,0 0 3cqw #ff7aaa9c;transform:rotate(-10deg)}
.heart b{position:absolute;inset:4.8cqw 0 0;text-align:center;color:white;font-size:6.8cqw;transform:rotate(10deg);text-shadow:0 .4cqw #b84387}
.coins{display:flex;align-items:center;gap:2cqw;margin-top:2cqw;min-width:20.4cqw;height:7.8cqw;border:1px solid #8656ce;border-radius:2.7cqw;background:linear-gradient(#28105a,#170a3d);font-size:3.8cqw;font-weight:900;padding:0 2cqw 0 7cqw;position:relative;box-shadow:inset 0 0 .8cqw #c963fb55}
.coin-icon{position:absolute;left:-3cqw;top:-1cqw;border:1cqw solid #ffda2f;border-radius:50%;height:8.4cqw;width:8.4cqw;transform:rotate(-20deg);background:radial-gradient(circle at 40% 35%,#fff5ac 0 18%,#ffb818 20%);box-shadow:.7cqw .6cqw #c7830b}
.coin-icon i{position:absolute;right:-2.6cqw;bottom:-3.2cqw;display:grid;place-items:center;background:#a5bd32;width:4.6cqw;height:4.6cqw;border-radius:50%;font-size:4.2cqw;line-height:1;color:white;font-style:normal;font-weight:1000;transform:rotate(20deg)}
.coin-dot{display:inline-block;width:3.6cqw;height:3.6cqw;border-radius:50%;background:radial-gradient(circle at 40% 35%,#fff5ac 0 20%,#ffb818 24%);border:.6cqw solid #ffda2f;vertical-align:-.4cqw}

/* Level badge */
.level-heading{position:absolute;top:12.9%;left:50%;transform:translateX(-50%);text-align:center;z-index:2;width:39cqw}
.level-heading h2{position:relative;margin:0;font-weight:1000;line-height:1.25;font-size:6cqw;letter-spacing:-.15cqw;padding:1.1cqw 1cqw 1.6cqw;border:2px solid #5337a4;border-bottom-color:#cc88ff;background:#0b0428;border-radius:2.7cqw;transform:rotate(-2deg);box-shadow:0 .5cqw #080124;text-shadow:0 .6cqw #000}
.difficulty{position:relative;display:inline-block;top:-.4cqw;z-index:-1;background:#2a1155;border:1px solid #8150b7;border-radius:0 0 2cqw 2cqw;padding:.4cqw 2.3cqw;font-size:3.5cqw;line-height:1.1;font-weight:1000;color:#deb0ff;text-shadow:0 .5cqw #000}
.paw{position:absolute;left:43%;top:-4.5cqw;z-index:3;color:#fff;background:#ed66b2;border:1px solid #ffc4e1;border-radius:50%;width:5cqw;height:5cqw;transform:rotate(15deg);display:grid;place-items:center}
.paw svg{width:75%;height:75%;fill:#fff}

.scoreboard{position:absolute;top:21.2%;left:8%;width:84%;display:flex;align-items:center;justify-content:space-between;z-index:2;font-size:2.6cqw}
.scoreboard>div{display:flex;align-items:baseline;gap:1.5cqw}
.scoreboard small{color:#cbb6ec;font-size:2.2cqw;letter-spacing:.2cqw}
.scoreboard b{color:#ffdf76;font-size:3.4cqw}
.scoreboard .target-score{flex-direction:column;align-items:flex-end;gap:.2cqw}
.scoreboard .target-score>b{font-size:2.5cqw;color:#e4cbff}

/* Board: bottles in explicit rows (js/game.js inserts row breaks), sized by the longest row. */
.board{position:absolute;top:25%;left:4%;width:92%;height:52.5%;display:flex;flex-wrap:wrap;align-content:space-evenly;justify-content:center}
.row-break{flex-basis:100%;height:0}
.bottle{position:relative;display:block;background:none;width:16.666%;height:30.8cqw;padding:0;transform-origin:50% 12%;transition:transform .25s,filter .25s;flex-shrink:0}
.board.cols-5 .bottle{width:19%;height:31cqw}
.board.cols-4 .bottle{width:23%;height:38cqw}
.board.cols-3 .bottle{width:25%;height:40cqw}
.board.rows-3 .bottle{height:29.5cqw}
.bottle svg{width:100%;height:100%;overflow:visible;filter:drop-shadow(0 1cqw .5cqw #0005)}
.bottle.selected{transform:translateY(-3cqw);filter:drop-shadow(0 0 2cqw #f1a8ff)}
.bottle.complete{filter:drop-shadow(0 0 1.7cqw #a6ffe777)}
.bottle.hinted{animation:hint 1s infinite}
.bottle.invalid{animation:shake .3s}
.bottle.pouring{transform:translateY(-4cqw) rotate(-8deg);transition:transform .1s}
.bottle.receiving{transform:scale(1.04);transition:transform .1s}
.complete-mark{position:absolute;bottom:-1cqw;left:50%;transform:translateX(-50%);color:#a5ffec;font-size:3cqw}

.play-meta{position:absolute;top:78.2%;left:8%;right:8%;display:flex;justify-content:space-between;font-size:2.6cqw;color:#bcb2e8}
.message{position:absolute;top:80.4%;width:100%;text-align:center;font-size:2.6cqw;color:#d3c6fc;margin:0;padding:0 4%;min-height:4cqw}
.tools{position:absolute;top:83%;left:12%;width:76%;display:flex;justify-content:space-between;z-index:5}
.tools button{position:relative;width:13.5cqw;height:11cqw;min-width:44px;min-height:40px;border-radius:3cqw;background:#2a1a6e99;padding:0;display:grid;place-items:center;box-shadow:inset 0 0 0 1px #8e6cd855}
.tools button img{width:7cqw;height:7cqw;filter:drop-shadow(0 .6cqw 0 #3a155e)}
.tools button small{font-size:2.3cqw;font-weight:900;position:absolute;right:-1cqw;top:-1cqw;background:#6749a1;border-radius:2cqw;min-width:4cqw;line-height:4cqw;padding:0 .8cqw}
.tools button.attention{animation:pulse 1s 3}
.pink-footer{position:absolute;bottom:0;left:-3%;width:106%;height:9%;background:radial-gradient(ellipse at 50% 100%,#ff54d2,#df359e 80%);border-radius:50% 50% 0 0 / 32% 32% 0 0;box-shadow:inset 0 1cqw 4cqw #ff87ee44;z-index:3}
.pink-footer>button{position:absolute;bottom:3.6cqw;left:0;width:100%;height:9cqw;font-size:5.6cqw;letter-spacing:-.2cqw;white-space:nowrap;font-weight:1000;padding:0;background:none;text-shadow:0 .7cqw #ae267c,0 1.3cqw 1cqw #5e1c6b66;color:white}
.scallops{position:absolute;inset:-3.4cqw 0 auto;height:10cqw;border-radius:50% 50% 0 0/100% 100% 0 0;background-image:url('../assets/images/scallops.svg');background-size:100% 100%;background-repeat:no-repeat;pointer-events:none}
.dfg-credit{position:absolute;bottom:.6cqw;left:0;width:100%;text-align:center;font-size:2.2cqw;font-weight:800;letter-spacing:.3cqw;color:#fff3fc;z-index:45;pointer-events:none;text-shadow:0 1px 2px #661b65}

/* After a win: Home + Next level. */
.win-bar{position:absolute;top:81%;left:10%;width:80%;display:flex;gap:3cqw;align-items:center;z-index:6}
.win-bar .home-btn{width:12.5cqw;height:12.5cqw}
.next-round{flex:1;height:12.5cqw;min-height:44px;background:linear-gradient(#ffb7ee,#ea55c4);box-shadow:0 1cqw #8d287f;border-radius:3cqw;font-size:4.6cqw;font-weight:1000;text-shadow:0 .4cqw #a53088;display:flex;align-items:center;justify-content:center;gap:2cqw}
.next-round img{width:5cqw;height:5cqw}

/* Home screen */
.game.screen-open>:not(.home-screen):not(.levels-screen):not(.dfg-credit){visibility:hidden}
.home-screen,.levels-screen{position:absolute;inset:0;z-index:40;background:radial-gradient(ellipse at 50% 58%,#4630a34f,transparent 50%),linear-gradient(#0d0436,#1d115c 65%,#32278b);text-align:center}
.home-screen:before,.levels-screen:before{content:'';position:absolute;inset:0;pointer-events:none;background-image:radial-gradient(circle,#d899ff99 0 1px,transparent 1.5px),radial-gradient(circle,#85fff980 0 1px,transparent 1.5px);background-size:53px 79px,91px 109px;opacity:.5}
.home-top{position:absolute;left:7%;right:7%;top:4%;display:flex;justify-content:space-between;align-items:center}
.home-coins{border:1px solid #a36ce0;background:#21104c;border-radius:3cqw;padding:1.5cqw 3cqw;color:#ffe276;font-size:4cqw;font-weight:900}
.home-title{position:absolute;top:13%;width:100%}
.home-title>span{font-size:2.6cqw;font-weight:900;letter-spacing:.8cqw;color:#ceb2ef}
.home-title h1{font-weight:1000;font-size:15cqw;line-height:.98;letter-spacing:-.7cqw;margin:4cqw 0 2cqw;color:#fff8ed;text-shadow:0 1.1cqw #64218b,0 1.7cqw #090222}
.home-title h1:focus{outline:none}
.home-title h1 strong{font-size:18cqw;color:#ff8be3;text-shadow:0 1.1cqw #9b2c91,0 1.7cqw #090222}
.home-title p{font-size:3.8cqw;color:#dec2f4;margin:3cqw 0;font-weight:800}
.home-bottles{position:absolute;top:43%;height:15%;left:19%;width:62%;display:flex;align-items:flex-end;justify-content:center;gap:3cqw}
.home-bottles>div{width:26%;height:86%;transform:rotate(-14deg);filter:drop-shadow(0 0 4cqw #f174cf44)}
.home-bottles>div:nth-child(2){height:100%;transform:translateY(-2cqw)}
.home-bottles>div:nth-child(3){transform:rotate(14deg)}
.home-bottles svg{height:100%;width:100%;overflow:visible}
.home-progress{position:absolute;top:61%;left:8%;width:84%;display:flex;justify-content:space-around;border:1px solid #a478d349;background:#1a0b4480;border-radius:3cqw;padding:3cqw 1cqw}
.home-progress small{display:block;font-size:2.1cqw;letter-spacing:.15cqw;color:#c7a6e6;font-weight:900}
.home-progress b{display:block;font-size:5cqw;color:#ffe8b5;margin-top:1cqw}
.home-progress b span{font-size:3cqw;color:#c7a6e6}
.home-play{position:absolute;top:72%;left:12%;width:76%;border-radius:4cqw;background:linear-gradient(#ffb0ee,#f76cd4 45%,#d839b2);box-shadow:inset 0 .5cqw #ffe3fc,0 1.5cqw #8f2487,0 2.5cqw 5cqw #08022255;font-size:6cqw;font-weight:1000;text-shadow:0 .6cqw #b23893;padding:3cqw 5cqw;display:flex;justify-content:space-between;align-items:center;min-height:48px}
.home-play img{width:5cqw;height:5cqw}
.home-play:active{transform:translateY(.8cqw);box-shadow:inset 0 .5cqw #ffe3fc,0 .7cqw #8f2487}
.home-save{position:absolute;top:80.5%;width:100%;font-size:2.5cqw;color:#b5a2d6;margin:0}
.home-actions{position:absolute;top:84%;left:8%;width:84%;display:flex;justify-content:space-between}
.home-actions button{background:transparent;color:#f5d1ff;width:30%;min-height:44px;padding:0;font-weight:800}
.home-actions img{width:7cqw;height:7cqw;display:block;margin:0 auto}
.home-actions span{display:block;font-size:2.7cqw;margin-top:1cqw;color:#d7c4ea}
.home-trim{position:absolute;bottom:0;width:106%;left:-3%;height:6%;background:linear-gradient(#e848bc,#be2d9a);border-radius:50% 50% 0 0}
.home-trim>span{position:absolute;bottom:4.2cqw;width:100%;left:0;font-size:2.5cqw;letter-spacing:.6cqw;font-weight:1000}

/* Level select */
.levels-top{position:absolute;top:3.5%;left:6%;right:6%;display:flex;align-items:center;justify-content:space-between;z-index:2}
.levels-top h2{margin:0;font-size:7cqw;font-weight:1000;text-shadow:0 .8cqw #64218b}
.levels-stars{display:flex;align-items:center;gap:1cqw;border:1px solid #a36ce0;background:#21104c;border-radius:3cqw;padding:1.2cqw 2.5cqw;color:#ffe276;font-size:3.4cqw;font-weight:900}
.levels-stars img{width:4.5cqw;height:4.5cqw}
.levels-tiers{position:absolute;top:13.5%;left:4%;right:4%;display:flex;gap:1.4cqw;overflow-x:auto;scrollbar-width:none;z-index:2;padding-bottom:1cqw}
.levels-tiers::-webkit-scrollbar{display:none}
.levels-tiers button{flex:0 0 auto;border-radius:5cqw;padding:1.6cqw 3cqw;background:#2a1460;border:1px solid #6e4bb8;color:#deb0ff;font-size:2.7cqw;font-weight:1000;min-height:36px}
.levels-tiers button[aria-selected=true]{background:linear-gradient(#ffb0ee,#e550c4);color:#fff;border-color:#ffc4ff;text-shadow:0 .4cqw #a53088}
.levels-grid{position:absolute;top:21.5%;bottom:7.5%;left:4%;right:4%;overflow-y:auto;display:grid;grid-template-columns:repeat(5,1fr);gap:2.4cqw;align-content:start;padding:1cqw 1cqw 6cqw;scrollbar-width:thin;scrollbar-color:#6e4bb8 transparent;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.lvl{position:relative;aspect-ratio:1/1.08;border-radius:3cqw;background:linear-gradient(#3b2386,#22105a);border:1px solid #7a58cc;box-shadow:0 .8cqw #0c0330;font-weight:1000;font-size:5.2cqw;color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;min-height:44px}
.lvl .stars{display:flex;gap:.3cqw;margin-top:.6cqw}
.lvl .stars img{width:3.4cqw;height:3.4cqw}
.lvl.next{background:linear-gradient(#ffb0ee,#e550c4);border-color:#ffd6f6;text-shadow:0 .5cqw #a53088;box-shadow:0 .8cqw #8f2487,0 0 3cqw #ff8be388}
.lvl.locked{background:#1a0b44;border-color:#3b2a75;color:#6f5aa6;box-shadow:none}
.lvl.locked img.lock{width:5cqw;height:5cqw;opacity:.85}
.lvl small{font-size:2.1cqw;color:#cbb6ec;font-weight:800}
.lvl.next small{color:#fff;text-shadow:none}

/* Dialogs */
dialog{background:linear-gradient(145deg,#31155d,#160b36);border:2px solid #8b51c8;border-radius:22px;width:min(90vw,370px);max-height:90dvh;overflow:auto;color:#fff;padding:26px 22px;text-align:center;box-shadow:0 20px 80px #0009}
dialog::backdrop{background:#08011dcc;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px)}
dialog h2{font-size:24px;margin:12px 0}
dialog p{font-size:14px;color:#d0bbec;line-height:1.7}
.close{position:absolute;right:6px;top:6px;background:none;width:44px;height:44px;padding:10px}
.close img{width:100%;height:100%}
.primary,.secondary{background:linear-gradient(#f998ed,#da49bd);border-radius:12px;padding:13px 20px;font-weight:1000;box-shadow:0 4px #8e277d;margin:8px 0;min-height:46px;font-size:16px;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.secondary{background:#5c3c8a;box-shadow:0 4px #2e1856}
.primary img,.secondary img{width:22px;height:22px}
.actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:6px}
.actions .primary{flex:1 1 150px}
.actions .secondary{flex:0 1 auto}
.setting-row{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:14px;margin:14px 0;text-align:left}
.setting-row button,.seg button{background:#764b9e;border-radius:8px;padding:10px 14px;min-height:44px;font-weight:900}
.seg{display:flex;gap:4px}
.seg button[aria-pressed=true]{background:linear-gradient(#f998ed,#da49bd)}
.seg button{padding:10px}
.modal-icon{font-size:55px;line-height:1}
.modal-icon img{width:72px;height:72px}
.reward-art{width:100%;max-width:280px;height:auto;display:block;margin:0 auto}
.tiny{font-size:10px;letter-spacing:1.5px;color:#d4acec;font-weight:900}
.star-rating{display:flex;justify-content:center;gap:6px;margin:6px 0}
.star-rating img{width:40px;height:40px}
.star-rating img:nth-child(2){transform:translateY(-8px) scale(1.12)}
.result-points{font-size:20px;color:#ffdf76;font-weight:1000}
.chest-bar{height:12px;border-radius:6px;background:#1a0b44;border:1px solid #6e4bb8;overflow:hidden;margin:8px 0}
.chest-bar i{display:block;height:100%;background:linear-gradient(90deg,#ffdd43,#ff8be3)}
.toast{position:fixed;left:50%;bottom:16%;transform:translate(-50%,20px);background:#2a1460f2;border:1px solid #8b51c8;color:#fff;border-radius:14px;padding:10px 16px;font-size:14px;font-weight:800;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:60;max-width:86vw;text-align:center}
.toast.show{opacity:1;transform:translate(-50%,0)}

.water-canvas{position:fixed;inset:0;width:100vw;height:100vh;z-index:25;pointer-events:none}
.confetti{position:fixed;top:-20px;width:8px;height:12px;z-index:30;animation:fall 2.8s linear forwards;pointer-events:none}
@keyframes hint{50%{filter:drop-shadow(0 0 10px #fff39e);transform:translateY(-3cqw)}}
@keyframes shake{25%,75%{translate:-4px}50%{translate:4px}}
@keyframes fall{to{transform:translateY(105vh) rotate(720deg)}}
@keyframes pulse{50%{box-shadow:inset 0 0 0 1px #8e6cd855,0 0 0 1.4cqw #ffdf6788}}
@media(prefers-reduced-motion:reduce){*,*:before{animation:none!important;transition:none!important}}
/* Phones taller than 333:592 use the whole screen: positions are percentages of the height, sizes follow the width. */
@media(max-aspect-ratio:333/592){.game{width:100vw;height:100dvh;aspect-ratio:auto}}

/* BrainCooker: keep the top bar clear of the platform Home button (set by the BrainCooker SDK). */
.topbar{left:calc(5% + var(--bc-home-inset, 0px))}
