/* GemCrash responsive layout for GameMonetize embeds and fullscreen. */
#mapScreen *,#gameScreen *,.modal *,#tutorial *{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}

/* GameMonetize/Google IMA inject their controls into this document. Keep the
   game below the ad and never inherit the game's touch restrictions. */
body.ad-break{touch-action:auto!important}
body.ad-break [id^="sdk__"],
body.ad-break [id*="ima"],
body.ad-break [class*="ima"]{
 pointer-events:auto!important;
 touch-action:auto!important;
 -webkit-user-select:auto!important;
 user-select:auto!important;
 z-index:2147483647!important
}
body.ad-break #mapScreen,
body.ad-break #gameScreen,
body.ad-break #shopModal,
body.ad-break #wheelModal,
body.ad-break #tutorial,
body.ad-break #modal{z-index:0!important}
html,body{width:100%;height:100%;min-height:0;overflow:hidden}
body{min-height:100dvh;padding:6px}
.map-screen{width:min(720px,100%);height:calc(100dvh - 12px);min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border:2px solid #b99af0;box-shadow:none!important;scrollbar-width:thin;scrollbar-color:#8f6be0 #160d38}
.map-screen::-webkit-scrollbar{width:8px}.map-screen::-webkit-scrollbar-thumb{border:2px solid #160d38;border-radius:10px;background:#8f6be0}
.map-screen::after{background:none!important;box-shadow:none!important}.map-screen .map-header{box-shadow:none!important}
.game-shell{width:min(660px,calc(100vw - 12px));height:calc(100dvh - 12px);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
.modal{height:100dvh;padding:8px;overflow:hidden}.modal-card{max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain}

/* GameMonetize desktop/tablet iframe: horizontal UI without squeezing. */
@media (min-width:700px){
 body.game-active{padding:6px}
 body.game-active .game-shell{--board-size:min(560px,calc(100dvh - 56px),calc(100vw - 350px));display:grid;grid-template-columns:minmax(145px,210px) var(--board-size) minmax(145px,195px);grid-template-rows:38px auto 1fr;grid-template-areas:"top top top" "hud board tools" "goal board tools";justify-content:center;align-content:start;gap:6px 12px;width:calc(100vw - 12px);height:calc(100dvh - 12px);max-width:1180px;max-height:calc(100dvh - 12px);overflow:hidden}
 body.game-active .topbar{grid-area:top;width:100%;height:38px;margin:0}body.game-active .topbar .game-logo{height:36px;max-width:210px}body.game-active .icon-button{width:32px;height:32px;font-size:14px;border-radius:9px}
 body.game-active .hud{grid-area:hud;width:auto;margin:0;display:grid;grid-template-columns:1fr;gap:6px;align-self:start}body.game-active .hud-card,body.game-active .level-card{height:52px;padding:5px;border-radius:12px}body.game-active .hud small{font-size:7px;line-height:1}body.game-active .hud strong{font-size:19px;line-height:1.08}body.game-active .progress{height:4px;margin-top:3px}
 body.game-active .goal-strip{grid-area:goal;align-self:start;width:100%;height:auto;min-width:0;min-height:74px;margin:0;padding:7px;flex-direction:column;gap:5px;border-radius:13px}body.game-active .goal-label{width:100%;padding:0 0 4px;border-right:0;border-bottom:1px solid #715695;text-align:center;font-size:7px}body.game-active .goal{gap:7px}body.game-active .goal-gem-frame{width:36px;height:36px;flex-basis:36px;border-radius:10px}body.game-active .goal .gem.mini{width:27px!important;height:27px!important}body.game-active .goal-info{min-width:0}body.game-active .goal-info small{font-size:6px}body.game-active .goal-info strong{margin:1px 0;font-size:10px}body.game-active .goal-info b{font-size:15px}
 body.game-active .board-wrap{grid-area:board;align-self:start;width:var(--board-size);margin:0;padding:7px;border-radius:18px}body.game-active .board{gap:3px;padding:4px;border-radius:12px}body.game-active .cell{padding:3px;border-radius:7px}
 body.game-active footer{grid-area:tools;display:block;width:auto;margin:0;align-self:start}body.game-active .perk-bar{width:auto;margin:0;display:grid;grid-template-columns:repeat(2,minmax(66px,1fr));gap:6px}body.game-active .perk-bar .perk-use{width:auto;max-width:none;min-height:57px}body.game-active .perk-use>span{font-size:18px}body.game-active .perk-use>small{display:block;font-size:6px}body.game-active .footer-actions{position:static;display:grid;grid-template-columns:1fr;gap:6px;margin-top:8px}body.game-active .footer-actions .power-button{width:100%;margin:0;padding:6px 8px;gap:6px;border-radius:10px}body.game-active .footer-actions .power-button span{font-size:17px}body.game-active .footer-actions .power-button b{font-size:8px}body.game-active .footer-actions .power-button small{font-size:6px}body.game-active footer>p{display:none}
 body.game-active .chapter-gemik{left:-96px!important;top:86%!important;width:82px!important;opacity:.96}body.game-active.chapter-6-game .zellgemik-board{left:auto!important;right:-96px!important;top:86%!important;width:82px!important}
 .map-screen .map-header{position:relative;top:auto;padding:5px 10px 8px;border-radius:0 0 17px 17px}.map-header .game-logo{height:68px;max-width:285px}.map-header>p{margin:0 0 3px;font-size:10px;line-height:1.1}.map-header .chapter-switch{gap:5px;margin:3px auto 4px}.map-header .chapter-current{width:min(230px,46vw);min-height:33px;padding:3px 10px}.map-header .chapter-current small{font-size:6px}.map-header .chapter-current b{font-size:9px}.map-header .chapter-arrow{width:33px;height:33px;min-width:33px}.map-header .chapter-arrow span{font-size:26px}.map-header .map-stats{gap:5px}.map-header .map-stats span{padding:4px 9px;font-size:9px;line-height:1}.map-header .music-toggle{margin:4px 0 2px;padding:4px 9px;font-size:7px}.map-header .map-menu-buttons{gap:6px;margin-top:2px}.map-header .wheel-button,.map-header .shop-button{min-height:43px;margin:0;padding-top:2px;padding-bottom:2px;transform:scale(.84)}.map-header .wheel-button{transform-origin:right center}.map-header .shop-button{transform-origin:left center}
}

/* GameMonetize fullscreen: use the available space instead of keeping the 560px iframe scale. */
@media (min-width:1600px) and (min-height:850px){
 body.game-active .game-shell{
  --board-size:min(760px,calc(100dvh - 118px),calc(100vw - 620px));
  grid-template-columns:minmax(230px,280px) var(--board-size) minmax(220px,270px);
  grid-template-rows:54px auto 1fr;
  gap:10px 18px;
  max-width:1480px;
 }
 body.game-active .topbar{height:54px}
 body.game-active .topbar .game-logo{height:52px;max-width:280px}
 body.game-active .icon-button{width:44px;height:44px;font-size:19px;border-radius:12px}
 body.game-active .hud{gap:9px}
 body.game-active .hud-card,body.game-active .level-card{height:68px;padding:8px;border-radius:15px}
 body.game-active .hud small{font-size:9px}
 body.game-active .hud strong{font-size:26px}
 body.game-active .progress{height:6px;margin-top:5px}
 body.game-active .goal-strip{min-height:96px;padding:10px;border-radius:16px;gap:8px}
 body.game-active .goal-label{font-size:9px;padding-bottom:6px}
 body.game-active .goal-gem-frame{width:46px;height:46px;flex-basis:46px}
 body.game-active .goal .gem.mini{width:35px!important;height:35px!important}
 body.game-active .goal-info small{font-size:8px}
 body.game-active .goal-info strong{font-size:13px}
 body.game-active .goal-info b{font-size:20px}
 body.game-active .board-wrap{padding:9px;border-radius:21px}
 body.game-active .board{gap:4px;padding:5px}
 body.game-active .cell{padding:4px;border-radius:9px}
 body.game-active .perk-bar{gap:9px}
 body.game-active .perk-bar .perk-use{min-height:75px;border-radius:14px}
 body.game-active .perk-use>span{font-size:25px}
 body.game-active .perk-use>small{font-size:8px}
 body.game-active .footer-actions{gap:9px;margin-top:11px}
 body.game-active .footer-actions .power-button{padding:10px 12px;border-radius:13px}
 body.game-active .footer-actions .power-button span{font-size:22px}
 body.game-active .footer-actions .power-button b{font-size:11px}
 body.game-active .footer-actions .power-button small{font-size:8px}
 body.game-active .chapter-gemik{left:-126px!important;top:84%!important;width:110px!important}
 body.game-active.chapter-6-game .zellgemik-board{right:-126px!important;top:84%!important;width:110px!important}
}

/* Narrow/portrait fallback: one touch-friendly scrollable column. */
@media (max-width:699px){
 body{padding:4px}.map-screen,.game-shell{width:100%;height:calc(100dvh - 8px);max-height:calc(100dvh - 8px)}body.game-active .topbar{height:50px}body.game-active .topbar .game-logo{height:48px}body.game-active .hud{gap:5px}body.game-active .hud-card,body.game-active .level-card{padding:5px 3px}body.game-active .goal-strip{margin:5px auto;padding:5px 8px}body.game-active .board-wrap{padding:5px;border-radius:15px}body.game-active .board{gap:2px;padding:3px}body.game-active .perk-bar{gap:3px;margin-top:5px}body.game-active .perk-bar .perk-use{flex:1 1 28%;width:auto;max-width:none;min-height:43px}body.game-active footer>p{display:none}body.game-active .chapter-gemik{left:2px!important;top:-2%!important;width:76px!important;opacity:.95}body.game-active.chapter-6-game .zellgemik-board{left:auto!important;right:2px!important;width:76px!important}.map-screen{border-radius:0}.map-header{border-radius:0 0 18px 18px}
}

/* Horizontal map dashboard for GameMonetize landscape embeds. */
@media (min-width:700px){
 .map-screen{--map-image:url("crystal-kingdom-map-universal.webp");--side-a:#6d4fb5;--side-b:#170b3c;width:min(1180px,calc(100vw - 12px));background-image:var(--map-image),radial-gradient(ellipse at 50% 35%,var(--side-a) 0,#332066 52%,var(--side-b) 100%)!important;background-size:auto calc(100% - 94px),100% 100%;background-position:center 94px,center top;background-repeat:no-repeat;background-attachment:local}
 .map-screen.chapter-2{--map-image:url("crystal-castle-map.webp");--side-a:#57358e;--side-b:#12072d}
 .map-screen.chapter-3{--map-image:url("coal-valley-map.webp");--side-a:#74442b;--side-b:#1b0d0a}
 .map-screen.chapter-4{--map-image:url("mine-map.webp");--side-a:#304255;--side-b:#080d15}
 .map-screen.chapter-5{--map-image:url("farm-map.webp");--side-a:#64863b;--side-b:#17230e}
 .map-screen.chapter-6{--map-image:url("zellgemik-home-map.webp");--side-a:#3c794e;--side-b:#0c2517}
 .map-screen.chapter-7{--map-image:url("forest-map.webp");--side-a:#315e3b;--side-b:#07190d}
 .map-screen.chapter-8{--map-image:url("meadow-map.webp");--side-a:#7ba84e;--side-b:#243918}
 .map-screen.chapter-9{--map-image:url("castle-approach-map.webp");--side-a:#59458c;--side-b:#160b35}
 .map-screen.chapter-10{--map-image:url("gemik-home-map.webp");--side-a:#74467f;--side-b:#210d2e}
 .map-screen .map-header{position:sticky;top:0;z-index:7;display:grid;grid-template-columns:150px minmax(260px,1fr) minmax(250px,340px);grid-template-rows:34px 48px;grid-template-areas:"brand title stats" "brand switch menu";align-items:center;gap:4px 12px;min-height:94px;padding:6px 12px 8px;border-radius:0 0 18px 18px}
 .map-header .brand{grid-area:brand;justify-content:center;align-self:center}
 .map-header .game-logo{width:145px;height:78px;max-width:100%;object-fit:contain}
 .map-header>p{grid-area:title;align-self:end;margin:0 0 2px;font-size:10px;line-height:1.1}
 .map-header .chapter-switch{grid-area:switch;width:100%;gap:5px;margin:0}
 .map-header .chapter-current{width:min(100%,270px);min-height:36px;padding:3px 9px}
 .map-header .chapter-arrow{width:34px;height:34px;min-width:34px}.map-header .chapter-arrow span{font-size:27px}
 .map-header .map-stats{grid-area:stats;align-self:end;gap:5px}
 .map-header .map-stats span{min-width:0;padding:5px 9px;font-size:9px;line-height:1}
 .map-header .map-menu-buttons{grid-area:menu;display:flex;align-items:center;justify-content:flex-end;gap:6px;margin:0}
 .map-header .wheel-button,.map-header .shop-button{flex:1 1 0;min-width:0;min-height:44px;margin:0;padding-top:2px;padding-bottom:2px;transform:none}
 .map-header .wheel-button{transform-origin:center}.map-header .shop-button{transform-origin:center}
 .map-header .wheel-button b,.map-header .shop-button b{font-size:9px}
 .map-header .wheel-button small,.map-header .shop-button small{font-size:6px}
 .map-header .music-toggle{position:absolute;left:165px;top:5px;width:105px;height:29px;margin:0;padding:4px 8px;border-radius:15px;font-size:7px;white-space:nowrap}
 .map-header .music-toggle span{font-size:12px}
 .map-screen .level-map{margin-top:0}
}

@media (min-width:700px) and (max-width:900px){
 .map-screen .map-header{grid-template-columns:115px minmax(230px,1fr) minmax(230px,290px);gap-x:7px;padding-inline:7px}
 .map-header .game-logo{width:110px;height:68px}
 .map-header .music-toggle{left:120px;top:5px;width:92px;font-size:6px}
 .map-header .wheel-btn-icon,.map-header .shop-button-icon{transform:scale(.78)}
 .map-header .wheel-button,.map-header .shop-button{padding-inline:5px}
}

/* Smaller, evenly spaced map markers that stay on the central route. */
@media (min-width:700px){
 .map-screen .level-row{left:50%!important}
 .map-screen .level-row .level-node{width:54px;height:54px;font-size:16px;border-width:3px}
 .map-screen .node-stars{bottom:-11px;font-size:8px}
 .map-screen.chapter-5 .level-map{height:1510px}
 .map-screen.chapter-5 .level-row:nth-child(odd):nth-child(-n+11){left:46%!important}
 .map-screen.chapter-5 .level-row:nth-child(even):nth-child(-n+11){left:54%!important}
 .map-screen.chapter-5 .level-row:nth-child(1){top:91%}.map-screen.chapter-5 .level-row:nth-child(2){top:85.5%}.map-screen.chapter-5 .level-row:nth-child(3){top:80%}.map-screen.chapter-5 .level-row:nth-child(4){top:74.5%}.map-screen.chapter-5 .level-row:nth-child(5){top:69%}.map-screen.chapter-5 .level-row:nth-child(6){top:63.5%}.map-screen.chapter-5 .level-row:nth-child(7){top:58%}.map-screen.chapter-5 .level-row:nth-child(8){top:52.5%}.map-screen.chapter-5 .level-row:nth-child(9){top:47%}.map-screen.chapter-5 .level-row:nth-child(10){top:41.5%}.map-screen.chapter-5 .level-row:nth-child(11){top:36%}.map-screen.chapter-5 .level-row:nth-child(12){top:29.5%}.map-screen.chapter-5 .level-row:nth-child(13){top:23%}.map-screen.chapter-5 .level-row:nth-child(14){top:16.5%}.map-screen.chapter-5 .level-row:nth-child(15){top:10%}
 .map-screen.chapter-7{background-size:auto calc(100% - 94px),100% 100%}
 .map-screen.chapter-7 .level-map{height:1600px}
 .map-screen.chapter-7 .level-row:nth-child(odd){left:46%!important}
 .map-screen.chapter-7 .level-row:nth-child(even){left:54%!important}
 .map-screen.chapter-7 .level-row:nth-child(1){top:91%}.map-screen.chapter-7 .level-row:nth-child(2){top:86.5%}.map-screen.chapter-7 .level-row:nth-child(3){top:82.1%}.map-screen.chapter-7 .level-row:nth-child(4){top:77.6%}.map-screen.chapter-7 .level-row:nth-child(5){top:73.1%}.map-screen.chapter-7 .level-row:nth-child(6){top:68.6%}.map-screen.chapter-7 .level-row:nth-child(7){top:64.2%}.map-screen.chapter-7 .level-row:nth-child(8){top:59.7%}.map-screen.chapter-7 .level-row:nth-child(9){top:55.2%}.map-screen.chapter-7 .level-row:nth-child(10){top:50.7%}.map-screen.chapter-7 .level-row:nth-child(11){top:46.3%}.map-screen.chapter-7 .level-row:nth-child(12){top:41.8%}.map-screen.chapter-7 .level-row:nth-child(13){top:37.3%}.map-screen.chapter-7 .level-row:nth-child(14){top:32.8%}.map-screen.chapter-7 .level-row:nth-child(15){top:28.4%}.map-screen.chapter-7 .level-row:nth-child(16){top:23.9%}.map-screen.chapter-7 .level-row:nth-child(17){top:19.4%}.map-screen.chapter-7 .level-row:nth-child(18){top:14.9%}.map-screen.chapter-7 .level-row:nth-child(19){top:10.5%}.map-screen.chapter-7 .level-row:nth-child(20){top:6%}
}

/* Fullscreen map: larger world artwork, header and level markers. */
@media (min-width:1600px) and (min-height:850px){
 .map-screen{
  width:min(1540px,calc(100vw - 32px));
  background-size:auto calc(100% - 124px),100% 100%;
  background-position:center 124px,center top;
 }
 .map-screen .map-header{
  grid-template-columns:210px minmax(390px,1fr) minmax(390px,470px);
  grid-template-rows:44px 62px;
  gap:6px 18px;
  min-height:124px;
  padding:8px 18px 10px;
  border-radius:0 0 23px 23px;
 }
 .map-header .game-logo{width:200px;height:104px}
 .map-header>p{font-size:14px;margin-bottom:4px}
 .map-header .chapter-switch{gap:8px}
 .map-header .chapter-current{width:min(100%,390px);min-height:48px;padding:5px 13px}
 .map-header .chapter-current small{font-size:8px}
 .map-header .chapter-current b{font-size:13px}
 .map-header .chapter-arrow{width:46px;height:46px;min-width:46px}
 .map-header .chapter-arrow span{font-size:34px}
 .map-header .map-stats{gap:8px}
 .map-header .map-stats span{padding:7px 13px;font-size:12px}
 .map-header .map-menu-buttons{gap:10px}
 .map-header .wheel-button,.map-header .shop-button{min-height:57px;padding:5px 9px}
 .map-header .wheel-button b,.map-header .shop-button b{font-size:12px}
 .map-header .wheel-button small,.map-header .shop-button small{font-size:8px}
 .map-header .music-toggle{left:224px;top:8px;width:138px;height:36px;padding:6px 10px;font-size:10px}
 .map-header .music-toggle span{font-size:16px}
 .map-screen .level-map,.map-screen.chapter-5 .level-map{height:1940px}
 .map-screen.chapter-7 .level-map{height:2050px}
 .map-screen.chapter-7{background-size:auto calc(100% - 124px),100% 100%}
 .map-screen .level-row .level-node{width:70px;height:70px;font-size:21px;border-width:4px}
 .map-screen .node-stars{bottom:-15px;font-size:11px}
}
