/* === BPM Tap Tempo Tool === */
.bt-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, sans-serif
}

.bt-hero {
    text-align: center;
    padding: 24px 16px 0
}

.bt-bpm-display {
    font-size: 80px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    color: #6d28d9;
    transition: transform .08s;
    margin-bottom: 4px
}

.bt-bpm-display.bt-pulse {
    transform: scale(1.06)
}

.bt-bpm-unit {
    font-size: 18px;
    font-weight: 700;
    color: #4b5563;
    letter-spacing: 2px
}

.bt-tempo-marking {
    font-size: 18px;
    font-style: italic;
    color: #7c3aed;
    margin-top: 4px;
    min-height: 24px;
    font-weight: 600
}

.bt-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0
}

.bt-ctrl-btn {
    background: #f3f0ff;
    border: 2px solid #7c3aed;
    color: #6d28d9;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s
}

.bt-ctrl-btn:hover {
    background: #7c3aed;
    color: #fff
}

.bt-ctrl-btn:active {
    transform: scale(.95)
}

/* Tap pad */
.bt-tap-pad {
    position: relative;
    background: linear-gradient(135deg, #4c1d95, #6d28d9);
    border: 3px solid #7c3aed;
    border-radius: 16px;
    padding: 40px 20px;
    margin: 16px;
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: 0 4px 20px rgba(109, 40, 217, .2)
}

.bt-tap-pad:hover {
    box-shadow: 0 6px 30px rgba(109, 40, 217, .3)
}

.bt-tap-pad:active,
.bt-tap-pad.bt-tapped {
    border-color: #a78bfa;
    box-shadow: 0 0 40px rgba(109, 40, 217, .35);
    background: linear-gradient(135deg, #5b21b6, #7c3aed)
}

.bt-tap-label {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    pointer-events: none
}

.bt-tap-sub {
    font-size: 13px;
    color: #e0d4fc;
    margin-top: 6px;
    pointer-events: none
}

.bt-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
    transform: scale(0);
    animation: bt-ripple-anim .5s ease-out forwards;
    pointer-events: none
}

@keyframes bt-ripple-anim {
    to {
        transform: scale(3);
        opacity: 0
    }
}

/* Stats bar */
.bt-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px 16px;
    font-size: 14px;
    color: #4b5563;
    flex-wrap: wrap
}

.bt-stats span {
    white-space: nowrap
}

.bt-stats strong {
    color: #1f2937;
    font-weight: 700
}

/* Tabs */
.bt-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin: 16px 16px 0;
    gap: 0
}

.bt-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s
}

.bt-tab.active {
    color: #6d28d9;
    border-bottom-color: #6d28d9
}

.bt-tab:hover:not(.active) {
    color: #4b5563
}

.bt-tab-panel {
    display: none;
    padding: 16px
}

.bt-tab-panel.active {
    display: block
}

/* BPM graph */
.bt-graph-wrap {
    background: #f8f6ff;
    border: 1px solid #e5e0f5;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px
}

.bt-graph-canvas {
    width: 100%;
    height: 120px;
    display: block
}

.bt-graph-label {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    margin-top: 4px;
    font-weight: 600
}

/* Interval bars */
.bt-interval-wrap {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 60px;
    padding: 0 4px
}

.bt-interval-bar {
    flex: 1;
    background: linear-gradient(to top, #7c3aed, #10b981);
    border-radius: 3px 3px 0 0;
    min-width: 6px;
    transition: height .15s
}

/* Delay table */
.bt-delay-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px
}

.bt-delay-table th {
    text-align: left;
    padding: 8px 10px;
    color: #6b7280;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
    font-size: 13px
}

.bt-delay-table td {
    padding: 8px 10px;
    color: #1f2937;
    border-bottom: 1px solid #f0f0f0
}

.bt-delay-table tr:hover td {
    background: #f8f6ff
}

.bt-delay-note {
    color: #6d28d9;
    font-weight: 700
}

.bt-delay-ms {
    font-family: 'SF Mono', Consolas, monospace;
    color: #059669;
    font-weight: 700;
    font-size: 15px
}

.bt-copy-btn {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #059669;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s
}

.bt-copy-btn:hover {
    background: #10b981;
    color: #fff
}

.bt-copy-btn.bt-copied {
    background: #059669;
    color: #fff
}

/* Metronome */
.bt-metro-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px
}

.bt-metro-bpm-input {
    width: 80px;
    background: #fff;
    border: 2px solid #7c3aed;
    color: #1f2937;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    padding: 8px;
    border-radius: 8px
}

.bt-metro-bpm-input:focus {
    outline: none;
    border-color: #6d28d9;
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .15)
}

.bt-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    box-shadow: 0 4px 15px rgba(109, 40, 217, .3)
}

.bt-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(109, 40, 217, .4)
}

.bt-play-btn:active {
    transform: scale(.95)
}

.bt-play-btn.bt-playing {
    background: linear-gradient(135deg, #ef4444, #dc2626)
}

.bt-select {
    background: #fff;
    border: 2px solid #d1d5db;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer
}

.bt-select:focus {
    outline: none;
    border-color: #7c3aed
}

/* Beat indicators */
.bt-beat-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px
}

.bt-beat-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3e8ff;
    border: 3px solid #c4b5fd;
    transition: all .08s
}

.bt-beat-dot.bt-accent {
    border-color: #f87171
}

.bt-beat-dot.bt-active {
    background: #7c3aed;
    box-shadow: 0 0 15px rgba(124, 58, 237, .5);
    border-color: #7c3aed
}

.bt-beat-dot.bt-active.bt-accent {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, .5);
    border-color: #ef4444
}

/* Volume */
.bt-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 14px;
    color: #4b5563
}

.bt-volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none
}

.bt-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(109, 40, 217, .3)
}

/* Accuracy */
.bt-accuracy-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 16px 0
}

.bt-accuracy-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
    border-radius: 4px;
    transition: width .3s
}

/* Hint */
.bt-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    text-align: center;
    font-weight: 500
}

/* Security banner */
.bt-security-banner {
    display: flex;
    gap: 16px;
    padding: 16px;
    margin: 16px;
    background: #f8f6ff;
    border-radius: 12px;
    border: 2px solid #e5e0f5;
    flex-wrap: wrap
}

.bt-security-item {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #4b5563
}

.bt-security-icon {
    font-size: 22px
}

.bt-security-item strong {
    color: #1f2937;
    display: block;
    font-size: 14px
}

.bt-security-item p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6b7280
}

/* Responsive */
@media(max-width:600px) {
    .bt-bpm-display {
        font-size: 60px
    }

    .bt-tap-pad {
        padding: 32px 16px;
        margin: 12px 8px
    }

    .bt-tap-label {
        font-size: 18px
    }

    .bt-stats {
        gap: 12px;
        font-size: 13px
    }

    .bt-tabs {
        margin: 12px 8px 0
    }

    .bt-tab {
        font-size: 12px;
        padding: 8px 4px
    }

    .bt-tab-panel {
        padding: 12px 8px
    }

    .bt-security-banner {
        flex-direction: column;
        gap: 10px;
        margin: 12px 8px
    }

    .bt-metro-controls {
        justify-content: center
    }
}