/* ============================================================
   PATTERN EXPLORER PRO — style.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800;900&family=Baloo+2:wght@700;800&display=swap');
@import url('variables.css');
@import url('drawer.css');

/* ── GLOBAL RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    padding: 0 16px 80px;
}

/* ── TOP NAV ── */
#top-nav {
    width: 100%;
    max-width: 640px;
    display: flex;
    justify-content: flex-end;
    padding: 20px 0 10px;
    margin-bottom: 5px;
    z-index: 10;
}

#drawer-toggle {
    background: var(--card);
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#drawer-toggle:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--shadow); }

.hamburger {
    width: 26px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 99px;
}

/* ── PROGRESS ROW (Gamified) ── */
#progress-row {
    width: 100%;
    max-width: 640px;
    margin-bottom: 25px;
    background: var(--card);
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: 0 8px 25px var(--shadow);
    border: 2px solid rgba(0,0,0,0.03);
    z-index: 5;
}

#progress-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

#progress-label {
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    white-space: nowrap;
}

#progress-container {
    flex: 1;
    height: 16px;
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.5);
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 15px var(--progress-glow);
}

/* ── GAME CARD ── */
#game-container {
    width: 100%;
    max-width: 640px;
    padding: 30px;
    background: var(--card);
    border-radius: 28px;
    box-shadow: 0 20px 50px var(--shadow);
    text-align: center;
    position: relative;
    z-index: 6;
}

/* ── STATS BAR ── */
#stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-family: 'Baloo 2', sans-serif;
    position: relative;
}

#score-text {
    background: var(--primary);
    color: var(--btn-text);
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: 0 3px 0 rgba(0,0,0,0.12);
}

#lives-container {
    display: flex;
    gap: 4px;
    font-size: 1.4rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.heart { display: inline-block; animation: heart-beat 2s infinite ease-in-out; }
@keyframes heart-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.heart.lost { filter: grayscale(1) opacity(0.25); animation: none; transform: scale(0.85); }

#level-indicator { background: rgba(0,0,0,0.06); padding: 6px 16px; border-radius: 99px; font-size: 0.95rem; font-weight: 800; }

.boss-text {
    opacity: 0;
    pointer-events: none;
    color: var(--secondary);
    font-family: 'Baloo 2', sans-serif;
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 10px 0;
    transition: opacity 0.3s;
}

#game-container.boss-level .boss-text {
    opacity: 1;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.05); opacity: 1; } }

#instruction {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary);
}

/* ── PATTERN DISPLAY ── */
#pattern-display {
    padding: 20px;
    margin: 20px 0;
    background: var(--pattern-bg);
    border-radius: 20px;
    border: 3px var(--border-style) var(--accent);
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pattern-item {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.8rem;
    background: var(--bg);
    width: 75px;
    height: 75px;
    border-radius: 18px;
    box-shadow: 0 5px 0 rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}

.pattern-item.appear { animation: item-pop 0.4s forwards; opacity: 0; }

.question-mark { color: var(--secondary); background: var(--card); border: 3px solid var(--secondary); font-size: 2.2rem; font-weight: 900; }

@keyframes item-pop { 
    0% { transform: scale(0); opacity: 0; } 
    100% { transform: scale(1); opacity: 1; } 
}

/* ── CHOICES ── */
#choices-container {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.choice-button {
    background: var(--accent);
    color: var(--btn-text);
    border: none;
    border-radius: 20px;
    font-size: 3.5rem;
    cursor: pointer;
    padding: 15px 25px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 0 rgba(0,0,0,0.15);
    line-height: 1;
}

.choice-button:hover:not(:disabled) { transform: translateY(-5px); box-shadow: 0 12px 0 rgba(0,0,0,0.15); }
.choice-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 4px 0 rgba(0,0,0,0.15); }

.choice-button.correct { background: var(--primary) !important; transform: scale(1.15); }
.choice-button.wrong { background: var(--error) !important; animation: shake 0.4s; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-12px); } 75% { transform: translateX(12px); } }

/* ── FEEDBACK ── */
#feedback-message { min-height: 50px; font-family: 'Baloo 2', sans-serif; font-size: 1.6rem; margin-top: 20px; font-weight: 800; }

/* ── COMBO BADGE ── */
#combo-badge {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: var(--secondary);
    color: #fff;
    padding: 8px 22px;
    border-radius: 99px;
    font-size: 1.3rem;
    font-weight: 900;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    border: 3px solid #fff;
}

#combo-badge.active { transform: translateX(-50%) scale(1); }

/* ── OVERLAYS ── */
#end-screen, 
#game-over-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card);
    border-radius: 28px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.restart-btn {
    margin-top: 25px;
    padding: 12px 30px;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Baloo 2', sans-serif;
    background: var(--primary);
    color: var(--btn-text);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(0,0,0,0.15);
    transition: all 0.2s;
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 rgba(0,0,0,0.15);
}

.restart-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}

/* ── FOOTER ── */
#game-footer {
    margin-top: auto;
    opacity: 0.6;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    padding: 20px 0;
}

/* ── CONFETTI CANVAS ── */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* --- MOBILE PASS ── */
@media (max-width: 600px) {
    body { padding: 0 12px 60px; }
    
    #top-nav { padding: 15px 0 5px; }
    
    #progress-row { 
        padding: 10px 15px; 
        margin-bottom: 15px;
        width: 100%; 
    }
    
    #progress-wrapper { gap: 10px; }
    #progress-label { font-size: 0.75rem; letter-spacing: 1px; }
    #progress-container { height: 14px; }

    #game-container { 
        padding: 20px 12px; 
        width: 100%; 
        border-radius: 24px; 
    }
    
    #stats { font-size: 0.9rem; margin-bottom: 15px; }
    #lives-container { font-size: 1.15rem; }
}
