@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

#spacetower-game-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: #050a14;
    font-family: 'Share Tech Mono', monospace, sans-serif;
    color: #cce8ff;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 15px; 
}
#spacetower-game-container:fullscreen { border-radius: 0; }
#spacetower-game-container * { box-sizing: border-box; }

/* Top Bar */
#st-top-bar {
    width: 100%; padding: 10px 20px; background: #0a1628;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #00e5ff33; z-index: 100;
}
#st-btn-full {
    background: transparent; border: 1px solid #00e5ff; color: #00e5ff;
    border-radius: 5px; width: 30px; height: 30px; cursor: pointer;
}
#st-btn-full:hover { background: #00e5ff33; }

/* Zone de jeu dynamique */
#st-game-area {
    position: relative;
    flex: 1; /* Prend tout l'espace restant */
    width: 100%;
    overflow: hidden; /* Empêche le débordement */
}

#st-starfield, #st-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%; /* S'adapte toujours à game-area */
    display: block;
}
#st-starfield { z-index: 0; pointer-events: none; }
#st-canvas { z-index: 5; }

/* HUD Fixé en haut du game-area */
#st-hud {
    position: absolute; top: 0; left: 0; width: 100%; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(5,10,20,0.9) 0%, rgba(5,10,20,0) 100%);
    pointer-events: none; /* Laisse passer les clics au travers... */
}

.st-hud-group {
    display: flex; gap: 20px;
}
.st-hud-item { text-align: center; }
.st-hud-label { font-family: 'Orbitron', sans-serif; font-size: 10px; letter-spacing: 2px; color: #00e5ff99; text-transform: uppercase; }
.st-hud-value { font-family: 'Orbitron', sans-serif; font-size: 22px; font-weight: 700; color: #00e5ff; text-shadow: 0 0 20px #00e5ff88; }
#st-timer-val { color: #ff6b35; text-shadow: 0 0 20px #ff6b3588; }

/* Nouveau Bouton Quitter HUD */
.st-btn-small {
    pointer-events: auto; /* ...sauf pour ce bouton */
    font-family: 'Orbitron', sans-serif; font-size: 10px; letter-spacing: 1px;
    padding: 5px 10px; border: 1px solid #ff336688; background: rgba(255,51,102,0.1);
    color: #ff3366; cursor: pointer; text-transform: uppercase; border-radius: 4px;
    transition: 0.2s;
}
.st-btn-small:hover { background: rgba(255,51,102,0.3); border-color: #ff3366; }

/* Overlays (Accueil & Fin) */
#spacetower-game-container .st-overlay {
    position: absolute; inset: 0; z-index: 50;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #0d2240ee 0%, #050a14ee 100%);
    backdrop-filter: blur(8px);
}
#spacetower-game-container .st-active { display: flex !important; }

#spacetower-game-container .st-overlay h1 {
    font-family: 'Orbitron', sans-serif; font-size: clamp(28px, 6vw, 48px);
    font-weight: 900; letter-spacing: 4px; color: #00e5ff;
    text-shadow: 0 0 20px #00e5ff88; margin-bottom: 8px; text-align: center;
    line-height: 1.1;
}

#spacetower-game-container .st-subtitle { font-size: 14px; letter-spacing: 3px; color: #00e5ff77; margin-bottom: 20px; text-align: center; }
#spacetower-game-container .st-overlay p { max-width: 400px; text-align: center; line-height: 1.6; color: #99c8e8; margin-bottom: 25px; font-size: 14px; }

/* Boutons principaux */
#spacetower-game-container .st-btn {
    font-family: 'Orbitron', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 2px;
    padding: 12px 30px; border: 2px solid #00e5ff; background: transparent; color: #00e5ff;
    cursor: pointer; text-transform: uppercase; transition: all 0.2s;
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    position: relative; overflow: hidden;
}
#spacetower-game-container .st-btn::before {
    content: ''; position: absolute; inset: 0; background: #00e5ff;
    transform: translateX(-100%); transition: transform 0.2s; z-index: -1;
}
#spacetower-game-container .st-btn:hover { color: #050a14; text-shadow: none; }
#spacetower-game-container .st-btn:hover::before { transform: translateX(0); }

/* Bouton Alternatif (Menu) */
#spacetower-game-container .st-btn-alt {
    border-color: #7c3aed; color: #7c3aed;
}
#spacetower-game-container .st-btn-alt::before { background: #7c3aed; }
#spacetower-game-container .st-btn-alt:hover { color: #fff; }

/* Difficulty */
.st-diff-select { display: flex; gap: 8px; margin-bottom: 30px; flex-wrap: wrap; justify-content: center; max-width: 460px; }
.st-diff-btn {
    font-family: 'Orbitron', sans-serif; font-size: 11px; letter-spacing: 1px;
    padding: 8px 12px; border: 1px solid #00e5ff44; background: transparent;
    color: #00e5ff88; cursor: pointer; transition: all 0.2s; text-transform: uppercase;
}
.st-diff-btn.st-active-btn, .st-diff-btn:hover { border-color: #00e5ff; color: #00e5ff; background: #00e5ff11; }

/* Hint (La lettre en bas) */
#st-key-hint { position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.st-key-display { font-family: 'Orbitron', sans-serif; font-size: 42px; font-weight: 900; color: #fff; text-shadow: 0 0 30px #00e5ff; letter-spacing: 4px; }
.st-key-label { font-size: 10px; letter-spacing: 2px; color: #00e5ff66; text-transform: uppercase; }

/* Feedback */
#st-feedback {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
    z-index: 30; font-family: 'Orbitron', sans-serif; font-size: 26px; font-weight: 900;
    pointer-events: none; opacity: 0; letter-spacing: 2px; text-align: center;
}
.show-good { color: #00ff9f; text-shadow: 0 0 20px #00ff9f; animation: flashFade 0.6s ease-out forwards; }
.show-bad { color: #ff3366; text-shadow: 0 0 20px #ff3366; animation: flashFade 0.6s ease-out forwards; }
@keyframes flashFade { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); } }

/* Game Over */
.st-score-big { font-family: 'Orbitron', sans-serif; font-size: clamp(48px, 10vw, 80px); font-weight: 900; color: #00e5ff; text-shadow: 0 0 20px #00e5ff88; margin: 10px 0; line-height:1; }
.st-score-sub { font-size: 12px; letter-spacing: 3px; color: #00e5ff66; margin-bottom: 20px; }

/* Planet */
.st-planet {
    width: 80px; height: 80px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #7c3aed, #1a0533);
    box-shadow: 0 0 40px #7c3aed66, inset -10px -10px 20px #00000066;
    margin-bottom: 20px; position: relative; animation: floatPlanet 3s ease-in-out infinite;
}
.st-planet::after {
    content: ''; position: absolute; top: 50%; left: -20px; right: -20px; height: 14px;
    border-radius: 50%; border: 3px solid #9d6bffaa; transform: translateY(-50%) rotateX(70deg);
}
@keyframes floatPlanet { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }