/* ==========================================================================
   Marmotte vs Raclettes - Space Defense Game Styles
   ========================================================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, #0a1628 0%, #152238 50%, #1a2d4a 100%);
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Game Container */
.game-container {
    max-width: 900px;
    width: 100%;
    background: linear-gradient(180deg, #1a2744 0%, #0f1829 100%);
    border: 2px solid rgba(100, 200, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 80px rgba(100, 200, 255, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.game-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fbbf24, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-tagline {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.95rem;
    color: #94a3b8;
}

.game-stats strong {
    color: #fbbf24;
}

/* Canvas */
.canvas-container {
    position: relative;
    margin: 0 auto 1.5rem;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #0a1628;
}

/* Controls */
.game-controls {
    text-align: center;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    color: #fff;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-help {
    padding: 0.75rem;
    width: 50px;
    height: 50px;
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid rgba(59, 130, 246, 0.4);
    color: #60a5fa;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    font-size: 1.3rem;
}

.btn-help:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-help:active {
    transform: translateY(0);
}

.game-instructions {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 1rem;
}

.game-instructions-mobile {
    display: none;
}

/* Touch Controls */
.game-touch-controls {
    display: none;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.touch-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 212, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.touch-btn:active {
    background: rgba(0, 212, 255, 0.4);
    transform: scale(0.95);
    border-color: #00d4ff;
}

.touch-btn-shoot {
    width: 80px;
    height: 80px;
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.4);
    font-size: 1.8rem;
}

.touch-btn-shoot:active {
    background: rgba(251, 191, 36, 0.5);
    border-color: #fbbf24;
}

/* Leaderboard */
.game-leaderboard {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-leaderboard h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #94a3b8;
}

#leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

#leaderboard::-webkit-scrollbar {
    width: 6px;
}

#leaderboard::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#leaderboard::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.3);
    border-radius: 3px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.85rem;
}

.leaderboard-entry.gold {
    border-left: 3px solid #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.leaderboard-entry.silver {
    border-left: 3px solid #94a3b8;
}

.leaderboard-entry.bronze {
    border-left: 3px solid #cd7f32;
}

.leaderboard-rank {
    color: #64748b;
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    color: #f8fafc;
}

.leaderboard-score {
    color: #fbbf24;
    font-family: monospace;
    font-weight: 600;
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 24, 41, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-screen h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.game-over-screen .win {
    color: #fbbf24;
}

.game-over-screen .lose {
    color: #ef4444;
}

.game-over-screen p {
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.game-over-screen input {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    margin-top: 1rem;
    width: 200px;
    text-align: center;
}

.game-over-screen input:focus {
    outline: none;
    border-color: #fbbf24;
}

.game-over-screen .btn {
    margin-top: 1rem;
}

/* Map Link */
.map-link {
    padding: 0.4rem 0.9rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.map-link:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

/* Footer */
.game-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: #64748b;
}

.game-footer a {
    color: #fbbf24;
    text-decoration: none;
    transition: color 0.3s;
}

.game-footer a:hover {
    color: #f97316;
}

/* Responsive */
@media (max-width: 540px) {
    .game-container {
        padding: 1rem;
    }

    .game-header h1 {
        font-size: 1.4rem;
    }

    .game-tagline {
        display: none;
    }

    .game-stats {
        font-size: 0.85rem;
        gap: 1rem;
    }

    #gameCanvas {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }

    .game-instructions-desktop {
        display: none;
    }

    .game-instructions-mobile {
        display: block;
    }

    .game-touch-controls {
        display: flex;
    }

    .touch-btn {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }

    .touch-btn-shoot {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }

    .game-leaderboard h3 {
        font-size: 0.9rem;
    }

    #leaderboard {
        max-height: 100px;
    }

    .leaderboard-entry {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .game-over-screen h3 {
        font-size: 1.5rem;
    }

    .game-over-screen input {
        width: 180px;
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 400px) {
    .touch-btn {
        width: 55px;
        height: 55px;
        font-size: 1.2rem;
    }

    .touch-btn-shoot {
        width: 65px;
        height: 65px;
        font-size: 1.4rem;
    }

    .game-touch-controls {
        gap: 0.75rem;
    }
}

/* Touch device detection */
@media (hover: none) and (pointer: coarse) {
    .game-instructions-desktop {
        display: none;
    }

    .game-instructions-mobile {
        display: block;
    }

    .game-touch-controls {
        display: flex;
    }
}

/* ==========================================================================
   Mode Selection
   ========================================================================== */

.mode-selection {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(15, 24, 41, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.mode-selection h3 {
    font-size: 1.1rem;
    color: #fbbf24;
    margin-bottom: 1rem;
    text-align: center;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.btn-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    background: rgba(251, 191, 36, 0.1);
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-mode:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
    transform: translateY(-2px);
}

.btn-mode:active {
    transform: translateY(0);
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.mode-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fbbf24;
}

.mode-desc {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ==========================================================================
   Help Modal
   ========================================================================== */

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.help-content {
    max-width: 800px;
    width: 100%;
    background: linear-gradient(180deg, #1a2744 0%, #0f1829 100%);
    border: 2px solid rgba(100, 200, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 25px 80px rgba(100, 200, 255, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.help-content::-webkit-scrollbar {
    width: 8px;
}

.help-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.help-content::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.4);
    border-radius: 4px;
}

.help-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid rgba(239, 68, 68, 0.4);
    border-radius: 50%;
    color: #ef4444;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-close:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
    transform: rotate(90deg);
}

.help-content h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #fbbf24, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    font-size: 1.3rem;
    color: #fbbf24;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 0.5rem;
}

.help-section p {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-note {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #60a5fa;
    padding: 0.75rem;
    border-radius: 4px;
    color: #60a5fa !important;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-section li {
    color: #94a3b8;
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.help-section li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #fbbf24;
    font-weight: bold;
}

.help-section strong {
    color: #f8fafc;
}

.powerup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.powerup-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s;
}

.powerup-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(251, 191, 36, 0.3);
    transform: translateY(-2px);
}

.powerup-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.powerup-item strong {
    display: block;
    color: #fbbf24;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.powerup-item p {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

@media (max-width: 540px) {
    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .btn-mode {
        padding: 0.75rem;
    }

    .mode-icon {
        font-size: 1.5rem;
    }

    .help-content {
        padding: 1.5rem;
        max-height: 95vh;
    }

    .help-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .help-section h3 {
        font-size: 1.1rem;
    }

    .powerup-grid {
        grid-template-columns: 1fr;
    }

    .powerup-icon {
        font-size: 2rem;
    }

    .btn-help {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}
