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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f1a;
    --bg-card: #12121f;
    --accent-primary: #7c3aed;
    --accent-secondary: #06b6d4;
    --accent-red: #ef233c;
    --accent-glow: rgba(124, 58, 237, 0.4);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --border-color: rgba(124, 58, 237, 0.25);
    --border-color2: rgba(6, 182, 212, 0.25);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Rajdhani', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(124,58,237,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(6,182,212,0.12) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

header {
    background: rgba(10,10,15,0.95);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 18px 20px 14px;
}

header h1 {
    font-family: 'Orbitron', monospace;
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
}

header p {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 3px;
}

.main-wrapper {
    flex: 1;
    position: relative;
    z-index: 1;
    padding: clamp(16px, 3vw, 32px);
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 36px);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.metronome-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Pendulum */
.pendulum-container {
    width: 140px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.pendulum-pivot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-secondary), #0080a0);
    box-shadow: 0 0 12px rgba(6,182,212,0.8);
    flex-shrink: 0;
    z-index: 2;
}

.pendulum-arm {
    width: 3px;
    height: 130px;
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transform-origin: top center;
    position: relative;
    margin-top: -2px;
    box-shadow: 0 0 6px rgba(124,58,237,0.4);
}

.pendulum-bob {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #a78bfa, var(--accent-primary));
    box-shadow:
        0 0 20px rgba(124,58,237,0.8),
        0 0 40px rgba(124,58,237,0.3);
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid rgba(255,255,255,0.2);
}

/* BPM Display */
.bpm-section { text-align: center; }

.bpm-display {
    font-family: 'Orbitron', monospace;
    font-size: clamp(56px, 14vw, 96px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -2px;
}

.bpm-label {
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    letter-spacing: 5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.tempo-name {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    letter-spacing: 3px;
    color: var(--accent-secondary);
    margin-top: 8px;
    min-height: 22px;
    transition: color 0.3s;
}

/* BPM Controls */
.bpm-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.bpm-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bpm-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(124,58,237,0.1);
    box-shadow: 0 0 10px rgba(124,58,237,0.2);
}

.bpm-btn:active { transform: scale(0.95); }

input[type="range"] {
    -webkit-appearance: none;
    width: 200px;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(124,58,237,0.7);
    border: 2px solid var(--accent-primary);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(124,58,237,0.7);
    border: 2px solid var(--accent-primary);
}

/* Beats per bar */
.beats-section { width: 100%; text-align: center; }

.beats-label {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--accent-secondary);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.beats-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.beat-select-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.beat-select-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.beat-select-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), #5b21b6);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(124,58,237,0.5);
}

/* Beat Visualizer */
.beat-visualizer {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 24px;
}

.beat-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.04s;
}

.beat-dot.active {
    background: var(--accent-primary);
    box-shadow: 0 0 14px rgba(124,58,237,0.9);
    transform: scale(1.4);
    border-color: var(--accent-primary);
}

.beat-dot.accent { border-color: var(--accent-secondary); }

.beat-dot.accent.active {
    background: var(--accent-secondary);
    box-shadow: 0 0 14px rgba(6,182,212,0.9);
    border-color: var(--accent-secondary);
}

/* Buttons */
.metro-btn-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-start {
    padding: 14px 40px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-primary), #5b21b6);
    color: #fff;
    box-shadow: 0 0 20px rgba(124,58,237,0.4);
    transition: all 0.2s;
    min-width: 140px;
}

.btn-start:hover {
    box-shadow: 0 0 30px rgba(124,58,237,0.7);
    transform: translateY(-2px);
}

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

.btn-start.running {
    background: linear-gradient(135deg, var(--accent-red), #9b0020);
    box-shadow: 0 0 20px rgba(239,35,60,0.4);
}

.btn-start.running:hover {
    box-shadow: 0 0 30px rgba(239,35,60,0.7);
}

.btn-tap {
    padding: 14px 28px;
    border-radius: 12px;
    border: 1px solid var(--accent-secondary);
    background: rgba(6,182,212,0.1);
    color: var(--accent-secondary);
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 140px;
}

.btn-tap:hover {
    background: rgba(6,182,212,0.2);
    box-shadow: 0 0 15px rgba(6,182,212,0.3);
}

.btn-tap:active {
    background: rgba(6,182,212,0.35);
    transform: scale(0.97);
}

.divider {
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

/* Volume */
.volume-section {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.volume-label {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--accent-secondary);
    text-transform: uppercase;
    white-space: nowrap;
}

.volume-icon { font-size: 16px; color: var(--text-muted); }

/* Keyboard shortcuts hint */
.shortcuts-hint {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color2);
    border-radius: 10px;
    padding: 12px 16px;
    width: 100%;
}

.shortcuts-hint h4 {
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--accent-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.key-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 16px;
    position: relative;
    z-index: 1;
}

footer p {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

footer a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover { color: var(--accent-primary); }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-primary);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    font-family: 'Rajdhani', sans-serif;
}

.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
    .bpm-display { font-size: 72px; }
    input[type="range"] { width: 160px; }
    .shortcuts-grid { grid-template-columns: 1fr; }
}
