/* GW_JUICE v2 — Game Juice Visual Effects */

/* ── Accessibility: prefers-reduced-motion + no-JS reveal fallback ── */
/* Per WEB-PAGE-STANDARDS B2 + feedback_custom_html_ios_checklist.md.       */
/* If user prefers reduced motion OR JS hasn't yet applied IntersectionObserver, */
/* reveal-classed elements must remain visible — never trapped at opacity:0.   */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .fade-in,
    .scroll-reveal,
    .gw-shake-light,
    .gw-shake-medium,
    .gw-shake-heavy {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
}

/* ── Screen Shake ── */
@keyframes gw-shake-light {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
}
@keyframes gw-shake-medium {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-4px, 2px); }
    30% { transform: translate(4px, -3px); }
    50% { transform: translate(-2px, 3px); }
    70% { transform: translate(3px, -4px); }
    90% { transform: translate(-1px, 1px); }
}
@keyframes gw-shake-heavy {
    0%, 100% { transform: translate(0) rotate(0); }
    10% { transform: translate(-6px, 3px) rotate(-0.5deg); }
    30% { transform: translate(6px, -5px) rotate(0.5deg); }
    50% { transform: translate(-4px, 4px) rotate(-0.3deg); }
    70% { transform: translate(5px, -3px) rotate(0.4deg); }
    90% { transform: translate(-2px, 2px) rotate(-0.1deg); }
}
.gw-shake-light { animation: gw-shake-light 150ms ease-out; }
.gw-shake-medium { animation: gw-shake-medium 300ms ease-out; }
.gw-shake-heavy { animation: gw-shake-heavy 500ms ease-out; }

/* ── Score Popup ── */
.gw-score-popup {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    transition: none;
    white-space: nowrap;
}
.gw-popup-fly {
    opacity: 0;
    transform: translate(-50%, -60px) scale(1.3);
    transition: all 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Combo Banner ── */
.gw-combo-banner {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translate(-50%, 20px) scale(0.8);
    z-index: 10001;
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #FF9800;
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.5), 0 2px 8px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gw-combo-show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.gw-combo-fire {
    font-size: 36px;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 68, 68, 0.6), 0 0 60px rgba(255, 152, 0, 0.3);
    animation: gw-combo-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes gw-combo-pulse {
    from { transform: translate(-50%, 0) scale(1); }
    to { transform: translate(-50%, 0) scale(1.08); }
}

/* ── Miss Flash ── */
.gw-miss-flash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 0, 0, 0.15);
    pointer-events: none;
    animation: gw-flash-out 400ms ease-out forwards;
}
@keyframes gw-flash-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ══════════════════════════════════════════
   CONFETTI CANNON
   ══════════════════════════════════════════ */
.gw-confetti-container {
    position: fixed;
    inset: 0;
    z-index: 10003;
    pointer-events: none;
    overflow: hidden;
}
.gw-confetti {
    position: absolute;
    top: -20px;
    opacity: 0;
    animation: gw-confetti-fall linear forwards;
}
@keyframes gw-confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    25% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* ══════════════════════════════════════════
   TIMER VIGNETTE
   ══════════════════════════════════════════ */
.gw-timer-vignette {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: inset 0 0 80px 30px rgba(255, 0, 0, 0.4);
}
.gw-vignette-critical {
    animation: gw-vignette-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes gw-vignette-pulse {
    from { box-shadow: inset 0 0 80px 30px rgba(255, 0, 0, 0.3); }
    to { box-shadow: inset 0 0 120px 50px rgba(255, 0, 0, 0.6); }
}

/* ══════════════════════════════════════════
   PERFECT ROUND
   ══════════════════════════════════════════ */
.gw-perfect-flash {
    position: fixed;
    inset: 0;
    z-index: 10002;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 70%);
    animation: gw-gold-flash 800ms ease-out forwards;
}
@keyframes gw-gold-flash {
    0% { opacity: 1; transform: scale(0.8); }
    50% { opacity: 0.8; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1.5); }
}
.gw-perfect-banner {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translate(-50%, 30px) scale(0.5);
    z-index: 10003;
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 48px;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 152, 0, 0.4), 0 4px 12px rgba(0,0,0,0.5);
    letter-spacing: 6px;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gw-perfect-show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

/* ══════════════════════════════════════════
   ACHIEVEMENT BADGES
   ══════════════════════════════════════════ */
.gw-achievement {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 10004;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0a1628 100%);
    border: 2px solid #FFD700;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.25), 0 0 40px rgba(255, 215, 0, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gw-ach-show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.gw-ach-icon {
    font-size: 28px;
    line-height: 1;
}
.gw-ach-label {
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #FFD700;
}
.gw-ach-title {
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 2px;
}

/* ══════════════════════════════════════════
   SCORE ODOMETER
   ══════════════════════════════════════════ */
.gw-odo-rolling {
    animation: gw-odo-jitter 80ms linear infinite;
}
@keyframes gw-odo-jitter {
    0% { transform: translateY(0); }
    25% { transform: translateY(-1px); }
    50% { transform: translateY(1px); }
    75% { transform: translateY(-0.5px); }
    100% { transform: translateY(0); }
}
.gw-odo-landed {
    animation: gw-odo-land 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes gw-odo-land {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); color: #FFD700; }
    100% { transform: scale(1); }
}

/* ── New Record Banner ── */
.gw-new-record {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, 30px) scale(0.7);
    z-index: 10002;
    background: linear-gradient(135deg, #1e3a5f 0%, #0a1628 100%);
    border: 2px solid #FF9800;
    border-radius: 16px;
    padding: 24px 40px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 32px rgba(255, 152, 0, 0.3), 0 0 60px rgba(255, 152, 0, 0.15);
}
.gw-record-show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.gw-record-label {
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 14px; font-weight: 800; letter-spacing: 3px;
    text-transform: uppercase; color: #FF9800; margin-bottom: 8px;
}
.gw-record-score {
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 48px; font-weight: 800; color: #ffffff; line-height: 1;
}
.gw-record-prev { font-size: 14px; color: rgba(255,255,255,0.5); margin-top: 6px; }

/* ── Play Again Button ── */
.gw-play-again {
    display: block;
    width: 100%; max-width: 320px;
    margin: 20px auto;
    padding: 16px 32px;
    background: linear-gradient(135deg, #FF9800, #f08c00);
    color: #ffffff;
    border: none; border-radius: 12px;
    font-family: 'Manrope', -apple-system, sans-serif;
    font-size: 17px; font-weight: 800;
    letter-spacing: 1px; text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
}
.gw-play-again:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 152, 0, 0.4);
}

/* ── Multiplier Badge ── */
.gw-mult-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #FF9800; color: #0a1628;
    border-radius: 6px; font-size: 12px; font-weight: 800;
    margin-left: 6px;
    animation: gw-mult-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes gw-mult-pop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .gw-combo-banner { font-size: 22px; }
    .gw-combo-fire { font-size: 28px; }
    .gw-perfect-banner { font-size: 36px; letter-spacing: 4px; }
    .gw-achievement { padding: 12px 16px; gap: 10px; }
    .gw-ach-title { font-size: 13px; }
    .gw-new-record { padding: 20px 28px; }
    .gw-record-score { font-size: 36px; }
}
