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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px 0;
    color: #9fb4a8;
}

.game-container {
    background: #0f380f;
    border: 8px solid #8bac0f;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 15px;
    max-width: 1000px;
    width: 98vw;
}

.game-header {
    text-align: center;
    margin-bottom: 10px;
}

.game-header h1 {
    color: #9bbc0f;
    font-size: 1.8em;
    text-shadow: 2px 2px #306230;
    margin-bottom: 8px;
    letter-spacing: 3px;
}

.info-bar {
    display: flex;
    justify-content: space-around;
    background: #0f380f;
    border: 3px solid #306230;
    padding: 10px;
    border-radius: 5px;
}

.score-display, .high-score-display, .speed-display, .lives-display {
    color: #9bbc0f;
    font-size: 1.2em;
    font-weight: bold;
}

.score-display span:first-child,
.high-score-display span:first-child,
.speed-display span:first-child,
.lives-display span:first-child {
    margin-right: 5px;
    color: #8bac0f;
}

.game-screen {
    position: relative;
    background: #9bbc0f;
    border: 4px solid #306230;
    border-radius: 5px;
    overflow: hidden;
}

.controls-tip {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 56, 15, 0.85);
    border: 2px solid #8bac0f;
    border-radius: 5px;
    padding: 8px 12px;
    color: #9bbc0f;
    font-size: 0.9em;
    font-weight: bold;
    display: none;
    gap: 15px;
    z-index: 10;
    pointer-events: none;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 56, 15, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #9bbc0f;
    text-align: center;
    padding: 20px;
}

.overlay-screen h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 3px 3px #306230;
    letter-spacing: 2px;
}

.overlay-screen p {
    font-size: 1.2em;
    margin: 10px 0;
}

.controls-info {
    margin: 20px 0;
    padding: 15px;
    background: rgba(48, 98, 48, 0.5);
    border: 2px solid #8bac0f;
    border-radius: 5px;
}

.controls-info p {
    margin: 8px 0;
    font-size: 1em;
}

.game-button {
    background: #9bbc0f;
    color: #0f380f;
    border: 4px solid #306230;
    padding: 15px 40px;
    font-size: 1.3em;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 20px;
    transition: all 0.1s;
    box-shadow: 0 4px #306230;
}

.game-button:hover {
    background: #8bac0f;
    transform: translateY(1px);
    box-shadow: 0 3px #306230;
}

.game-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px #306230;
}

.game-footer {
    text-align: center;
    margin-top: 10px;
    color: #8bac0f;
    font-size: 0.85em;
}

.hidden {
    display: none !important;
}

#newHighScore {
    color: #ffcc00;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px #306230;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Hyperlink styling to match Gameboy theme */
a {
    color: #9bbc0f;
    text-decoration: none;
    border-bottom: 2px solid #8bac0f;
    transition: all 0.2s ease;
    font-weight: bold;
}

a:hover {
    color: #8bac0f;
    border-bottom-color: #9bbc0f;
    text-shadow: 1px 1px #306230;
}

a:visited {
    color: #8bac0f;
    border-bottom-color: #306230;
}

a:active {
    color: #ffcc00;
    border-bottom-color: #ffcc00;
}

/* Mobile/Desktop visibility toggles */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Mobile Touch Controls */
.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.mobile-dpad {
    position: absolute;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-btn {
    pointer-events: auto;
    background: rgba(48, 98, 48, 0.8);
    border: 3px solid #8bac0f;
    color: #9bbc0f;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.5em;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: all 0.1s;
}

.mobile-btn:active {
    background: rgba(139, 172, 15, 0.8);
    transform: scale(0.95);
}

.mobile-btn-up,
.mobile-btn-down {
    width: 60px;
    height: 60px;
}

.mobile-btn-swing {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 100px;
    height: 100px;
    font-size: 1.2em;
}

.mobile-btn-pause {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-bars {
    display: inline-block;
    width: 20px;
    height: 20px;
    position: relative;
}

.pause-bars::before,
.pause-bars::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 20px;
    background: #9bbc0f;
    border-radius: 1px;
}

.pause-bars::before {
    left: 0;
}

.pause-bars::after {
    right: 0;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .controls-tip {
        display: none !important;
    }
}

/* Scale down controls for very small screens */
@media (max-width: 480px) {
    .mobile-dpad {
        left: 10px;
        bottom: 10px;
        gap: 8px;
    }
    
    .mobile-btn-up,
    .mobile-btn-down {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }
    
    .mobile-btn-swing {
        right: 10px;
        bottom: 10px;
        width: 80px;
        height: 80px;
        font-size: 1em;
    }
    
    .mobile-btn-pause {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
    }
    
    .pause-bars {
        width: 16px;
        height: 16px;
    }
    
    .pause-bars::before,
    .pause-bars::after {
        width: 5px;
        height: 16px;
    }
    
    /* Scale down overlay screens and buttons */
    .overlay-screen h2 {
        font-size: 1.5em !important;
        margin-bottom: 10px;
    }
    
    .overlay-screen p {
        font-size: 1em;
        margin: 8px 0;
    }
    
    .final-score-text {
        font-size: 1.2em !important;
        margin: 12px 0 !important;
    }
    
    .game-button {
        padding: 12px 30px;
        font-size: 1.1em;
        margin-top: 12px;
    }
    
    .controls-info {
        padding: 10px;
        margin: 15px 0;
    }
    
    .controls-info p {
        margin: 6px 0;
        font-size: 0.9em;
    }
}

@media (max-width: 360px) {
    .mobile-dpad {
        left: 8px;
        bottom: 8px;
        gap: 6px;
    }
    
    .mobile-btn-up,
    .mobile-btn-down {
        width: 45px;
        height: 45px;
        font-size: 1.1em;
    }
    
    .mobile-btn-swing {
        right: 8px;
        bottom: 8px;
        width: 70px;
        height: 70px;
        font-size: 0.9em;
    }
    
    .mobile-btn-pause {
        top: 6px;
        right: 6px;
        width: 35px;
        height: 35px;
    }
    
    .pause-bars {
        width: 14px;
        height: 14px;
    }
    
    .pause-bars::before,
    .pause-bars::after {
        width: 4px;
        height: 14px;
    }
    
    /* Even smaller overlays for tiny screens */
    .overlay-screen h2 {
        font-size: 1.2em !important;
        margin-bottom: 8px;
    }
    
    .overlay-screen p {
        font-size: 0.85em;
        margin: 6px 0;
    }
    
    .final-score-text {
        font-size: 1.1em !important;
        margin: 10px 0 !important;
    }
    
    .game-button {
        padding: 10px 25px;
        font-size: 1em;
        margin-top: 8px;
    }
    
    .controls-info {
        padding: 8px;
        margin: 10px 0;
    }
    
    .controls-info p {
        margin: 5px 0;
        font-size: 0.85em;
    }
}

@media (max-width: 1050px) {
    .game-container {
        padding: 8px;
        border-width: 4px;
    }
    
    .game-header h1 {
        font-size: 1.4em;
        margin-bottom: 5px;
    }
    
    .info-bar {
        font-size: 0.85em;
        padding: 6px;
    }
    
    .controls-tip {
        font-size: 0.75em;
        padding: 6px 10px;
        gap: 10px;
    }
    
    .game-footer {
        font-size: 0.75em;
    }
    
    .overlay-screen h2 {
        font-size: 2em;
    }
}

