@font-face {
  font-family: "Proxima Nova";
  src: url("../fonts/ProximaNova-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Proxima Nova";
  src: url("../fonts/ProximaNova-Extrabold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
b, strong{
  font-weight: 800;
}

:root { --design-w: 1920; --design-h: 1080; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: "Proxima Nova", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  touch-action: manipulation;      /* prevents double-tap zoom on most browsers */
  -webkit-text-size-adjust: 100%;
   -webkit-user-select: none;
   user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Portrait layout overrides */
html.portrait #mobileControls{
  left: 50%;
  right: auto;
  top: auto;
  bottom: 30px;
  transform: translateX(-50%);
   width: 460px;
  height: 460px;
  background: rgba(255,255,255,0);
  box-shadow: 0 10px 30px rgba(0,0,0,0);
}

html.portrait #mobileControls .dpad-btn{
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.9;
  -webkit-tap-highlight-color: transparent;
}

html.portrait #soundToggle{
  left: 38px;
  top: 36px;
  right: auto;
  bottom: auto;
}


/* Portrait popups: center the whole stack (content + button) vertically */
html.portrait .popup-shell.mode-stack{
  justify-content: center;    
  padding: 48px 0;             
  box-sizing: border-box;
}
html.portrait .popup-shell.mode-stack .popup-content{
  flex: 0 0 auto;              
}
html.portrait .popup-shell.mode-stack .popup-footer{
  margin-top: 80px !important;  
  margin-bottom: 0 !important; 
}
/* Portrait: bigger popup button */
html.portrait .popup-ok{
  font-size: 48px;        /* text size */
  padding: 26px 64px;     /* button size */
  border-radius: 999px;  /* keep pill look */
}


.popup-shell.mode-stack .popup-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px;
}

html.portrait .popup-shell.mode-stack {
  background: rgba(255, 255, 255, 0.85);
}

html.portrait .popup-shell.mode-stack.theme-dark {
  background: rgba(62, 62, 62, 0.85);
}

#viewport, #stage, #app {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
#game, #stage, #ui-layer, .maze, .sprite, img, canvas, svg {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
img {
  -webkit-user-drag: none;
}

/* D-pad: prevent iOS double-tap / gesture zoom */
#mobileControls,
.dpad,
.dpad-btn {
  touch-action: none;           
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}


#app {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#viewport {
  position: fixed;
  inset: 0;
  height: 100svh;
  height: 100dvh;
  width: 100vw;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);

  overflow: hidden;
  touch-action: none;
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  overflow: hidden;
  touch-action: none;
  background: #000;
}

#bg {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

#overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.overlay { position: absolute; user-select: none; pointer-events: none; }

/* ---------- Gameplay layer ---------- */

#gameLayer {
  position: absolute;
  inset: 0;
  z-index: 10;
}

#gameHud2 {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 60px;
  z-index: 30;
  pointer-events: none;
  color: #fff;
}
#gameHud { display: none; }


#hudLeft, #hudRight {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

#scoreLabel, #livesLabel { font-size: 22px; opacity: 0.85; letter-spacing: 0.08em; }
#scoreValue, #livesValue { font-size: 56px; font-weight: 700; line-height: 1; }

#mapWrap {
  position: absolute;
  /* set by JS */
  border-radius: 24px;
  overflow: hidden;
}

#mapImages {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

#mapSurface {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#mapEntities {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.grid {
  position: absolute;
  inset: 0;
  display: grid;
  opacity: 0.08; /* DEV-only. set to 0 when shipping */
}
.cell { border: 1px solid rgba(255,255,255,0.35); }

.sprite {
  position: absolute;
  image-rendering: auto;
  user-select: none;
  pointer-events: none;
}


.maze-bg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  pointer-events:none;
  user-select:none;
}

.item-pulse{
  animation: item-pulse 1.6s ease-in-out infinite;
  transform-origin:center center;
}

@keyframes item-pulse{
  0%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(0,0) scale(1.3); }
  100%{ transform: translate(0,0) scale(1); }
}

/* subtle enemy wobble (rotation) */
.enemy-wobble{
  animation: enemy-wobble 1.2s ease-in-out infinite;
  transform-origin:center center;
}

@keyframes enemy-wobble{
  0%{ transform: rotate(-20deg); }
  50%{ transform: rotate(4deg); }
  100%{ transform: rotate(-20deg); }
}


/* ---------- UI layer / screens ---------- */

/* --- Sound toggle --- */
#soundToggle{
  position:absolute;
  right: 38px;
  bottom: 36px;
  z-index: 160;
  cursor: pointer;
  pointer-events: auto;
}
#soundToggle.hidden{ display:none !important; }

#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

#screenLayer {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

#modalBackdrop {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 100;
}
#modalBackdrop.hidden { display: none !important; }

#modalBackdrop.with-bg {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(28, 121, 127, 0.8);
}


#modal {
  position: absolute;
  opacity: 0;
  transform: scale(0.94);
  will-change: transform, opacity;
  user-select: none;
  pointer-events: auto;
   z-index: 110; 
}
#modal.is-ready {
  opacity: 1;
  animation: modal-pop 260ms cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes modal-pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.popup-shell {
  border-radius: 60px;
  border: 10px solid #2AA0B8;
  padding: 60px 90px;
  background: #fff;
  box-shadow: 12px 12px 0 rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.popup-shell.theme-dark {
  background: #3E3E3E;
  border-color: #F5A623;
  box-shadow: none; /* remove shadow only for dark  0 8px 24px rgba(0,0,0,0.2); */
}

.popup-content {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
}

.popup-shell.mode-center .popup-content {
  justify-content: center;
}

.popup-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
  width: 100%;
}

.popup-shell.mode-split .popup-content {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.popup-media {
  width: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.popup-media img {
  max-width: 100%;
  max-height: 100%;
}

.popup-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
  min-width: 0;
  flex: 1;
}

.popup-title { width: 100%; font-size: 72px; text-align: center; font-weight: 700; margin: 0; color: #111; line-height: 1.05; }
.popup-text  { font-size: 42px; line-height: 1.18; font-weight: 700; margin: 0; color: #111;  white-space: pre-line; display: inline-block; text-align: center;}
.popup-text strong { font-weight: 900; }

.popup-copy .popup-text {
  text-align: center;
}
.popup-copy {
  align-items: center;
}

.popup-shell.mode-split .popup-content {
  padding-left: 20px;   /* image side (tighter) */
  padding-right: 220px;  /* text side (looser) */
}


.theme-dark .popup-title,
.theme-dark .popup-text { color: #fff; }

.popup-footer {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.popup-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 18px 70px;
  font-size: 34px;
  font-weight: 700;
  cursor: pointer;
  background: #111;
  color: #fff;
  pointer-events: auto;
}
.theme-dark .popup-ok {
  background: #fff;
  color: #111;
}

.ui-button {
  transform-origin: center center;
  transition: transform 160ms ease, filter 160ms ease;
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
.ui-button:hover { transform: scale(1.06); filter: brightness(1.05); }
.ui-button:active { transform: scale(0.98); }

.hidden { display: none !important; }

#stageDecor{
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
}

#mapWrap{
  position:absolute;
  z-index:1;
  overflow:hidden; /* still clips maze-only visuals */
}

#gridOverlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 2; /* maze-bg under it, entities above it */
}



@keyframes hand-wave {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(6deg); }
  30%  { transform: rotate(-4deg); }
  45%  { transform: rotate(5deg); }
  60%  { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}

.anim-hand-wave {
  animation: hand-wave 2.2s ease-in-out infinite;
}

.hero-blink {
  animation: hero-blink 0.35s steps(2, end) infinite;
}

@keyframes hero-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}



/* ===============================
   Mobile D-Pad
   =============================== */

#mobileControls{
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 55;
  width: 480px;
  height: 480px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  display: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#mobileControls .dpad{
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

#mobileControls .dpad-btn{
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.4;
  -webkit-tap-highlight-color: transparent;
}

#mobileControls .dpad-btn img{
  width: 88px;
  height: 88px;

  pointer-events: none;
  user-select: none;

  --rot: 0deg;
  transform: rotate(var(--rot));
  transition: transform 70ms ease;
}

/* Press feedback — scale IMAGE only (no jumping) */
#mobileControls .dpad-btn:active img{
  transform: rotate(var(--rot)) scale(0.92);
}

/* ===============================
   Button positions (inside padded area)
   =============================== */

#mobileControls .btn-up{
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}
#mobileControls .btn-down{
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
#mobileControls .btn-left{
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
#mobileControls .btn-right{
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* ===============================
   Arrow rotation
   =============================== */

#mobileControls .btn-up    img { --rot:   0deg; }
#mobileControls .btn-right img { --rot:  90deg; }
#mobileControls .btn-down  img { --rot: 180deg; }
#mobileControls .btn-left  img { --rot: 270deg; }



#fsBtn{
  position:absolute;
  top: 14px;
  right: 14px;
  z-index: 9999;
  padding: 8px;
  border: 0;
  border-radius: 8px;

  background: rgba(0,0,0,.05);
  cursor: pointer;

  display: grid;
  place-items: center;

  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;

  transition: transform 140ms ease, filter 140ms ease;
}

#fsBtn:hover { transform: scale(1.06); filter: brightness(1.05); }
#fsBtn:active { transform: scale(0.96); }

#fsBtn img{
  width: 28px;
  height: 28px;
  display:block;
  pointer-events:none;
  -webkit-user-drag:none;
}

#fsBtn.hidden{ display:none; }
