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

body {
    font-family: 'Quicksand', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #ffeef8 0%, #ffe8f5 25%, #ffd6eb 50%, #ffc9e6 75%, #ffb8e0 100%);
    position: relative;
}

/* ============================================
   BACKGROUND PARTICLES
   ============================================ */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Generate floating particles */
#particles::before,
#particles::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: float 8s infinite ease-in-out;
}

#particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

#particles::after {
    top: 60%;
    left: 80%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-30px) translateX(20px);
        opacity: 0.8;
    }
}

/* ============================================
   SCREEN MANAGEMENT
   ============================================ */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(255, 105, 180, 0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: cardEnter 0.6s ease;
    position: relative;
}

@keyframes cardEnter {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #d63384;
    margin-bottom: 16px;
    line-height: 1.3;
}

.subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 32px;
    font-weight: 500;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    outline: none;
}

.btn:focus {
    box-shadow: 0 0 0 4px rgba(214, 51, 132, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6eb4 0%, #ff9aca 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 110, 180, 0.4);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #a882dd 0%, #c9a8ed 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 130, 221, 0.4);
}

/* ============================================
   GAME SCREEN
   ============================================ */
#game-screen {
    display: block;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 20px 32px;
    z-index: 10;
    pointer-events: none;
}

.score-display,
.timer-display {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    color: #d63384;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.2);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.commentary {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 32px;
    border-radius: 50px;
    font-weight: 600;
    color: #d63384;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.commentary.show {
    opacity: 1;
}

/* ============================================
   WIN SCREEN
   ============================================ */
.win-card {
    max-width: 600px;
}

.win-title {
    font-size: 2rem;
    font-weight: 700;
    color: #d63384;
    margin-bottom: 16px;
}

.win-message {
    font-size: 1.3rem;
    color: #495057;
    margin-bottom: 32px;
    font-weight: 600;
}

.input-container {
    margin-bottom: 24px;
}

.valentine-input {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-family: 'Quicksand', sans-serif;
    border: 2px solid #ffb8e0;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    color: #d63384;
}

.valentine-input:focus {
    border-color: #ff6eb4;
    box-shadow: 0 0 0 4px rgba(255, 110, 180, 0.2);
}

/* ============================================
   SUCCESS SCREEN
   ============================================ */
.success-card {
    z-index: 20;
    position: relative;
}

.success-title {
    font-size: 3rem;
    font-weight: 700;
    color: #d63384;
    margin-bottom: 16px;
}

.success-message {
    font-size: 1.3rem;
    color: #495057;
    margin-bottom: 32px;
    font-weight: 600;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .title {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 14px 36px;
        font-size: 1rem;
    }

    .hud {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .timer-display {
        align-self: flex-end;
    }

    .score-display,
    .timer-display {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .commentary {
        bottom: 32px;
        font-size: 0.85rem;
        padding: 10px 24px;
    }

    .win-title {
        font-size: 1.6rem;
    }

    .win-message {
        font-size: 1.1rem;
    }

    .success-title {
        font-size: 2.2rem;
    }

    .success-message {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    .btn {
        padding: 12px 32px;
        font-size: 0.95rem;
    }

    .win-title {
        font-size: 1.4rem;
    }

    .win-message {
        font-size: 1rem;
    }

    .valentine-input {
        font-size: 1rem;
        padding: 14px 20px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #d63384;
    outline-offset: 2px;
}
