html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  /* The color variables for your checkerboard */
  --color-1: white; /* White */
  --color-2: black; /* Black */
  
  /* The exact mathematical size of each individual square */
  --square-size: 40px; 

  /* CSS math logic to render the alternating pattern */
  background-image: 
    linear-gradient(45deg, var(--color-2) 25%, transparent 25%, transparent 75%, var(--color-2) 75%),
    linear-gradient(45deg, var(--color-2) 25%, var(--color-1) 25%, var(--color-1) 75%, var(--color-2) 75%);
  
  /* Double the size of the square handles the seamless grid spacing */
  background-size: calc(var(--square-size) * 2) calc(var(--square-size) * 2);
  
  /* Offsets the first gradient layer by one square length to create the alternating effect */
  background-position: 0 0, var(--square-size) var(--square-size);

  /* ✅ FIX 1: The Centering Engine (Flexbox) */
  display: flex;
  justify-content: center; /* Centers .main horizontally */
  align-items: center;     /* Centers .main vertically */
}

.main {
  background-color: white;
  color: black;
  font-family: Verdana;
  border: solid black 2px;
  
  /* Responsive sizing based on the SMALLEST screen dimension */
  width: 70vmin;
  height: 70vmin;
  
  /* Safe container configuration for text contents */
  padding: 30px;
  box-sizing: border-box; /* Forces padding to stay INSIDE the square size */
  overflow-y: auto;       /* Adds a clean scrollbar inside the box if text overflows */
}

.header {
  text-decoration: underline;
  padding-left: 5%;
  padding-right: 5%;
}

.links {
  width: 50%;
  margin: 0 auto;
}

/* --- MOBILE RESPONSIVE OVERRIDES --- */
@media (max-width: 600px) {
  .main {
    /* 1. Make the square fill more of the narrow mobile screen */
    width: 90vmin;
    height: 90vmin;
    
    /* 2. Shrink the padding inside the square so content has more room */
    padding: 15px; 
  }

  .header {
    /* 3. Drop the main font/header size down so it doesn't clip or wrap ugly */
    font-size: 1.5rem; 
    padding-left: 2%;
    padding-right: 2%;
  }

  .links {
    /* 4. Allow the links container to widen up on thin screens */
    width: 80%; 
    font-size: 0.9rem; /* Slighting smaller links for easy clicking */
  }
}