/* Reset default margins and ensure box-sizing */
* {
    box-sizing: border-box;
}

body {
    background-color: #0d0d0d;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* Updated to match main site */
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, #6b00b3, #00b7eb); /* Gradient from main site */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
    margin: 20px 0;
    width: 100%;
    max-width: 900px; /* Match main site */
    padding: 20px;
}

main {
    width: 100%;
    flex: 1; /* Allow main to expand */
    display: flex;
    flex-direction: column;
    align-items: center;
}

footer {
    margin-top: auto;
    background-color: #333;
    color: #fff;
    font-size: 0.9rem;
    padding: 20px;
    width: 100%;
    max-width: 900px;
    text-align: center;
}

h1 {
    font-size: 2.5rem; /* Match main site */
    margin: 10px 0;
    color: #ffffff; /* White for header */
    font-weight: 700;
}

.back-to-home {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.button {
    background-color: #6b00b3; /* Purple from main site */
    color: #ffffff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #ff6f00; /* Orange hover from main site */
}

.tagline {
    color: #fff;
    font-size: 1.3rem;
    margin: 10px 0 20px;
}

nav {
    margin: 20px 0;
}

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

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

.x-logo {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-left: 5px;
    transition: transform 0.3s;
}

.x-logo:hover {
    transform: scale(1.1);
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

.score-board {
    margin-bottom: 10px;
    text-align: center;
}

.score-board h2 {
    font-size: 18px;
    margin: 5px 0;
}

.score-board p {
    font-size: 16px;
    color: #e0e0e0;
    margin: 5px 0;
}

#gameCanvas {
    width: 100%;
    max-width: 450px;
    height: auto;
    border: 2px solid #e0e0e0;
    background-color: #000;
    margin-top: 10px;
    aspect-ratio: 1 / 1;
    touch-action: none;
}

.play-controls {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    max-width: 450px;
    margin-top: 10px;
}

#playButton {
    background-color: rgba(106, 13, 173, 0.7);
    color: #e0e0e0;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    width: 150px;
    user-select: none;
}

#playButton:hover {
    background-color: rgba(138, 43, 226, 0.7);
}

.game-state {
    font-size: 24px;
    font-weight: bold;
    color: #d32f2f;
    margin-top: 10px;
    text-align: center;
}

.name-entry {
    display: none;
    margin-top: 20px;
    text-align: center;
    width: 100%;
    max-width: 800px;
}

#webAuthName {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #e0e0e0;
    padding: 5px;
    width: 200px;
}

#submitHighScore {
    background-color: rgba(106, 13, 173, 0.7);
    color: #e0e0e0;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 5px;
    border-radius: 5px;
}

#submitHighScore:hover {
    background-color: rgba(138, 43, 226, 0.7);
}

.high-score-gift-card {
    display: none;
    margin-top: 10px;
    text-align: center;
    width: 100%;
    max-width: 800px;
}

#giftCardLink {
    background-color: rgba(0, 128, 0, 0.7);
    color: #e0e0e0;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    display: inline-block;
    font-size: 18px;
}

#giftCardLink:hover {
    background-color: rgba(0, 255, 0, 0.7);
}

.magic-emoji {
    width: 0.9em;
    height: auto;
    vertical-align: middle;
    margin: 0 2px;
}

@media (max-width: 768px) {
    .magic-emoji {
        width: 0.8em;
    }
    #gameCanvas {
        max-width: 90vw;
        height: auto;
    }
    .play-controls {
        max-width: 90vw;
    }
    #playButton {
        padding: 8px 15px;
        font-size: 16px;
        width: 120px;
    }
    .score-board h2 {
        font-size: 16px;
    }
    .score-board p {
        font-size: 14px;
    }
    .game-state {
        font-size: 20px;
    }
    .name-entry {
        margin-top: 10px;
    }
    #webAuthName {
        width: 180px;
        font-size: 14px;
    }
    #submitHighScore {
        font-size: 14px;
    }
    h1 {
        font-size: 2rem;
    }
    header {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .magic-emoji {
        width: 0.7em;
    }
    #playButton {
        padding: 6px 12px;
        font-size: 14px;
        width: 100px;
    }
    h1 {
        font-size: 1.75rem;
    }
    header {
        padding: 10px;
    }
}