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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

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

h1 {
    color: white;
    font-size: 2.8rem;
    margin-bottom: 25px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4), 0 0 20px rgba(255,255,255,0.2);
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    border-radius: 2px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

.tab-content {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.tab-content.active {
    display: block;
}

h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
}

.type-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.type-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.type-btn:hover,
.type-btn.active {
    background: #667eea;
    color: white;
}

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

.chord-btn {
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #f0f0f0, #cacaca);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 3px 3px 6px #bebebe, -3px -3px 6px #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    user-select: none;
    -webkit-user-select: none;
}

.chord-symbol {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.chord-chinese {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.chord-btn:hover {
    transform: translateY(-2px);
    box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
}

.chord-btn.selected {
    background: linear-gradient(145deg, #667eea, #764ba2);
}

.chord-btn.selected .chord-symbol {
    color: white;
}

.chord-btn.selected .chord-chinese {
    color: rgba(255, 255, 255, 0.9);
}

.piano-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.piano {
    display: flex;
    position: relative;
    user-select: none;
    height: 120px;
}

.key {
    position: relative;
    cursor: pointer;
    border: 1px solid #ccc;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.1s ease;
}

.white-key {
    width: 40px;
    height: 120px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 100%);
    border-radius: 0 0 5px 5px;
}

.white-key:hover {
    background: linear-gradient(to bottom, #f0f0f0 0%, #e0e0e0 100%);
}

.white-key.active {
    background: linear-gradient(to bottom, #667eea 0%, #764ba2 100%);
    color: white;
}

.black-key {
    width: 28px;
    height: 80px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    color: white;
    border-radius: 0 0 3px 3px;
    position: absolute;
    z-index: 2;
    top: 0;
    border: 1px solid #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.black-key:hover {
    background: linear-gradient(to bottom, #555 0%, #222 100%);
}

.black-key.active {
    background: linear-gradient(to bottom, #667eea 0%, #764ba2 100%);
}

.playback-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.playback-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.playback-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.playback-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.challenge-setup {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.challenge-setup .difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.challenge-setup label {
    font-weight: 600;
    color: #4a5568;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.challenge-setup select {
    padding: 12px 20px;
    border: 2px solid #667eea;
    border-radius: 12px;
    font-size: 1rem;
    background: linear-gradient(145deg, #ffffff, #f8f9ff);
    color: #4a5568;
    min-width: 160px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.challenge-setup select:hover {
    border-color: #5a67d8;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

.challenge-setup select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.challenge-setup .start-button-container {
    text-align: center;
}

.challenge-setup button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.challenge-setup button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.challenge-area {
    text-align: center;
}

.challenge-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.challenge-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.challenge-controls button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.challenge-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

.challenge-options {
    display: none;
}

.option-btn {
    padding: 15px;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    color: #667eea;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.option-btn:hover {
    background: #f8f9ff;
}

.option-btn.selected {
    background: #667eea;
    color: white;
}

.result {
    text-align: center;
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    min-height: 30px;
    line-height: 1.6;
}

.result-chord-symbol {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin: 0 8px;
}

.result-chord-chinese {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
    margin: 0 8px;
}

.result.correct {
    color: #28a745;
}

.result.incorrect {
    color: #dc3545;
}

.interactive .key {
    cursor: pointer;
}

.interactive .key:hover {
    opacity: 0.8;
}

.interactive .key.selected {
    background: linear-gradient(145deg, #ffc107, #ffb300);
    color: white;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .chord-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .piano {
        overflow-x: auto;
        max-width: 100%;
    }

    .challenge-controls {
        flex-direction: column;
        gap: 10px;
    }

    .challenge-options {
        display: none;
    }
}