/* ==================== Reset & Variables ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    margin: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: relative;
    font-family: 'Poppins', sans-serif;
}

/* ==================== Header ==================== */
.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.game-title i {
    color: #667eea;
    font-size: 1.8rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    font-family: 'Poppins', sans-serif;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.header-btn i {
    font-size: 1rem;
}

/* ==================== Game Container ==================== */
#container {
    width: 100%;
    height: 100%;
    padding-top: 70px;
}

#game {
    position: absolute;
    top: 70px;
    right: 0;
    bottom: 0;
    left: 0;
}

/* ==================== Score Display ==================== */
#score-container {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-200px);
    text-align: center;
    transition: transform 0.5s ease;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.score-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.score-label i {
    color: #667eea;
}

#score {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 800;
    color: #667eea;
    line-height: 1;
    margin: 0.5rem 0;
}

#high-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

#high-score-display i {
    color: #fbbf24;
}

#high-score {
    font-weight: 700;
    color: var(--text-primary);
}

/* ==================== Instructions ==================== */
#instructions {
    position: absolute;
    width: 100%;
    top: 280px;
    left: 0;
    text-align: center;
    transition: opacity 0.5s ease;
    opacity: 0;
    z-index: 40;
}

.instruction-content {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.instruction-content i {
    color: #667eea;
    font-size: 1.5rem;
}

#instructions.hide {
    opacity: 0 !important;
}

/* ==================== Game Over Screen ==================== */
.game-over {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 60;
}

.game-over-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 500px;
}

.game-over-content * {
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 0;
    transform: translateY(-30px);
}

.game-over-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: var(--secondary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-over-icon i {
    font-size: 3rem;
    color: white;
}

.game-over h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.final-score-text {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.final-score-text span {
    font-weight: 700;
    color: #667eea;
    font-size: 1.5rem;
}

.encouragement {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.restart-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
/* Made with love by SinceraXY */
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    font-family: 'Poppins', sans-serif;
}

.restart-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ==================== Game Ready Screen ==================== */
.game-ready {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 60;
}

.ready-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 500px;
}

.ready-content * {
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 0;
    transform: translateY(-30px);
}

.game-logo {
    margin-bottom: 1.5rem;
}

.game-logo i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.game-logo h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: var(--text-primary);
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

#start-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.2rem 3rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    font-family: 'Poppins', sans-serif;
    margin-bottom: 2rem;
}

#start-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.quick-tips {
    background: rgba(102, 126, 234, 0.1);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: left;
}

.quick-tips h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.quick-tips h3 i {
    color: #fbbf24;
}

.quick-tips ul {
    list-style: none;
    padding: 0;
}

.quick-tips li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.quick-tips li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: 700;
}

/* ==================== Rules Sidebar ==================== */
.rules {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100vh;
    background: rgba(26, 32, 44, 0.98);
    backdrop-filter: blur(20px);
    color: white;
    padding: 2rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.rules.show {
    transform: translateX(0);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
/* QQ: 2952671670 */
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.rules-content h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.rule-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.rule-item > i {
    font-size: 2rem;
    color: #4facfe;
    flex-shrink: 0;
}

.rule-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #4facfe;
}

.rule-item p {
    font-size: 0.95rem;
    opacity: 0.9;

/* Developer: SinceraXY from CUPB */

    line-height: 1.6;
    margin: 0.3rem 0;
}

/* ==================== State Classes ==================== */
#container.playing #score-container,
#container.resetting #score-container {
    transform: translateX(-50%) translateY(0);
}

#container.playing #instructions {
    opacity: 1;
}

#container.playing .game-ready,
#container.resetting .game-ready {
    display: none;
}

#container.playing .game-over,
#container.resetting .game-over {
    display: none;
}

#container.ready .game-ready {
    pointer-events: all;
}

#container.ready .ready-content * {
    opacity: 1;
    transform: translateY(0);
}

#container.ready .game-over {
    display: none;
}

#container.ended #score-container {
    transform: translateX(-50%) translateY(0) scale(0.8);
}

#container.ended .game-over {
    pointer-events: all;
}

#container.ended .game-ready {
    display: none;
}

#container.ended .game-over-content * {
    opacity: 1;
    transform: translateY(0);
}

#container.ended .game-over-content .encouragement,
#container.ended .game-over-content .restart-btn {
    transition-delay: 0.3s;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .game-header {
        padding: 0.8rem 1rem;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .header-btn span {
        display: none;
    }
    
    #score-container {
        padding: 1rem 1.5rem;
    }
    
    #score {
        font-size: 3rem;
    }
    
    .instruction-content {
        font-size: 0.9rem;
        padding: 0.8rem 1.5rem;
    }
    
    .game-over-content,
    .ready-content {
        margin: 1rem;
        padding: 2rem;
    }
    
    .rules {
        width: 100%;
    }
}
