/* ==========================================================================
   MelodyBloom - Global Styles & CSS Variables
   ========================================================================== */

:root {
    --bg-dark: #070510;
    --bg-card: rgba(18, 12, 34, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(168, 85, 247, 0.4);
    
    /* Neon Palettes */
    --accent-purple: #a855f7;
    --accent-blue: #06b6d4;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Gradients */
    --bg-gradient: linear-gradient(135deg, #090615 0%, #150e2a 50%, #05030a 100%);
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
    --accent-gradient-glow: 0 0 20px rgba(168, 85, 247, 0.4);
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-sans: 'Outfit', 'Noto Sans SC', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Animated fluid background glow */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: -2;
    overflow: hidden;
}

.app-background::before {
    content: '';
    position: absolute;
    top: -25%;
    left: -25%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.15) 0%, transparent 40%);
    z-index: -1;
    animation: background-drift 20s ease-in-out infinite alternate;
}

@keyframes background-drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.05); }
}

/* ==========================================================================
   App Layout
   ========================================================================== */

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
}

/* Header Area */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-animation {
    animation: rotate-disc 12s linear infinite;
    animation-play-state: paused;
}

body.playing .spin-animation {
    animation-play-state: running;
}

@keyframes rotate-disc {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-top: -2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Form Controls & Dropdowns */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    outline: none;
    font-family: var(--font-sans);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

select:hover, select:focus {
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

option {
    background: #18122c;
    color: var(--text-primary);
}

/* Buttons */
.action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
}

.primary-btn {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-gradient-glow);
}

.primary-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.5);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--text-secondary);
}

.glow-btn {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.35);
}

.glow-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 0 25px rgba(236, 72, 153, 0.5);
}

/* ==========================================================================
   Main Grid & Column Structure
   ========================================================================== */

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glassmorphism Card Style */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.card-header.compact {
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.header-title i {
    color: var(--accent-purple);
    font-size: 18px;
}

.header-title h2 {
    font-size: 18px;
    font-weight: 600;
}

/* ==========================================================================
   Editor Section
   ========================================================================== */

.editor-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-pink);
}

/* Textarea Container with Line Numbers */
.textarea-container {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 310px;
    overflow: hidden;
    position: relative;
    font-family: var(--font-mono);
}

.textarea-container:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
}

.line-numbers {
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-muted);
    text-align: right;
    user-select: none;
    font-size: 14px;
    line-height: 1.6;
    min-width: 32px;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 12px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
}

/* Helper Keyboard */
.helper-keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.helper-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.helper-btn:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
    transform: translateY(-1px);
}

.helper-btn.syntax {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--accent-blue);
}

.helper-btn.syntax:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* ==========================================================================
   Drafts Section (草稿箱)
   ========================================================================== */

.save-draft-form {
    display: flex;
    gap: 10px;
}

#draft-name-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 12px;
    outline: none;
    font-size: 13px;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

#draft-name-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.compact-btn {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.drafts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-drafts-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 16px 0;
}

.draft-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.draft-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.draft-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.draft-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.draft-time {
    font-size: 10px;
    color: var(--text-muted);
}

.draft-actions {
    display: flex;
    gap: 6px;
}

.draft-action-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.draft-action-btn.load:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-blue);
}

.draft-action-btn.delete:hover {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

/* ==========================================================================
   Viewer Section (Playback Panel)
   ========================================================================== */

.viewer-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.playback-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.play-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.play-action-btn.pulse-glow {
    background: var(--accent-gradient);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

body.playing .play-action-btn.pulse-glow {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-blue) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: heartbeat 2s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.play-action-btn:hover {
    transform: scale(1.08);
}

.play-action-btn.secondary {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 15px;
}

.play-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--accent-pink);
    border-color: var(--accent-pink);
}

.icon-toggle-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.icon-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.icon-toggle-btn.active {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Param Sliders Grid */
.param-sliders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

@media (max-width: 576px) {
    .param-sliders {
        grid-template-columns: 1fr;
    }
}

.slider-item, .selector-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.val-badge {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    padding: 0px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* Custom Input Range Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
    transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent-blue);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}

.selector-item label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.selector-item select {
    width: 100%;
}

/* ==========================================================================
   Advanced Mixer Accordion (高级调音台折叠面板)
   ========================================================================== */

.advanced-mixer-accordion {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.12);
}

.accordion-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-smooth);
}

.accordion-toggle:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--accent-blue);
}

.accordion-toggle .arrow-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

.accordion-toggle.active .arrow-icon {
    transform: rotate(180deg);
    color: var(--accent-blue);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.accordion-content.show {
    max-height: 400px;
    transition: max-height 0.3s ease-in-out;
}

.mixer-sliders {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

@media (max-width: 576px) {
    .mixer-sliders {
        grid-template-columns: 1fr;
    }
}

/* Visualizer Container */
.visualizer-container {
    width: 100%;
    height: 52px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   Sheet Music Rendering Display
   ========================================================================== */

.sheet-music-panel {
    flex: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

.sheet-meta {
    font-size: 13px;
    color: var(--accent-blue);
    font-weight: bold;
    font-family: var(--font-mono);
}

.sheet-music-scroll {
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
    padding: 16px 8px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 16px 8px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
    padding: 40px 0;
}

.empty-state i {
    font-size: 40px;
}

/* Note Block Structures */
.jianpu-note-block {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 64px;
    position: relative;
    user-select: none;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
    padding: 0 4px;
}

.jianpu-note-block.interactive {
    cursor: pointer;
}

.jianpu-note-block.interactive:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.jianpu-note-block.playing {
    background: rgba(6, 182, 212, 0.15) !important;
    border-color: var(--accent-blue) !important;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
    z-index: 10;
}

.jianpu-note-block.playing .note-number {
    color: var(--accent-blue);
    font-weight: 700;
}

/* Note parts */
.octave-dots {
    height: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.dot-indicator {
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
    display: inline-block;
}

.jianpu-note-block.playing .dot-indicator {
    background: var(--accent-blue);
}

.note-body {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.note-number {
    font-size: 24px;
    font-family: var(--font-sans);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
}

.note-number.rest {
    color: var(--text-muted);
}

.note-sharp-prefix {
    font-size: 14px;
    margin-right: 1px;
    color: var(--accent-blue);
    font-weight: bold;
    align-self: center;
}

.note-dot-suffix {
    font-size: 16px;
    margin-left: 2px;
    margin-top: 4px;
    color: var(--accent-pink);
    line-height: 1;
}

/* Sub-underlines for short beats */
.duration-lines {
    height: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    margin-top: 2px;
}

.duration-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

.jianpu-note-block.playing .duration-line {
    background: var(--accent-blue);
}

/* Dash horizontal lines (延長音) */
.jianpu-dash-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 64px;
    color: var(--text-muted);
}

.jianpu-dash-content {
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

/* Bar lines separator */
.jianpu-bar-line {
    width: 2px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 8px;
    align-self: center;
    border-radius: 1px;
}

/* Chord notation block */
.jianpu-chord-block {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 2px 6px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 72px;
    margin: -4px 2px;
}

.jianpu-chord-block.playing {
    border-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.1);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

/* ==========================================================================
   Piano Footer
   ========================================================================== */

.piano-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keyboard-mode-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.piano-keyboard-wrapper {
    overflow-x: auto;
    padding: 10px 0;
    width: 100%;
}

.piano-keyboard {
    display: flex;
    height: 160px;
    position: relative;
    user-select: none;
    margin: 0 auto;
    width: max-content;
}

/* Piano Key Styling */
.piano-key {
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.piano-key.white-key {
    width: 44px;
    height: 150px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-bottom: 5px solid #d1d5db;
    border-radius: 0 0 6px 6px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 12px;
    color: #1f2937;
}

.piano-key.white-key:hover {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.2);
}

.piano-key.white-key.active {
    background: var(--accent-gradient);
    color: white;
    border-bottom-width: 1px;
    transform: translateY(4px);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.6);
}

.piano-key.black-key {
    width: 26px;
    height: 95px;
    background: #110e1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 4px solid #000;
    border-radius: 0 0 4px 4px;
    z-index: 2;
    margin-left: -13px;
    margin-right: -13px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 8px;
    color: #9ca3af;
}

.piano-key.black-key:hover {
    background: #201b30;
}

.piano-key.black-key.active {
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    border-bottom-width: 1px;
    transform: translateY(4px);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.6);
    color: white;
}

/* Key label texts */
.key-note-name {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.7;
    margin-bottom: 2px;
}

.key-jianpu-name {
    font-size: 14px;
    font-weight: 700;
}

/* ==========================================================================
   Full Screen Library Modal (曲库弹窗大面板)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 2, 10, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 90%;
    max-width: 960px;
    height: 80vh;
    max-height: 700px;
    background: rgba(20, 15, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-pink);
}

.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
    white-space: nowrap;
    outline: none;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: var(--accent-gradient-glow);
}

.modal-grid-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.song-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition-smooth);
}

.song-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-purple);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.15);
    transform: translateY(-2px);
}

.song-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.song-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.song-card-artist {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.song-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    flex: 1;
}

.song-meta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.badge.easy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge.medium {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-blue);
}

.badge.hard {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

.badge.meta-key, .badge.meta-bpm {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.song-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 12px;
    margin-top: 4px;
}

.song-card-actions .action-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(168, 85, 247, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.4);
}
