/* ------------------------------
   Global & "Game Boy" Frame
   ------------------------------ */
   html, body {
    margin: 0;
    padding: 0;
    background: #444;  /* Background behind the Game Boy frame */
    font-family: 'Press Start 2P', sans-serif; /* Optional retro font */
    color: #000;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #gameboyFrame {
    background: #C4C4C4;   /* Classic Game Boy gray */
    border: 1rem solid #999;
    border-radius: 1rem;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 428px;      /* iPhone 13 Max width */
    width: 100%;
    height: 90vh;          /* Overall frame height */
    max-height: 926px;      /* iPhone 13 Max portrait height approx */
  }
  
  /* ------------------------------
     Screen Area (Game "Screen")
     ------------------------------ */
  /* Originally the screen area occupied about 2/3 of the frame (≈60vh).
     Now we fix it to 48vh (a 20% reduction) */
  #screenArea {
    flex: 0 0 48vh;
    position: relative;
    background: #111;      /* Black background for the screen */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  
  #gameCanvas {
    background: #000;
    border: 6px solid #6B8E23;
    box-shadow: 0 0 10px #000;
    width: 90%;     /* Scales to fit within the screen area */
    height: auto;
    max-height: 100%;
  }
  
  /* Overlays within the screen area */
  #startOverlay,
  #scoreboard {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 1rem;
    border: 2px solid #444;
    color: #fff;
    text-align: center;
    z-index: 10;
  }
  
  #scoreboard {
    width: 80%;
    display: none;  /* Hidden until game over */
  }
  
  #startOverlay input {
    width: 150px;
    padding: 0.5rem;
    margin-right: 0.5rem;
  }
  
  table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem auto;
  }
  table, th, td {
    border: 1px solid #ccc;
    color: #fff;
  }
  th, td {
    padding: 0.3rem;
    text-align: center;
  }
  
  /* ------------------------------
     Controls Area (Bottom of Frame)
     ------------------------------ */
  /* The controls area takes the remaining vertical space */
  #controlsArea {
    flex: 0 0 calc(90vh - 48vh); /* The rest of the frame's 90vh (i.e. 42vh) */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
  }
  
  /* Enlarged Joystick (50% bigger than original 100px → 150px) */
  #joystick {
    position: relative;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  /* Enlarged Joystick Knob (75px, 50% larger than original 50px) */
  #joystickKnob {
    position: absolute;
    width: 75px;
    height: 75px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid #fff;
    border-radius: 50%;
    top: calc(50% - 37.5px);
    left: calc(50% - 37.5px);
  }
  
  /* Enlarged A/B Buttons (50% larger than 50px → 75px) and staggered */
  #buttons {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  #buttonA, #buttonB {
    width: 75px;
    height: 75px;
    background: #333;
    border: 2px solid #000;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 3px #000;
  }
  
  /* Stagger the buttons: place A closer to the right edge */
  #buttonA {
    position: relative;
    right: 0;
  }
  #buttonB {
    position: relative;
    right: 20px;
  }
  
  /* For shorter screens, adjust frame height */
  @media (max-height: 700px) {
    #gameboyFrame {
      height: 100vh;
      max-height: none;
    }
  }
  