html,
body {
  margin: 0!important;
  padding: 0;
  height: 100%;
  background: #000;
	 touch-action: manipulation;
	overflow:hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

#wpadminbar {display:none!important;}

p {margin:0!important;}
    br { content: "";display:none; }
    #wrapper,#content {background:#000;}
    .game-font {font-family: 'Press Start 2P', cursive!important;}
    #pointspopup,#above-footer,.callouts,#nav_menu-2,#nav_menu-19,#nav_menu-3,#custom_html-8 {display:none!important;}
#gameContainer {
  background: #000;
  font-family: 'Press Start 2P', cursive;
  position: relative;
  width: 100%;
  max-width: 522px;
  margin: 0 auto;
  overflow: hidden;

  /* Respect notches / rounded corners on modern phones */
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

/* Responsive canvas: auto-scales to container width, keeps aspect */
canvas#gameCanvas {
  background: #000;
  border: 5px solid #4d4d4d;
  border-radius: 10px;
  font-family: 'Press Start 2P', cursive;
  overflow: hidden;
  color: white;

  /* CRISP PIXELS */
  image-rendering: -moz-crisp-edges !important;
  image-rendering: -webkit-crisp-edges !important;
  image-rendering: pixelated !important;

  display: block;
  cursor: pointer;

  /* Responsive: width follows container, height follows aspect ratio */
  width: 100%;
  height: auto;
  aspect-ratio: 512 / 560;
  box-sizing: border-box;
}

    .hint {
		position: relative;
  bottom: 0px;
  left: 0;
  right: 0;
  color: #aaa;
  font-size: 14px;
  opacity: .8;
  text-align: center;
  margin-top: 10px;
font-family:"arial",sans-serif;
		font-weight:bold;
}
    .hint span { font-size: 12px; color:#ff0; }
   #titleScreen {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      background: radial-gradient(120% 120% at 50% 100%, #001f3f 0%, #000 60%);
      transition: opacity .5s ease-out;
      z-index: 10;
    }
   #titleScreen h1 {
  font-size: clamp(18px, 4vw, 28px);
  margin: 0 0 8px;
  display: flex;
  justify-content: center;
}
   #titleScreen h1 > span {
  position: relative;
  display: inline-block;
  color: #fff;
  text-shadow: 0 0 8px #ff00ff, 0 0 16px #ff00ff, 3px 3px 0 #00f;
  /* Animation: 1s wave, 1.5s pause */
  animation-name: mexican-wave;
  animation-duration: 2.5s;
  animation-iteration-count: infinite;
  /* Animation delay will be set by JavaScript */
}

#titleScreen h1 > span.space {
  width: 0.5em; /* Create a space */
  text-shadow: none;
  animation: none; /* No animation for spaces */
}
    #titleScreen h2 {
  font-size: clamp(10px, 1.5vw, 14px);
  color: #ffcc00;
  text-shadow: 1px 1px #8a5;
  margin: 0 0 26px;
  letter-spacing: 1px;
}
    #playButton {
      background: 
      /* Fancy retro gradient */
      linear-gradient(145deg, #00ff7f, #00b359);
      color: #001b0f;
      padding: 10px 20px;
      border: 3px solid #00ff7f;
      border-radius: 8px;
      font-family: 'Press Start 2P', cursive;
      font-size: 14px;
      cursor: pointer;
      box-shadow: 0 0 12px rgba(0, 255, 127, 0.8),
                  0 0 24px rgba(0, 255, 127, 0.6);
      text-shadow: 1px 1px #006633;
      margin-bottom: 16px;
      position: relative;
      overflow: hidden;
    }
    #playButton::before {
      content: "";
      position: absolute;
      top: 0;
      left: -100%;
      right: -100%;
      height: 100%;
      background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.7),
        transparent
      );
      transform: skewX(-30deg);
      animation: shine 1.5s infinite;
    }
    
    @keyframes shine {
      0% { transform: translateX(-100%) skewX(-30deg); }
      100% { transform: translateX(100%) skewX(-30deg); }
    }
    #playButton:hover {
      filter: brightness(1.15);
      box-shadow: 0 0 16px rgba(0, 255, 127, 1),
                  0 0 32px rgba(0, 255, 127, 0.8);
    }
    #instructions { 
      font-size: 9px;
      color: #cdd;
      line-height: 1.7;
      margin: 0 20px 16px;
      text-align: center;
      padding: 12px;
      border-radius: 10px;
      background: linear-gradient(145deg, #02131f, #001b2b);
      border: 1px solid #123;
      box-shadow: inset 0 0 8px rgba(0, 255, 255, 0.1);
      max-width: 480px;
    }
#instructions p {margin-bottom:1rem!important;}
    #instructions strong, #instructions span {
      color: #ffcc00;
      text-shadow: 1px 1px #8a5;
    }
    #retroBorder {
      border: 2px dashed #567;
      border-radius: 8px;
      padding: 8px;
      margin: 20px;
    }
   
  /* ECHO EFFECT FOR KEY DESCRIPTION TEXT */
    .key-focus {
      display: inline-block;
      color: #fff;
      text-shadow: 0 0 4px #00f, 0 0 10px #0ff;
      position: relative;
   
    }
    .key-focus::after {
      content: 'PRESS, HOLD, SURVIVE!';
      position: absolute;
      left: 0;
      right: 0;
      top: 18px;
      font-size: 10px;
      color: #0ff;
      opacity: 0.7;
      text-shadow: 0 0 6px #0ff;
  
    }
    .title-row {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      justify-content: center;
      gap: 50px;
      margin-bottom: 20px;
    }
    .title-column {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .title-column p {
      margin-top: 6px;
      font-size: 10px;
      color: #9ab;
      text-align: center;
    }
.highscore-table-wrapper {
      width: 90%;
      max-width: 280px;
      margin: 0 auto 20px;
      font-size: clamp(10px, 3vw, 12px); /* Responsive font */
      line-height: 1.8;
    }
    
    /* Specific wrapper for Game Over screen scrolling */
    #gameOverScoreWrapper,
    #titleScoreWrapper {
      /* Height for 1 header + 4 rows */
      height: 110px; 
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: #666 #333;
      padding-right: 10px; /* Space for scrollbar */
      border-top: 1px solid #666;
      border-bottom: 1px solid #666;
    }

    .highscore-table {
      width: 100%;
      border-collapse: collapse;
      color: #fff;
    }
    
    .highscore-table th {
      color: #ffcc00; /* Yellow */
      padding: 4px 2px;
      font-size: clamp(11px, 3.1vw, 13px); /* Slightly larger */
      position: sticky; /* Makes header stick during scroll */
      top: 0;
      background: #000; /* Ensures it covers scrolling content */
      z-index: 1; /* Keeps header above rows */
    }
    
    .highscore-table td {
      padding: 2px;
      border-top: 1px dashed #444; /* Separator lines */
    }
   

    #titleHighScoreLabel {
      font-size: 14px;
      color: #ffcc00;
      text-shadow: 1px 1px #8a5;
      margin: 20px 0 10px; /* Added margin */
    }
    
    #nameEntry {
      margin-top: 0px;
      display: none; /* Hidden by default */
    }
    #nameEntry p {
      font-size: 10px;
      line-height: 1.6;
      color: #cdd;
    }

#nameEntry label {
color:#fff;
}
    #playerNameInput {
      background: #333;
      border: 2px solid #888;
      color: #fff;
      font-family: 'Press Start 2P', cursive;
      font-size: 0.9rem;
      width: 80px;
      text-align: center;
      text-transform: uppercase;
      margin-top: 10px;
      padding: 3px;
    }
    #submitScoreButton,
    #continueButton {
      background: #00ff7f;
      color: #001b0f;
      padding: 10px 20px;
      border: 3px solid #006b3f;
      border-radius: 8px;
      box-shadow: 0 4px 0 #004d30, 0 0 12px rgba(0,255,127,.25) inset;
      cursor: pointer;
      user-select: none;
      margin-top: 20px;
      display: inline-block;
    }
 #consentBlock {
      margin-top: 15px;
  max-width: 280px;
  text-align: left;
  display: flex;
  flex-direction: row;
	 font-family:"Arial",sans-serif;
    }

    #consentBlock #consentCheckbox {
margin-right:4px;
    }
    #consentBlock label {
      font-size: 10px; line-height: 1.1; color: #cdd;
    } 
#howToPlay {
  font-size: 11px;
  color: #cdd;
  max-width: 220px;
  margin: 8px;
  text-align: left;
  border-radius: 8px;
  padding: 8px;
  background: linear-gradient(145deg, #02131f, #001b2b);
  border: 1px solid #123;
  box-shadow: inset 0 0 8px rgba(0, 255, 255, 0.15);
}
#howToPlay h3 {
  font-size: 11px;
  color: #ffcc00;
  margin: 0 0 6px;
}
#howToPlay p {
  margin: 0;
  line-height: 1.5;
}

#howToPlay strong {
  color: #00ff7f;
  text-shadow: 0 0 4px #00ff7f;
}
#howToPlay span {
  color: #ff6666;
}

/* Mexican wave animation for the title */
@keyframes mexican-wave {
  0% {
    transform: translateY(0);
    text-shadow: 0 0 8px #ff00ff, 0 0 16px #ff00ff, 3px 3px 0 #00f;
  }
  20% {
    transform: translateY(-6px);
    text-shadow: 0 0 12px #ff00ff, 0 0 24px #ff00ff, 4px 4px 0 #00f;
  }
  40% {
    transform: translateY(0);
    text-shadow: 0 0 8px #ff00ff, 0 0 16px #ff00ff, 3px 3px 0 #00f;
  }
  100% {
    transform: translateY(0);
    text-shadow: 0 0 8px #ff00ff, 0 0 16px #ff00ff, 3px 3px 0 #00f;
  }
}
    #titleHighScore, #newHighScoreLabel { 
      font-size: 14px;
      color: #00ff7f;
      text-shadow: 0 0 8px #0f0, 2px 2px 0 #070;
      margin: 8px 0;
    }
    /* Score & lives display inside the game canvas */
    #scoreDisplay {
      position: absolute;
      top: 8px;
      left: 8px;
      color: #fff;
      font-size: 10px;
      text-shadow: 1px 1px #000;
      background: rgba(0, 0, 0, 0.4);
      padding: 4px 8px;
      border-radius: 6px;
      border: 1px solid #4d4d4d;
    }
    #scoreLabel {
      color: #ffcc00;
    }
    #livesDisplay {
      position: absolute;
      top: 8px;
      right: 8px;
      color: #fff;
      font-size: 10px;
      text-shadow: 1px 1px #000;
      background: rgba(0, 0, 0, 0.4);
      padding: 4px 8px;
      border-radius: 6px;
      border: 1px solid #4d4d4d;
    }
    #livesLabel {
      color: #ff6666;
    }
    #levelDisplay {
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      color: #fff;
      font-size: 10px;
      text-shadow: 1px 1px #000;
      background: rgba(0, 0, 0, 0.4);
      padding: 4px 8px;
      border-radius: 6px;
      border: 1px solid #4d4d4d;
    }
    #levelLabel {
      color: #00ffff;
    }
    #newHighScoreLabel {
      display: none;
    }

 #gameOverScreen {
      position: absolute; /* Changed from fixed */
      inset: 0;
      display: none; /* Hidden by default */
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      background: radial-gradient(120% 120% at 50% 100%, #3f0000 0%, #000 60%); /* Red gradient */
      z-index: 10;
      
      /* --- ADD THESE 3 LINES --- */
      overflow-y: auto; /* Make the overlay scroll if content is too tall */
      padding-bottom: 20px; /* Add space at the bottom */
      box-sizing: border-box; /* Include padding in height calculation */
    }
    #gameOverScreen h2 {
  font-size: clamp(24px, 2.5vw, 28px);
  color: #f00;
  text-shadow: 0 0 8px #f00, 3px 3px 0 #800;
  margin: 0 0 8px;
}
    #gameOverScreen h3 {
      font-size: 14px;
      color: #ffcc00;
      text-shadow: 1px 1px #8a5;
      margin: 0 0 16px;
    }
    #finalScore {
      font-size: 12px;
      color: #cdd;
      margin: 0 0 10px;
      font-style: italic;
    }
   
    #gameOverScreen table th {
      background: rgba(80, 0, 0, 0.95);
      color: #ff6666;
      text-shadow: 1px 1px #000;
    }
    #gameOverScreen table tr:nth-child(even) td {
      background: rgba(40, 0, 0, 0.95);
    }
    #gameOverScreen table tr:last-child td {
      border-bottom: none;
    }

    .score-label {
      color: #ffcc00;
      text-shadow: 1px 1px #8a5;
    }
    
    /* Sparkline-style history text: smaller and more compact */
    #performanceHistory {
      font-size: 10px;
      text-align: center;
      color: #9ab;
      margin: 10px 0 16px;
      padding-top: 8px;
      border-top: 1px dashed #444; /* Separator lines */
    }
   

    #titleHighScoreLabel {
      font-size: 14px;
      color: #ffcc00;
      text-shadow: 1px 1px #8a5;
      margin: 20px 0 10px; /* Added margin */
    }
    
    #nameEntry {
      margin-top: 20px;
      display: none; /* Hidden by default */
    }
    #nameEntry p {
      font-size: 10px;
      line-height: 1.6;
      color: #cdd;
    }
    #playerNameInput {
      background: #333;
      border: 2px solid #888;
      color: #fff;
      font-family: 'Press Start 2P', cursive;
      font-size: 0.9rem;
      width: 80px;
      text-align: center;
      text-transform: uppercase;
      margin-top: 10px;
      padding: 4px;
      border-radius: 4px;
      outline: none;
      box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
    }
    #playerNameInput::placeholder {
      color: #888;
    }
    #playerNameInput:focus {
      border-color: #ffd700;
      box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
    }

#scoreDiff {
  display: block;
  font-size: 10px;
  color: #9f9;
  margin-top: 4px;
}

#previousScore {
  display: block;
  font-size: 10px;
  color: #9ab;
  margin-top: 4px;
}

#gameOverSubtitle {
  font-size: 11px;
  color: #ffcc00;
  text-shadow: 1px 1px #8a5;
  margin: 4px 0 8px;
}

/* Make the buttons smaller & tighter */
#restartButton, #backToTitleButton {
  font-size: 11px;
  padding: 6px 10px;
  margin: 4px;
}

#leaderboardNav {
  margin-bottom: 6px;
}

#leaderboardList li span {
  color: #ffcc00;
}

/* FLUID, MOBILE-FRIENDLY HIGH SCORE LAYOUT */
#highScoresContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px; /* Anti-scrollbar overlap */
}
.highscore-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #4d4d4d;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
}
.highscore-entry span {
  margin: 0 4px;
}
.highscore-entry .hs-rank {
  color: #ffcc00;
}
.highscore-entry .hs-name {
  color: #fff;
}
.highscore-entry .hs-score {
  color: #00ff7f;
}
.highscore-entry .hs-date {
  color: #9ab;
}



#leaderboardList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#leaderboardList li {
  margin: 3px 0;
}

/* Override old margin, if needed */
#leaderboardSection {
  margin-top: 10px;
}

#controlsRef {
  margin-bottom: 4px;
  font-size: 10px;
}
#controlsRef strong {
  color: #ffcc00;
}

/* Buttons within overlay screens */
.overlay-button {
  background: linear-gradient(145deg, #00ffcc, #007f7f);
  color: #001b1b;
  padding: 8px 14px;
  border: 2px solid #00ffcc;
  border-radius: 6px;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.8),
              0 0 16px rgba(0, 255, 204, 0.5);
  text-shadow: 1px 1px #004040;
  margin: 4px 4px 4px;
}

/* Back button variation */
.overlay-button.back {
  background: linear-gradient(145deg, #ff9900, #cc6600);
  border-color: #ffcc66;
  box-shadow: 0 0 8px rgba(255, 204, 102, 0.8),
              0 0 16px rgba(255, 153, 0, 0.6);
}
.overlay-button:hover {
  filter: brightness(1.1);
}

/* ---------------------------------
   MOBILE TOUCH CONTROLS (FLEX LAYOUT)
   --------------------------------- */
#touch-controls {
  display: none; /* JS sets to flex on mobile */
  width: 100%;
  background: #000;
  box-sizing: border-box;

  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  /* Slightly tighter padding + safe area handling */
  padding-top: 4px;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0));
  padding-left: calc(8px + env(safe-area-inset-left, 0));
  padding-right: calc(8px + env(safe-area-inset-right, 0));
}

/* Joystick block on the left */
#joystick-base {
  flex-shrink: 0;
  width: 110px;
  height: 56px;
  background-color: #333;
  border: 2px solid #555;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

/* The draggable stick */
#joystick-stick {
  width: 34px;
  height: 34px;
  background-color: #555;
  border: 2px solid #777;
  border-radius: 50%;
  position: relative;
  left: 0;
  transition: left 0.08s ease-out;
}

/* Row of buttons on the right */
#touch-buttons {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Individual touch buttons */
.touch-button {
  width: 90px;
  height: 56px;
  background: #444;
  color: #fff;
  border: 2px solid #666;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-family: 'Press Start 2P', cursive;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.touch-button:active {
  transform: scale(0.95);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}
