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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    font-weight: 500;
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    outline: none;
}

input[type="text"]:focus {
    border-color: #007aff;
}

button {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#analyze-btn {
    background: #007aff;
    color: #fff;
}

#analyze-btn:hover {
    background: #0066d6;
}

#analyze-btn:disabled {
    opacity: 0.5;
}

.hidden { display: none !important; }

.loading {
    text-align: center;
    padding: 30px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top-color: #007aff;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
    background: #ff3b30;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.result {
    margin-top: 10px;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.video-container {
    flex: 1;
    position: relative;
    padding-bottom: 42%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    min-height: 280px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.side-panel {
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.bpm-display {
    text-align: center;
}

#bpm-value {
    font-size: 3.5rem;
    font-weight: 600;
    color: #007aff;
    line-height: 1;
    display: block;
}

.bpm-label {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.beat-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #007aff;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
    transition: transform 0.05s ease-out;
}

.beat-indicator.pulse {
    transform: scale(1.4);
    box-shadow: 0 4px 25px rgba(0, 122, 255, 0.5);
}

.tempo-cat {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}

#song-title {
    font-size: 0.9rem;
    color: #999;
    margin-top: 15px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

@media (max-width: 600px) {
    .main-content {
        flex-direction: column;
    }
    .video-container {
        padding-bottom: 56.25%;
    }
    .side-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }
}
