:root{color-scheme:dark;--glass:rgba(15,18,22,.58);--line:rgba(255,255,255,.22)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#000;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
canvas{display:block;width:100%;height:100%;touch-action:none}#game{position:fixed;inset:0}
#crosshair{position:fixed;left:50%;top:50%;width:20px;height:20px;transform:translate(-50%,-50%);pointer-events:none;filter:drop-shadow(0 1px 1px #000)}
#crosshair:before,#crosshair:after{content:"";position:absolute;background:#fff}#crosshair:before{left:9px;top:2px;width:2px;height:16px}#crosshair:after{left:2px;top:9px;width:16px;height:2px}
#hud{position:fixed;inset:0;pointer-events:none;color:#fff;text-shadow:0 2px 2px #000}
#stats{position:absolute;left:12px;top:10px;background:var(--glass);border:1px solid var(--line);padding:8px 10px;border-radius:8px;font-size:12px;line-height:1.55;backdrop-filter:blur(5px)}
#hint{position:absolute;left:50%;top:12px;transform:translateX(-50%);background:var(--glass);border:1px solid var(--line);padding:7px 11px;border-radius:8px;font-size:12px;white-space:nowrap}
#hotbar{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);display:flex;gap:4px;padding:5px;background:rgba(0,0,0,.42);border-radius:7px}
.slot{width:54px;height:54px;border:2px solid rgba(255,255,255,.36);background:rgba(20,20,20,.58);display:grid;place-items:center;position:relative;border-radius:3px;pointer-events:auto}
.slot.active{border:3px solid #fff;transform:translateY(-2px)}.swatch{width:29px;height:29px;box-shadow:inset -5px -5px 0 rgba(0,0,0,.16),inset 4px 4px 0 rgba(255,255,255,.12)}
.qty{position:absolute;right:3px;bottom:1px;font-size:11px;font-weight:700}.key{position:absolute;left:3px;top:1px;font-size:9px;opacity:.8}
#message{position:absolute;left:50%;bottom:88px;transform:translateX(-50%);background:rgba(0,0,0,.52);padding:6px 10px;border-radius:6px;font-size:12px;opacity:0;transition:opacity .2s}
#mobile{position:fixed;inset:0;pointer-events:none;display:none}.pad{position:absolute;left:18px;bottom:92px;width:174px;height:174px;pointer-events:auto}
.pad button,.jump{position:absolute;width:56px;height:56px;border-radius:14px;border:1px solid rgba(255,255,255,.34);background:rgba(0,0,0,.36);color:#fff;font-size:22px;backdrop-filter:blur(3px);touch-action:none}
.pad .up{left:59px;top:0}.pad .up.running{background:rgba(10,107,220,.72);border-color:#91ddff;box-shadow:0 0 0 2px rgba(91,198,255,.25)}.pad .left{left:0;top:59px}.pad .down{left:59px;top:59px}.pad .right{right:0;top:59px}
.jump{right:24px;bottom:122px;width:82px;height:82px;border-radius:50%;font-size:15px;pointer-events:auto}
#tapbar{position:absolute;right:16px;bottom:24px;display:flex;gap:8px;pointer-events:auto}#tapbar button{height:46px;min-width:74px;border:1px solid rgba(255,255,255,.34);background:rgba(0,0,0,.42);color:#fff;border-radius:11px;font:inherit}
#startCover{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:linear-gradient(#7fb4df,#aacd8c 65%,#6f8d58);z-index:20;color:#fff;text-align:center}
#startCover .panel{padding:28px 26px;background:rgba(0,0,0,.46);border:1px solid rgba(255,255,255,.35);border-radius:14px;box-shadow:0 16px 50px rgba(0,0,0,.25);max-width:480px;margin:20px}
#startCover h1{font-size:clamp(34px,8vw,62px);margin:0 0 12px;letter-spacing:.03em;text-shadow:0 4px 0 rgba(0,0,0,.35)}
#startCover p{font-size:13px;line-height:1.7;margin:8px 0}#startCover button{margin-top:12px;font:inherit;font-weight:700;padding:14px 28px;border:2px solid #fff;border-radius:7px;color:#fff;background:#34703a;box-shadow:inset 0 -4px 0 rgba(0,0,0,.22);cursor:pointer}
#loading{margin-top:12px;font-size:12px;opacity:.9}
@media(max-width:760px),(pointer:coarse){#mobile{display:block}#hint{display:none}.slot{width:42px;height:42px}.swatch{width:23px;height:23px}#hotbar{bottom:18px;max-width:94vw;overflow:hidden}.slot:nth-child(n+7){display:none}#stats{font-size:10px}}
#crafting{position:fixed;inset:0;z-index:15;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.45);backdrop-filter:blur(3px);pointer-events:auto}
#crafting.open{display:flex}
.craft-panel{width:min(760px,92vw);max-height:86vh;overflow:auto;background:#c8c8c8;color:#202020;border:4px solid #2f2f2f;box-shadow:inset 4px 4px 0 #eee,inset -4px -4px 0 #777,0 16px 50px rgba(0,0,0,.45);padding:14px;text-shadow:none}
.craft-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}.craft-title{font-size:22px;font-weight:900;letter-spacing:.08em}.craft-sub{font-size:11px;color:#4b4b4b;margin-top:3px}
#craftClose{width:38px;height:38px;border:3px solid #555;background:#aaa;color:#111;font:700 24px/1 monospace;box-shadow:inset 2px 2px 0 #eee,inset -2px -2px 0 #777;cursor:pointer}
#craftInventory{display:flex;flex-wrap:wrap;gap:5px;padding:8px;margin-bottom:12px;background:#8d8d8d;border:3px solid #555;box-shadow:inset 2px 2px 0 #666,inset -2px -2px 0 #bbb}
.inv-chip{background:#dedede;border:2px solid #555;padding:5px 7px;font-size:11px;min-width:76px}.inv-chip strong{float:right;margin-left:8px}
#recipeList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.recipe{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;background:#b9b9b9;border:3px solid #555;padding:9px;box-shadow:inset 2px 2px 0 #e4e4e4,inset -2px -2px 0 #868686}
.recipe.locked{filter:grayscale(1);opacity:.55}.recipe-name{font-weight:900;font-size:13px}.recipe-needs{font-size:10px;color:#444;margin-top:5px;line-height:1.5}
.recipe button{min-width:84px;height:42px;border:3px solid #4a4a4a;background:#7fa55f;color:#111;font:800 12px monospace;box-shadow:inset 2px 2px 0 #bad399,inset -2px -2px 0 #536b40;cursor:pointer}
.recipe button:disabled{background:#888;box-shadow:none;color:#555;cursor:not-allowed}
.craft-help{font-size:10px;color:#444;margin-top:10px;text-align:center}
@media(max-width:760px),(pointer:coarse){#recipeList{grid-template-columns:1fr}.craft-panel{width:94vw;max-height:80vh;padding:10px}.recipe{grid-template-columns:1fr auto}.craft-title{font-size:18px}#tapbar{bottom:18px;right:12px;flex-direction:column}#tapbar button{min-width:68px;height:40px}}

#progress{position:absolute;left:50%;bottom:170px;transform:translateX(-50%);width:min(360px,78vw);background:rgba(0,0,0,.5);border:1px solid rgba(255,255,255,.28);padding:7px 9px;border-radius:7px;backdrop-filter:blur(4px)}
.xp-row{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:11px}
#levelText{color:#d6ff68;font-size:13px}#xpText{opacity:.9}
#xpTrack{height:8px;background:rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.25);margin:5px 0 4px;overflow:hidden}
#xpFill{height:100%;width:0;background:#78c83d;transition:width .22s ease}
#blueprintText{text-align:center;font-size:10px;color:#fff5b1}
.recipe-level{display:inline-block;margin-left:6px;padding:1px 4px;background:#6a6a6a;color:#fff;font-size:9px}
@media(max-width:760px),(pointer:coarse){#progress{bottom:151px;width:min(300px,70vw);left:53%}.xp-row{font-size:10px}#levelText{font-size:11px}#blueprintText{font-size:9px}}

#breakMeter{position:fixed;left:50%;top:calc(50% + 28px);transform:translateX(-50%);width:180px;display:none;pointer-events:none;z-index:6;color:#fff;text-align:center;text-shadow:0 2px 2px #000}
#breakMeter.active{display:block}
#breakLabel{font-size:11px;margin-bottom:4px}
#breakTrack{height:9px;background:rgba(0,0,0,.58);border:1px solid rgba(255,255,255,.45);overflow:hidden}
#breakFill{height:100%;width:0;background:#fff;transition:width .05s linear}

/* Mobile control separation: keep jump away from mining controls */
@media(max-width:760px),(pointer:coarse){
  #mobile{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
  .jump{
    right:18px;
    top:42%;
    bottom:auto;
    width:82px;
    height:82px;
    z-index:3;
    touch-action:none;
    -webkit-user-select:none;
    user-select:none;
  }
  #tapbar{
    right:12px;
    bottom:calc(18px + env(safe-area-inset-bottom));
    flex-direction:column;
    gap:10px;
    z-index:4;
  }
  #tapbar button{
    min-width:86px;
    height:46px;
    touch-action:none;
    -webkit-user-select:none;
    user-select:none;
    -webkit-touch-callout:none;
  }
  .pad{
    bottom:calc(84px + env(safe-area-inset-bottom));
  }
}

/* iPad/Chrome robust mobile controls v2 */
@media (pointer:coarse){
  #mobile{position:fixed;inset:0;pointer-events:none}
  .jump{
    position:absolute;
    top:auto !important;
    right:124px !important;
    bottom:calc(150px + env(safe-area-inset-bottom)) !important;
    width:78px !important;
    height:78px !important;
    z-index:6 !important;
    pointer-events:auto;
    touch-action:none;
  }
  #tapbar{
    position:absolute;
    right:12px !important;
    bottom:calc(14px + env(safe-area-inset-bottom)) !important;
    display:flex;
    flex-direction:column;
    gap:8px;
    z-index:7;
    pointer-events:auto;
  }
  #tapbar button{
    width:100px;
    min-width:100px;
    height:44px;
    margin:0;
    touch-action:none;
  }
}
@media (pointer:coarse) and (orientation:landscape){
  .jump{
    right:132px !important;
    bottom:calc(96px + env(safe-area-inset-bottom)) !important;
  }
  #tapbar{
    right:14px !important;
    bottom:calc(12px + env(safe-area-inset-bottom)) !important;
  }
}

/* General-item hotbar */
.item-glyph{display:grid;place-items:center;width:29px;height:29px;background:#d8d8d8;color:#222;border:2px solid #555;font-size:10px;font-weight:900;line-height:1;text-shadow:none}
.item-name{position:absolute;left:50%;bottom:-15px;transform:translateX(-50%);font-size:8px;white-space:nowrap;opacity:0;pointer-events:none}
.slot.active .item-name{opacity:1}
@media(max-width:760px),(pointer:coarse){
  #hotbar{overflow-x:auto;overflow-y:visible;max-width:96vw;pointer-events:auto;scrollbar-width:none}
  #hotbar::-webkit-scrollbar{display:none}
  .slot{width:38px;height:38px;min-width:38px}
  .swatch,.item-glyph{width:21px;height:21px}
  .item-glyph{font-size:8px}
  .slot:nth-child(n+7){display:grid!important}
  .item-name{display:none}
}

/* Pixel-art item visuals */
.item-icon{
  width:32px;
  height:32px;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  object-fit:contain;
  flex:none;
  background:transparent;
  touch-action:none;
}
.hotbar-icon{
  width:34px;
  height:34px;
  filter:drop-shadow(1px 2px 0 rgba(0,0,0,.38));
}
.inv-chip{
  display:flex;
  align-items:center;
  gap:7px;
  min-width:132px;
  min-height:42px;
  padding:4px 7px;
}
.inv-chip .inv-label{
  min-width:0;
  flex:1;
  line-height:1.2;
}
.inv-chip strong{
  float:none;
  margin-left:auto;
}
.inv-icon{
  width:28px;
  height:28px;
  filter:drop-shadow(1px 1px 0 rgba(0,0,0,.25));
}
.recipe-main{
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}
.recipe-copy{min-width:0}
.recipe-icon{
  width:38px;
  height:38px;
  filter:drop-shadow(1px 2px 0 rgba(0,0,0,.25));
}
.slot{
  overflow:visible;
}
@media(max-width:760px),(pointer:coarse){
  .hotbar-icon{width:26px;height:26px}
  .inv-icon{width:26px;height:26px}
  .recipe-icon{width:34px;height:34px}
  .inv-chip{min-width:118px}
}

/* Account + save UI */
#authCover{
  position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(#6ea4d6,#a9c98b 67%,#688556);color:#fff;padding:18px
}
.auth-panel{
  width:min(440px,94vw);background:rgba(18,21,24,.88);border:2px solid rgba(255,255,255,.34);
  box-shadow:0 18px 60px rgba(0,0,0,.38);padding:22px;border-radius:12px;text-shadow:none
}
.auth-panel h1{margin:0 0 16px;text-align:center;font-size:36px;letter-spacing:.06em;text-shadow:0 3px 0 #222}
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:16px}
.auth-tabs button,#authSubmit{
  min-height:44px;border:2px solid #555;background:#777;color:#fff;font:800 13px monospace;
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.28),inset -2px -2px 0 rgba(0,0,0,.26);cursor:pointer
}
.auth-tabs button.active{background:#4f8a44;border-color:#d8f0d2}
#authModeText{font-weight:900;font-size:15px;margin-bottom:10px}
#authForm{display:grid;gap:10px}
#authForm label{display:grid;gap:5px;font-size:11px;color:#d8d8d8}
#authForm input{
  width:100%;height:44px;border:3px solid #555;background:#dedede;color:#181818;padding:7px 9px;
  font:700 16px monospace;outline:none;box-shadow:inset 2px 2px 0 #aaa
}
#authForm input:focus{border-color:#b7e58d}
#authSubmit{margin-top:2px;background:#4f8a44}
#authError{min-height:18px;color:#ffb0aa;font-size:11px;line-height:1.4}
.auth-note{margin-top:12px;font-size:10px;line-height:1.5;color:#c8c8c8;text-align:center}
#accountBox{
  position:absolute;right:12px;top:10px;min-width:176px;background:var(--glass);border:1px solid var(--line);
  padding:7px 8px;border-radius:8px;font-size:10px;pointer-events:auto;text-shadow:0 2px 2px #000;
  backdrop-filter:blur(5px)
}
#accountBox>div:first-child{display:flex;justify-content:space-between;gap:10px;align-items:center}
#accountName{font-size:11px;color:#eaffaa;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#saveStatus{opacity:.8}
.account-actions{display:flex;gap:5px;margin-top:6px}
.account-actions button{
  flex:1;height:28px;border:1px solid rgba(255,255,255,.35);background:rgba(0,0,0,.36);
  color:#fff;font:700 9px monospace;border-radius:4px;touch-action:manipulation
}
@media(max-width:760px),(pointer:coarse){
  .auth-panel{padding:18px}
  .auth-panel h1{font-size:30px}
  #accountBox{right:8px;top:8px;min-width:150px;font-size:9px}
  #accountName{max-width:86px}
  .account-actions button{height:26px}
}

/* Five-world selection */
#worldCover{
  position:fixed;inset:0;z-index:35;display:none;align-items:center;justify-content:center;
  background:linear-gradient(#6ea4d6,#a9c98b 67%,#688556);color:#fff;padding:18px
}
.world-panel{
  width:min(820px,95vw);max-height:90vh;overflow:auto;background:rgba(18,21,24,.9);
  border:2px solid rgba(255,255,255,.34);box-shadow:0 18px 60px rgba(0,0,0,.38);
  padding:20px;border-radius:12px;text-shadow:none
}
.world-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:14px}
.world-head h2{margin:2px 0 4px;font-size:28px}
.world-head p{margin:0;color:#c9c9c9;font-size:11px}
.world-kicker{font-size:10px;color:#bfc4c8;letter-spacing:.08em}
.world-kicker strong{color:#eaffaa}
#worldLogout{
  min-width:100px;height:40px;border:2px solid #555;background:#777;color:#fff;
  font:800 11px monospace;box-shadow:inset 2px 2px 0 rgba(255,255,255,.25),inset -2px -2px 0 rgba(0,0,0,.25)
}
#worldGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.world-slot{
  border:3px solid #555;background:#c6c6c6;color:#202020;padding:12px;
  box-shadow:inset 2px 2px 0 #eee,inset -2px -2px 0 #858585;
  display:grid;grid-template-columns:1fr auto;gap:12px;align-items:center;min-height:108px
}
.world-slot.empty{background:#a9a9a9}
.world-slot-title{font-size:17px;font-weight:900;letter-spacing:.04em}
.world-slot-meta{font-size:10px;line-height:1.55;color:#444;margin-top:5px}
.world-slot-actions{display:flex;flex-direction:column;gap:6px}
.world-slot button{
  min-width:104px;height:38px;border:3px solid #4a4a4a;background:#6f9b52;color:#111;
  font:800 11px monospace;box-shadow:inset 2px 2px 0 #b6d49f,inset -2px -2px 0 #4b6d38
}
.world-slot .delete-world{background:#9b6760;box-shadow:inset 2px 2px 0 #d1aaa5,inset -2px -2px 0 #68413d;color:#fff}
@media(max-width:680px),(pointer:coarse){
  .world-panel{padding:14px;max-height:88vh}
  .world-head h2{font-size:22px}
  #worldGrid{grid-template-columns:1fr}
  .world-slot{min-height:92px;padding:10px}
  .world-slot button{min-width:96px;height:36px}
}

/* Full inventory */
#inventoryScreen{
  position:fixed;inset:0;z-index:28;display:none;align-items:center;justify-content:center;
  background:rgba(0,0,0,.46);padding:14px;pointer-events:auto
}
#inventoryScreen.open{display:flex}
.inventory-panel{
  width:min(640px,96vw);max-height:94vh;overflow:auto;
  background:#c6c6c6;color:#222;border:4px solid #383838;
  box-shadow:inset 3px 3px 0 #eee,inset -3px -3px 0 #7b7b7b,0 12px 40px rgba(0,0,0,.45);
  padding:14px;text-shadow:none
}
.inventory-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px}
.inventory-title{font:900 22px monospace;letter-spacing:.06em}
.inventory-sub{font:700 10px monospace;color:#555;margin-top:2px}
#inventoryClose{
  width:38px;height:38px;border:3px solid #555;background:#9a9a9a;color:#222;
  font:900 22px monospace;box-shadow:inset 2px 2px 0 #ddd,inset -2px -2px 0 #666
}
.inventory-grid{
  display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:4px;
}
.main-grid{margin-bottom:9px}
.inventory-hotbar-label{font:900 10px monospace;color:#555;margin:2px 0 4px}
.inv-slot{
  position:relative;aspect-ratio:1/1;min-width:0;
  border:3px solid #555;background:#8f8f8f;
  box-shadow:inset 2px 2px 0 #d7d7d7,inset -2px -2px 0 #666;
  display:flex;align-items:center;justify-content:center;padding:2px;touch-action:manipulation
}
.inv-slot.selected-slot{outline:3px solid #f7ef90;outline-offset:1px}
.inv-slot.hotbar-current{border-color:#e8e17d}
.inv-slot .item-icon{width:70%;height:70%;filter:drop-shadow(1px 2px 0 rgba(0,0,0,.3))}
.inv-slot .stack-qty{
  position:absolute;right:3px;bottom:1px;color:#fff;font:900 12px monospace;
  text-shadow:1px 1px 0 #000,-1px -1px 0 #000
}
.inv-slot .slot-number{
  position:absolute;left:3px;top:2px;font:700 8px monospace;color:#222;opacity:.75
}
.inventory-detail{
  display:grid;grid-template-columns:48px minmax(0,1fr) auto;gap:9px;align-items:center;
  margin-top:12px;padding:9px;border:3px solid #666;background:#aaa;
  box-shadow:inset 2px 2px 0 #ddd,inset -2px -2px 0 #777
}
.inventory-detail.empty{opacity:.65}
#inventoryDetailIcon{width:44px;height:44px;display:flex;align-items:center;justify-content:center}
#inventoryDetailIcon .item-icon{width:40px;height:40px}
.inventory-detail-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
#inventoryDetailName{font:900 14px monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#inventoryDetailQty{font:700 10px monospace;color:#555}
.inventory-actions{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.inventory-actions button{
  min-width:84px;height:36px;border:3px solid #555;background:#8e8e8e;color:#222;
  font:900 10px monospace;box-shadow:inset 2px 2px 0 #ddd,inset -2px -2px 0 #666
}
#inventoryDrop{background:#9d6660;color:#fff;box-shadow:inset 2px 2px 0 #d6a29e,inset -2px -2px 0 #68433f}
.inventory-actions button:disabled{opacity:.4}
.inventory-help{text-align:center;margin-top:8px;font:700 9px monospace;color:#666}
@media(max-width:760px),(pointer:coarse){
  .inventory-panel{padding:10px}
  .inventory-title{font-size:18px}
  .inventory-grid{gap:3px}
  .inv-slot{border-width:2px}
  .inventory-detail{grid-template-columns:42px 1fr;gap:7px}
  #inventoryDetailIcon{width:38px;height:38px}
  #inventoryDetailIcon .item-icon{width:36px;height:36px}
  .inventory-actions{grid-column:1/-1;justify-content:stretch;display:grid;grid-template-columns:repeat(3,1fr)}
  .inventory-actions button{min-width:0;height:34px}
  #tapbar button{width:100px;min-width:100px}
}

.inv-slot.move-target{box-shadow:inset 2px 2px 0 #d7d7d7,inset -2px -2px 0 #666,0 0 0 1px rgba(255,245,150,.22)}
.inv-slot.move-target:active{outline:2px solid rgba(255,245,150,.85)}

/* Player health + death */
#healthHud{
  position:absolute;left:50%;bottom:88px;transform:translateX(-50%);
  display:flex;align-items:center;justify-content:center;
  padding:3px 6px;background:rgba(0,0,0,.34);border-radius:6px
}
#hearts{display:flex;gap:2px;align-items:center}
.heart-img{
  width:24px;height:22px;display:block;object-fit:contain;
  image-rendering:pixelated;image-rendering:crisp-edges;
  user-select:none;-webkit-user-drag:none
}
#deathScreen{
  position:fixed;inset:0;z-index:60;display:none;align-items:center;justify-content:center;
  background:rgba(74,0,0,.58);backdrop-filter:blur(2px);pointer-events:auto
}
#deathScreen.open{display:flex}
.death-panel{text-align:center;color:#fff;text-shadow:0 3px 0 rgba(0,0,0,.55);padding:28px}
.death-title{font:900 clamp(44px,10vw,82px)/1 monospace;margin-bottom:16px}
.death-sub{font:700 13px monospace;margin-bottom:20px}
#respawnBtn{
  min-width:220px;padding:14px 24px;border:3px solid #fff;background:#6d6d6d;color:#fff;
  font:900 16px monospace;box-shadow:inset 3px 3px 0 #a9a9a9,inset -3px -3px 0 #3d3d3d;
  cursor:pointer
}
#respawnBtn:active{transform:translateY(1px)}
@media(max-width:760px),(pointer:coarse){
  #healthHud{bottom:74px}
  .heart-img{width:20px;height:19px}
  #hearts{gap:1px}
  #respawnBtn{min-width:190px;min-height:48px}
}

/* Stamina: ten decorative full-charge lightning icons (no drain or regeneration yet). */
#staminaHud{
  position:absolute;
  left:50%;
  bottom:124px;
  transform:translateX(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:3px 6px;
  border-radius:6px;
  background:rgba(0,0,0,.34);
  pointer-events:none;
}
#staminaIcons{display:flex;align-items:center;gap:2px}
.stamina-img{
  display:block;
  width:24px;
  height:22px;
  object-fit:contain;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  user-select:none;
  -webkit-user-drag:none;
}
@media(max-width:760px),(pointer:coarse){
  #staminaHud{bottom:106px}
  .stamina-img{width:20px;height:19px}
  #staminaIcons{gap:1px}
}


/* Large, spacious D-pad: 4 directions around a genuinely empty center. */
@media (max-width:760px),(pointer:coarse){
  .pad{
    --dpad-size:76px;
    --dpad-gap:8px;
    position:absolute;
    left:16px;
    bottom:calc(84px + env(safe-area-inset-bottom));
    width:calc(var(--dpad-size) + var(--dpad-size) + var(--dpad-size) + var(--dpad-gap) + var(--dpad-gap));
    height:calc(var(--dpad-size) + var(--dpad-size) + var(--dpad-size) + var(--dpad-gap) + var(--dpad-gap));
    pointer-events:none;
    z-index:6;
  }
  .pad button{
    position:absolute;
    width:var(--dpad-size);
    height:var(--dpad-size);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
    font-size:32px;
    font-weight:900;
    line-height:1;
    border-radius:18px;
    pointer-events:auto;
    touch-action:none;
    -webkit-user-select:none;
    user-select:none;
    -webkit-touch-callout:none;
  }
  .pad .up{
    left:calc(var(--dpad-size) + var(--dpad-gap));
    top:0;right:auto;bottom:auto;
  }
  .pad .left{
    left:0;
    top:calc(var(--dpad-size) + var(--dpad-gap));
    right:auto;bottom:auto;
  }
  .pad .right{
    left:calc(var(--dpad-size) + var(--dpad-size) + var(--dpad-gap) + var(--dpad-gap));
    top:calc(var(--dpad-size) + var(--dpad-gap));
    right:auto;bottom:auto;
  }
  .pad .down{
    left:calc(var(--dpad-size) + var(--dpad-gap));
    top:calc(var(--dpad-size) + var(--dpad-size) + var(--dpad-gap) + var(--dpad-gap));
    right:auto;bottom:auto;
  }
}
@media (pointer:coarse) and (max-width:600px) and (orientation:portrait){
  .pad{
    --dpad-size:62px;
    --dpad-gap:7px;
    left:10px;
    bottom:calc(84px + env(safe-area-inset-bottom));
  }
  .pad button{font-size:28px;border-radius:15px}
  /* Keep jump on the right and away from the larger D-pad and action bar. */
  .jump{
    right:12px !important;
    bottom:calc(236px + env(safe-area-inset-bottom)) !important;
  }
}

/* Camera view switch: anchored below the coordinates, clear of the movement pad. */
#viewModeButton{
  position:absolute;
  top:115px;
  left:12px;
  min-height:40px;
  padding:7px 11px;
  border:2px solid rgba(230,246,255,.55);
  border-radius:8px;
  background:rgba(12,35,50,.78);
  color:#fff;
  font:800 12px ui-monospace,monospace;
  text-shadow:0 1px 1px #000;
  pointer-events:auto;
  touch-action:manipulation;
  cursor:pointer;
  z-index:9;
}
#viewModeButton:active{background:rgba(32,111,144,.93);transform:translateY(1px)}
#crosshair.view-front{display:none}
@media(max-width:760px),(pointer:coarse){
  #viewModeButton{
    top:98px;
    left:10px;
    min-height:45px;
    min-width:126px;
    padding:9px 11px;
    font-size:11px;
    -webkit-user-select:none;
    user-select:none;
  }
}


/* BLOCKWORLD action buttons: match the account/world-creation beveled pixel controls. */
/* Change visual styling only; keep the proven touch-button layout and hit areas. */
.jump,
#tapbar button{
  -webkit-appearance:none;
  appearance:none;
  box-sizing:border-box;
  border:3px solid #4a4a4a;
  border-radius:6px;
  background:#6f9b52;
  background-image:none;
  color:#16220e;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-weight:900;
  text-align:center;
  text-shadow:none;
  box-shadow:inset 2px 2px 0 #b6d49f,inset -2px -2px 0 #4b6d38,0 3px 0 rgba(0,0,0,.5);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
  cursor:pointer;
}
.jump{
  font-size:14px;
  letter-spacing:.02em;
  line-height:1.1;
}
#tapbar button{
  font-size:12px;
  line-height:1.15;
  padding:3px 5px;
  white-space:normal;
}
.jump:active,
#tapbar button:active{
  background:#54823d;
  border-color:#343b32;
  box-shadow:inset 2px 2px 0 #375b28,inset -2px -2px 0 #8bb66e,0 1px 0 rgba(0,0,0,.4);
  transform:translateY(2px);
}
.jump:focus-visible,
#tapbar button:focus-visible{
  outline:3px solid #ecf8af;
  outline-offset:2px;
}


/* Separate run-arrow above the existing walk arrow: never double-tap to sprint. */
@media (max-width:760px),(pointer:coarse){
  .pad{overflow:visible}
  .pad .sprint{
    position:absolute;
    left:calc(var(--dpad-size) + var(--dpad-gap));
    top:calc(-1 * (var(--dpad-size) + var(--dpad-gap)));
    right:auto;
    bottom:auto;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:1px;
    width:var(--dpad-size);
    height:var(--dpad-size);
    padding:0;
    border:3px solid #294a84;
    border-radius:14px;
    background:#527ec4;
    color:#fff;
    font:900 28px/1 ui-monospace,monospace;
    text-shadow:0 2px 1px #1e3762;
    box-shadow:inset 2px 2px 0 #a0bbed,inset -2px -2px 0 #2d5097,0 3px 0 rgba(0,0,0,.38);
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
    pointer-events:auto;
    touch-action:none;
    user-select:none;
    -webkit-user-select:none;
    -webkit-touch-callout:none;
    -webkit-tap-highlight-color:transparent;
  }
  .pad .sprint .run-label{
    display:block;
    font:900 10px/1.1 ui-monospace,monospace;
    letter-spacing:.07em;
    pointer-events:none;
    user-select:none;
    -webkit-user-select:none;
  }
  .pad .sprint.running,
  .pad .sprint:active{
    background:#31589e;
    border-color:#24395e;
    box-shadow:inset 2px 2px 0 #223b6a,inset -2px -2px 0 #87a8df,0 1px 0 rgba(0,0,0,.35);
    transform:translateY(2px);
  }
}
@media (pointer:coarse) and (max-width:600px) and (orientation:portrait){
  .pad .sprint{border-radius:12px;font-size:25px}
  .pad .sprint .run-label{font-size:9px}
}
/* Prevent iPadOS text selection/copy overlays when tapping game controls. */
@media (pointer:coarse){
  #mobile,#mobile button,#hud,#hud *,#crosshair{
    -webkit-user-select:none;
    user-select:none;
    -webkit-touch-callout:none;
    -webkit-tap-highlight-color:transparent;
  }
  #mobile button{touch-action:none}
  #hotbar .slot{touch-action:manipulation}
}

/* Red walk D-pad: same beveled button treatment as the blue RUN key. */
@media (max-width:760px),(pointer:coarse){
  .pad .up,
  .pad .down,
  .pad .left,
  .pad .right{
    -webkit-appearance:none;
    appearance:none;
    box-sizing:border-box;
    border:3px solid #873037;
    border-radius:14px;
    background:#c65259;
    color:#fff;
    font:900 28px/1 ui-monospace,monospace;
    text-shadow:0 2px 1px #641e29;
    box-shadow:inset 2px 2px 0 #f1a7aa,inset -2px -2px 0 #96363d,0 3px 0 rgba(0,0,0,.38);
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
    pointer-events:auto;
    touch-action:none;
    user-select:none;
    -webkit-user-select:none;
    -webkit-touch-callout:none;
    -webkit-tap-highlight-color:transparent;
  }
  .pad .up:active,
  .pad .down:active,
  .pad .left:active,
  .pad .right:active{
    background:#9b3640;
    border-color:#64232c;
    box-shadow:inset 2px 2px 0 #72262e,inset -2px -2px 0 #e58e95,0 1px 0 rgba(0,0,0,.35);
    transform:translateY(2px);
  }
}
@media (pointer:coarse) and (max-width:600px) and (orientation:portrait){
  .pad .up,.pad .down,.pad .left,.pad .right{
    border-radius:12px;
    font-size:25px;
  }
}

/* Main play-mode menu: single-player now, multiplayer reserved for later. */
#menuCover{
  position:fixed;inset:0;z-index:36;display:none;align-items:center;justify-content:center;
  background:linear-gradient(#6ea4d6,#a9c98b 67%,#688556);color:#fff;padding:18px
}
.menu-panel{
  width:min(460px,94vw);padding:28px 24px;text-align:center;text-shadow:none;
  background:rgba(18,21,24,.9);border:2px solid rgba(255,255,255,.34);
  box-shadow:0 18px 60px rgba(0,0,0,.38);border-radius:12px
}
.menu-panel h1{margin:0 0 10px;font-size:clamp(28px,7vw,42px);letter-spacing:.06em;text-shadow:0 3px 0 #222}
.menu-kicker{font-size:12px;letter-spacing:.07em;color:#c9c9c9;margin-bottom:26px;overflow-wrap:anywhere}
.menu-kicker strong{color:#eaffaa}
.menu-actions{display:grid;gap:12px}
.menu-actions button{
  width:100%;min-height:60px;border:3px solid #315c30;border-radius:8px;background:#57934a;
  color:white;font:900 clamp(16px,4vw,20px) ui-monospace,monospace;
  box-shadow:inset 3px 3px 0 #94c487,inset -3px -3px 0 #346d35,0 4px 0 rgba(0,0,0,.35);
  cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none
}
.menu-actions button:active:not(:disabled){transform:translateY(2px);box-shadow:inset 3px 3px 0 #346d35,inset -3px -3px 0 #94c487}
.menu-actions button:disabled{
  border-color:#555;background:#737373;color:#ddd;
  box-shadow:inset 3px 3px 0 #929292,inset -3px -3px 0 #505050;
  cursor:default;opacity:.8
}
.menu-actions button span{font-size:11px;white-space:nowrap}
#menuLogout{
  margin-top:25px;min-height:42px;padding:0 28px;border:2px solid #555;background:#777;color:#fff;
  font:800 12px ui-monospace,monospace;
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.25),inset -2px -2px 0 rgba(0,0,0,.25);cursor:pointer
}
.world-header-actions{display:flex;gap:8px;flex-shrink:0}
#worldBack{
  min-width:72px;height:40px;border:2px solid #555;background:#777;color:#fff;
  font:800 11px ui-monospace,monospace;
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.25),inset -2px -2px 0 rgba(0,0,0,.25);cursor:pointer
}
@media(max-width:680px),(pointer:coarse){
  .menu-panel{padding:22px 16px}
  .world-header-actions{flex-wrap:wrap;justify-content:flex-end}
  #worldBack{min-width:70px}
}

/* Multiplayer host / join / friends screens */
#multiCover{
  position:fixed;inset:0;z-index:39;display:none;align-items:center;justify-content:center;
  background:linear-gradient(#6ea4d6,#a9c98b 67%,#688556);padding:16px;color:white;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
}
.multi-panel{
  width:min(600px,96vw);max-height:min(92vh,850px);overflow-y:auto;overflow-x:hidden;
  padding:20px;background:rgba(18,21,24,.94);border:2px solid rgba(255,255,255,.35);
  border-radius:12px;box-shadow:0 18px 60px rgba(0,0,0,.38);text-shadow:none;
}
.multi-heading{display:flex;justify-content:space-between;gap:12px;align-items:center}
.multi-kicker{font-size:11px;letter-spacing:.16em;color:#a9d4a1}
.multi-heading h2{font-size:clamp(21px,5vw,29px);margin:4px 0}
#multiStatus{font-size:12px;line-height:1.6;color:#e4e4e4;min-height:2.3em;margin:9px 0 17px}
.multi-section{display:grid;gap:12px}
.multi-section[hidden]{display:none!important}
.multi-section p{font-size:12px;color:#dedede;line-height:1.6;margin:2px 0}
.multi-section label{font-size:12px}
.multi-section form{display:grid;gap:9px}
.multi-section input{
  box-sizing:border-box;width:100%;min-height:46px;padding:10px 12px;
  border:2px solid #789877;border-radius:5px;background:#f5f8f3;
  color:#191c19;font-size:17px;user-select:text;-webkit-user-select:text;
}
.multi-section button,.multi-heading button{
  min-height:44px;padding:9px 15px;border:2px solid #4a4a4a;border-radius:5px;
  font:800 13px ui-monospace,monospace;color:white;background:#777;
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.28),inset -2px -2px 0 rgba(0,0,0,.35);
  cursor:pointer;touch-action:manipulation;
}
.multi-section button:disabled{opacity:.5;cursor:default}
.multi-section .multi-primary{
  font-size:clamp(15px,3.8vw,19px);min-height:55px;background:#569447;
  border-color:#315c30;box-shadow:inset 3px 3px 0 #94c487,inset -3px -3px 0 #346d35;
}
#multiSlotGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.multi-slot{
  border:2px solid #5a5a5a;background:#343c36;border-radius:6px;
  padding:12px;display:flex;flex-direction:column;gap:7px;
}
.multi-slot strong{font-size:16px}.multi-slot span{font-size:11px;color:#c9d6cb}
.multi-slot .multi-slot-actions{display:flex;gap:8px;flex-wrap:wrap}
.multi-slot-actions button{background:#548746}
.multi-slot-actions .multi-delete{background:#955b58}
.multi-self,.multi-room{
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
  padding:12px;border:2px solid #556b54;border-radius:6px;background:#273327;
}
.multi-self span,.multi-room span{font-size:11px;color:#cdd6cb}
.multi-self strong,.multi-room strong{font:bold 23px ui-monospace,monospace;letter-spacing:.1em;color:#eaffaa}
.multi-room{justify-content:center}.multi-room strong{font-size:clamp(26px,6vw,37px)}
.friend-pending{border:2px solid #99b978;padding:12px;background:#314d32;border-radius:5px;font-size:12px}
.friend-list{display:grid;gap:8px}
.friend-card{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:10px;background:#333e34;border:1px solid #526351}
.friend-card span{font-size:11px;color:#d7dfd7}
.friend-card button{font-size:12px}
.multi-people{border:1px solid #59695a;background:#273027;border-radius:5px;padding:12px;font-size:12px;line-height:1.9;white-space:pre-line}
@media(max-width:600px),(pointer:coarse){
  .multi-panel{padding:14px;max-height:87vh}
  #multiSlotGrid{grid-template-columns:1fr}
  .multi-section button,.multi-heading button{min-height:45px}
}

/* Share a local single-player world without replacing its save. */
.world-slot .share-world{background:#5f9da1;color:#fff;border-color:#2b5661;box-shadow:inset 2px 2px 0 #93ccd1,inset -2px -2px 0 #336879}
#inviteFriendsBtn{white-space:nowrap}
#multiRoomCopy{flex:0 0 auto;min-height:42px;background:#426c7a}

/* Equipment slots: stack-safe, tappable on mobile and desktop. */
.armor-title{display:flex;justify-content:space-between;align-items:center;
  font:900 12px monospace;color:#393939;margin:10px 1px 5px}
#armorDefense{color:#356648;font-size:11px}
.armor-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;
  padding:6px;margin-bottom:10px;background:#a5a5a5;border:3px solid #777;
  box-shadow:inset 2px 2px 0 #dadada,inset -2px -2px 0 #666}
.armor-slot{display:flex;justify-content:center;align-items:center;gap:6px;height:48px;
  border:3px solid #777;background:#bbbbbb;box-shadow:inset 2px 2px 0 #ececec,inset -2px -2px 0 #777;
  color:#333;font:bold 11px monospace;touch-action:manipulation}
.armor-slot.wearing{background:#dee6d8;border-color:#65855c}
.armor-slot .item-icon{width:29px;height:29px;image-rendering:pixelated}
.armor-slot strong{font-size:19px;color:#777}
#inventoryEquip{background:#7da26b}
@media(max-width:760px),(pointer:coarse){
  .armor-grid{gap:4px;margin-bottom:7px}
  .armor-slot{height:41px;gap:4px;font-size:10px}
  .armor-slot .item-icon{width:24px;height:24px}
  .inventory-actions{grid-template-columns:repeat(4,minmax(0,1fr))}
  .inventory-actions button{font-size:9px;min-width:0;padding:2px}
  #tapbar button{font-size:12px}
}

/* Tap inventory armor, then the highlighted equipment destination. */
.armor-slot.equip-target{background:#d3efc2;border-color:#467e39;box-shadow:inset 2px 2px 0 #efffe3,inset -2px -2px 0 #7caa65,0 0 0 2px #6fc64d}
.armor-slot.equip-target:active{background:#b2dba0}

/* 27-slot world chest. Compact enough for landscape iPad Safari. */
#chestScreen{position:fixed;inset:0;z-index:32;display:none;align-items:center;
  justify-content:center;background:rgba(0,0,0,.62);padding:10px;pointer-events:auto}
#chestScreen.open{display:flex}
.chest-panel{width:min(675px,96vw);max-height:94dvh;overflow:auto;padding:12px;
  background:#c5c5c5;color:#242424;border:4px solid #383838;
  box-shadow:inset 3px 3px 0 #eee,inset -3px -3px 0 #777,0 14px 42px rgba(0,0,0,.5);
  text-shadow:none}
.chest-header{display:flex;justify-content:space-between;align-items:center;gap:12px}
.chest-title{font:900 23px/1.3 monospace;letter-spacing:.04em}
.chest-sub{font:700 11px monospace;color:#555}
#chestClose{width:38px;height:38px;flex:none;font:900 23px monospace;
  border:3px solid #555;background:#9a9a9a;color:#292929;touch-action:manipulation}
.chest-row-title{display:flex;justify-content:space-between;font:900 12px monospace;
  margin:12px 0 5px;color:#454545}
.chest-row-title span{color:#6b6b6b;font:700 10px monospace}
.chest-grid{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:4px}
.chest-grid .inv-slot{min-height:0;aspect-ratio:1/1}
.chest-grid .inv-slot:disabled{opacity:1}
.chest-grid .inv-slot.chest-busy{opacity:.55}
.chest-grid .item-icon{image-rendering:pixelated}
.chest-footer{display:flex;align-items:center;gap:12px;margin-top:12px}
#chestSingle{flex:none;border:3px solid #555;background:#b7bd9b;color:#242424;
  padding:9px 10px;font:900 11px monospace;touch-action:manipulation}
#chestHint{font:700 11px monospace;color:#4d4d4d;line-height:1.45}
@media(max-width:760px),(pointer:coarse){
 .chest-panel{padding:9px}
 .chest-grid{gap:3px}
 .chest-grid .inv-slot{border-width:2px}
 .chest-title{font-size:20px}
 .chest-row-title{margin:8px 0 4px}
 .chest-footer{gap:8px;margin-top:9px}
 #chestHint{font-size:10px}
}

/* NEXACRAFT cinematic title cover: full 1672 x 941 key art; no tiny preview. */
.title-cover{
  position:fixed;inset:0;z-index:100;display:block;
  background:#152a32 url("assets/nexacraft-title.webp?v=20261011titleHD1672") center center / cover no-repeat;
  cursor:pointer;touch-action:manipulation;
  user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;
  opacity:1;transition:opacity .32s ease;
}
.title-cover.is-dismissed{opacity:0;pointer-events:auto}
.title-cover[hidden]{display:none!important}
.title-bottom-shade{
  position:absolute;inset:61% 0 0;pointer-events:none;
  background:linear-gradient(0deg,rgba(4,10,16,.70),rgba(4,10,16,.02));
}
.title-enter{
  position:absolute;left:50%;bottom:clamp(25px,16.8%,185px);
  transform:translateX(-50%);z-index:1;
  border:1px solid rgba(216,249,236,.62);
  background:rgba(5,18,24,.80);border-radius:4px;
  box-shadow:0 0 21px rgba(20,231,202,.20),0 2px 16px rgba(0,0,0,.55);
  padding:10px clamp(17px,3.6vw,40px) 6px;
  color:#f6fcf9;font:500 clamp(13px,1.9vw,23px)/1.2 Georgia,serif;
  letter-spacing:.18em;white-space:nowrap;text-align:center;text-shadow:0 1px 4px #000;
  cursor:pointer;touch-action:manipulation;
  animation:nexaTitlePulse 1.7s ease-in-out infinite;
}
.title-enter-label{display:block}
.title-enter-ornament{
  display:block;color:#88e9d7;font-size:12px;
  letter-spacing:.3em;line-height:1.2;margin-top:4px;
}
.title-enter:hover,.title-enter:focus-visible{
  background:rgba(14,54,54,.92);outline:2px solid #7ce4d1;outline-offset:2px;
}
@keyframes nexaTitlePulse{
  0%,100%{box-shadow:0 0 9px rgba(20,231,202,.10),0 2px 16px rgba(0,0,0,.55)}
  50%{box-shadow:0 0 28px rgba(20,231,202,.45),0 2px 16px rgba(0,0,0,.55)}
}
@media(max-height:520px){.title-enter{bottom:8%;padding:7px 22px 4px;font-size:15px}}
@media(prefers-reduced-motion:reduce){.title-enter{animation:none}.title-cover{transition:none}}
/* Keep the same scenery visible when choosing SINGLE or MULTIPLAYER. */
#menuCover,#authCover{
  background:linear-gradient(rgba(8,17,21,.33),rgba(8,19,19,.58)),
    url("assets/nexacraft-title.webp?v=20261011titleHD1672") center center / cover no-repeat,#172f33;
}
.menu-panel{
  background:rgba(12,22,24,.94);border-color:rgba(115,232,216,.45);
  box-shadow:0 20px 65px rgba(0,0,0,.58),0 0 30px rgba(15,214,198,.12);
}
.menu-panel h1{color:#e8f7f0;text-shadow:0 0 18px rgba(40,230,210,.38)}
.menu-actions button{
  background:#357a71;border-color:#174e4a;
  box-shadow:inset 3px 3px 0 #7cbbac,inset -3px -3px 0 #16534e,0 4px 0 rgba(0,0,0,.35);
}
.menu-actions button:hover{background:#41918a}


/* NEXACRAFT world-entry and save-slot visual unification.
   Shared high-resolution Nexa Gate key art / illuminated obsidian glass. */
#startCover,#worldCover,#multiCover{
  background:
    linear-gradient(180deg,rgba(4,14,20,.37),rgba(4,14,20,.67)),
    url("assets/nexacraft-title.webp?v=20261011titleHD1672") center center / cover no-repeat,
    #132b32;
  color:#effbf7;
}
#startCover,#worldCover{
  padding:max(14px,env(safe-area-inset-top)) 14px max(14px,env(safe-area-inset-bottom));
}
#startCover .panel,.world-panel,.multi-panel{
  position:relative;
  background:rgba(10,23,28,.91);
  color:#effbf7;
  border:1px solid rgba(119,229,218,.55);
  border-radius:15px;
  box-shadow:0 24px 70px rgba(0,0,0,.66),0 0 32px rgba(37,217,207,.15),
    inset 0 0 0 1px rgba(175,249,234,.055);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  text-shadow:none;
}
#startCover .panel::before,.world-panel::before{
  content:"";display:block;position:absolute;left:20px;right:20px;top:0;height:2px;
  background:linear-gradient(90deg,transparent,#56dac9 37%,#b3ffdb 50%,#56dac9 63%,transparent);
  box-shadow:0 0 14px rgba(53,235,202,.72);
  pointer-events:none;
}
#startCover .panel{
  width:min(610px,94vw);max-width:none;
  padding:clamp(25px,4vw,42px) clamp(19px,4.2vw,44px);
}
#startCover h1{
  color:#f2fffb;font-size:clamp(29px,6vw,50px);font-weight:900;
  letter-spacing:.09em;line-height:1.13;margin:0 0 19px;
  text-shadow:0 0 24px rgba(76,238,215,.46),0 3px 10px rgba(0,0,0,.55);
}
#startCover p{
  color:#cddfdc;font-size:clamp(12px,1.3vw,14px);
  line-height:1.85;margin:10px 0;
}
#startCover #startBtn{
  min-width:min(250px,100%);min-height:53px;margin-top:21px;
  padding:12px 28px;background:linear-gradient(180deg,#388d85,#22665f);
  border:1px solid #7bcabe;color:#f6fffa;
  border-radius:8px;box-shadow:inset 0 1px 0 rgba(202,255,241,.33),
    0 5px 0 #123e3a,0 0 22px rgba(46,214,190,.16);
  font-size:clamp(14px,1.6vw,17px);font-weight:900;letter-spacing:.05em;
  cursor:pointer;touch-action:manipulation;
}
#startCover #startBtn:hover,#startCover #startBtn:focus-visible{
  background:linear-gradient(180deg,#42aea0,#2a786f);outline:2px solid #95f4dd;outline-offset:3px;
}
#startCover #startBtn:active{transform:translateY(2px);box-shadow:inset 0 1px 0 rgba(202,255,241,.33),0 2px 0 #123e3a}
#startCover #loading{
  margin-top:19px;font-size:11px;color:#a4c9c5;letter-spacing:.025em;
}
.world-panel{
  width:min(940px,96vw);max-height:min(91vh,900px);
  padding:clamp(14px,2.4vw,26px);
  scrollbar-color:#508b85 rgba(6,22,26,.7);scrollbar-width:thin;
}
.world-head{gap:16px;align-items:center;margin-bottom:19px}
.world-head h2{
  color:#f3fffb;font-size:clamp(21px,2.7vw,30px);
  letter-spacing:.04em;text-shadow:0 0 16px rgba(54,226,202,.24);
}
.world-head p{color:#b9d0cd;font-size:clamp(10px,1.1vw,12px);line-height:1.5}
.world-kicker{color:#8fbbb4;font-size:11px}
.world-kicker strong{color:#cefbdc}
.world-header-actions{gap:9px}
#worldBack,#worldLogout{
  min-width:76px;min-height:41px;height:auto;padding:10px 13px;
  border:1px solid rgba(120,201,193,.45);border-radius:6px;
  background:rgba(29,62,67,.85);color:#e4f9f3;
  box-shadow:inset 0 1px 0 rgba(232,255,253,.11);
  cursor:pointer;touch-action:manipulation;
}
#worldBack:hover,#worldLogout:hover{background:#326c69}
#worldBack:focus-visible,#worldLogout:focus-visible{
  outline:2px solid #9af7df;outline-offset:2px;
}
#worldGrid{gap:12px}
.world-slot,.world-slot.empty{
  position:relative;min-width:0;min-height:138px;padding:13px 14px;
  grid-template-columns:minmax(0,1fr) auto;gap:12px;
  background:linear-gradient(145deg,rgba(37,67,71,.94),rgba(15,36,43,.96));
  border:1px solid rgba(97,184,178,.38);border-radius:9px;
  color:#e9f8f4;box-shadow:inset 0 1px 0 rgba(169,240,225,.10),0 5px 13px rgba(0,0,0,.24);
}
.world-slot.empty{background:linear-gradient(145deg,rgba(30,54,60,.84),rgba(13,33,39,.90));border-color:rgba(105,166,160,.27)}
.world-slot:hover{border-color:rgba(106,230,212,.71);box-shadow:inset 0 1px 0 rgba(169,240,225,.14),0 0 18px rgba(40,206,186,.13)}
.world-slot-title{
  font-size:clamp(15px,1.7vw,19px);line-height:1.25;letter-spacing:.055em;
  color:#f1fffb;text-shadow:0 0 9px rgba(80,214,202,.22);
}
.world-slot-meta{
  margin-top:8px;color:#b3cfcb;font-size:clamp(10px,1vw,11px);line-height:1.65;
}
.world-slot-actions{gap:7px}
.world-slot button{
  min-width:108px;min-height:35px;height:auto;padding:8px 9px;
  border:1px solid rgba(141,224,200,.55);border-radius:5px;
  background:linear-gradient(180deg,#3d9281,#24665f);color:#f5fffc;
  font:800 11px ui-monospace,SFMono-Regular,monospace;
  box-shadow:inset 0 1px 0 rgba(230,255,242,.27),0 2px 0 rgba(0,0,0,.23);
  cursor:pointer;touch-action:manipulation;white-space:nowrap;
}
.world-slot button:first-child:hover{background:#4ba794}
.world-slot .share-world{
  background:linear-gradient(180deg,#366e86,#224b60);
  border-color:rgba(143,210,231,.55);color:#f1faff;
  box-shadow:inset 0 1px 0 rgba(216,243,255,.25),0 2px 0 rgba(0,0,0,.24);
}
.world-slot .share-world:hover{background:#417e99}
.world-slot .delete-world{
  background:linear-gradient(180deg,#804d56,#5b333c);
  border-color:rgba(207,141,146,.48);color:#ffedee;
  box-shadow:inset 0 1px 0 rgba(255,220,220,.15),0 2px 0 rgba(0,0,0,.24);
}
.world-slot .delete-world:hover{background:#965560}
.world-slot button:focus-visible{
  outline:2px solid #91e6d5;outline-offset:2px;
}
/* iPad landscape: fill down the left column first (WORLD 1/2/3),
   then the right column (WORLD 4/5). Portrait phones stay a single list. */
@media(min-width:760px) and (orientation:landscape){
  #worldGrid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-rows:repeat(3,auto);
    grid-auto-flow:column;
  }
  .world-panel{max-height:88vh}
}
@media(max-width:759px){
  .world-panel{max-height:88dvh;padding:13px}
  #worldGrid{grid-template-columns:1fr;gap:9px}
  .world-slot,.world-slot.empty{min-height:105px;padding:11px;gap:8px}
  .world-slot button{min-width:96px;font-size:10px;min-height:35px}
  .world-head{align-items:flex-start}
  .world-header-actions{flex-wrap:wrap;justify-content:flex-end}
  #worldBack,#worldLogout{min-width:64px;font-size:10px;padding:9px}
}
@media(max-height:550px){
  #startCover .panel{padding:16px 22px;max-height:93vh;overflow-y:auto}
  #startCover h1{font-size:clamp(24px,6vh,36px);margin-bottom:10px}
  #startCover p{margin:5px 0;line-height:1.5}
  #startCover #startBtn{min-height:41px;margin-top:11px}
  .world-panel{max-height:92vh}
}


/* NEXACRAFT unified in-game HUD: XP, stamina and hearts */
/* The HUD now shares the same compact smoky-glass language as the
   coordinate/camera panel on the left and account panel on the right.
   This is presentation only: damage, stamina and XP formulas stay unchanged. */
#progress,#staminaHud,#healthHud{
  background:rgba(14,23,27,.75);
  border:1px solid rgba(198,232,226,.28);
  border-radius:8px;
  box-shadow:0 4px 18px rgba(0,0,0,.23),inset 0 1px 0 rgba(232,255,248,.055);
  -webkit-backdrop-filter:blur(5px);
  backdrop-filter:blur(5px);
  color:#ecfbf5;
  text-shadow:0 1px 2px rgba(0,0,0,.82);
  box-sizing:border-box;
  pointer-events:none;
}
#progress{
  left:50%;
  bottom:166px;
  width:min(366px,70vw);
  padding:10px 12px 8px;
}
#progress .xp-row{
  display:flex;align-items:center;justify-content:space-between;
  gap:10px;font-size:11px;line-height:1.25;
}
#levelText{
  color:#dbffa1;font-size:13px;font-weight:900;
  text-shadow:0 0 9px rgba(166,255,178,.17);
}
#xpText{color:#d6e9e3;opacity:1;font-variant-numeric:tabular-nums}
#xpTrack{
  height:7px;margin:8px 0 6px;
  border:1px solid rgba(160,211,193,.40);
  border-radius:4px;overflow:hidden;
  background:rgba(3,11,14,.70);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.32);
}
#xpFill{
  height:100%;width:0;
  background:linear-gradient(90deg,#3d9f8d,#87e9bb);
  box-shadow:0 0 8px rgba(95,226,188,.38);
  transition:width .22s ease;
}
#blueprintText{
  color:#c4ddd2;font-size:10px;line-height:1.35;
  letter-spacing:.015em;
}
#staminaHud{
  left:50%;bottom:124px;
  min-height:30px;padding:4px 9px;
}
#healthHud{
  left:50%;bottom:88px;
  min-height:30px;padding:4px 9px;
}
#staminaIcons,#hearts{justify-content:center}
@media(max-width:760px),(pointer:coarse){
  #progress{
    left:50%;bottom:158px;
    width:min(355px,65vw);
    padding:8px 11px 7px;
  }
  #progress .xp-row{font-size:10px}
  #levelText{font-size:12px}
  #blueprintText{font-size:9px}
  #staminaHud{bottom:116px;min-height:29px;padding:4px 9px}
  #healthHud{bottom:82px;min-height:29px;padding:4px 9px}
}
@media(max-width:600px){
  #progress{bottom:153px;width:min(300px,76vw);padding:7px 9px}
  #staminaHud{bottom:113px;padding:4px 7px}
  #healthHud{bottom:80px;padding:4px 7px}
}
@media(max-height:560px){
  #progress{bottom:144px;padding:5px 9px}
  #staminaHud{bottom:107px;min-height:24px;padding:2px 7px}
  #healthHud{bottom:76px;min-height:24px;padding:2px 7px}
}


/* NEXACRAFT top-corner controls: BLACK raised D-pad treatment */
/* Black-charcoal version of the beveled walking D-pad design.
   Only the upper-left stats/camera and upper-right account/button colors
   change. Preserve existing placement, touch areas and game behavior. */
#stats,#accountBox,#viewModeButton{
  -webkit-appearance:none;
  appearance:none;
  box-sizing:border-box;
  background:#242629;
  background-image:none;
  color:#f5f7fa;
  border:3px solid #101215;
  border-radius:12px;
  box-shadow:inset 2px 2px 0 #73787e,
    inset -2px -2px 0 #0b0d10,
    0 3px 0 rgba(0,0,0,.47);
  -webkit-backdrop-filter:none;
  backdrop-filter:none;
  text-shadow:0 2px 1px #080a0d;
}
#stats{
  padding:8px 10px;
  line-height:1.55;
  font-variant-numeric:tabular-nums;
}
#viewModeButton{
  min-height:46px;
  padding:9px 13px;
  font-weight:900;
  touch-action:manipulation;
  -webkit-user-select:none;
  user-select:none;
}
#viewModeButton:active{
  background:#141719;
  border-color:#090b0d;
  box-shadow:inset 2px 2px 0 #111317,
    inset -2px -2px 0 #7b8088,
    0 1px 0 rgba(0,0,0,.4);
  transform:translateY(2px);
}
#viewModeButton:focus-visible,
.account-actions button:focus-visible{
  outline:2px solid #a8f0df;
  outline-offset:3px;
}
#accountBox{
  min-width:215px;
  padding:8px 9px 10px;
}
#accountName{
  color:#e8f9c3;
  font-weight:900;
  text-shadow:0 1px 1px #080a0d;
}
#saveStatus{color:#e6ebef;opacity:1}
.account-actions{
  display:flex;
  gap:5px;
  margin-top:8px;
}
.account-actions button{
  -webkit-appearance:none;
  appearance:none;
  flex:1 1 0;
  min-width:0;
  height:38px;
  padding:4px 2px;
  border:2px solid #0e1013;
  border-radius:7px;
  background:#303338;
  color:#f5f7fa;
  font:900 9px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  text-shadow:0 1px 1px #090b0d;
  box-shadow:inset 1px 1px 0 #858a91,
    inset -1px -1px 0 #111317,
    0 2px 0 rgba(0,0,0,.34);
  touch-action:manipulation;
  overflow-wrap:anywhere;
  cursor:pointer;
}
.account-actions button:active{
  background:#15181b;
  border-color:#080a0c;
  box-shadow:inset 1px 1px 0 #111317,
    inset -1px -1px 0 #828790;
  transform:translateY(1px);
}
@media(max-width:760px),(pointer:coarse){
  #stats{
    left:10px;top:9px;
    padding:7px 9px;
    font-size:10px;
  }
  #viewModeButton{
    left:10px;top:104px;
    min-width:126px;
    min-height:46px;
    padding:9px 11px;
    font-size:11px;
  }
  #accountBox{
    right:9px;top:9px;
    min-width:205px;
    padding:7px 8px 9px;
    font-size:9px;
  }
  #accountName{max-width:103px}
  .account-actions button{height:37px;font-size:9px}
}
@media(max-width:420px){
  #accountBox{min-width:175px;padding:6px}
  #accountName{max-width:82px}
  .account-actions{gap:3px}
  .account-actions button{font-size:8px;padding:3px 1px}
  #stats{padding:6px;font-size:9px}
  #viewModeButton{top:99px;min-width:112px;font-size:10px;padding:7px}
}

/* NEXACRAFT encrypted account transfer between devices (2026-10-14). */
.transfer-secondary{
  display:block;max-width:100%;margin:12px auto 3px;
  padding:10px 14px;border:2px solid #81a68b;border-radius:9px;
  background:#193b32;color:#f7e6b3;font-weight:800;
  font-size:13px;cursor:pointer;touch-action:manipulation;
  box-shadow:0 3px 0 #0b241f;line-height:1.5;
}
.transfer-secondary:active{transform:translateY(2px);box-shadow:0 1px 0 #0b241f}
.transfer-cover[hidden]{display:none!important}
.transfer-cover{
  position:fixed;inset:0;z-index:999999;
  display:flex;align-items:center;justify-content:center;
  padding:18px;background:rgba(5,12,15,.86);
  -webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);
  overflow:auto;
}
.transfer-panel{
  width:min(440px,100%);max-height:calc(100vh - 36px);overflow:auto;
  padding:22px 20px;border:2px solid #d4a95c;border-radius:15px;
  background:#122b2a;color:#fff5d8;text-align:left;
  box-shadow:0 15px 60px #0009;
}
.transfer-panel h2{font-size:20px;line-height:1.3;margin:0 0 12px;color:#ffe19b}
.transfer-panel p{font-size:13px;line-height:1.65;margin:0 0 12px;white-space:pre-line}
.transfer-panel label{display:block;font-size:13px;font-weight:800;margin-bottom:12px}
.transfer-panel input{
  display:block;width:100%;height:48px;padding:9px 12px;margin-top:7px;
  background:#f4f4eb;color:#132324;border:2px solid #9eb9a5;border-radius:8px;
  font:16px system-ui,sans-serif;
}
.transfer-panel .transfer-actions{display:flex;gap:8px;margin:10px 0 14px}
.transfer-actions button{
  min-width:0;flex:1;padding:13px 10px;border-radius:8px;
  border:2px solid #648f78;background:#225e47;color:#fff9e4;
  font-size:13px;font-weight:900;cursor:pointer;touch-action:manipulation;
}
.transfer-actions button:disabled{opacity:.5;cursor:wait}
.transfer-actions #transferGo{background:#9a672e;border-color:#e6b76b}
#transferStatus{min-height:1.6em;color:#f5d091}
.transfer-panel small{font-size:11px;line-height:1.6;display:block;color:#d0dbcb}
@media(max-width:480px){
  .transfer-panel{padding:17px 15px}
  .transfer-panel h2{font-size:18px}
  .transfer-secondary{font-size:12px}
}

#transferShare[hidden]{display:none!important}
.transfer-share{display:block;width:100%;min-height:43px;margin:-3px 0 12px;padding:10px;border-radius:8px;border:2px solid #c0cc92;background:#2c6a63;color:#fff8e0;font-weight:900;font-size:13px;touch-action:manipulation;cursor:pointer}

/* Left hand/offhand slot: torch only, touch-friendly with separate action. */
.offhand-row{
  display:flex;align-items:center;gap:9px;padding:6px 8px;margin:0 0 10px;
  background:#a5a5a5;border:3px solid #777;
  box-shadow:inset 2px 2px 0 #dadada,inset -2px -2px 0 #666;
}
.offhand-caption{font:900 12px monospace;min-width:0;flex:1;color:#373737}
.offhand-caption small{display:block;font:700 10px monospace;margin-top:4px;color:#535353}
.offhand-slot{
  display:flex;align-items:center;justify-content:center;flex:0 0 54px;height:52px;
  border:3px solid #676767;background:#bbb;color:#434343;font:900 11px monospace;
  box-shadow:inset 2px 2px 0 #ededed,inset -2px -2px 0 #777;
  touch-action:manipulation;
}
.offhand-slot.wearing{background:#e4f1d8;border-color:#548347}
.offhand-slot.equip-target{outline:3px solid #6bba55}
.offhand-slot .item-icon{width:36px;height:36px;image-rendering:pixelated}
#inventoryOffhandEquip{
  min-height:42px;min-width:0;flex:1.1;
  border:3px solid #54774e;background:#80a66c;color:#172a17;
  box-shadow:inset 2px 2px 0 #d5ecd0,inset -2px -2px 0 #64855d;
  font:900 11px monospace;padding:4px;touch-action:manipulation
}
#inventoryOffhandEquip:disabled{opacity:.48}
@media(max-width:480px){
  .offhand-row{gap:5px;padding:5px}
  .offhand-caption{font-size:10px}
  .offhand-caption small{font-size:8px}
  .offhand-slot{flex-basis:44px;height:44px;font-size:9px}
  .offhand-slot .item-icon{width:31px;height:31px}
  #inventoryOffhandEquip{font-size:9px;padding:3px;min-height:42px}
}
