body.game-active {
  background-color:#100828;
  background-image:linear-gradient(#10072d44,#0b0624aa),url("gameplay-crystal-background.webp");
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
}
body.game-active.chapter-2-game{
  background-image:linear-gradient(#10072d33,#0b062477),url("crystal-chamber-gameplay.webp");
  background-position:center center;
}
body.game-active.chapter-2-game::before{background:radial-gradient(circle at 50% 48%,transparent 0 35%,#10052a77 100%)}
body.game-active.chapter-2-game .board-wrap{border-color:#d8c3ff;box-shadow:0 0 0 4px #7652b799,0 18px 45px #05020fbb,0 0 30px #9d77ff77,inset 0 2px 2px #ffffff55}
body.game-active.chapter-3-game{background-image:linear-gradient(#060b1533,#09070988),url("coal-valley-gameplay.webp");background-position:center center}
body.game-active.chapter-3-game::before{background:radial-gradient(circle at 50% 48%,transparent 0 35%,#06050988 100%)}
body.game-active.chapter-3-game .board-wrap{border-color:#ffb45f;box-shadow:0 0 0 4px #593421aa,0 18px 45px #030205cc,0 0 30px #ff852f66,inset 0 2px 2px #ffffff44}
body.game-active.chapter-4-game{background-image:linear-gradient(#02050a44,#01030a99),url("mine-gameplay.webp");background-position:center center}
body.game-active.chapter-4-game::before{background:radial-gradient(circle at 50% 48%,transparent 0 32%,#010309aa 100%)}
body.game-active.chapter-4-game .board-wrap{border-color:#7899ad;box-shadow:0 0 0 4px #263b4caa,0 18px 45px #00040ddd,0 0 30px #55cfff55,inset 0 2px 2px #ffffff33}
body.game-active.chapter-5-game{background-image:linear-gradient(#47641511,#1b3c1866),url("farm-gameplay.webp");background-position:center center}
body.game-active.chapter-5-game::before{background:radial-gradient(circle at 50% 48%,transparent 0 34%,#17321377 100%)}
body.game-active.chapter-5-game .board-wrap{border-color:#ffe575;box-shadow:0 0 0 4px #5b7f2aaa,0 18px 45px #142208aa,0 0 30px #fff26066,inset 0 2px 2px #ffffff66}
body.game-active.chapter-6-game{background-image:linear-gradient(#0b291d22,#061b1677),url("zellgemik-home-gameplay.webp");background-position:center center}
body.game-active.chapter-6-game::before{background:radial-gradient(circle at 50% 48%,transparent 0 34%,#04160faa 100%)}
body.game-active.chapter-6-game .board-wrap{border-color:#8cff9d;box-shadow:0 0 0 4px #1d633eaa,0 18px 45px #03150ddd,0 0 32px #52ff8a66,inset 0 2px 2px #ffffff66}
body.game-active.chapter-7-game{background-image:linear-gradient(#061c1066,#03130baa),url("forest-gameplay.webp");background-position:center}body.game-active.chapter-7-game .board-wrap{border-color:#88ee72;box-shadow:0 0 0 4px #245e2caa,0 18px 45px #020d08dd,0 0 30px #62ff6b66}
body.game-active.chapter-8-game{background-image:linear-gradient(#efff8611,#245a1855),url("meadow-gameplay.webp");background-position:center}body.game-active.chapter-8-game .board-wrap{border-color:#fff58a;box-shadow:0 0 0 4px #609331aa,0 18px 45px #17320aaa,0 0 32px #f4ff7566}
body.game-active.chapter-9-game{background-image:linear-gradient(#170a3b55,#09041d88),url("castle-approach-gameplay.webp");background-position:center}body.game-active.chapter-9-game .board-wrap{border-color:#78efff;box-shadow:0 0 0 4px #352078aa,0 18px 45px #07031bdd,0 0 32px #5beaff66}
body.game-active.chapter-10-game{background-image:linear-gradient(#2b0d3f55,#14062088),url("gemik-home-gameplay.webp");background-position:center}body.game-active.chapter-10-game .board-wrap{border-color:#ff9df1;box-shadow:0 0 0 4px #63287aaa,0 18px 45px #10051ddd,0 0 32px #ff6ee866}
body.game-active.chapter-5-game .gem.type-2.coal-gem{clip-path:polygon(50% 0,94% 26%,82% 85%,50% 100%,18% 85%,6% 26%);border-radius:0;background:linear-gradient(145deg,#fff9 0 10%,#d5afff 11% 25%,#a768ff 27% 68%,#5421a8 70%);filter:drop-shadow(0 4px 2px #03010a88) drop-shadow(0 0 6px #a767ff);box-shadow:none}
body.game-active.chapter-5-game .gem.type-2.coal-gem::before{display:none}body.game-active.chapter-5-game .gem.type-2.coal-gem::after{display:block;inset:14% 18% 50%;background:#fff8;clip-path:polygon(10% 0,100% 0,55% 100%,0 70%)}
body.game-active.chapter-5-game .gem.type-2.coal-gem.special-row::before{display:block;left:3%;right:3%;top:42%;bottom:auto;width:auto;height:16%;background:#fff;clip-path:none;box-shadow:0 0 5px #fff}body.game-active.chapter-5-game .gem.type-2.coal-gem.special-col::before{display:block;left:42%;right:auto;top:3%;bottom:3%;width:16%;height:auto;background:#fff;clip-path:none;box-shadow:0 0 5px #fff}

/* Farma: trzy typy gemów zmieniają się w produkty gospodarstwa */
body.game-active.chapter-5-game .gem.type-2{width:72%;height:88%;border:3px solid #fff8d2;border-radius:50% 50% 44% 44%;clip-path:ellipse(43% 49% at 50% 50%)!important;background:radial-gradient(circle at 34% 25%,#fff 0 8%,#fff9d7 10% 40%,#e8c995 68%,#a76c3d 100%)!important;box-shadow:inset -8px -10px 12px #b7794255,inset 5px 6px 9px #fff,0 5px 0 #76502c,0 0 11px #fff3a5!important;filter:drop-shadow(0 4px 2px #4c321966)!important}
body.game-active.chapter-5-game .gem.type-2::after{display:block;inset:13% 27% 58% 23%;border-radius:50%;clip-path:none;background:#fff9}
body.game-active.chapter-5-game .gem.type-3{width:72%;height:90%;border:3px solid #eaffff;border-radius:9px;clip-path:polygon(17% 0,83% 0,100% 20%,100% 100%,0 100%,0 20%);transform:none;background:linear-gradient(90deg,#d8fbff 0 17%,#fff 18% 68%,#bceeff 69% 100%);box-shadow:inset 0 -8px #65bddd88,inset 6px 0 #fff,0 5px 0 #347a9b,0 0 12px #9ff6ff;filter:drop-shadow(0 4px 2px #173f5a88)}
body.game-active.chapter-5-game .gem.type-3::after{display:block;content:"MILK";inset:31% 7% 23%;clip-path:none;padding-top:12%;border-radius:4px;background:linear-gradient(#4dc8ee,#257bb8);color:#fff;font:900 clamp(5px,1.2vw,8px) Nunito;text-align:center;text-shadow:0 1px #19557d}
body.game-active.chapter-5-game .gem.type-5{width:86%;height:82%;border:3px solid #ff9a80;border-radius:48% 52% 46% 50%;clip-path:none;background:radial-gradient(circle at 33% 25%,#fff5 0 7%,#ff755f 9% 31%,#ed362f 48%,#b91922 78%,#72131b 100%);filter:drop-shadow(0 5px 2px #64151baa) drop-shadow(0 0 8px #ff684f);box-shadow:inset -7px -8px 10px #71101b77,inset 5px 5px 8px #ffb39a88}
body.game-active.chapter-5-game .gem.type-5::after{display:block;inset:-9% 22% 67%;clip-path:polygon(50% 0,62% 36%,100% 25%,72% 56%,91% 100%,54% 70%,23% 100%,34% 57%,0 31%,39% 37%);background:linear-gradient(#c9ff72,#359c3f 62%,#17642e);filter:drop-shadow(0 2px 1px #174c25);box-shadow:none}
.gemik-miner{display:none;position:absolute;z-index:6;width:clamp(120px,21vw,155px);height:auto;left:clamp(-122px,-14vw,-86px);top:-4%;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 9px #ffd96855);transform-origin:center bottom}
body.game-active.chapter-4-game .gemik-miner{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.gemik-wanderer{display:none;position:absolute;z-index:6;width:clamp(120px,21vw,155px);height:auto;left:clamp(-122px,-14vw,-86px);top:-4%;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 9px #d975ff66);transform-origin:center bottom}
body.game-active.chapter-3-game .gemik-wanderer{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.gemik-king{display:none;position:absolute;z-index:6;width:clamp(120px,21vw,155px);height:auto;left:clamp(-122px,-14vw,-86px);top:-4%;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 10px #ffe06688) drop-shadow(0 0 15px #a35cff55);transform-origin:center bottom}
body.game-active.chapter-2-game .gemik-king{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.gemik-guide{display:none;position:absolute;z-index:6;width:clamp(120px,21vw,155px);height:auto;left:clamp(-122px,-14vw,-86px);top:-4%;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 12px #7cecff77);transform-origin:center bottom}
body.game-active:not(.chapter-2-game):not(.chapter-3-game):not(.chapter-4-game):not(.chapter-5-game):not(.chapter-6-game) .gemik-guide{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.gemik-farmer{display:none;position:absolute;z-index:6;height:auto;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 10px #ffe56d88) drop-shadow(0 0 15px #77d64f55)}
body.game-active.chapter-5-game .gemik-farmer,body.game-active.chapter-6-game .gemik-farmer{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.zellgemik-board{display:none;position:absolute;z-index:6;height:auto;pointer-events:none;user-select:none;filter:drop-shadow(0 10px 8px #000c) drop-shadow(0 0 11px #62ff7c88);transform-origin:center bottom}
body.game-active.chapter-6-game .zellgemik-board{display:block;left:auto!important;right:clamp(-122px,-14vw,-86px)!important;top:-4%!important;animation:zellgemik-hover 3s ease-in-out infinite alternate}
body.game-active.chapter-7-game .gemik-guide{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
body.game-active.chapter-8-game .gemik-guide{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
body.game-active.chapter-9-game .gemik-guide{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
body.game-active.chapter-10-game .gemik-guide{display:block;animation:miner-hover 2.8s ease-in-out infinite alternate}
.chapter-gemik{width:clamp(120px,21vw,155px)!important;left:clamp(-122px,-14vw,-86px)!important;top:-4%!important;transform-origin:center bottom!important}
@keyframes miner-hover{from{transform:translateY(-50%) rotate(-2deg)}to{transform:translateY(calc(-50% - 13px)) rotate(2deg);filter:drop-shadow(0 16px 10px #0009) drop-shadow(0 0 13px #ffd96877)}}
@keyframes zellgemik-hover{from{transform:translateY(calc(-50% - 10px)) rotate(2deg)}to{transform:translateY(calc(-50% - 23px)) rotate(-2deg);filter:drop-shadow(0 16px 10px #0009) drop-shadow(0 0 15px #62ff8c99)}}
@media(max-width:520px){.chapter-gemik{width:98px!important;left:-38px!important;top:-5%!important;opacity:.95}body.game-active.chapter-6-game .zellgemik-board{left:auto!important;right:-38px!important}}
body.game-active::before {
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:radial-gradient(circle at 50% 48%,transparent 0 38%,#09031966 100%);
}
body.game-active .ambient{opacity:.1}
body.game-active .game-shell{z-index:1}
body.game-active .topbar{padding-inline:8px;border-radius:18px;background:linear-gradient(90deg,transparent,#170d3c99,transparent)}
.game-logo{display:block;width:auto;height:68px;object-fit:contain;filter:drop-shadow(0 5px 7px #09021aaa)}
.map-header .game-logo{height:118px;max-width:min(92vw,430px)}
.topbar .brand{flex:1;justify-content:center;min-width:0}.topbar .game-logo{max-width:100%;height:70px}
body.game-active .hud-card,body.game-active .level-card{backdrop-filter:blur(9px);border-color:#aa8bd0aa}
body.game-active .board-wrap{border:3px solid #9eefff;box-shadow:0 0 0 4px #56328c99,0 18px 45px #05020fbb,0 0 25px #55eaff55,inset 0 2px 2px #ffffff44}
body.game-active .board-wrap::before,body.game-active .board-wrap::after{content:"◆";position:absolute;z-index:5;top:-18px;color:#75f3ff;font-size:27px;text-shadow:0 0 11px #57eaff;pointer-events:none}
body.game-active .board-wrap::before{left:18px;transform:rotate(-18deg)}body.game-active .board-wrap::after{right:18px;transform:rotate(18deg);color:#e38aff;text-shadow:0 0 11px #d968ff}
body.game-active footer{padding-bottom:8px;border-radius:18px;background:linear-gradient(180deg,transparent,#10082e77)}
@media(max-width:700px){body.game-active{background-position:center top;background-attachment:scroll}}
@media(max-width:480px){.map-header .game-logo{height:92px;max-width:92vw}.topbar .game-logo{height:58px}.topbar{height:66px}}

/* Gem Celu — po kliknięciu zamienia cały poziomy rząd w kolor celu */
.gem.goal-line{clip-path:polygon(50% 0,86% 18%,100% 50%,72% 100%,28% 100%,0 50%,14% 18%);border-radius:0;background:conic-gradient(from 25deg,#ffb7ee,#ff2d73 12%,#8a0f72 27%,#4b42ff 39%,#41e9ff 48%,#ff4ca5 61%,#ffcf66 76%,#d30d51 89%,#ffb7ee);box-shadow:inset 0 0 0 3px #fff9;filter:drop-shadow(0 0 9px #ff3c94) drop-shadow(0 0 17px #6beaff) drop-shadow(0 5px 2px #12042c);animation:goal-gem-pulse .85s ease-in-out infinite alternate}
.gem.goal-line::before{content:"";position:absolute;inset:8% 12% 45%;z-index:1;background:linear-gradient(135deg,#fff 0 14%,#ff9adaaa 15% 45%,transparent 47%);clip-path:polygon(0 0,100% 0,58% 100%,12% 70%)}
.gem.goal-line::after{display:block;content:"";position:absolute;inset:20%;background:radial-gradient(circle at 35% 25%,#fff 0 8%,#ff4e9c 10% 35%,#a50b58 60%,#4d084c 100%);clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);box-shadow:inset 0 0 7px #fff}
.gem.goal-line b{position:relative;z-index:2;font:900 21px Nunito;color:#fff;text-shadow:0 2px #7b0b55,0 0 9px #fff}.gem.goal-line span{position:absolute;z-index:3;left:50%;bottom:4%;transform:translateX(-50%);padding:0 5px;border:1px solid #fff8;border-radius:7px;background:#3c0b55dd;color:#fff78c;font:900 11px Nunito;box-shadow:0 0 7px #ff67d7}
.goal-line-cell{background:radial-gradient(circle,#8b326f,#392266 58%,#20164a)!important;box-shadow:inset 0 0 14px #ff50c766}
@keyframes goal-gem-pulse{to{transform:scale(1.11) rotate(3deg);filter:drop-shadow(0 0 15px #ff55b5) drop-shadow(0 0 24px #68edff) drop-shadow(0 5px 2px #12042c);filter:hue-rotate(16deg) drop-shadow(0 0 16px #ff55b5) drop-shadow(0 0 24px #68edff)}}

.gem.atom-board{clip-path:none;border-radius:50%;background:radial-gradient(circle at 36% 28%,#f8ffb0 0 8%,#c8ff4b 10% 35%,#56c62d 38% 58%,#174d29 62%);border:3px solid #dcff83;box-shadow:inset 0 0 11px #fff9;filter:drop-shadow(0 0 12px #8cff3e) drop-shadow(0 5px 2px #102517);animation:atom-board-pulse .65s ease-in-out infinite alternate}.gem.atom-board::after{display:none}.gem.atom-board b{font:900 28px Nunito;color:#173d21;text-shadow:0 1px #efff9c}.atom-board-cell{background:radial-gradient(circle,#58943d,#203f2b 62%,#20164a)!important;box-shadow:inset 0 0 14px #8dff4d88}
@keyframes atom-board-pulse{to{transform:scale(1.12) rotate(8deg);filter:drop-shadow(0 0 20px #baff55) drop-shadow(0 5px 2px #102517)}}

.gem.scissors{clip-path:none;border-radius:18px;background:linear-gradient(145deg,#fff8a1,#ffb52f 42%,#f15a50 70%,#8c246a);border:3px solid #fff1a2;box-shadow:inset 0 0 9px #fff9;filter:drop-shadow(0 0 11px #ffd74f) drop-shadow(0 5px 2px #3b1233);animation:scissors-snip .75s ease-in-out infinite alternate}.gem.scissors::after{display:none}.gem.scissors b{font:900 27px Nunito;color:#fff;text-shadow:0 2px #882d55,0 0 6px #fff}.gem.scissors span{position:absolute;right:-5px;bottom:-5px;padding:2px 4px;border:2px solid #fff;border-radius:9px;background:#ff3c73;color:#fff;font:900 9px Nunito}.scissors-cell{background:radial-gradient(circle,#83528f,#302052 65%,#20164a)!important}
@keyframes scissors-snip{to{transform:scale(1.09) rotate(-7deg);filter:drop-shadow(0 0 18px #fff16d) drop-shadow(0 5px 2px #3b1233)}}
