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

:root {
    --primary-color: #6B46C1;
    --secondary-color: #9333EA;
    --background: #0F172A;
    --surface: #1E293B;
    --surface-light: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --accent: #F59E0B;
    --success: #10B981;
    --hover: #7C3AED;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: var(--surface);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

select, input[type="range"] {
    background: var(--surface-light);
    border: 1px solid var(--surface-light);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

select:hover, input[type="range"]:hover {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

input[type="range"] {
    padding: 5px;
}

#tempo-value {
    color: var(--accent);
    font-weight: 600;
    margin-left: 10px;
}

.generate-btn {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(107, 70, 193, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 70, 193, 0.4);
}

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

.progression-display {
    background: var(--background);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    display: none;
}

.progression-display.active {
    display: block;
}

.progression-display h2 {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.chord-sequence {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.chord-box {
    background: var(--surface);
    border: 2px solid var(--surface-light);
    border-radius: 12px;
    padding: 20px 30px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chord-box.playing {
    border-color: var(--accent);
    background: var(--surface-light);
    transform: scale(1.05);
}

.chord-box.playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.2), transparent);
    animation: pulse 1s ease-out;
}

@keyframes pulse {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.chord-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.chord-number {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.playback-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.play-btn, .stop-btn, .export-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--surface-light);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover:not(:disabled), 
.stop-btn:hover:not(:disabled), 
.export-btn:hover:not(:disabled) {
    background: var(--surface-light);
    border-color: var(--primary-color);
}

.play-btn:disabled, 
.stop-btn:disabled, 
.export-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.theory-info {
    background: var(--background);
    border-radius: 12px;
    padding: 25px;
}

.theory-info h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.theory-explanation {
    color: var(--text-secondary);
    line-height: 1.6;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .chord-box {
        padding: 15px 20px;
    }
    
    .chord-name {
        font-size: 1.4rem;
    }
}