* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1A237E;
    font-family: 'Press Start 2P', monospace;
}

#game-container {
    position: relative;
    width: 100%;
    height: calc(100% - 40px);
    touch-action: none;
}

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

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    display: none;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    pointer-events: none;
}

#hud.visible {
    display: flex;
}

#courage-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

#courage-icon {
    font-size: 24px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

#courage-bar-container {
    flex: 1;
    max-width: 200px;
    height: 16px;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #FFD700;
}

#courage-bar {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #FFA500, #FFD700);
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 6px;
}

#courage-text {
    color: #FFD700;
    font-size: 10px;
    text-shadow: 2px 2px 0 #000;
    white-space: nowrap;
}

#stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#stats span {
    color: #FFF;
    font-size: 9px;
    text-shadow: 2px 2px 0 #000;
    background: rgba(0,0,0,0.4);
    padding: 4px 8px;
    border-radius: 4px;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

#mobile-controls.visible {
    display: flex;
}

#joystick-container {
    pointer-events: auto;
}

#joystick-base {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

#joystick-stick {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    border: 2px solid #FFF;
    transition: transform 0.05s ease-out;
}

#tackle-btn {
    pointer-events: auto;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #FFD700;
    background: linear-gradient(135deg, #FF6B35, #E74C3C);
    color: #FFF;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#tackle-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

#footer {
    height: 40px;
    background: #E8BE5A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #5D4E37;
}

#footer a {
    color: #E74C3C;
    text-decoration: none;
    margin-left: 5px;
}

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

/* Desktop adjustments */
@media (min-width: 768px) {
    #mobile-controls {
        opacity: 0.6;
    }
    
    #mobile-controls:hover {
        opacity: 1;
    }
    
    #courage-text {
        font-size: 12px;
    }
    
    #stats span {
        font-size: 11px;
    }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
    #courage-icon {
        animation: none;
    }
    
    #courage-bar {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    #courage-bar-container {
        border-width: 3px;
    }
    
    #stats span {
        background: #000;
        border: 1px solid #FFF;
    }
}