/* /css/game.css */

/* =========================
   ROOT VARIABLES (from your styles.css)
   ========================= */
:root {
  --font-main: 'Roboto Mono', monospace;
  --font-heading: 'Stardos Stencil', serif;
  --color-bg: #ffffff;
  --color-text: #111111;
  --color-dark: #111111;
  --color-light: #ffffff;
}

/* =========================
   BASE STYLES FOR FULLSCREEN GAME
   ========================= */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Prevents scrollbars */
  font-family: var(--font-main);
  background-color: var(--color-dark);
}

/* =========================
   GAME CONTAINER & CANVAS
   ========================= */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  background-color: #e0e0e0; /* Fallback color */
  background-size: cover;
  background-position: center;
  cursor: none; /* Hide cursor over the whole game area */
}

#items-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  z-index: 15;
}

#dirt-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  z-index: 10;
  pointer-events: none; 
}


/* =========================
   UI ELEMENTS
   ========================= */
#score-display {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 8px 18px;
  border-radius: 5px;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  z-index: 30;
  border: 1px solid var(--color-dark);
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  z-index: 20;
  box-sizing: border-box;
  cursor: default;
  gap: 2rem;
  flex-wrap: wrap;
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0; /* Prevent this from shrinking */
}

.game-overlay h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 10vw, 4.5rem);
    color: var(--color-dark);
    margin: 0;
}

.game-overlay h2 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 8vw, 3.5rem);
  margin-bottom: 1rem;
  color: var(--color-dark);
}

.game-overlay .subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin: 0.5rem 0 2rem 0;
}

.game-overlay .instructions {
  font-family: var(--font-main);
  max-width: 500px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

#submit-score-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#player-name {
    font-family: var(--font-main);
    padding: 0.5rem;
    width: 80%;
    max-width: 300px;
    border: 1px solid var(--color-dark);
    border-radius: 5px;
}

#final-score {
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: bold;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.game-button {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  padding: 0.75rem 2rem;
  background-color: var(--color-dark);
  color: var(--color-light);
  border: none;
  cursor: pointer;
  transition: opacity 0.3s;
  text-decoration: none;
  display: inline-block;
}

.game-button:hover {
  opacity: 0.8;
}

.home-link {
    background-color: #555;
}

.high-score-container {
    background: rgba(0,0,0,0.05);
    padding: 1rem;
    border-radius: 8px;
    min-width: 250px;
    max-height: 40vh; /* Prevent lists from getting too long */
    overflow-y: auto;
    flex-shrink: 0; /* Prevent this from shrinking */
}

.high-score-container h3 {
    font-family: var(--font-heading);
    margin-top: 0;
}

.high-score-container ol {
    list-style-position: inside;
    padding-left: 0;
    text-align: left;
}

.high-score-container li {
    font-family: var(--font-main);
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.high-score-container li span {
    font-size: 0.8em;
    color: #555;
    float: right;
}

/* UPDATED: Media query for mobile layout */
@media (max-width: 768px) {
    .game-overlay {
        flex-direction: column; /* Stack items vertically */
        justify-content: center; /* Center content vertically */
        padding: 1rem; /* Reduce padding */
        gap: 0.5rem; /* Reduce gap between elements */
        flex-wrap: nowrap;
    }
    
    .game-overlay h1 { font-size: 2rem; }
    .game-overlay .subtitle { font-size: 0.9rem; margin-bottom: 1rem; }
    .game-overlay .instructions { display: none; } /* Hide instructions on small screens to save space */
    
    .high-score-container {
        max-height: 25vh; /* Limit height of score boxes */
        width: 80%;
        padding: 0.5rem;
        min-width: unset;
    }

    .high-score-container h3 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    .high-score-container li {
        font-size: 0.8rem;
    }
}
