/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.octave-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.octave-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.octave-display {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    min-width: 100px;
    text-align: center;
    font-weight: 500;
}

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

.control-select {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    min-width: 150px;
}

.control-select option {
    background: #1a1a2e;
    color: white;
}

.control-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.play-btn {
    background: #4ecdc4;
    color: white;
}

.play-btn:hover {
    background: #45b7d1;
    transform: translateY(-1px);
}

.stop-btn {
    background: #ff6b6b;
    color: white;
}

.stop-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 400px;
}

.game-area {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.game-canvas {
    width: 100%;
    height: 400px;
    display: block;
    background: transparent;
}

.score-panel {
    width: 280px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.score-section h3 {
    color: #4ecdc4;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row span:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.stat-row span:last-child {
    font-weight: 600;
    color: white;
}

.controls-help h4 {
    color: #4ecdc4;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.help-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.help-text div {
    margin-bottom: 0.5rem;
}

.help-text strong {
    color: white;
}

/* Piano Container */
.piano-container {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    position: sticky;
    bottom: 0;
    overflow-x: auto;
}

.piano-keyboard {
    margin: 0 auto;
    position: relative;
    height: 160px;
    display: block;
    transition: all 0.3s ease;
}

/* Piano Keys */
.piano-key {
    position: absolute;
    border: 2px solid #333;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 8px 8px;
}

.piano-key.white {
    width: 48px;
    height: 140px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 20%, #e9ecef 80%, #dee2e6 100%);
    color: #333;
    padding: 0.5rem 0.25rem;
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    border: 2px solid #ccc;
    z-index: 1;
}

.piano-key.black {
    width: 28px;
    height: 90px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 20%, #2c3e50 80%, #1a252f 100%);
    color: #fff;
    padding: 0.5rem 0.25rem;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid #1a1a1a;
    z-index: 3;
    border-radius: 0 0 6px 6px;
}

.piano-key:hover {
    transform: translateY(3px);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.piano-key.black:hover {
    transform: translateY(2px);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.piano-key.active {
    transform: translateY(6px);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4);
}

.piano-key.black.active {
    transform: translateY(4px);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.piano-key.white.active {
    background: linear-gradient(180deg, #e9ecef 0%, #dee2e6 20%, #ced4da 80%, #adb5bd 100%);
}

.piano-key.black.active {
    background: linear-gradient(180deg, #1a252f 0%, #212529 20%, #1a1a1a 80%, #000 100%);
}

.piano-key.white:hover {
    background: linear-gradient(180deg, #f8f9fa 0%, #f1f3f4 20%, #e1e5e9 80%, #d6dbdf 100%);
}

.piano-key.black:hover {
    background: linear-gradient(180deg, #34495e 0%, #3d566e 20%, #2c3e50 80%, #243342 100%);
}

/* Piano key labels */
.note-label {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
    text-align: center;
}

.key-label {
    font-size: 0.65rem;
    font-weight: bold;
    line-height: 1;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    text-align: center;
    min-width: 16px;
}

.piano-key.white .key-label {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.piano-key.black .key-label {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Highlight current octave keys */
.piano-key.current-octave {
    border-color: #4ecdc4 !important;
}

.piano-key.white.current-octave {
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 0 15px rgba(78, 205, 196, 0.4);
}

.piano-key.black.current-octave {
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 0 15px rgba(78, 205, 196, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .score-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .score-section,
    .stats-section,
    .controls-help {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-controls {
        justify-content: center;
    }
    
    .piano-key.white {
        width: 40px;
        height: 100px;
    }
    
    .piano-key.black {
        width: 26px;
        height: 65px;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
}

/* Game-specific styles */
.strike-line {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ff6b6b, transparent);
    z-index: 10;
    pointer-events: none;
}

/* Loading and disabled states */
.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.control-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}