* {
    box-sizing: border-box;
}

body {
    background-color: black;
    color: #e0e0e0;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    min-height: 100vh;
}

.header {
    text-align: center;
    margin: 20px 0;
    width: 100%;
    max-width: 800px;
}

.back-to-home {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 10px 0;
}

.back-button {
    display: inline-block;
    background-color: #6a0dad; /* Purple from landing page */
    color: #ffffff;
    padding: 10px 20px;
    margin: 10px 5px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s;
}

.back-button:hover {
    background-color: #8a2be2; /* Lighter purple on hover */
    transform: translateY(-2px);
}

h1 {
    color: #e0e0e0;
    font-size: 24px;
    text-align: center;
    margin: 10px 0;
}

main {
    width: 100%;
    max-width: 800px;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #1a1a1a;
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 10px;
    text-align: left;
    color: #e0e0e0;
    font-size: 16px;
}

th {
    background-color: rgba(106, 13, 173, 0.7);
}

tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

tr:hover {
    background-color: rgba(138, 43, 226, 0.2);
}

#gameCanvas {
    border: 2px solid white;
    max-width: 100%;
    height: auto;
    aspect-ratio: 800 / 600;
}

#prizeLinkContainer {
    display: none;
    text-align: center;
    z-index: 15;
    width: 100%;
    max-width: 800px;
}

#prizeLink {
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    text-decoration: none;
    padding: 10px;
    border: 2px solid #00ff00;
    border-radius: 5px;
    display: none;
}

#prizeLink:hover {
    background-color: #333;
}

#keyboardControls {
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    text-align: center;
    margin-top: 10px;
    display: block;
}

#keyboardControls p {
    margin: 5px 0;
    font-weight: bold;
}

#keyboardControls ul {
    list-style: none;
    padding: 0;
    margin: 5px 0;
}

#keyboardControls li {
    margin: 5px 0;
}

#touchControls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
    z-index: 20;
}

#touchControls button {
    font-size: 24px;
    padding: 15px 30px;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    touch-action: manipulation;
    border-radius: 8px;
}

#leftBtn, #rightBtn {
    background-color: rgba(0, 255, 0, 0.5); /* Original green */
}

#shootBtn {
    background-color: rgba(255, 0, 0, 0.5); /* Original red */
    border-radius: 50%;
    padding: 15px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#nameEntry {
    display: none;
    text-align: center;
    z-index: 10;
    width: 100%;
    max-width: 800px;
}

#nameEntry.active {
    display: block;
}

#nameEntry input {
    font-size: 24px;
    padding: 15px;
    margin: 10px;
    width: 250px;
}

#nameEntry button {
    font-size: 24px;
    padding: 15px 30px;
    background-color: #333;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    touch-action: manipulation;
    border-radius: 8px;
}

#nameEntry p {
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    margin: 10px 0 0;
}

@media (max-width: 1024px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    #keyboardControls {
        display: none;
    }
    #touchControls {
        display: flex;
    }
    #gameCanvas {
        width: 100%;
        height: auto;
        margin-top: 2vh;
    }
    #nameEntry {
        position: absolute;
    }
    #prizeLinkContainer {
        position: absolute;
    }
    #prizeLink {
        font-size: 16px;
        padding: 8px;
    }
}

@media (max-width: 1024px) and (orientation: landscape) {
    #touchControls {
        padding: 5px;
        gap: 10px;
    }
    #touchControls button {
        font-size: 18px;
        padding: 8px 16px;
    }
    #shootBtn {
        padding: 8px;
        width: 50px;
        height: 50px;
    }
    #gameCanvas {
        margin-top: 1vh;
        max-height: 80vh;
    }
    #nameEntry input {
        font-size: 18px;
        padding: 10px;
        width: 200px;
    }
    #nameEntry button {
        font-size: 18px;
        padding: 10px 20px;
    }
    #prizeLink {
        font-size: 14px;
        padding: 6px;
    }
}

@media (min-width: 1025px) {
    #touchControls, #nameEntry {
        display: none !important;
    }
    #prizeLinkContainer {
        margin-top: 10px;
        position: static;
    }
}