@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700;900&display=swap');

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    overflow: hidden; background: #000;
    font-family: 'Poppins', sans-serif;
    user-select: none; touch-action: none;
    -webkit-tap-highlight-color: transparent;
}
canvas { display: block; width: 100vw; height: 100vh; }

/* ============ FLASH & TOASTS ============ */
#flash-screen {
    position: absolute; inset: 0;
    background: white; opacity: 0;
    pointer-events: none; transition: opacity 0.3s; z-index: 50;
}
#mission-toast, #new-record-toast {
    position: absolute; top: -80px; left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px; border-radius: 30px;
    font-weight: 900; font-size: 16px;
    transition: top 0.4s cubic-bezier(.34,1.56,.64,1);
    z-index: 300; white-space: nowrap;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
#mission-toast  { background: #FFD700; color: #000; }
#new-record-toast { background: linear-gradient(90deg,#ff6b6b,#ffd93d); color:#000; top:-80px; }
#mission-toast.show, #new-record-toast.show { top: 20px; }

/* ============ COMBO DISPLAY ============ */
#combo-display {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 64px; font-weight: 900;
    color: #fff; text-shadow: 0 0 30px #ff6, 0 0 60px #f90;
    pointer-events: none; z-index: 100;
    opacity: 0; transition: opacity 0.3s;
}
#combo-display.pop {
    animation: comboPop 0.6s forwards;
}
@keyframes comboPop {
    0%   { opacity:1; transform: translate(-50%,-50%) scale(0.5); }
    40%  { opacity:1; transform: translate(-50%,-50%) scale(1.3); }
    100% { opacity:0; transform: translate(-50%,-80%) scale(1); }
}

/* ============ HUD ============ */
#ui-layer {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; display: none;
}
.hud-box {
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(10px);
    padding: 8px 14px; border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; gap: 6px;
    color: #fff; font-size: 18px; font-weight: 900;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
#score-container {
    position: absolute; top: 15px; left: 15px;
    display: flex; flex-direction: column; gap: 5px;
}
.high-score-text {
    color: #FFD700; font-size: 13px; font-weight: 900;
    background: rgba(0,0,0,0.6); padding: 3px 10px;
    border-radius: 10px; text-transform: uppercase;
}
#coin-board {
    position: absolute; top: 15px; right: 65px;
    color: #FFD700;
}
#multiplier-hud {
    position: absolute; top: 55px; right: 65px;
    color: #ff6; font-size: 16px;
}
#active-powerups {
    position: absolute; top: 90px; left: 15px;
    display: flex; gap: 8px; font-size: 22px;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.9));
}
.pwr-icon { display: none; animation: pulse 1s infinite; }

#pause-btn {
    position: absolute; top: 15px; right: 15px;
    background: rgba(0,0,0,0.6); color: white;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50%; width: 46px; height: 46px;
    font-size: 14px; pointer-events: auto; cursor: pointer;
    z-index: 100; font-weight: bold; transition: transform 0.15s, background 0.15s;
}
#pause-btn:active { transform: scale(0.88); background: rgba(255,255,255,0.2); }

/* ============ OVERLAYS ============ */
.overlay-screen {
    position: absolute; inset: 0;
    background: rgba(8, 8, 20, 0.88);
    backdrop-filter: blur(10px);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    color: white; z-index: 200; pointer-events: auto;
}
.title-wrapper h1 {
    color: #ff3366;
    font-size: clamp(42px, 12vw, 72px);
    font-weight: 900; text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255,51,102,0.8), 0 4px 0 rgba(0,0,0,0.5);
    text-align: center; line-height: 1;
    margin-bottom: 20px; letter-spacing: -1px;
}
.title-wrapper h1 span { color: #FFD700; }
.overlay-screen > h1 {
    font-size: 42px; font-weight: 900;
    text-transform: uppercase; text-align: center;
    line-height: 1.1; margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255,51,102,0.8);
    color: #ff3366;
}

/* ============ BUTTONS ============ */
.btn {
    padding: 14px 28px;
    font-size: 17px; font-weight: 900;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #00C9FF, #92FE9D);
    color: #000; border: none; border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,201,255,0.4);
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.15s;
    margin-top: 12px; width: 80%; max-width: 260px;
    letter-spacing: 0.5px;
}
.btn:active { transform: scale(0.94); box-shadow: none; }
.btn-play {
    background: linear-gradient(135deg, #ff3366, #ff6b35);
    box-shadow: 0 8px 30px rgba(255,51,102,0.5);
    font-size: 20px; padding: 16px 32px;
}
.btn-shop {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 8px 20px rgba(255,215,0,0.5);
}
.btn-blue {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 8px 20px rgba(0,201,255,0.5);
}
.btn-back {
    background: rgba(255,255,255,0.12); color: white;
    box-shadow: none; border: 1px solid rgba(255,255,255,0.3);
    margin-top: 24px;
}
.btn-row {
    display: flex; gap: 12px; margin-top: 4px;
}
.btn-row .btn { width: auto; flex: 1; max-width: 150px; }

/* ============ MISC UI ============ */
.controls-hint {
    text-align: center;
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    background: rgba(0,0,0,0.62);
    padding: 18px 28px;
    border-radius: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(255,255,255,0.13);
    line-height: 2.1;
    width: 90vw;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.mission-bar {
    color: #FFD700; font-weight: 900; font-size: 14px;
    background: rgba(255,215,0,0.12); padding: 8px 18px;
    border-radius: 20px; margin-bottom: 12px;
    border: 1px solid rgba(255,215,0,0.3);
}
.high-score-banner {
    margin-top: 16px; color: #aaa; font-size: 14px; font-weight: 700;
}
.shop-coins-bar {
    color: #fff; font-size: 18px; font-weight: 700;
    margin-bottom: 14px;
}

/* ============ STATS BOX ============ */
.stats-box {
    background: rgba(0,0,0,0.55); padding: 20px 24px;
    border-radius: 18px; width: 82%; max-width: 310px;
    margin-top: 16px; border: 1px solid rgba(255,255,255,0.1);
}
.stats {
    font-size: 14px; margin: 10px 0; color: #888;
    display: flex; justify-content: space-between; align-items: center;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.stats span { color: #fff; font-size: 22px; font-weight: 900; }

/* ============ SHOP ============ */
.skin-container { display: flex; gap: 16px; margin-top: 8px; margin-bottom: 8px; }
.skin-card {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
}
.skin-label { color: #fff; font-size: 13px; font-weight: 900; }
.skin-sub { color: #888; font-size: 11px; text-align: center; }
.skin-btn {
    width: 74px; height: 74px; border-radius: 18px;
    border: 3px solid transparent; cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    font-size: 32px; display: flex; align-items: center; justify-content: center;
    outline: none;
}
.skin-btn:active { transform: scale(0.9); }
.skin-active {
    border-color: #00C9FF !important;
    box-shadow: 0 0 20px #00C9FF, 0 0 40px rgba(0,201,255,0.4);
    transform: scale(1.08);
}

/* ============ LEADERBOARD ============ */
.rank-row {
    display: flex; justify-content: space-between; align-items: center;
    margin: 8px 0; padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 16px;
}
.rank-row:last-child { border: none; }
.rank-medal { font-size: 20px; }

/* ============ ANIMATIONS ============ */
@keyframes pulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}
@keyframes slideIn {
    from { opacity:0; transform: translateY(30px); }
    to   { opacity:1; transform: translateY(0); }
}
.overlay-screen > * { animation: slideIn 0.4s ease both; }
.overlay-screen > *:nth-child(2) { animation-delay: 0.05s; }
.overlay-screen > *:nth-child(3) { animation-delay: 0.10s; }
.overlay-screen > *:nth-child(4) { animation-delay: 0.15s; }
.overlay-screen > *:nth-child(5) { animation-delay: 0.20s; }