:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --accent-gold: #d4af37;
    --accent-gold-light: #f5d67e;
    --accent-gold-dark: #b8941f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-tertiary: #6b6b7e;
    --white-key: #fafafa;
    --white-key-shadow: #e0e0e8;
    --black-key: #1a1a1a;
    --key-active: #d4af37;
    --border-subtle: rgba(212, 175, 55, 0.1);
    --glow: rgba(212, 175, 55, 0.3);
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(100, 100, 200, 0.03) 0%, transparent 50%);
    animation: gradientShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-5%, -5%) rotate(5deg); }
}

/* Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Start Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(13, 13, 20, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.start-content {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.piano-icon {
    font-size: 6rem;
    color: var(--accent-gold);
    margin-bottom: 2rem;
    animation: floatIcon 3s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.4));
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.start-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-gold-light) 0%, var(--accent-gold) 50%, var(--accent-gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.start-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

#start-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-gold-light) 0%, var(--accent-gold) 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 
        0 4px 20px rgba(212, 175, 55, 0.3),
        0 0 60px rgba(212, 175, 55, 0.2);
    transition: all 0.3s ease;
    font-family: 'DM Sans', sans-serif;
}

#start-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 30px rgba(212, 175, 55, 0.4),
        0 0 80px rgba(212, 175, 55, 0.3);
}

#start-btn:active {
    transform: translateY(0) scale(0.98);
}

#start-btn i {
    font-size: 1.3rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(13, 13, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.3rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-gold);
    transform: translateX(-3px);
}

.back-btn i {
    font-size: 1.1rem;
}

.nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.composer-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
}

/* Main Wrapper */
.piano-wrapper {
    position: relative;
    min-height: 100vh;
    padding-top: 6rem;
    padding-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 2;
}

/* Control Panel */
.control-panel {
    width: 90%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.control-group {
    display: flex;
    gap: 3rem;
    flex: 1;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
}

.control-item label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.control-item label i {
    font-size: 1.2rem;
    color: var(--accent-gold);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.4);
}

.volume-value,
.reverb-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-align: center;
}

.octave-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.octave-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'DM Sans', sans-serif;
}

.octave-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

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

.octave-btn i {
    font-size: 1.1rem;
}

.octave-display {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.octave-display strong {
    color: var(--accent-gold);
    font-size: 1.1rem;
}

/* Piano Container */
.piano-container {
    width: 90%;
    max-width: 1200px;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--border-subtle);
    border-bottom: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 10px var(--accent-gold);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

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

.note-display {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-gold);
    min-width: 60px;
    text-align: center;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Piano Stage */
.piano-stage {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 3rem 2rem;
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.piano {
    display: inline-flex;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem 1.5rem 0 1.5rem;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    touch-action: none;
}

/* Keys */
.key {
    position: relative;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.08s cubic-bezier(0.4, 0, 0.2, 1);
}

.key-label,
.key-hint {
    pointer-events: none;
    transition: all 0.2s ease;
}

.white {
    width: 60px;
    height: 280px;
    background: linear-gradient(180deg, #ffffff 0%, var(--white-key) 70%, var(--white-key-shadow) 100%);
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    box-shadow: 
        0 8px 12px rgba(0, 0, 0, 0.15),
        inset 0 -8px 8px rgba(0, 0, 0, 0.05),
        inset 0 2px 2px rgba(255, 255, 255, 0.8);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 1.5rem;
    gap: 0.5rem;
}

.white .key-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.white .key-hint {
    font-size: 0.95rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.04);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

.white:hover {
    background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 70%, var(--white-key-shadow) 100%);
    transform: translateY(1px);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 -6px 8px rgba(0, 0, 0, 0.08);
}

.white:active,
.white.active {
    background: linear-gradient(180deg, var(--accent-gold-light) 0%, var(--accent-gold) 70%, var(--accent-gold-dark) 100%);
    transform: translateY(3px);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 -4px 8px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(212, 175, 55, 0.6);
}

.white.active .key-label,
.white.active .key-hint {
    color: var(--bg-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.black {
    width: 40px;
    height: 180px;
    background: linear-gradient(180deg, #2a2a2a 0%, var(--black-key) 60%, #000000 100%);
    border: 2px solid #000000;
    border-radius: 0 0 6px 6px;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.6),
        inset 0 -4px 8px rgba(0, 0, 0, 0.8),
        inset 0 2px 2px rgba(255, 255, 255, 0.1);
    z-index: 2;
    margin-left: -20px;
    margin-right: -20px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 1rem;
}

.black .key-hint {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.black:hover {
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 60%, #000000 100%);
    transform: translateY(2px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.7),
        inset 0 -3px 8px rgba(0, 0, 0, 0.9);
}

.black:active,
.black.active {
    background: linear-gradient(180deg, var(--accent-gold) 0%, var(--accent-gold-dark) 60%, #8b7422 100%);
    transform: translateY(4px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.8),
        inset 0 -2px 8px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(212, 175, 55, 0.8);
}

.black.active .key-hint {
    color: var(--bg-primary);
    background: rgba(0, 0, 0, 0.2);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Piano Footer */
.piano-footer {
    padding: 2rem;
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 0 0 20px 20px;
    border: 1px solid var(--border-subtle);
    border-top: none;
}

.instructions {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.instruction-item i {
    font-size: 1.3rem;
    color: var(--accent-gold);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .control-panel {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .control-group {
        width: 100%;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .octave-controls {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .start-content h1 {
        font-size: 2.5rem;
    }
    
    .piano-icon {
        font-size: 4rem;
    }
    
    .top-nav {
        padding: 1rem 1.5rem;
    }
    
    .composer-name {
        display: none;
    }
    
    .piano-wrapper {
        padding-top: 5rem;
    }
    
    .control-panel {
        width: 95%;
        padding: 1.2rem 1.5rem;
    }
    
    .piano-container {
        width: 95%;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .piano-stage {
        padding: 2rem 1rem;
    }
    
    .piano {
        padding: 1rem 1rem 0 1rem;
    }
    
    .white {
        width: 50px;
        height: 240px;
    }
    
    .black {
        width: 34px;
        height: 155px;
        margin-left: -17px;
        margin-right: -17px;
    }
    
    .instructions {
        gap: 1.5rem;
    }
    
    .instruction-item {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .start-content h1 {
        font-size: 2rem;
    }
    
    .start-content p {
        font-size: 0.95rem;
    }
    
    #start-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .white {
        width: 42px;
        height: 200px;
    }
    
    .black {
        width: 28px;
        height: 130px;
        margin-left: -14px;
        margin-right: -14px;
    }
    
    .white .key-hint,
    .black .key-hint {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    .white .key-label {
        font-size: 0.65rem;
    }
}

/* Scrollbar Styling */
.piano-stage::-webkit-scrollbar {
    height: 8px;
}

.piano-stage::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.piano-stage::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 10px;
}

.piano-stage::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold-light);
}
