﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top, #1b2735, #090a0f);
    font-family: 'Courier New', monospace;
    color: #fff;
}

/* ---------------- MENU ---------------- */

#menu {
    z-index: 9999;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    background: rgba(255, 255, 255, 0.05);
    padding: 25px 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px #0ff;
    text-align: center;
    backdrop-filter: blur(10px);
}

    #menu h1 {
        font-size: 40px;
        color: #00faff;
        text-shadow: 0 0 10px #00faff;
        margin-bottom: 20px;
    }

.menu-block {
    margin: 16px 0;
    font-size: 18px;
}

/* ---------------- MENU BUTTONS & SELECTS LIKE HOME HEADING ---------------- */
button, .menuBtn, select {
    font-family: 'Courier New', monospace; /* same as home heading */
    font-size: 20px; /* slightly smaller than heading */
    font-weight: bold;
    color: #fff; /* white letters */
    text-shadow: 0 0 10px #fff; /* white glow */
    background: rgba(0,0,0,0.2); /* semi-transparent background */
    border: 2px solid #0ff;
    border-radius: 8px;
    padding: 10px 35px;
    margin: 8px 0;
    cursor: pointer;
    transition: 0.2s;
}

#leaderName {
    font-family: 'Courier New', monospace; /* same as home heading */
    font-size: 10px; /* slightly smaller than heading */
    font-weight: bold;
    color: black; /* white letters */
    text-shadow: 0 0 10px #fff; /* white glow */
    background: rgba(0,0,0,0.2); /* semi-transparent background */
    border: 2px solid #0ff;
    border-radius: 8px;
    padding: 10px 35px;
    margin: 8px 0;
    cursor: pointer;
    transition: 0.2s;
}

    /* Hover effects */
    .menuBtn:hover, select:hover {
        background: #0ff;
        color: black;
        text-shadow: 0 0 15px #0ff; /* hover glow effect */
    }

/* For select dropdown text alignment */
select {
    text-align: center;
    -webkit-appearance: none; /* remove default arrow styling on Chrome/Safari */
    -moz-appearance: none; /* remove default arrow styling on Firefox */
    appearance: none;
}

/* Optional: Add a custom arrow for select */
select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='black'><polygon points='0,0 12,0 6,6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 40px;
}


/* ---------------- HUD ---------------- */

/*#hud {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
    display: none;
    z-index: 10;
    text-align: center;
}*/

/* ---------------- CANVAS ---------------- */

canvas {
    background: #111;
    border: 4px solid #0ff;
    border-radius: 12px;
    box-shadow: 0 0 20px #0ff, 0 0 40px #0ff inset;
}

#gameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: auto; /* <–– FIX */
    padding-top: 20px; /* optional */
}


#scoreCard {
    position: fixed; /* relative to viewport, not parent */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    padding: 30px 50px;
    border-radius: 12px;
    text-align: center;
    color: #0ff;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 20px #0ff;
    z-index: 9999; /* top layer */
    pointer-events: auto; /* clickable */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 90%; /* responsive */
}


    #scoreCard h2 {
        color: red;
        font-size: 40px;
        margin-bottom: 15px;
    }

    #scoreCard p {
        font-size: 28px;
    }

#pauseBtn {
    position: absolute;
    top: calc(50% + 320px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 45px;
    font-size: 22px;
    background: red;
    color: black;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 15;
    box-shadow: 0 0 10px #0ff;
}

    #pauseBtn:hover {
        background: #099;
        color: white;
    }

#menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
}

    #menu h2 {
        font-size: 40px;
        font-weight: bold;
        color: #00faff;
        margin-bottom: 10px;
    }

#settingsPanel {
    display: none;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #888;
    border-radius: 5px;
    background-color: #222;
    color: white;
    text-align: left;
    width: 220px;
    margin: 15px auto 0 auto;
}

#gameContainer {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

#pauseMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.05);
    padding: 25px 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px #0ff;
    backdrop-filter: blur(10px);
    text-align: center;
    z-index: 30;
}

    #pauseMenu h2 {
        color: #0ff;
        font-size: 32px;
        margin-bottom: 15px;
    }

    #pauseMenu p {
        color: white;
        font-size: 22px;
        margin-bottom: 20px;
    }

/* Canvas checkered patterns */
.canvas-green-check {
    background-color: #0a0;
    background-image: linear-gradient(45deg, #060 25%, transparent 25%, transparent 75%, #060 75%, #060), linear-gradient(45deg, #060 25%, transparent 25%, transparent 75%, #060 75%, #060);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

.canvas-blue-check {
    background-color: #00f;
    background-image: linear-gradient(45deg, #009 25%, transparent 25%, transparent 75%, #009 75%, #009), linear-gradient(45deg, #009 25%, transparent 25%, transparent 75%, #009 75%, #009);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

#leaderName {
    width: 80%;
    padding: 10px;
    margin: 10px 0;
    font-size: 10px;
    border-radius: 6px;
    border: 2px solid #555;
    background: #fff;
    text-align: center;
    outline: none;
    transition: 0.2s ease;
}

    #leaderName:focus {
        border-color: #00cc66;
        box-shadow: 0px 0px 10px #00cc6655;
    }

    #leaderboardPanel{
        text-align:center;
        justify-content:center;
    }
.leaderboard-grid {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    font-size: 18px;
}

    .leaderboard-grid div {
        padding: 6px 0;
    }

.lb-rank {
    text-align: right;
    font-weight: bold;
    opacity: 0.7;
}

.lb-name {
    text-align: left;
    font-weight: 500;
}

.lb-score {
    text-align: right;
    font-weight: bold;
}

/* Base desktop */
canvas {
    border: 4px solid #0ff;
    border-radius: 12px;
    box-shadow: 0 0 20px #0ff, 0 0 40px #0ff inset;
    display: block;
    margin: 0 auto;
}

/*#hud {
    font-size: 40px;
    top: 10%;
    left: 22%;
    transform: translateX(-50%);
}*/

/* Responsive buttons */
button, select, #leaderName {
    font-size: 18px;
    padding: 10px 35px;
    width: 200px;
    max-width: 90%;
}

/* Mobile small */
@media screen and (max-width: 600px) {
/*    #hud {
        font-size: 50px;
        top: 5%;
    }*/

    button, select, #leaderName {
        font-size: 14px;
        padding: 6px 12px;
    }

    #menu, #pauseMenu, #scoreCard, #leaderboardPanel {
        width: 90%;
        padding: 15px;
    }

    .leaderboard-grid {
        font-size: 14px;
        gap: 4px;
    }

}

/* Tablet */
@media screen and (min-width: 601px) and (max-width: 1024px) {
/*    #hud {
        font-size: 50px;
        top: 8%;
    }*/

    button, select, #leaderName {
        font-size: 16px;
        padding: 8px 20px;
    }

    #menu, #pauseMenu, #scoreCard, #leaderboardPanel {
        width: 80%;
        padding: 20px;
    }

    
}

/* Large desktop */
@media screen and (min-width: 1200px) {
/*    #hud {
        font-size: 50px;
    }*/

    button, select, #leaderName {
        font-size: 20px;
        padding: 12px 35px;
    }

    #menu, #pauseMenu, #scoreCard, #leaderboardPanel {
        width: 400px;
        padding: 25px;
    }
}

#canvasContainer {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

#gameCanvas {
    transform-origin: top center;
    position: relative;
    z-index: 1;
    margin-top: 10vh !important;
}

#mobileControls {
    display: none;
    width: 100%;
    margin-top: 20px;
    justify-content: center;
}

.dpad {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.middle-row {
    display: flex;
    gap: 12px;
}

.dpad-btn {
    width: 70px;
    height: 70px;
    font-size: 32px;
    border: none;
    background: red;
    color: red;
    border-radius: 10px;
    box-shadow: 0 0 10px #0ff;
    cursor: pointer;
}

    .dpad-btn:active {
        transform: scale(0.90);
    }

@media screen and (max-width: 1024px) {
    #mobileControls {
        display: flex;
    }
}
/* ---------------- HEADER ---------------- */
#gameHeader {
    position: absolute;
    top: 40px; /* distance from top */
    width: 100%;
    text-align: center;
    z-index: 10000;
}

    #gameHeader h1 {
        font-family: 'Courier New', monospace;
        font-size: 48px;
        color: #00faff;
        text-shadow: 0 0 10px #00faff, 0 0 20px #0ff, 0 0 30px #0ff;
        margin: 0;
    }

/* Responsive header */
@media screen and (max-width: 600px) {
    #gameHeader h1 {
        font-size: 58px;
    }
}

@media screen and (min-width: 601px) and (max-width: 1024px) {
    #gameHeader h1 {
        font-size: 86px;
    }
    /*#hud {
        top: 10%;*/ /* top-left for tablet */
        /*left: 50px;
        transform: none;*/ /* remove desktop translate */
        /*font-size: 35px;
        text-align: left;
    }*/
}

@media screen and (min-width: 1200px) {
    #gameHeader h1 {
        font-size: 56px;
    }
}
/* ---------------- MOBILE CONTROLS ---------------- */
#mobileControls {
    display: none;
    width: 100%;
    margin-top: 40px; /* distance from canvas */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px; /* spacing between D-pad and action row */
}

/* DPAD STRUCTURE */
.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* reduced vertical spacing between up arrow and middle row */
}

.middle-row {
    display: flex;
    gap: 35px; /* spacing between left/middle/right buttons */
}

/* DPAD BUTTONS */
.dpad-btn {
    width: 80px;
    height: 80px;
    font-size: 32px;
    border: none;
    background: red;
    color: white;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .dpad-btn:active {
        transform: scale(0.9);
        box-shadow: 0 3px 8px rgba(0, 255, 255, 0.6);
        background: linear-gradient(145deg, #00aabb, #0ff);
    }

/* SHOW ON PHONES ONLY */
@media screen and (max-width: 1024px) {
    #mobileControls {
        display: flex;
        margin-top: 50px;
    }

    .dpad-btn {
        width: 120px;
        height: 120px;
        font-size: 36px;
        border-radius: 25px;
    }

    .middle-row {
        gap: 120px; /* space between left/middle/right buttons */
    }

    .dpad {
        gap: 18px; /* slightly larger than desktop for touch comfort */
    }
    #menu {
        width: 50%;
        padding: 30px 25px; /* bigger panel padding */
        border-radius: 20px;
    }

        #menu h2 {
            font-size: 50px; /* bigger heading */
            margin-bottom: 20px;
        }

        #menu .menuBtn {
            font-size: 45px; /* bigger buttons */
            padding: 15px 45px;
            width: 90%; /* full width buttons */
            max-width: none;
            border-radius: 15px;
        }
    /* Settings Panel */
    #settingsPanel {
        width: 100%;
        padding: 20px;
        border-radius: 15px;
    }

        #settingsPanel label {
            font-size: 50px;
            margin-top: 10px;
            display: block;
        }

        #settingsPanel select {
            font-size: 50px;
            padding: 10px;
            width: 50%;
            margin-bottom: 10px;
        }

    /* Leaderboard Panel */
    #leaderboardPanel {
        width: 50%;
        padding: 20px;
        border-radius: 15px;
    }

        #leaderboardPanel h3 {
            font-size: 35px;
            margin-bottom: 15px;
        }

    .leaderboard-grid {
        font-size: 35px;
        gap: 6px;
    }

    /* Input for saving name */
    #leaderName {
        font-size: 35px;
        padding: 12px;
        width: 100%;
    }

    /* Score card buttons */
    #saveScoreBtn {
        font-size: 50px;
        padding: 12px 45px;
        width: 50%;
        max-width: none;
        border-radius: 15px;
    }
    #scoreCard {
        width: 50%;
        padding: 25px;
        border-radius: 20px;
    }

        #scoreCard h2 {
            font-size: 32px;
            margin-bottom: 15px;
        }

        #scoreCard p {
            font-size: 40px;
            margin-bottom: 15px;
        }

    #leaderName {
        font-size: 35px;
        padding: 12px;
        width: 100%;
    }

    #saveScoreBtn {
        font-size: 30px;
        padding: 12px 40px;
        width: 70%;
        border-radius: 15px;
    }

    /* Pause button larger */
    #pauseBtn {
        padding: 10px 40px;
        font-size: 50px;
    }
}
/* MOBILE VIEW - BIGGER HOME PANEL AND BUTTONS */
@media screen and (max-width: 600px) {
    #menu {
        width: 90%;
        padding: 30px 25px; /* bigger panel padding */
        border-radius: 20px;
    }

        #menu h2 {
            font-size: 36px; /* bigger heading */
            margin-bottom: 20px;
        }

        #menu .menuBtn {
            font-size: 20px; /* bigger buttons */
            padding: 15px 45px;
            width: 100%; /* full width buttons */
            max-width: none;
            border-radius: 15px;
        }
}
/* Ensure body takes full height */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
}

/* Make the canvas container flexible to fill available space */
.canvasContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Footer styling */
footer {
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 20px;
    margin-top: auto; /* Pushes the footer to the bottom */
}

    footer a {
        color: #0ff;
        text-decoration: none;
        margin: 0 10px;
    }

        footer a:hover {
            text-decoration: underline;
        }

.underCanvasRow {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* forces pause button to the right */
    margin-top: 10px; /* small space under canvas */
}

.mobile-pause {
    width: 70px;
    height: 70px;
    background: red;
    border: none;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

    /* Pause bars */
    .mobile-pause::before,
    .mobile-pause::after {
        content: "";
        width: 12px;
        height: 26px;
        background: white;
        border-radius: 3px;
        position: absolute;
    }

    /* Left bar */
    .mobile-pause::before {
        left: 20px;
    }

    /* Right bar */
    .mobile-pause::after {
        right: 20px;
    }

    /* Optional hover effect */
    .mobile-pause:hover {
        background: #333;
    }

@media (max-width < 1024px) {
    .mobile-pause {
        display: flex; /* show ONLY on mobile */
    }
}
#menu {
    background-color: black !important; /* solid black */
    color: white; /* text stays visible */
}
#pauseMenu {
    background-color: black !important; /* solid black */
    color: white; /* text stays visible */
}

@media screen and (min-width: 1980px) and (max-width: 3840px) {

    /* Header adjustments */
    #gameHeader {
        top: 20%; /* buffer from top */
    }

        #gameHeader h1 {
            font-size: 72px; /* larger header for big screens */
        }

    /* Canvas adjustments */
    #gameCanvas {
        margin-top: 20px; /* gap between header and canvas */
        transform-origin: top center;
        max-width: 80%; /* scale canvas without overflowing */
    }

    /* Mobile controls (for very large touch screens, optional) */
    #mobileControls {
        margin-top: 60px;
    }


    /* Score card adjustments */
    #scoreCard {
        width: 500px;
        padding: 35px;
        border-radius: 20px;
    }

        #scoreCard h2 {
            font-size: 60px;
            margin-bottom: 20px;
        }

        #scoreCard p {
            font-size: 40px;
        }

    /*#hud {
        top: 34%;*/ /* top-left for tablet */
        /*left: 37%;
        transform: none;*/ /* remove desktop translate */
        /*font-size: 35px;
        text-align: left;
    }*/
}

/* ============================================
   GLOBAL FIX — makes pause menu scalable
   ============================================ */
#pauseMenu {
    --pauseScale: 1; /* default desktop scaling */
    transform: translate(-50%, -50%) scale(var(--pauseScale)) !important;
    width: 60%;
    max-width: 450px;
}

/* ============================================
   TABLETS & LARGE PHONES (≤ 1024px)
   ============================================ */
@media screen and (max-width: 1024px) {

    #pauseMenu {
        --pauseScale: 1.3;
        width: 80%;
        padding: 40px 30px;
        border-radius: 20px;
    }

    #pauseMenu h2 {
        font-size: 60px;
        margin-bottom: 25px;
    }

    #pauseMenu p {
        font-size: 50px;
        margin-bottom: 30px;
    }

    #pauseMenu .menuBtn {
        font-size: 45px;
        padding: 20px 40px;
        width: 90%;
        border-radius: 15px;
    }
}

/* ============================================
   SMALL PHONES (≤ 600px)
   ============================================ */
@media screen and (max-width: 600px) {

    #pauseMenu {
        --pauseScale: 1.45;
        width: 90%;
        padding: 35px 25px;
        border-radius: 20px;
    }

    #pauseMenu h2 {
        font-size: 40px;
    }

    #pauseMenu p {
        font-size: 34px;
    }

    #pauseMenu .menuBtn {
        font-size: 30px;
        padding: 18px 35px;
        width: 100%;
    }
}

/* ============================================
   VERY SMALL PHONES (≤ 400px)
   ============================================ */
@media screen and (max-width: 400px) {

    #pauseMenu {
        --pauseScale: 1.6; /* strongest zoom */
        width: 95%;
        padding: 30px 20px;
        border-radius: 18px;
    }

    #pauseMenu h2 {
        font-size: 32px;
        margin-bottom: 15px;
    }

    #pauseMenu p {
        font-size: 26px;
        margin-bottom: 20px;
    }

    #pauseMenu .menuBtn {
        font-size: 24px;
        padding: 15px 28px;
        border-radius: 12px;
        width: 100%;
    }
}

/* -------------------------------------------------
   FIX: HEADER, HUD, CANVAS & PAGE LAYOUT
---------------------------------------------------*/

/* 1. Prevent page scrolling and lock height */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* prevents scrolling */
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, #1b2735, #090a0f);
}

/* 2. Canvas container */
.canvasContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* top alignment */
    align-items: center; /* center horizontally */
    position: relative;
    padding-top: 120px; /* space for header on all devices */
}

/* 3. Header */
#gameHeader {
    position: fixed;
    top: 40px; /* space from top, adjust per device below */
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    text-align: center;
    pointer-events: none;
}

    #gameHeader h1 {
        margin: 0;
        font-size: 48px;
        color: #00faff;
        text-shadow: 0 0 10px #00faff, 0 0 20px #0ff;
    }

/* 4. Score / HUD */
/*#hud {
    position: fixed;
    top: 18%;
    left: 25%;
    transform: translate(0, 0);
    font-size: 40px;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
    z-index: 9999;
}*/

/* 5. Canvas styling */
#gameCanvas {
    max-width: 100%;
    max-height: calc(100% - 150px); /* leave space for header + footer */
    display: block;
    border: 4px solid #0ff;
    border-radius: 12px;
    box-shadow: 0 0 20px #0ff, 0 0 40px #0ff inset;
    margin-bottom: 20px; /* spacing from footer */
}

/* 6. Footer */
footer {
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 20px;
    width: 100%;
    flex-shrink: 0; /* prevent footer from collapsing */
}

    footer a {
        color: #0ff;
        text-decoration: none;
        margin: 0 10px;
    }

        footer a:hover {
            text-decoration: underline;
        }

/* 7. Mobile / Tablet Adjustments */
@media screen and (max-width: 1024px) {
    #gameHeader {
        top: 30px;
    }

        #gameHeader h1 {
            font-size: 80px;
        }

/*    #hud {
        font-size: 50px;
    }*/

    .canvasContainer {
        padding-top: 100px;
    }
}



/* 8. Large screens */
@media screen and (min-width: 1600px) {
    #gameHeader h1 {
        font-size: 72px;
    }

/*    #hud {
        font-size: 50px;
    }*/

    .canvasContainer {
        padding-top: 150px;
    }
}

.canvasContainer {
    position: relative;
    display: inline-block;
}

/* HUD sticks to top-left of the canvas container */
#hud {
    position: absolute;
    top: 180px; /* distance ABOVE the canvas */
    left: 0;
    z-index: 999;
    pointer-events: none;
    font-size: 38px;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
}


