:root{color-scheme:dark;--bg:#080713;--text:#f7f3ff;--muted:#a9a4c4;--purple:#a56bff;--cyan:#4de7ff;--pink:#ff73d1;--line:rgba(195,174,255,.15);font-family:"Vazirmatn",system-ui,sans-serif}*{box-sizing:border-box}html{min-height:100%;background:var(--bg)}body{margin:0;min-height:100vh;color:var(--text);background:radial-gradient(ellipse at 50% 12%,#201344 0,transparent 36%),linear-gradient(180deg,#0a0818,#080713 68%,#0b0a19);overflow-x:hidden}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;touch-action:manipulation}.app-shell{position:relative;z-index:1;width:min(100% - 34px,900px);margin:auto;padding:20px 0 24px}.ambient{position:fixed;pointer-events:none;filter:blur(75px);opacity:.2;border-radius:50%;z-index:0}.ambient-one{width:280px;height:280px;top:170px;left:-150px;background:#783bff}.ambient-two{width:240px;height:240px;right:-130px;top:460px;background:#00c7e9}.star-field{position:fixed;inset:0;pointer-events:none;opacity:.34;background-image:radial-gradient(1px 1px at 10% 18%,#fff 98%,transparent),radial-gradient(1px 1px at 72% 11%,#a9cfff 98%,transparent),radial-gradient(1.5px 1.5px at 88% 38%,#fff 98%,transparent),radial-gradient(1px 1px at 35% 58%,#d7c3ff 98%,transparent);background-size:310px 290px}.topbar{height:54px;display:flex;align-items:center;justify-content:space-between}.wordmark{display:flex;align-items:center;gap:10px;color:var(--text);text-decoration:none;direction:ltr}.brand-mark{width:37px;height:37px;display:grid;place-items:center;border:1px solid #b793ff8c;border-radius:12px;color:#fff;font-size:16px;font-weight:900;background:linear-gradient(145deg,#8d54ed,#30205c);box-shadow:0 0 22px #8b55ef55}.brand-mark span{color:#71eaff}.brand-name{font:800 13px/1 system-ui;letter-spacing:1.5px}.brand-name b{color:#b48aff}.top-actions{display:flex;align-items:center;gap:9px}.currency-pill,.icon-button{height:38px;border:1px solid var(--line);background:#ffffff08;border-radius:13px;color:var(--text)}.currency-pill{display:flex;align-items:center;gap:8px;padding:0 12px;font-size:13px}.currency-gem{color:#75eaff;text-shadow:0 0 12px #45dfff;font-size:16px}.icon-button{width:39px;font-size:18px;cursor:pointer}.icon-button:hover{border-color:#a56bff88;background:#a56bff18}.hero{position:relative;min-height:540px;padding:42px 10px 24px;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto;align-items:center}.hero-copy{grid-column:1;grid-row:1;align-self:start;padding:30px 0 0 5px;z-index:2}.eyebrow{margin:0 0 12px;color:#b9a2ff;font-size:11px;font-weight:700;display:flex;align-items:center;gap:8px}.pulse-dot{width:7px;height:7px;border-radius:50%;background:#67edff;box-shadow:0 0 12px #67edff}.hero h1{font-size:clamp(31px,6vw,51px);line-height:1.45;margin:0;font-weight:900;letter-spacing:-1.5px}.hero h1 span{color:#b98cff;text-shadow:0 0 28px #985aff55}.hero-description{max-width:310px;color:var(--muted);font-size:13px;line-height:2;margin:13px 0 0}.core-stage{grid-column:2;grid-row:1/3;position:relative;height:360px;display:grid;place-items:center;isolation:isolate}.core-glow{position:absolute;width:175px;height:175px;border-radius:50%;background:#824aff55;filter:blur(42px);animation:breathe 4s ease-in-out infinite}.prism{width:min(78%,240px);height:auto;position:relative;z-index:2;filter:drop-shadow(0 0 18px #9562ff99);animation:float 5s ease-in-out infinite}.orbit{position:absolute;border:1px solid #9c79ff35;border-radius:50%;transform:rotate(-25deg)}.orbit-a{width:270px;height:105px}.orbit-b{width:300px;height:140px;transform:rotate(57deg);border-color:#51dfff2a}.orbit-c{width:220px;height:220px;border-style:dashed;border-color:#d58cff26;animation:spin 34s linear infinite}.spark{position:absolute;width:5px;height:5px;background:#a9f7ff;border-radius:50%;box-shadow:0 0 13px 4px #59ddff88}.spark-one{top:20%;right:22%}.spark-two{bottom:22%;left:18%;background:#e5a5ff}.spark-three{top:54%;right:8%;width:3px;height:3px}.core-caption{position:absolute;bottom:18px;z-index:3;font:700 10px system-ui;letter-spacing:3px;color:#cfc1ff}.hero-bottom{grid-column:1/-1;grid-row:3;display:flex;align-items:center;flex-direction:column;gap:13px;padding-top:5px}.chapter-label{display:flex;align-items:center;gap:9px;color:#aaa4c5;font-size:10px}.chapter-label strong{font:700 10px system-ui;letter-spacing:2px;color:#d9caff}.chapter-line{width:25px;height:1px;background:linear-gradient(90deg,transparent,#a56bff)}.primary-button{position:relative;width:min(100%,390px);min-height:58px;border:1px solid #d2b6ff66;border-radius:17px;color:white;font-weight:800;font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:14px;background:linear-gradient(105deg,#713bd1,#8f4be9 48%,#4a70df);box-shadow:0 8px 30px #743ee955,inset 0 1px #ffffff55;transition:.2s;overflow:hidden}.primary-button:hover{transform:translateY(-2px);box-shadow:0 12px 38px #743ee977}.primary-button b{font-size:20px;color:#d7faff}.continue-hint{margin:0;color:#8883a5;font-size:11px}.quick-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:12px 0 42px}.stat-card{min-height:72px;border:1px solid var(--line);border-radius:16px;background:linear-gradient(145deg,#ffffff0c,#ffffff03);display:flex;align-items:center;gap:10px;padding:12px}.stat-icon{width:34px;height:34px;border-radius:11px;display:grid;place-items:center;background:#a56bff1a;font-size:17px}.stat-icon.cyan{color:var(--cyan);background:#4de7ff12}.stat-icon.pink{color:var(--pink);background:#ff73d112}.stat-card small{display:block;color:#9690b2;font-size:10px;margin-bottom:4px}.stat-card strong{font-size:13px}.modes-section{padding:0 2px}.section-heading{display:flex;justify-content:space-between;align-items:end;margin-bottom:16px}.section-heading .eyebrow{margin-bottom:5px}.section-heading h2{font-size:19px;margin:0}.section-number{font:10px system-ui;letter-spacing:1.5px;color:#696481}.mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.mode-card{min-height:135px;text-align:right;position:relative;overflow:hidden;border:1px solid var(--line);border-radius:18px;padding:14px;color:var(--text);cursor:pointer;background:linear-gradient(135deg,#21173d,#111025);transition:.2s}.mode-card:hover{transform:translateY(-3px);border-color:#a56bff88}.block-card{background:linear-gradient(135deg,#102b40,#111025)}.mode-art{height:66px;display:flex;align-items:center;justify-content:center;gap:7px;direction:ltr}.tubes-art i{width:17px;height:48px;border:2px solid #b8b1df;border-radius:5px 5px 10px 10px;background:linear-gradient(to top,#a64dff 0 27%,#4de7ff 27% 53%,#ff70c9 53% 76%,transparent 76%);box-shadow:0 0 12px #8e56ff55}.tubes-art i:nth-child(2){height:58px;background:linear-gradient(to top,#ffad55 0 30%,#66e7ff 30% 58%,#b86cff 58% 82%,transparent 82%)}.tubes-art i:nth-child(3){height:52px;background:linear-gradient(to top,#66e6bd 0 25%,#ff72ca 25% 55%,#a16aff 55% 78%,transparent 78%)}.tubes-art i:nth-child(4){height:43px;background:linear-gradient(to top,#4de7ff 0 32%,#a56bff 32% 65%,transparent 65%)}.blocks-art i{width:20px;height:20px;border-radius:4px;background:#a56bff;box-shadow:0 0 13px #a56bff99}.blocks-art i:nth-child(2),.blocks-art i:nth-child(5){background:#4de7ff;transform:translateY(-12px)}.blocks-art i:nth-child(3){background:#ff73d1}.blocks-art i:nth-child(4),.blocks-art i:nth-child(6){background:#5b83ff;transform:translateY(12px)}.mode-info{display:flex;flex-direction:column;gap:4px}.mode-info strong{font-size:13px}.mode-info small{font:9px system-ui;letter-spacing:.6px;color:#a6a0c1}.mode-arrow{position:absolute;left:13px;bottom:15px;color:#c4a4ff;font-size:19px}.footer{display:flex;justify-content:space-between;gap:12px;margin-top:35px;padding-top:17px;border-top:1px solid var(--line);font-size:10px;color:#77718f}.footer span:first-child{font:700 10px system-ui;letter-spacing:1.5px;color:#aaa0ca}
[hidden]{display:none!important}.game-screen{padding:18px 0 28px;min-height:calc(100vh - 95px)}.game-topline{display:flex;align-items:center;justify-content:space-between;gap:8px}.back-button,.game-level{border:1px solid var(--line);background:#ffffff09;color:#dcd5f7;border-radius:12px;padding:9px 12px;font-size:11px}.back-button{cursor:pointer}.game-heading{text-align:center}.game-heading small{font:700 9px system-ui;letter-spacing:2px;color:#b58aff}.game-heading h2{font-size:18px;margin:3px 0 0}.game-level b{color:#6deaff}.game-hud{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin:22px 0 20px}.game-hud>div{border:1px solid var(--line);background:#ffffff08;border-radius:13px;padding:9px;text-align:center}.game-hud small{display:block;color:#938cab;font-size:10px}.game-hud strong{font-size:17px}.liquid-board{display:flex;justify-content:center;align-items:flex-end;flex-wrap:wrap;gap:14px 11px;min-height:300px;padding:24px 12px 30px;border:1px solid #a987ff22;border-radius:22px;background:radial-gradient(ellipse at 50% 100%,#6539a52b,transparent 65%),#0e0c20}.tube{width:43px;height:154px;border:2px solid #c9c3edaa;border-top:4px solid #e7e1ff;border-radius:8px 8px 18px 18px;background:linear-gradient(90deg,#ffffff18,transparent 35%,#ffffff12);display:flex;flex-direction:column-reverse;overflow:hidden;padding:3px;position:relative;cursor:pointer;box-shadow:inset 0 0 12px #fff1,0 8px 18px #0005;transition:transform .18s,border-color .18s}.tube:before{content:"";position:absolute;inset:0 5px auto;height:20px;background:linear-gradient(#fff3,transparent);pointer-events:none}.tube.selected{transform:translateY(-12px);border-color:#66eaff;box-shadow:0 0 17px #42dfff77,inset 0 0 12px #fff2}.liquid-layer{height:25%;width:100%;flex:0 0 25%;border-radius:3px;box-shadow:inset 0 3px 5px #ffffff40,inset 0 -3px 5px #0002;animation:fillIn .25s ease}.tube.empty{opacity:.8}.block-board-wrap{border:1px solid #a987ff22;border-radius:22px;padding:14px;background:radial-gradient(ellipse at 50% 0%,#264c8a30,transparent 70%),#0e0c20}.block-board{width:min(100%,440px);aspect-ratio:1;display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin:auto;touch-action:manipulation}.block-cell{border:1px solid #ffffff0b;border-radius:5px;background:#ffffff08;min-width:0;aspect-ratio:1;padding:0}.block-cell.filled{background:var(--cell-color);border-color:#ffffff55;box-shadow:inset 0 2px 5px #ffffff44,0 0 10px color-mix(in srgb,var(--cell-color),transparent 45%)}.block-cell.preview{background:color-mix(in srgb,var(--preview-color),transparent 35%);border-color:var(--preview-color);box-shadow:0 0 10px var(--preview-color)}.block-cell.invalid{background:#ff426655}.piece-area{margin-top:18px}.piece-label{text-align:center;color:#a49dbd;font-size:11px;margin-bottom:10px}.piece-tray{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.piece-slot{min-height:92px;border:1px solid var(--line);border-radius:13px;background:#ffffff06;display:grid;place-items:center;cursor:pointer;padding:8px}.piece-slot.selected{border-color:#7beaff;box-shadow:0 0 16px #4de7ff44;background:#4de7ff0b}.piece-slot.used{opacity:.2;pointer-events:none}.piece-shape{display:grid;gap:3px}.piece-square{width:17px;height:17px;border-radius:4px;background:var(--piece-color);box-shadow:inset 0 2px 4px #ffffff55,0 0 8px color-mix(in srgb,var(--piece-color),transparent 45%)}.game-controls{display:flex;justify-content:center;gap:9px;margin:17px 0 10px}.tool-button{border:1px solid var(--line);border-radius:12px;background:#ffffff09;color:#dcd5f7;padding:10px 14px;display:flex;gap:7px;align-items:center;cursor:pointer;font-size:12px}.tool-button:disabled{opacity:.35;cursor:not-allowed}.tool-button:hover:not(:disabled){border-color:#a56bff88;background:#a56bff18}.game-message{min-height:25px;text-align:center;color:#a9a1c6;font-size:11px;line-height:1.8}.modal-backdrop{position:fixed;inset:0;z-index:10;background:#05040dd9;backdrop-filter:blur(12px);display:grid;place-items:center;padding:22px}.modal-backdrop[hidden]{display:none}.dialog{width:min(100%,420px);position:relative;padding:30px 22px 23px;text-align:center;border:1px solid #a56bff55;border-radius:24px;background:radial-gradient(ellipse at 50% 0%,#5a329344,transparent 65%),#121025;box-shadow:0 20px 90px #0009,0 0 40px #854bff22}.dialog-close{position:absolute;top:12px;left:14px;border:0;background:transparent;color:#aaa2c4;font-size:27px;cursor:pointer}.dialog h2{font-size:23px;margin:0 0 8px}.dialog>p:not(.eyebrow){color:var(--muted);font-size:12px;line-height:1.9}.dialog-actions{display:grid;gap:10px;margin-top:22px}.dialog-actions .primary-button{width:100%;min-height:49px}.secondary-button{min-height:49px;border:1px solid #5b4a83;border-radius:15px;background:#ffffff08;color:#e7ddff;font-weight:700;cursor:pointer}.secondary-button:hover{background:#a56bff20}
@keyframes float{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-13px) rotate(2deg)}}@keyframes breathe{0%,100%{opacity:.55;transform:scale(.88)}50%{opacity:1;transform:scale(1.12)}}@keyframes spin{to{transform:rotate(335deg)}}@keyframes fillIn{from{transform:scaleY(.2);transform-origin:bottom}to{transform:scaleY(1);transform-origin:bottom}}
@media(min-width:700px){.app-shell{padding-top:28px}.hero{min-height:570px;padding-inline:45px}.hero-copy{padding-top:65px}.core-stage{height:400px}.quick-stats{margin-inline:35px}.modes-section{padding-inline:35px}.mode-card{min-height:155px;padding:18px}.mode-art{height:78px}.footer{margin-inline:35px}.game-screen{max-width:720px;margin:auto}}
@media(max-width:520px){.app-shell{width:calc(100% - 28px);padding-top:12px}.hero{min-height:500px;padding:20px 0 18px;grid-template-columns:1fr 1fr}.hero-copy{padding-top:34px}.hero-description{font-size:11px;max-width:180px}.core-stage{height:300px}.orbit-a{width:190px;height:80px}.orbit-b{width:215px;height:100px}.orbit-c{width:175px;height:175px}.prism{width:90%}.core-caption{font-size:8px;letter-spacing:2px;bottom:18px}.quick-stats{gap:7px;margin-bottom:35px}.stat-card{padding:9px 7px;gap:7px;min-height:67px}.stat-icon{width:28px;height:28px;font-size:14px}.stat-card small{font-size:9px}.stat-card strong{font-size:11px}.section-heading h2{font-size:17px}.mode-grid{gap:8px}.mode-card{padding:10px;min-height:128px}.mode-info strong{font-size:12px}.mode-info small{font-size:8px}.footer{font-size:9px}.tube{width:38px;height:137px}.liquid-board{gap:12px 8px;min-height:270px;padding-inline:8px}.game-controls{gap:6px}.tool-button{padding:9px 10px;font-size:11px}.piece-square{width:14px;height:14px}.block-board{gap:3px}.game-topline{gap:5px}.back-button,.game-level{padding:8px;font-size:10px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
/* GAME VIEWPORT: keep gameplay fixed inside the mobile screen */
body.game-active{height:100dvh;min-height:0;overflow:hidden}
body.game-active .app-shell{height:100dvh;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}
body.game-active .topbar{display:none}
body.game-active #game-screen{display:flex;flex:1;min-height:0;height:100%;flex-direction:column;overflow:hidden;padding:8px 0 4px}
body.game-active .game-topline{flex:0 0 auto;min-height:42px}
body.game-active .game-heading small{display:none}
body.game-active .game-heading h2{font-size:16px}
body.game-active .game-hud{flex:0 0 auto;margin:10px 0 12px;gap:7px}
body.game-active .game-hud>div{padding:6px 8px}
body.game-active .game-hud small{font-size:9px}
body.game-active .game-hud strong{font-size:15px}
body.game-active .liquid-board{flex:1;min-height:0;height:auto;overflow:hidden;align-content:center;gap:clamp(8px,2vh,14px) clamp(6px,2vw,11px);padding:12px 8px}
body.game-active .tube{height:clamp(88px,18dvh,142px);width:clamp(29px,8.8vw,43px)}
body.game-active .block-board-wrap{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:clamp(8px,1.5vh,14px);padding:8px}
body.game-active .block-board{width:min(100%, min(440px, 43dvh));max-height:43dvh;flex:0 1 auto}
body.game-active .piece-area{flex:0 0 auto;margin-top:0}
body.game-active .piece-label{display:none}
body.game-active .piece-slot{min-height:clamp(58px,10dvh,82px);padding:5px}
body.game-active .piece-square{width:clamp(11px,3.3vw,16px);height:clamp(11px,3.3vw,16px)}
body.game-active .game-controls{flex:0 0 auto;margin:9px 0 3px;gap:7px}
body.game-active .tool-button{justify-content:center;min-height:40px;padding:7px 12px}
body.game-active .game-message{flex:0 0 auto;min-height:18px;margin:0;font-size:10px;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-height:700px){
 body.game-active .game-hud{margin:7px 0 8px}
 body.game-active .game-controls{margin-top:6px}
 body.game-active .block-board{width:min(100%, min(390px, 39dvh));max-height:39dvh}
 body.game-active .piece-slot{min-height:54px}
}
@media(max-width:380px){
 body.game-active .tool-button{padding-inline:8px;font-size:10px}
 body.game-active .game-level,body.game-active .back-button{padding:7px 8px}
}
@media(prefers-reduced-motion:reduce){body.game-active *{scroll-behavior:auto}}


/* Hard lock: the game itself must never exceed the visible phone viewport */
html:has(body.game-active), body.game-active {
  width:100%;
  height:100%;
  min-height:0 !important;
  max-height:100dvh;
  overflow:hidden !important;
}
body.game-active .app-shell {
  width:calc(100% - 28px);
  height:100dvh !important;
  min-height:0 !important;
  max-height:100dvh;
  margin:0 auto;
  padding-top:max(6px,env(safe-area-inset-top)) !important;
  padding-bottom:max(6px,env(safe-area-inset-bottom)) !important;
  overflow:hidden !important;
}
body.game-active #game-screen {
  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;
  overflow:hidden !important;
  flex:1 1 0 !important;
}
body.game-active #liquid-board,
body.game-active #block-board-wrap {
  min-height:0 !important;
  max-height:100% !important;
  overflow:hidden !important;
}
body.game-active .game-message {
  margin-bottom:0 !important;
}
