@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;900&display=swap');

#gameCanvas {
    --orbit-primary: #667eea;
    --orbit-secondary: #764ba2;
    --orbit-accent: #00d2ff;
    --orbit-bg-game: #240b36;
    --orbit-text: #2d3748;
    
    width: 100%; min-height: 600px;
    display: flex; justify-content: center; align-items: center;
    padding: 10px;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}

#gameCanvas * { box-sizing: border-box; touch-action: manipulation; }

/* WRAPPER & CONTAINER */
#orbit-game-wrapper {
    position: relative; width: 100%; max-width: 600px; 
    aspect-ratio: 1 / 1; max-height: 80vh; 
    display: flex; justify-content: center; align-items: center;
}

#orbit-board-container {
    width: 100%; height: 100%;
    background: var(--orbit-bg-game);
    border-radius: 25px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    border: 5px solid #fff;
    overflow: hidden; position: relative; user-select: none; color: white;
}

/* PLEIN ECRAN */
#orbit-game-wrapper:fullscreen {
    width: 100vw; height: 100vh; max-height: 100vh;
    border-radius: 0; padding: 0;
    display: flex; justify-content: center; align-items: center;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}
#orbit-game-wrapper:fullscreen #orbit-board-container {
    width: auto; height: auto; max-width: 100%; max-height: 100%;
    aspect-ratio: 1/1; border-radius: 25px; box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

#orbit-canvas { width: 100%; height: 100%; display: block; }

#ui-layer {
    position: absolute; inset: 0; pointer-events: none;
    display: flex; justify-content: center; align-items: center; z-index: 10;
}

/* ECRANS */
.screen {
    position: absolute; inset: 0;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; pointer-events: auto;
    background: rgba(30, 10, 50, 0.9); backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease; padding: 15px;
}
.screen.active { display: flex; }
.hidden { display: none !important; }

#game-interface {
    background: transparent !important; backdrop-filter: none !important;
    box-shadow: none !important; pointer-events: none;
    justify-content: flex-start; padding: 0;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* UI ELEMENTS */
.orbit-card {
    background: white; padding: 20px; border-radius: 20px;
    width: 90%; max-width: 350px; text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3); color: var(--orbit-text);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    margin: auto; max-height: 95%; overflow-y: auto;
}

.orbit-content-scroll { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.orbit-title { 
    font-size: 1.6rem; margin: 0; font-weight: 800; line-height: 1.2; flex-shrink: 0;
    background: linear-gradient(to right, var(--orbit-primary), var(--orbit-secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.orbit-title-red { color: #f56565; margin: 0; font-size: 1.6rem; font-weight: 800; }

.btn-primary {
    background: linear-gradient(to right, var(--orbit-primary), var(--orbit-secondary));
    color: white; border: none; padding: 10px 30px; font-size: 1rem; border-radius: 50px;
    font-family: 'Poppins', sans-serif; font-weight: bold; cursor: pointer;
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3); transition: transform 0.2s;
    white-space: nowrap; flex-shrink: 0; margin-top: 5px;
}
.btn-primary:hover { transform: translateY(-2px); }

/* CONTROLES (Bas Droite) */
.icon-controls {
    position: absolute; bottom: 15px; right: 15px;
    display: flex; gap: 8px; z-index: 60; pointer-events: auto;
}
.icon-btn {
    background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
    color: white; font-size: 1rem; cursor: pointer; border-radius: 50%;
    width: 38px; height: 38px; display: flex; justify-content: center; align-items: center;
    transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.4); }

.high-scores-box {
    background: #f7fafc; padding: 8px; border-radius: 10px; width: 100%; border: 1px solid #e2e8f0;
}
.high-scores-box h3 { margin: 0 0 5px 0; color: #a0aec0; font-size: 0.7rem; text-transform: uppercase; }
.high-scores-box ul { list-style: none; padding: 0; margin: 0; font-size: 0.8rem; font-weight: 600; color: #4a5568; }
.high-scores-box li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #edf2f7; }

.instruction-box-mini {
    background: #ebf8ff; color: #2c5282; padding: 8px; border-radius: 10px; font-size: 0.8rem;
}
.instruction-box-mini p { margin: 0; }

.hud-top {
    position: absolute; top: 15px; left: 15px; display: flex; gap: 8px; z-index: 20; pointer-events: none;
}
.hud-pill {
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    padding: 5px 12px; border-radius: 20px; color: white; font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2); font-size: 0.85rem;
}
.hud-pill span { color: var(--orbit-accent); font-size: 1rem; margin-left: 5px; }

#center-feedback {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 3rem; font-weight: 900; opacity: 0; pointer-events: none;
    white-space: nowrap; z-index: 15; text-shadow: 0 5px 20px rgba(0,0,0,0.5);
}
.anim-combo { color: #ffd700; animation: popFade 0.6s forwards; }
.anim-perfect { color: #00d2ff; animation: popFade 0.6s forwards; }
.anim-miss { color: #ff4b1f; animation: shake 0.4s forwards; }

.result-circle {
    width: 90px; height: 90px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orbit-primary), var(--orbit-secondary));
    color: white; display: flex; flex-direction: column; justify-content: center; align-items: center;
    font-size: 1.8rem; font-weight: bold; margin: 5px auto 15px;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4); flex-shrink: 0;
}
.result-circle small { font-size: 0.8rem; font-weight: normal; opacity: 0.9; }

.stats-row { display: flex; gap: 15px; justify-content: center; width: 100%; }
.stat-item { display: flex; flex-direction: column; }
.stat-val { font-weight: 800; font-size: 1.1rem; color: var(--orbit-secondary); }
.stat-lbl { font-size: 0.75rem; color: #a0aec0; }

@keyframes popFade { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 40% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
@keyframes shake { 0% { transform: translate(-50%, -50%); opacity: 1; } 25% { transform: translate(-55%, -50%); } 75% { transform: translate(-45%, -50%); } 100% { opacity: 0; } }

@media (max-width: 450px) {
    #orbit-game-wrapper { max-height: 500px; border-width: 3px; }
    .orbit-card { padding: 15px; width: 95%; }
    .orbit-title { font-size: 1.4rem; }
    .btn-primary { padding: 8px 25px; font-size: 0.9rem; }
}