/* ============================================
   Space Shooter - Feuille de styles
   Design inspiré de Pulse Pattern
   ============================================ */

/* --- Reset et base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#game-main {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
}

/* --- Conteneur principal --- */
#game-container {
    width: 100%;
    max-width: 500px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    gap: 8px;
    position: relative;
}

/* --- En-tête --- */
#game-header {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

#game-title {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7, #ff6fd8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* --- Scores --- */
#scores-container {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.score-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

/* --- Barre d'informations --- */
#info-bar {
    width: 100%;
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 6px 10px;
    flex-shrink: 0;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

/* --- Zone de jeu --- */
#game-area {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    min-height: 0;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #000011;
    border-radius: 10px;
}

/* --- Overlays --- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 12, 41, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 200;
    animation: fadeIn 0.25s ease;
}

.overlay.hidden {
    display: none !important;
}

.overlay h2 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-align: center;
}

.overlay p {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 12px;
    max-width: 90%;
    color: #ccc;
}

.overlay p strong {
    color: #fff;
}

/* --- Boutons --- */
.game-btn {
    padding: 12px 36px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    margin: 6px;
    color: #fff;
}

.game-btn:active {
    transform: scale(0.95);
}

.btn-play {
    background: linear-gradient(135deg, #00d2ff, #7b2ff7);
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.btn-play:hover {
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
}

.btn-stop {
    background: linear-gradient(135deg, #ff5252, #d50000);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

.btn-stop:hover {
    box-shadow: 0 6px 20px rgba(255, 82, 82, 0.5);
}

.btn-rules {
    background: linear-gradient(135deg, #ff6fd8, #7b2ff7);
    box-shadow: 0 4px 15px rgba(123, 47, 247, 0.3);
}

.btn-rules:hover {
    box-shadow: 0 6px 20px rgba(123, 47, 247, 0.5);
}

.btn-scores {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-scores:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- Règles --- */
.rules-content {
    max-height: 50vh;
    overflow-y: auto;
    text-align: left;
    padding: 15px;
    max-width: 90%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #ccc;
}

.rules-content h3 {
    font-size: 0.95rem;
    color: #b0b0ff;
    margin: 14px 0 6px;
    font-weight: 600;
}

.rules-content ul {
    padding-left: 20px;
    margin-bottom: 8px;
}

.rules-content li {
    margin-bottom: 4px;
}

/* --- Scores highscore --- */
#highscores-list {
    max-height: 40vh;
    overflow-y: auto;
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    margin: 5px 0;
    background: rgba(123, 47, 247, 0.1);
    border-radius: 5px;
    border-left: 3px solid #7b2ff7;
    font-size: 0.9rem;
}

.score-entry:nth-child(1) {
    border-left-color: gold;
    background: rgba(255, 215, 0, 0.1);
}

.score-entry:nth-child(2) {
    border-left-color: silver;
}

.score-entry:nth-child(3) {
    border-left-color: #cd7f32;
}

/* --- Contrôle pause --- */
#touch-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 150;
}

.control-btn {
    background: rgba(123, 47, 247, 0.8);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(123, 47, 247, 1);
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

/* --- Utilitaires --- */
.hidden {
    display: none !important;
}

/* --- Responsive : petits écrans --- */
@media (max-height: 600px) {
    #game-container {
        padding: 5px 10px;
        gap: 4px;
    }

    #game-title {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    .score-number {
        font-size: 1.1rem;
    }

    #info-bar {
        padding: 4px 8px;
    }

    .info-label {
        font-size: 0.6rem;
    }

    .info-value {
        font-size: 0.85rem;
    }

    .game-btn {
        padding: 10px 28px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #game-title {
        font-size: 1.3rem;
    }

    .score-number {
        font-size: 1.2rem;
    }

    .game-btn {
        padding: 10px 25px;
        font-size: 0.9rem;
        min-width: 120px;
    }

    .overlay h2 {
        font-size: 1.5rem;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }
}

/* --- Responsive : grands écrans --- */
@media (min-width: 768px) {
    #game-container {
        padding: 20px;
        gap: 12px;
    }

    #game-title {
        font-size: 2rem;
    }

    .score-number {
        font-size: 1.8rem;
    }
}

/* --- Mode paysage mobile --- */
@media (orientation: landscape) and (max-height: 500px) {
    #game-container {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 5px 10px;
        gap: 4px;
        max-width: 100%;
        justify-content: center;
    }

    #game-header {
        width: 50%;
        order: 1;
    }

    #game-title {
        font-size: 1rem;
        margin-bottom: 2px;
    }

    .score-number {
        font-size: 1rem;
    }

    #info-bar {
        width: 50%;
        order: 2;
        padding: 3px 6px;
    }

    #game-area {
        order: 3;
        flex: 1 1 100%;
    }

    .game-btn {
        padding: 8px 20px;
        font-size: 0.8rem;
    }

    #touch-controls {
        bottom: 10px;
        right: 10px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }
}
