* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f0f23;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* Abstract gradient background shapes */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(72, 198, 239, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 77, 166, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 60% 20%, rgba(255, 200, 124, 0.3) 0%, transparent 50%);
    animation: gradientShift 20s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(5%, -5%) rotate(120deg);
    }
    66% {
        transform: translate(-5%, 5%) rotate(240deg);
    }
}

.container {
    max-width: 600px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.37),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

header {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 40px 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #ffffff;
    text-shadow:
        0 0 20px rgba(120, 119, 198, 0.8),
        0 0 40px rgba(120, 119, 198, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.7;
    color: rgba(255, 255, 255, 0.8);
}

main {
    padding: 40px 30px;
}

.bpm-display {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.bpm-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.1) 0%, rgba(72, 198, 239, 0.1) 100%);
    z-index: -1;
}

.bpm-value {
    font-size: 6rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 0 40px rgba(120, 119, 198, 0.5);
    letter-spacing: -2px;
}

.bpm-label {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.tap-area {
    margin-bottom: 40px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.tap-button {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 70px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.tap-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.1) 0%, rgba(72, 198, 239, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tap-button:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow:
        0 12px 40px 0 rgba(31, 38, 135, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.tap-button:hover::before {
    opacity: 1;
}

.tap-button:active,
.tap-button.active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.12);
}

.tap-text {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
    letter-spacing: 8px;
    text-shadow:
        0 0 30px rgba(120, 119, 198, 0.9),
        0 0 60px rgba(120, 119, 198, 0.6),
        0 4px 8px rgba(0, 0, 0, 0.4);
}

.tap-hint {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.controls {
    margin-bottom: 30px;
    text-align: center;
}

.reset-btn {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 16px 45px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px 0 rgba(31, 38, 135, 0.2);
    letter-spacing: 1px;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(31, 38, 135, 0.3);
}

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

footer {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation for tap feedback */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive design */
@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    main {
        padding: 30px 20px;
    }

    .bpm-display {
        padding: 30px 20px;
        margin-bottom: 30px;
    }

    .bpm-value {
        font-size: 4.5rem;
    }

    .tap-button {
        padding: 50px 30px;
    }

    .tap-text {
        font-size: 2.5rem;
        letter-spacing: 6px;
    }

    .tap-hint {
        font-size: 0.8rem;
    }
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
    .tap-button {
        padding: 70px 40px;
    }

    .tap-text {
        font-size: 3rem;
    }
}
