/* ========================================
   SIMON SAYS - BLOUM LAB
   ======================================== */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f0f1a 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* === BACKGROUND EFFECTS === */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.floating-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #00d9ff 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #a855f7 0%, transparent 70%);
    bottom: -50px;
    right: -50px;
    animation-delay: -7s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #10b981 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* === GAME WRAPPER === */
.game-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

/* === HEADER === */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.back-link {
    color: #00d9ff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #a855f7;
}

.game-logo {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d9ff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sound-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.sound-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sound-btn.muted {
    opacity: 0.5;
}

/* === GAME CONTAINER === */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

/* === SCREENS === */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* === MENU SCREEN === */
.menu-screen {
    padding: 20px;
    overflow-y: auto;
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.title-glow {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #00d9ff, #a855f7, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 217, 255, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 10px rgba(0, 217, 255, 0.3)); }
    to { filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.4)); }
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    text-align: center;
}

/* === BUTTONS === */
.btn-primary {
    background: linear-gradient(135deg, #00d9ff 0%, #a855f7 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 40px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.4);
}

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

.btn-glow {
    animation: btnGlow 2s ease-in-out infinite alternate;
}

@keyframes btnGlow {
    from { box-shadow: 0 5px 20px rgba(0, 217, 255, 0.3); }
    to { box-shadow: 0 5px 30px rgba(168, 85, 247, 0.5); }
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 12px 30px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* === INSTRUCTIONS === */
.instructions {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
}

.instructions h3 {
    color: #00d9ff;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.instruction {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.instruction .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* === LEADERBOARD === */
.leaderboard-preview, .leaderboard-full {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
}

.leaderboard-preview h3, .leaderboard-full h3 {
    color: #ffd700;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard-full .leaderboard-list {
    max-height: 250px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    font-size: 0.85rem;
}

.leaderboard-entry.top-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-entry.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.rank {
    width: 30px;
    font-weight: 700;
    color: #00d9ff;
}

.pseudo {
    flex: 1;
    color: white;
    font-weight: 500;
}

.score {
    color: #a855f7;
    font-weight: 700;
}

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 20px;
}

/* === GAME SCREEN === */
.game-screen {
    display: flex;
    flex-direction: column;
}

.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.hud-left, .hud-right {
    flex: 1;
}

.hud-right {
    display: flex;
    justify-content: flex-end;
}

.hud-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.score-display {
    display: flex;
    gap: 15px;
}

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

.score-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-box span:last-child {
    font-size: 1.3rem;
    font-weight: 700;
    color: #00d9ff;
}

.game-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #ffd700;
    animation: pulse 1s ease-in-out infinite;
}

.game-status.your-turn {
    color: #10b981;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* === SIMON BOARD === */
.simon-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.simon-board {
    position: relative;
    width: 280px;
    height: 280px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    border-radius: 50%;
    padding: 10px;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.8) 100%);
    box-shadow: 
        0 0 0 8px rgba(255, 255, 255, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.simon-btn {
    position: relative;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.simon-btn:disabled {
    cursor: not-allowed;
}

.simon-green {
    background: linear-gradient(135deg, #166534 0%, #22c55e 50%, #166534 100%);
    border-radius: 100% 10px 10px 10px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(34, 197, 94, 0.3);
}

.simon-green.active, .simon-green:active:not(:disabled) {
    background: linear-gradient(135deg, #4ade80 0%, #86efac 50%, #4ade80 100%);
    box-shadow: 
        inset 0 0 10px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(34, 197, 94, 0.8),
        0 0 80px rgba(34, 197, 94, 0.4);
}

.simon-red {
    background: linear-gradient(135deg, #991b1b 0%, #ef4444 50%, #991b1b 100%);
    border-radius: 10px 100% 10px 10px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(239, 68, 68, 0.3);
}

.simon-red.active, .simon-red:active:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, #fca5a5 50%, #f87171 100%);
    box-shadow: 
        inset 0 0 10px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(239, 68, 68, 0.8),
        0 0 80px rgba(239, 68, 68, 0.4);
}

.simon-yellow {
    background: linear-gradient(135deg, #a16207 0%, #eab308 50%, #a16207 100%);
    border-radius: 10px 10px 10px 100%;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(234, 179, 8, 0.3);
}

.simon-yellow.active, .simon-yellow:active:not(:disabled) {
    background: linear-gradient(135deg, #facc15 0%, #fef08a 50%, #facc15 100%);
    box-shadow: 
        inset 0 0 10px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(234, 179, 8, 0.8),
        0 0 80px rgba(234, 179, 8, 0.4);
}

.simon-blue {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #1e40af 100%);
    border-radius: 10px 10px 100% 10px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(59, 130, 246, 0.3);
}

.simon-blue.active, .simon-blue:active:not(:disabled) {
    background: linear-gradient(135deg, #60a5fa 0%, #93c5fd 50%, #60a5fa 100%);
    box-shadow: 
        inset 0 0 10px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(59, 130, 246, 0.8),
        0 0 80px rgba(59, 130, 246, 0.4);
}

.key-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.simon-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0a0f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: #00d9ff;
    box-shadow: 
        0 0 0 4px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* === GAME OVER SCREEN === */
.gameover-screen {
    padding: 20px;
    overflow-y: auto;
}

.gameover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.gameover-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-final {
    text-align: center;
    padding: 20px;
}

.score-big {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #00d9ff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.score-label-big {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    margin-top: 5px;
}

.stats-row {
    display: flex;
    gap: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #a855f7;
}

/* === SAVE FORM === */
.save-score-form {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

.pseudo-input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.pseudo-input:focus {
    border-color: #00d9ff;
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.pseudo-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.save-status {
    font-size: 0.9rem;
    min-height: 24px;
    text-align: center;
}

.save-status.success {
    color: #10b981;
}

.save-status.error {
    color: #ef4444;
}

.gameover-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* === RESPONSIVE === */
@media (max-width: 400px) {
    .game-wrapper {
        padding: 5px;
    }
    
    .simon-board {
        width: 240px;
        height: 240px;
    }
    
    .simon-center {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    
    .title-glow {
        font-size: 1.6rem;
    }
    
    .instruction-grid {
        grid-template-columns: 1fr;
    }
    
    .key-hint {
        display: none;
    }
}

@media (min-width: 500px) {
    .simon-board {
        width: 320px;
        height: 320px;
    }
    
    .simon-center {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}
