/* --- Core Responsive Layout (Fixes Overflow) --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent all scrolling */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
}

/* --- Typography & UI --- */
h1 { font-size: 2.5em; margin-bottom: 10px; color: white; }
p { font-size: 1.2em; color: #bdc3c7; margin-top: 0; }

/* REBUILT: Fully responsive game container and canvas */
#game-container {
    position: relative;
    width: clamp(300px, 80vmin, 600px); /* Responsive width: min 300px, max 600px, ideally 80% of viewport smaller dimension */
    height: clamp(300px, 80vmin, 600px); /* Responsive height */
    margin: 15px auto;
}

#game-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #34495e;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

/* REBUILT: Dashboard layout with perfect alignment */
#game-info {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: clamp(1rem, 2.5vmin, 1.5rem); /* Responsive font size */
    font-weight: bold;
}

#stats-display {
    display: flex;
    gap: 20px;
}
#action-buttons {
    display: flex;
    gap: 10px;
}
#hint-btn, #restart-btn {
    padding: 10px 20px;
    font-size: 0.9em;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}
#hint-btn { background-color: #3498db; }
#restart-btn { background-color: #e74c3c; }
#hint-btn:hover, #restart-btn:hover { transform: translateY(-2px); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
#hint-btn:disabled { background-color: #7f8c8d; cursor: not-allowed; transform: none; box-shadow: none; }

/* --- Win Overlay (Unchanged) --- */
#win-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(44, 62, 80, 0.95); border-radius: 15px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #f1c40f; font-size: 2em; animation: fade-in 0.5s;
}
@keyframes fade-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
#win-stats { font-size: 0.6em; color: #ecf0f1; margin-top: -10px; margin-bottom: 20px; }
#next-level-btn {
    padding: 15px 30px; font-size: 1em; border: none; border-radius: 10px;
    background-color: #f1c40f; color: #2c3e50; cursor: pointer; transition: all 0.2s;
}
#next-level-btn:hover { background-color: #f39c12; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

.hidden { display: none !important; }