@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');
:root{--ink:#111b3c;--night:#090f25;--gold:#f4ce7c;--text:#f4ecd9;--muted:#9eabc8;--line:#ffffff18;--panel:#1e2b51}*{box-sizing:border-box}body{margin:0;min-height:100svh;color:var(--text);font-family:'DM Sans','Microsoft YaHei',sans-serif;background:radial-gradient(ellipse at 50% 35%,#293b65 0, var(--ink) 44%,var(--night) 100%)}body:before{content:'';position:fixed;inset:0;pointer-events:none;opacity:.22;background-image:radial-gradient(#f4ce7c 1px,transparent 1px);background-size:87px 103px}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}button:focus-visible{outline:3px solid var(--gold);outline-offset:5px}button:disabled{opacity:.35;cursor:not-allowed}button:hover:not(:disabled){filter:brightness(1.18)}button:active:not(:disabled){transform:translateY(2px)}.game{position:relative;width:min(100% - 48px,680px);margin:auto;padding:28px 0 20px}header{display:flex;justify-content:space-between;align-items:center}.edition{font-size:10px;letter-spacing:2px;color:var(--muted)}.edition i{display:block;letter-spacing:1px;font-style:normal;font-size:10px;margin-top:5px;opacity:.6}.small{background:#ffffff08;border:1px solid var(--line);border-radius:20px;padding:10px 15px;font-size:12px}.heading{text-align:center;padding:28px 0 24px}.eyebrow{font-size:11px;color:var(--gold);letter-spacing:4px;margin:0 0 5px}h1{font-family:'Playfair Display',Georgia,serif;font-size:clamp(48px,9vw,72px);letter-spacing:-3px;margin:0;line-height:1.2;font-weight:700}h1 em{color:var(--gold)}.subtitle{font-size:13px;color:var(--muted);letter-spacing:2px;margin:14px 0 0}.levelbar{display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:15px 0}.levelbar>div:not(.moves){text-align:center}.levelbar span{font-size:19px;font-weight:600}.levelbar small{display:block;font-size:10px;color:var(--muted);margin-top:4px}.moves{text-align:right;min-width:74px}.moves b{font-size:23px;font-variant-numeric:tabular-nums;color:var(--gold)}.workshop{position:relative;min-height:290px;display:flex;align-items:center;justify-content:center;padding:40px 6px 50px;isolation:isolate}.orbit{position:absolute;border:1px solid #f4ce7c0b;border-radius:50%;width:320px;height:240px;transform:rotate(-24deg);z-index:-1}.orbit-two{width:240px;height:320px;transform:rotate(24deg)}.board{display:flex;flex-wrap:wrap;align-items:end;justify-content:center;gap:30px 22px;max-width:570px;width:100%;perspective:700px}.bottle{position:relative;border:0;background:transparent;width:53px;height:184px;padding:0;transition:transform .25s,filter .25s;flex-shrink:0;filter:drop-shadow(0 9px 7px #0006)}.bottle .glass{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:2;pointer-events:none}.liquid{position:absolute;left:10%;right:10%;bottom:2.5%;height:85%;border-radius:0 0 12px 12px;overflow:hidden;display:flex;flex-direction:column-reverse;opacity:.95}.layer{height:25%;flex-shrink:0;background:linear-gradient(90deg,#0002,transparent 30%,#fff2 70%,#0002),var(--color);box-shadow:inset 0 2px #ffffff38;position:relative}.layer:after{content:attr(data-symbol);position:absolute;inset:0;display:grid;place-items:center;font-size:9px;color:#ffffff68}.shine{position:absolute;left:19%;top:17%;bottom:10%;width:3px;background:#ffffff27;z-index:3;border-radius:4px;pointer-events:none}.bottle.selected{transform:translateY(-22px);filter:drop-shadow(0 0 12px #f4ce7c70)}.bottle.complete:after{content:'✓';position:absolute;top:-22px;left:0;right:0;color:var(--gold);font-size:16px}.bottle.hinted{animation:hint 1s 3}.bottle.pouring{animation:pour .45s}.shelf{position:absolute;height:1px;bottom:34px;left:5%;right:5%;background:linear-gradient(90deg,transparent,#cba76e55,transparent);box-shadow:0 8px 28px 5px #0003}.workshop-label{position:absolute;bottom:10px;font-size:8px;letter-spacing:1px;color:#9eabc84d}#message{text-align:center;color:var(--muted);font-size:12px;min-height:32px;margin:12px 0 16px;line-height:1.7}.tools{display:flex;justify-content:center;gap:18px}.tools button{width:76px;border:1px solid #f4ce7c25;border-radius:18px;background:linear-gradient(#34446b66,#1b284b);padding:10px 0;color:var(--text);display:flex;flex-direction:column;align-items:center;gap:5px;box-shadow:0 5px 0 #080e2240}.tool-symbol{font-family:Georgia,serif;font-size:30px;line-height:34px;color:var(--gold)}.tools img{height:34px;width:34px;object-fit:contain}.tools button>span:last-child{font-size:11px}footer{display:flex;align-items:center;gap:10px;margin-top:32px;border-top:1px solid var(--line);padding-top:16px}footer img{width:66px;height:60px;object-fit:contain}footer p{flex:1;margin:0}footer b{font-size:12px;font-weight:500}footer p span{display:block;color:var(--muted);font-size:9px;margin-top:7px}footer button{background:transparent;border:1px solid var(--line);border-radius:50%;width:36px;height:36px;color:var(--muted)}dialog{background:var(--panel);color:var(--text);border:1px solid #f4ce7c55;border-radius:24px;padding:28px;width:min(90vw,440px);max-height:85svh;box-shadow:0 30px 100px #0008}dialog::backdrop{background:#050a1dbb;backdrop-filter:blur(8px)}dialog p{font-size:13px;line-height:1.9;color:var(--muted)}h2{font-family:Georgia,'Microsoft YaHei',serif;margin:0;font-size:28px}.dialog-heading{display:flex;align-items:center;justify-content:space-between}.close{background:transparent;border:0;font-size:28px;min-width:44px;min-height:44px}#level-list{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:22px}#level-list button{padding:14px 4px;background:#ffffff09;border:1px solid var(--line);border-radius:12px}#level-list button.current{border-color:var(--gold);color:var(--gold)}#level-list small{display:block;font-size:9px;margin-top:5px;color:var(--muted)}#win-dialog{text-align:center;padding:40px 28px}.primary{background:var(--gold);color:var(--ink);border:0;border-radius:12px;padding:15px 28px;font-weight:700}.secondary{display:block;font-size:12px;margin:15px auto 0;color:var(--muted)}@keyframes hint{50%{filter:drop-shadow(0 0 15px var(--gold));transform:translateY(-12px)}}@keyframes pour{40%{transform:translateY(-40px) rotate(var(--pour-angle, 23deg))}70%{transform:translateY(-40px) rotate(var(--pour-angle, 23deg))}}@media(min-width:800px){.game{padding-top:35px}.workshop{min-height:340px}.heading{padding:28px 0}.board{gap:30px}.bottle{width:58px;height:206px}}@media(max-width:400px){.game{width:calc(100% - 32px);padding-top:18px}.board{gap:24px 16px}.bottle{width:45px;height:164px}.tools{gap:12px}.tools button{width:67px}.heading{padding:22px 0}.workshop{min-height:260px}footer{margin-top:25px}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}

/* English title and controls need more horizontal space. */
header{justify-content:flex-end}.heading h1{font-size:clamp(38px,7.5vw,62px);letter-spacing:-2px}.heading .eyebrow{letter-spacing:2px}.tools button>span:last-child{font-size:10px}.levelbar small{max-width:220px;line-height:1.5}footer b{font-size:11px}footer p span{line-height:1.6}p{text-wrap:pretty}
#level-range{display:block;width:100%;margin-top:8px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--ink);color:var(--text);font:inherit}#levels-dialog label{font-size:12px;color:var(--muted)}
/* Completion celebration uses the original APK's Perfect, star and glow sprites. */
#win-dialog{padding:28px 24px 18px;overflow-x:hidden;background:radial-gradient(ellipse at 50% 22%,#456193 0,#25375e 38%,#152241 85%);border:1px solid #f4ce7c99;max-height:92svh}#win-dialog[open]{animation:victory-enter .45s cubic-bezier(.16,1,.3,1)}.victory-content{position:relative;z-index:1}.victory-emblem{position:relative;height:116px;width:160px;margin:4px auto 0}.victory-glow{position:absolute;width:180px;height:180px;left:-10px;top:-30px;opacity:.65;animation:victory-glow 4s linear infinite}.victory-star{position:absolute;width:92px;height:92px;object-fit:contain;left:34px;top:13px;filter:drop-shadow(0 0 16px #ffd472);animation:victory-star .65s cubic-bezier(.2,1.6,.4,1)}.victory-check{position:absolute;width:44px;right:15px;bottom:5px;filter:drop-shadow(0 3px 4px #0006)}.victory-perfect{display:block;max-width:76%;width:250px;height:auto;margin:0 auto 18px;animation:victory-star .6s .1s both}#win-title{font-family:'Playfair Display',Georgia,serif;font-size:clamp(24px,6vw,32px);color:var(--text)}#win-text{margin:8px 0 18px;font-size:13px;color:#cbd5ec}.victory-stats{display:grid;grid-template-columns:1fr 1fr;border:1px solid #f4ce7c30;border-radius:16px;background:#07142a40;padding:16px 8px}.victory-stats>div+div{border-left:1px solid #ffffff20}.victory-stats b{display:block;color:var(--gold);font-size:30px;line-height:1.2;font-variant-numeric:tabular-nums}.victory-stats span{display:block;font-size:10px;color:#bdcce5;margin-top:5px}.victory-progress{text-align:left;margin:18px 0 10px}.victory-progress span{font-size:11px;color:#bdcce5}.victory-progress progress{display:block;width:100%;height:7px;margin-top:8px;appearance:none;border:0;border-radius:8px;overflow:hidden;background:#080e24}.victory-progress progress::-webkit-progress-bar{background:#080e24}.victory-progress progress::-webkit-progress-value{background:var(--gold);border-radius:8px}.victory-progress progress::-moz-progress-bar{background:var(--gold)}#win-encouragement{font-size:11px;margin:14px 0 20px}#win-dialog .primary{width:100%;box-shadow:0 4px 0 #b08336,0 6px 24px #f4ce7c28;padding:17px 20px;font-size:16px}#win-dialog .secondary{margin-top:12px;min-height:36px}#confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:24px}#confetti span{position:absolute;left:var(--x);top:-25px;width:7px;height:13px;background:var(--color);opacity:0;animation:confetti-fall 2.6s var(--delay) ease-in forwards}#confetti span:nth-child(3n){border-radius:50%;width:8px;height:8px}.victorious .bottle.complete{animation:bottle-victory .7s ease-out}@keyframes victory-enter{from{opacity:0;transform:translateY(24px) scale(.9)}to{opacity:1;transform:none}}@keyframes victory-star{from{opacity:0;transform:scale(.3) rotate(-15deg)}to{opacity:1;transform:scale(1) rotate(0)}}@keyframes victory-glow{to{transform:rotate(360deg)}}@keyframes confetti-fall{0%{opacity:0;transform:translate(0,0) rotate(0)}10%{opacity:1}80%{opacity:1}100%{opacity:0;transform:translate(var(--drift),650px) rotate(var(--spin))}}@keyframes bottle-victory{50%{filter:drop-shadow(0 0 18px #f4ce7c);transform:translateY(-12px)}}@media(prefers-reduced-motion:reduce){#confetti{display:none}.victory-glow{animation:none}}
/* The original back sprite is the small rear lip, not a full bottle body. */
.bottle-back{position:absolute;left:22%;top:.3%;width:56%;height:1%;z-index:0;pointer-events:none}.bottle .liquid{z-index:1}
/* First-level rendering study; other levels keep their current presentation. */
.first-level-scene{height:410px;min-height:410px;padding:0;overflow:visible;border-radius:20px;background:#0c1638}.first-level-canvas{position:absolute;inset:0;width:100%;height:100%;border-radius:20px;pointer-events:none}.first-level-canvas[hidden]{display:none}.first-level-scene .orbit,.first-level-scene .shelf,.first-level-scene .workshop-label{display:none}.first-level-scene .board{position:absolute;inset:0;display:block!important;max-width:none;perspective:none;gap:0}.first-level-scene .bottle{position:absolute;transform:none!important;filter:none!important;background:transparent;border-radius:12px;transition:none;animation:none!important}.first-level-scene .bottle>*{visibility:hidden}.first-level-scene .bottle.complete:after{display:none}.first-level-scene .bottle:focus-visible{outline:2px solid #d7b2ff;outline-offset:8px}.first-level-scene .bottle:hover{background:#b180ff08}@media(max-width:400px){.first-level-scene{height:370px;min-height:370px}}
#level-list button.locked{opacity:.5;background:#080e2438;border-style:dashed;color:var(--muted);cursor:not-allowed}.level-lock{display:inline-block;position:relative;width:10px;height:8px;border:1px solid currentColor;border-radius:2px;margin-right:7px}.level-lock:before{content:'';position:absolute;width:5px;height:5px;border:1px solid currentColor;border-bottom:0;border-radius:5px 5px 0 0;left:1.5px;top:-6px}#levels-dialog details{font-size:11px;color:var(--muted);margin-bottom:16px}#levels-dialog summary{cursor:pointer;padding:8px 0}

/* Portal embedding: preserve the game's portrait board without page chrome. */
.embedded-game .game{width:calc(100% - 24px);padding:10px 0}
.embedded-game .heading{display:none}
.embedded-game .game>header{height:30px;margin-bottom:6px}
.embedded-game .small{padding:7px 10px;font-size:11px}
.embedded-game .levelbar{padding:8px 0;margin-bottom:8px}
.embedded-game .levelbar span{font-size:16px}
.embedded-game .levelbar small{font-size:9px;max-width:175px}
.embedded-game #message{font-size:11px;min-height:20px;margin:5px 0;line-height:1.5}
.embedded-game .tools{gap:8px}
.embedded-game .tools button{width:65px;padding:5px 0;border-radius:12px;gap:2px}
.embedded-game .tool-symbol{font-size:23px;line-height:25px}
.embedded-game .tools img{width:25px;height:25px}
.embedded-game .game>footer{display:flex;margin-top:8px;padding-top:8px;gap:8px}
.embedded-game .game>footer img{width:40px;height:40px;flex-shrink:0}
.embedded-game .game>footer p{min-width:0}
.embedded-game .game>footer b{font-size:9.5px;line-height:1.35}
.embedded-game .game>footer p span{font-size:8px;line-height:1.4;margin-top:3px}
.embedded-game .game>footer button{width:28px;height:28px;flex-shrink:0}

/* Keep the standalone game in a portrait play area on wider screens. */
html:not(.embedded-game) .game{width:min(calc(100% - 32px), 56.25svh, 450px);min-height:min(100svh, 800px);aspect-ratio:9 / 16}
html:not(.embedded-game) .game{padding:16px 0}
html:not(.embedded-game) .heading{padding:12px 0}
html:not(.embedded-game) .heading h1{font-size:clamp(36px, 6vh, 48px)}
html:not(.embedded-game) .subtitle{margin-top:5px}
html:not(.embedded-game) .levelbar{padding:8px 0}
html:not(.embedded-game) #message{margin:6px 0;min-height:22px}
html:not(.embedded-game) .tools button{padding:6px 0}
html:not(.embedded-game) .tool-symbol{font-size:25px;line-height:27px}
html:not(.embedded-game) .tools img{width:27px;height:27px}
html:not(.embedded-game) footer{margin-top:14px;padding-top:10px}

/* Level map: a winding path that keeps long campaigns easy to navigate. */
#levels-dialog{width:min(94vw,440px);height:min(88svh,760px);max-height:92svh;padding:0;overflow:hidden;display:none;flex-direction:column;border:1px solid #f5d1d0;border-radius:26px;color:#403650;background:#f2c4c4;box-shadow:0 24px 80px #080d22aa}
#levels-dialog[open]{display:flex}
#levels-dialog .map-header{display:flex;align-items:flex-start;justify-content:space-between;padding:21px 22px 13px;background:#fff8f2}
#levels-dialog .map-header h2{font-family:'Playfair Display',Georgia,serif;font-size:29px;color:#47365c}
#levels-dialog .map-header p{margin:0;font-size:11px;line-height:1.4;color:#89758b}
#levels-dialog .map-header .map-kicker{font-size:9px;font-weight:700;letter-spacing:2px;color:#bb7792;margin-bottom:4px}
#levels-dialog .map-header #map-progress{margin-top:4px}
#levels-dialog .close{color:#79677d;line-height:1}
#levels-dialog .map-toolbar{position:relative;z-index:2;display:flex;align-items:center;gap:9px;padding:10px 22px;background:#fff8f2;border-top:1px solid #e9dce3}
#levels-dialog .map-toolbar label{white-space:nowrap;color:#826c82;font-size:11px;font-weight:700}
#levels-dialog #level-range{flex:1;min-width:0;width:auto;margin:0;padding:8px 30px 8px 10px;border:1px solid #e7d3df;border-radius:10px;background:#fff;color:#51415c;font-size:12px}
#levels-dialog .map-toolbar details{position:relative;margin:0;color:#826c82;font-size:11px}
#levels-dialog .map-toolbar summary{padding:8px 0;list-style:none;text-decoration:underline;cursor:pointer}
#levels-dialog .map-toolbar details p{position:absolute;right:0;top:100%;width:min(280px,75vw);margin:0;padding:14px;border-radius:12px;background:#fff;color:#64536c;box-shadow:0 8px 24px #35223b3d;font-size:11px;line-height:1.6}
#levels-dialog .map-legend{display:flex;justify-content:center;flex-wrap:wrap;gap:8px 13px;padding:9px 12px;background:#f9e9e5;color:#766276;font-size:10px}
.map-legend span{display:inline-flex;align-items:center;gap:4px}.map-legend i{width:9px;height:9px;border-radius:3px;background:#b4aab4}.map-legend .legend-current{background:#72c99c}.map-legend .legend-ready{background:#d191b6}.map-legend .legend-done{background:#78a6dc}
#levels-dialog .map-scroll{position:relative;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;background:linear-gradient(180deg,#c883a0,#edb4b7 45%,#ffddc9);scrollbar-color:#b77e98 transparent;scrollbar-width:thin}
#levels-dialog #level-list{display:block;position:relative;width:100%;margin:0;min-height:120px}
#level-list svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
#level-list svg path{fill:none;stroke:#fff3e7;stroke-opacity:.54;stroke-width:14;stroke-linecap:round;vector-effect:non-scaling-stroke}
#levels-dialog #level-list .map-node{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;width:65px;height:65px;padding:0;border:3px solid #fff;border-radius:17px;background:linear-gradient(160deg,#f6d2e8,#d18db4 55%,#b671a1);color:#fff;box-shadow:0 4px 0 #8f6688,0 7px 14px #654b6955,inset 0 0 0 2px #ffffff55;transform:translate(-50%,-50%);opacity:1;text-shadow:0 1px 3px #533353aa}
#levels-dialog #level-list .map-node:hover:not(:disabled){filter:brightness(1.08);transform:translate(-50%,-53%)}
#levels-dialog #level-list .map-node.current{background:linear-gradient(150deg,#c7f5d4,#75cb96 55%,#50ad7d);box-shadow:0 0 0 7px #fff8,0 0 28px 12px #fff6,0 4px 0 #5e9278,inset 0 0 0 2px #fff7;z-index:1}
#levels-dialog #level-list .map-node.completed:not(.current){background:linear-gradient(150deg,#d3eaff,#80aee0 55%,#5b83bd);box-shadow:0 4px 0 #627da4,0 7px 14px #654b6955,inset 0 0 0 2px #fff7}
#levels-dialog #level-list .map-node.locked{background:linear-gradient(150deg,#ddd9da,#a49da4 58%,#87808b);color:#f4f0f4;box-shadow:0 4px 0 #77717d,0 7px 14px #654b6955,inset 0 0 0 2px #fff5;cursor:not-allowed}
#levels-dialog #level-list .map-node.milestone{outline:3px solid #ffe2a2;outline-offset:3px}
.map-node .node-number{font-family:Georgia,serif;font-size:24px;font-weight:700;line-height:1}
.map-node .node-status{font-size:10px;font-weight:800;line-height:1.3;letter-spacing:1px}
#levels-dialog #level-list .map-node:focus-visible{outline:3px solid #503868;outline-offset:6px}
@media(max-height:500px){#levels-dialog .map-header{padding:10px 16px 6px}#levels-dialog .map-toolbar{padding:5px 16px}#levels-dialog .map-legend{padding:5px}}
