/* ========================================
   TuneBuilder - Design System & Variables
   ======================================== */

:root {
    /* Brand Colors */
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --secondary: #ec4899;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 6px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;

    /* Compact Mode (can be toggled) */
    --compact-space-xs: 2px;
    --compact-space-sm: 4px;
    --compact-space-md: 8px;
    --compact-space-lg: 12px;
    --compact-space-xl: 16px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    padding: var(--space-md);
    color: var(--gray-800);
    overflow-x: hidden;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Header & Branding
   ======================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--gray-100);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.2));
    transition: transform var(--transition-normal);
}

.logo-icon:hover {
    transform: scale(1.05);
}

.brand-text h1 {
    font-size: 2em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.2;
}

.tagline {
    font-size: 0.9em;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 14px;
    font-size: 0.9em;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn .icon {
    font-size: 1.1em;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-500);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-600);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-accent {
    background: linear-gradient(135deg, var(--warning) 0%, var(--secondary) 100%);
    color: white;
}

.btn-accent:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-ghost {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 10px;
    width: 40px;
    height: 40px;
    justify-content: center;
}

.btn-ghost:hover {
    background: var(--gray-200);
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1em;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1em;
}

.btn-icon:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    transform: scale(1.05);
}

.btn-icon .icon {
    display: block;
}

/* ========================================
   Control Panel
   ======================================== */

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: var(--space-lg);
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

/* Playback Bar - Main controls at top */
.playback-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border-bottom: 2px solid var(--gray-200);
}

.playback-controls {
    display: flex;
    gap: var(--space-sm);
}

.btn-lg {
    font-size: 1.05em;
    padding: 12px 24px;
    font-weight: 600;
}

/* Compact Settings */
.playback-settings {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    flex: 1;
    justify-content: center;
}

.setting-compact {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.setting-label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}

.slider-inline {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, var(--gray-200), var(--primary-light));
    border-radius: 2px;
    outline: none;
}

.slider-inline::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all var(--transition-fast);
}

.slider-inline::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.slider-inline::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.setting-value {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--primary);
    min-width: 45px;
    text-align: right;
}

.scale-select-compact {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    background: white;
    cursor: pointer;
    font-weight: 500;
}

.btn-icon-sm {
    padding: 6px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    opacity: 0.7;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.btn-icon-sm:hover {
    opacity: 1;
    background: var(--primary-lighter);
    transform: scale(1.1);
}

/* Utility Controls */
.utility-controls {
    display: flex;
    gap: var(--space-sm);
}

.utility-controls .btn {
    min-width: 44px;
    padding: 8px;
}

/* Pattern Management Bar */
.pattern-management-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
}

.arrangement-compact .arrangement-timeline {
    margin-top: 0;
    border: none;
    border-top: 1px solid var(--gray-200);
}

/* ========================================
   Pattern Switcher (v3)
   ======================================== */

.pattern-switcher {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.pattern-switcher-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}

.pattern-buttons {
    display: flex;
    gap: 4px;
}

.pattern-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    min-width: 50px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.pattern-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.pattern-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.pattern-btn.has-content {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.05);
}

.pattern-btn.active.has-content {
    background: var(--primary);
    color: white;
}

.pattern-key {
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1;
}

.pattern-name {
    font-size: 0.7em;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
    line-height: 1;
}

.pattern-btn.active .pattern-name {
    color: rgba(255, 255, 255, 0.9);
}

.pattern-btn:not(.has-content) .pattern-name {
    opacity: 0.5;
}

/* Playing state - shows during song mode playback */
.pattern-btn.playing {
    border-color: var(--warning);
    animation: patternPulse 1s ease-in-out infinite;
}

.pattern-btn.playing::after {
    content: '▶';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6em;
    color: var(--warning);
}

.pattern-btn.active.playing {
    border-color: var(--warning);
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.5), 0 0 0 2px var(--primary);
}

.pattern-btn.active.playing::after {
    color: white;
}

@keyframes patternPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.6);
    }
}

.pattern-name-input {
    width: 100%;
    max-width: 80px;
    padding: 2px 4px;
    font-size: 0.7em;
    font-weight: 600;
    border: 1px solid var(--primary);
    border-radius: 3px;
    background: white;
    text-align: center;
}

.pattern-name-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.btn-pattern-menu {
    padding: 6px 8px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.2em;
    line-height: 1;
}

.btn-pattern-menu:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* ========================================
   Arrangement Timeline (v3)
   ======================================== */

.arrangement-timeline {
    margin-top: var(--space-md);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.arrangement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.arrangement-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.arrangement-icon {
    font-size: 1.2em;
}

.arrangement-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-700);
}

.arrangement-controls {
    display: flex;
    gap: 4px;
}

.btn-loop-mode {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8em;
}

.btn-loop-mode:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-loop-mode.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.btn-loop-mode .icon {
    font-size: 1.1em;
}

.btn-loop-mode .loop-text {
    font-weight: 600;
    font-size: 0.85em;
}

.arrangement-body {
    padding: var(--space-md);
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

.arrangement-track {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 60px;
    position: relative;
}

.arrangement-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 80px;
    height: 50px;
    padding: 8px;
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    cursor: grab;
    transition: all var(--transition-fast);
    position: relative;
    user-select: none;
}

.arrangement-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.arrangement-block:active {
    cursor: grabbing;
}

.arrangement-block.current {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Playing state - shows during song mode playback */
.arrangement-block.playing {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.2));
    animation: arrangementPulse 0.8s ease-in-out infinite;
}

@keyframes arrangementPulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.6), 0 4px 12px rgba(245, 158, 11, 0.4);
    }
}

.arrangement-block.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.arrangement-block.drop-target {
    border-color: var(--accent);
    border-style: dashed;
    background: rgba(16, 185, 129, 0.1);
}

.block-key {
    font-size: 1.3em;
    font-weight: 700;
    line-height: 1;
}

.block-name {
    font-size: 0.7em;
    font-weight: 600;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

.btn-remove-block {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 0.9em;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrangement-block:hover .btn-remove-block {
    opacity: 1;
}

.btn-remove-block:hover {
    transform: scale(1.2);
    background: var(--danger-dark);
}

.btn-add-pattern {
    min-width: 60px;
    height: 50px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 2em;
    font-weight: 300;
}

.btn-add-pattern:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
    transform: scale(1.05);
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    pointer-events: none;
    z-index: 10;
    transition: left 100ms linear;
}

.playhead::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -3px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--danger);
}

/* Pattern switcher in header (alternative placement) */
.pattern-switcher-header {
    margin-left: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .pattern-switcher {
        width: 100%;
        overflow-x: auto;
    }

    .pattern-buttons {
        flex-wrap: nowrap;
    }

    .pattern-btn {
        min-width: 45px;
        padding: 5px 6px;
    }

    .pattern-key {
        font-size: 1em;
    }

    .pattern-name {
        font-size: 0.65em;
        max-width: 50px;
    }

    .pattern-switcher-label {
        display: none; /* Hide label on mobile to save space */
    }

    /* Arrangement Timeline Mobile */
    .arrangement-timeline {
        margin-top: var(--space-sm);
    }

    .arrangement-header {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: flex-start;
    }

    .arrangement-controls {
        width: 100%;
        justify-content: space-between;
    }

    .btn-loop-mode {
        flex: 1;
        justify-content: center;
    }

    .arrangement-body {
        padding: var(--space-sm);
    }

    .arrangement-block {
        min-width: 70px;
        height: 45px;
    }

    .block-key {
        font-size: 1.1em;
    }

    .block-name {
        font-size: 0.65em;
        max-width: 60px;
    }

    .btn-add-pattern {
        min-width: 50px;
        height: 45px;
        font-size: 1.5em;
    }
}

/* ========================================
   Control Panel (continued)
   ======================================== */

.global-controls {
    display: flex;
    gap: var(--space-lg);
    flex: 1;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 200px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    font-size: 0.9em;
    color: var(--gray-700);
}

.label-icon {
    font-size: 1.2em;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.slider-value {
    font-weight: 700;
    color: var(--primary);
    min-width: 70px;
    text-align: right;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-200);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

/* ========================================
   Octave Controls
   ======================================== */

.octave-control {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    transition: all var(--transition-fast);
}

.octave-control:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.btn-octave {
    width: 20px;
    height: 20px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.btn-octave:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.btn-octave:active {
    transform: scale(0.95);
}

.octave-display {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--gray-600);
    min-width: 38px;
    text-align: center;
    user-select: none;
}

.octave-value {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.0em;
}

/* ========================================
   Tracks
   ======================================== */

.tracks-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.track {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 2px solid var(--gray-200);
    transition: all var(--transition-normal);
}

.track:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}

/* Collapsible track functionality */
.track.collapsed .sequencer-wrapper {
    display: none;
}

.track.collapsed {
    padding-bottom: var(--space-md);
}

.btn-collapse {
    background: transparent;
    border: none;
    color: var(--gray-500);
    font-size: 1.3em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.btn-collapse:hover {
    background: var(--gray-200);
    color: var(--gray-700);
    transform: scale(1.1);
}

.btn-collapse .icon {
    transition: transform var(--transition-normal);
    display: inline-block;
}

.track.collapsed .btn-collapse .icon {
    transform: rotate(-90deg);
}

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.track-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.track-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.track-color {
    width: 4px;
    height: 28px;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.track-header h3 {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

/* Pattern Indicator - Shows which pattern (A-H) is loaded */
.pattern-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.85em;
    font-weight: 700;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    transition: all var(--transition-fast);
    cursor: help;
}

.pattern-indicator:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

.instrument-select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--primary);
    background: white;
    color: var(--gray-800);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.instrument-select:hover {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.instrument-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.track-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.volume-slider {
    width: 80px;
}

.mute-btn.muted .icon::before {
    content: '🔇';
}

/* ========================================
   Sequencer Grid
   ======================================== */

.sequencer-wrapper {
    display: flex;
    gap: var(--space-sm);
}

.note-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}

.note-label {
    height: calc((180px - 28px) / 8);
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: 700;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0 6px;
    border-radius: var(--radius-sm);
    min-width: 32px;
}

.sequencer-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    background: var(--gray-300);
    padding: 4px;
    border-radius: var(--radius-sm);
    min-height: 180px;
    flex: 1;
    position: relative;
}

.cell {
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    min-height: 20px;
}

.cell:hover {
    background: var(--gray-100);
    transform: scale(1.08);
    border-color: var(--primary-light);
    z-index: 5;
}

.cell.active {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    border-color: var(--primary-dark);
}

.cell.active:hover {
    background: var(--primary-dark);
}

.cell.playing {
    outline: 3px solid var(--warning);
    outline-offset: -3px;
    z-index: 10;
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Track-specific colors */
.track[data-track="0"] .cell.active {
    background: #8b5cf6;
}

.track[data-track="1"] .cell.active {
    background: #ec4899;
}

.track[data-track="2"] .cell.active {
    background: #10b981;
}

/* Beat markers */
.cell[data-col="0"],
.cell[data-col="4"],
.cell[data-col="8"],
.cell[data-col="12"] {
    border-left: 2px solid var(--gray-400);
}

/* ========================================
   Modal
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    text-align: center;
    padding: var(--space-xl);
    border-bottom: 2px solid var(--gray-100);
}

.logo-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.logo-large h2 {
    font-size: 2em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-large p {
    color: var(--gray-600);
    font-size: 1.1em;
    margin-top: var(--space-sm);
}

.modal-body {
    padding: var(--space-xl);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.feature-item {
    text-align: center;
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: var(--space-sm);
}

.feature-item h4 {
    font-size: 1.1em;
    color: var(--gray-800);
    margin-bottom: var(--space-xs);
}

.feature-item p {
    font-size: 0.9em;
    color: var(--gray-600);
}

/* ========================================
   Help Panel
   ======================================== */

.help-panel {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding: var(--space-lg);
    }
}

.help-panel.hidden {
    display: none;
}

.help-content h3 {
    color: var(--gray-800);
    margin-bottom: var(--space-md);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.shortcut {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    background: white;
    border-radius: var(--radius-sm);
}

kbd {
    background: var(--gray-800);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shortcut span {
    color: var(--gray-700);
    font-size: 0.9em;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: var(--space-sm);
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    padding-left: var(--space-lg);
    position: relative;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: var(--space-sm);
}

/* ========================================
   Footer
   ======================================== */

footer {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 2px solid var(--gray-100);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-text {
    color: var(--gray-500);
    font-size: 0.9em;
}

.footer-version {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: var(--space-sm);
    }

    .container {
        padding: var(--space-lg);
    }

    header {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .brand {
        flex-direction: column;
    }

    .brand-text h1 {
        font-size: 1.5em;
    }

    .control-panel {
        flex-direction: column;
    }

    .playback-controls {
        width: 100%;
        justify-content: center;
    }

    .global-controls {
        width: 100%;
        flex-direction: column;
    }

    .control-group {
        width: 100%;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .sequencer-grid {
        gap: 2px;
        min-height: 150px;
    }

    .note-label {
        min-width: 28px;
        font-size: 0.7em;
        padding: 0 4px;
    }

    .btn-text {
        display: none;
    }

    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .brand-text h1 {
        font-size: 1.3em;
    }

    .track-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .track-controls {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========================================
   Accessibility & Interactions
   ======================================== */

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   Instrument Editor Panel
   ======================================== */

/* Panel Container */
.instrument-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.instrument-panel.open {
    opacity: 1;
    pointer-events: all;
}

/* Overlay (for mobile) */
.panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.instrument-panel.open .panel-overlay {
    opacity: 1;
}

/* Panel Content Container */
.panel-container {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 380px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.instrument-panel.open .panel-container {
    transform: translateX(0);
}

/* Panel Header */
.panel-header {
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0;
}

.panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Panel Body */
.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: white;
}

/* Parameter Groups */
.param-group {
    margin-bottom: var(--space-lg);
}

.param-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--gray-700);
    margin-bottom: var(--space-sm);
}

.param-value {
    color: var(--primary);
    font-weight: 700;
    font-size: 1em;
    font-family: 'Courier New', monospace;
}

/* Panel Select */
.panel-select {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-300);
    background: white;
    font-size: 1em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.panel-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.panel-select:hover {
    border-color: var(--primary);
}

/* Waveform Display */
.waveform-display {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-300);
    background: var(--gray-50);
    font-size: 1em;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
    text-transform: capitalize;
}

/* Envelope Canvas */
.envelope-canvas {
    width: 100%;
    height: 120px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-300);
    background: var(--gray-50);
    display: block;
}

/* Parameter Sliders */
.param-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.param-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.param-slider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

.param-slider:hover::-moz-range-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

/* Edit Button */
.btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: 8px;
}

.btn-edit:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-edit .icon {
    font-size: 1.1em;
}

/* Button Block (full width) */
.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1em;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .panel-container {
        width: 100%;
        transform: translateY(100%);
    }

    .instrument-panel.open .panel-container {
        transform: translateY(0);
    }

    .btn-edit .btn-text {
        display: none;
    }

    .btn-edit {
        padding: 6px 10px;
        min-width: 40px;
        justify-content: center;
    }
}

/* Dark Mode Support (future) */
@media (prefers-color-scheme: dark) {
    .instrument-panel {
        /* Will be implemented in future dark mode update */
    }
}

/* ========================================
   Scale Highlighting Features
   ======================================== */

/* Scale Selector Styles */
.scale-control-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scale-select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-700);
    font-size: 0.9em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scale-select:hover {
    border-color: var(--primary);
}

.scale-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.btn-small {
    padding: 6px 12px;
    min-width: auto;
}

.scale-info {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Scale Highlighting on Grid */
.cell.in-scale {
    background: rgba(139, 92, 246, 0.06);
    border-color: rgba(139, 92, 246, 0.15);
}

.cell.in-scale:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
}

.cell.in-scale.active {
    background: var(--primary);
    border-color: var(--primary-dark);
}

.cell.in-scale.active:hover {
    background: var(--primary-dark);
}

/* Scale Highlighting on Note Labels */
.note-label.in-scale {
    font-weight: 700;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.08);
    border-left: 3px solid var(--primary);
    padding-left: 8px;
}

/* ========================================
   AI Generation Features
   ======================================== */

/* AI Generate Button */
.btn-ai-generate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875em;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-ai-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-ai-generate:active {
    transform: translateY(0);
}

.btn-ai-generate.loading {
    animation: shimmer 1.5s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* AI Modal Styles */
.ai-modal {
    z-index: 1000;
    display: none; /* Hidden by default - only shows when .show class is added */
}

.ai-modal.show {
    display: flex; /* Show when .show class is added */
}

.ai-modal-content {
    max-width: 500px;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.ai-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-modal .modal-header h2 {
    font-size: 1.4em;
    margin: 0;
}

.ai-modal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ai-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* AI Modal Body */
.ai-modal .modal-body {
    padding: var(--space-xl);
}

/* AI Track Info */
.ai-track-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
}

.ai-track-label {
    font-size: 0.85em;
    color: var(--gray-600);
    font-weight: 600;
}

.ai-track-name {
    font-size: 0.95em;
    color: var(--primary);
    font-weight: 700;
}

/* AI Parameter Groups */
.ai-param-group {
    margin-bottom: var(--space-lg);
}

.ai-param-group label {
    display: block;
    margin-bottom: var(--space-sm);
}

.ai-param-group label > span:first-child {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.95em;
    display: block;
    margin-bottom: 4px;
}

.ai-param-hint {
    font-size: 0.8em;
    color: var(--gray-500);
    display: block;
}

.ai-param-value {
    float: right;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9em;
}

/* AI Select */
.ai-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-700);
    font-size: 0.9em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-select:hover {
    border-color: var(--primary);
}

.ai-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* AI Slider */
.ai-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-200);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ai-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ai-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

.ai-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ai-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

.ai-density-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75em;
    color: var(--gray-500);
}

/* AI Checkbox */
.ai-checkbox-group {
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 2px solid var(--gray-200);
}

.ai-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.ai-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* AI Quota Display */
.ai-quota-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.ai-quota-icon {
    font-size: 1.2em;
}

.ai-quota-text {
    font-size: 0.9em;
    color: var(--gray-700);
    font-weight: 600;
}

/* AI Actions */
.ai-actions {
    display: flex;
    gap: 12px;
    margin-top: var(--space-xl);
}

.ai-actions .btn {
    flex: 1;
}

/* AI Preview Section */
.ai-preview-section {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 2px solid var(--accent);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-preview-header h4 {
    margin: 0 0 8px 0;
    color: var(--gray-800);
    font-size: 1.1em;
}

.ai-preview-info {
    font-size: 0.9em;
    color: var(--gray-600);
    margin-bottom: var(--space-md);
}

.ai-preview-actions {
    display: flex;
    gap: 10px;
}

.ai-preview-actions .btn {
    flex: 1;
}

/* AI Loading State */
.ai-loading-state {
    text-align: center;
    padding: var(--space-xl);
}

.ai-loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-loading-text {
    font-size: 1em;
    color: var(--gray-600);
    font-weight: 600;
}

/* AI-Generated Note Indicator */
.cell.ai-generated {
    position: relative;
    animation: aiPop 0.4s ease;
}

@keyframes aiPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell.ai-generated::after {
    content: '✨';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.8;
    animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
    0% { opacity: 0.8; }
    70% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Mobile Responsiveness for AI Features */
@media (max-width: 768px) {
    .ai-modal-content {
        max-width: 95%;
        margin: 20px;
    }

    .btn-ai-generate .btn-text {
        display: none;
    }

    .btn-ai-generate {
        padding: 6px 10px;
        min-width: 40px;
        justify-content: center;
    }

    .ai-actions {
        flex-direction: column;
    }

    .ai-preview-actions {
        flex-direction: column;
    }

    .scale-control-container {
        flex-direction: column;
        align-items: stretch;
    }

    .scale-select {
        width: 100%;
    }
}

/* ========================================
   Modal System
   ======================================== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

/* Modal Dialog */
.modal-dialog {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.modal-title {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--gray-500);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

/* Modal Body */
.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.modal-message {
    font-size: 1em;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Input Modal */
.modal-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--gray-700);
}

.modal-input {
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1em;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.modal-input.error {
    border-color: var(--danger);
}

.modal-error {
    color: var(--danger);
    font-size: 0.85em;
    font-weight: 500;
}

/* Pattern Picker Modal */
.pattern-picker-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pattern-picker-message {
    font-size: 1em;
    color: var(--gray-700);
    margin: 0;
}

.pattern-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pattern-picker-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 100px;
}

.pattern-picker-button:hover {
    border-color: var(--primary);
    background: var(--primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.pattern-picker-button.has-content {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.05);
}

.pattern-picker-button.empty {
    opacity: 0.5;
}

.pattern-key-label {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary);
}

.pattern-name-label {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--gray-600);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pattern-content-indicator {
    display: flex;
    gap: 4px;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: background 0.2s;
}

.indicator-dot.filled {
    background: var(--accent);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 2000;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
    overflow: hidden;
}

.context-menu.active {
    opacity: 1;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.9em;
    color: var(--gray-700);
    transition: background 0.15s ease;
}

.context-menu-item:hover,
.context-menu-item:focus {
    background: var(--gray-100);
    outline: none;
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.menu-item-icon {
    font-size: 1.2em;
    width: 20px;
    text-align: center;
}

.menu-item-label {
    flex: 1;
}

.menu-item-shortcut {
    font-size: 0.85em;
    color: var(--gray-500);
    font-family: monospace;
}

.context-menu-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

/* Mobile Responsive Modal */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .modal-title {
        font-size: 1.1em;
    }

    .pattern-picker-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .pattern-picker-button {
        padding: 12px 6px;
        min-height: 90px;
    }

    .pattern-key-label {
        font-size: 1.3em;
    }

    .context-menu {
        min-width: 180px;
    }
}

/* ========================================
   Drum Track (TR-808 Style)
   ======================================== */

.track-drums {
    border-left: 4px solid #f59e0b;
}

.track-drums .track-header {
    background: linear-gradient(135deg, #fef3c7, #fef3c7);
}

.track-drums .track-title h3 {
    color: #92400e;
}

/* Drum Kit Selector */
.drumkit-select {
    padding: 8px 12px;
    border: 2px solid #fbbf24;
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.9em;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.drumkit-select:hover {
    border-color: #f59e0b;
    background: #fef3c7;
}

.drumkit-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Drum Labels */
.drum-labels .note-label {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    font-weight: 700;
    font-size: 0.8em;
    border-color: #fbbf24;
}

.drum-labels .note-label:hover {
    background: #fde68a;
    transform: translateX(2px);
}

/* Drum Grid */
.drum-grid {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.drum-grid .cell {
    background: rgba(254, 243, 199, 0.3);
    border-color: #fde68a;
    transition: all 0.15s ease;
}

.drum-grid .cell:hover {
    background: #fef3c7;
    border-color: #fbbf24;
    transform: scale(1.05);
}

.drum-grid .cell.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: #d97706;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    transform: scale(1.1);
}

.drum-grid .cell.playing {
    background: #d97706;
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
}

/* Drum Grid Rows - Subtle alternating colors */
.drum-grid .grid-row:nth-child(2n) {
    background: rgba(251, 191, 36, 0.03);
}

/* Beat Markers (every 4 beats) for drum grid */
.drum-grid .cell:nth-child(4n+1) {
    border-left: 2px solid #fbbf24;
}

/* Mobile Responsive Drum Track */
@media (max-width: 768px) {
    .track-drums .track-header {
        padding: 8px 12px;
    }

    .drumkit-select {
        font-size: 0.75em;
        padding: 6px 8px;
    }

    .drum-labels .note-label {
        font-size: 0.7em;
        width: 28px;
    }
}

/* ========================================
   Synth Track (Virtual Analog)
   ======================================== */

.track-synth {
    border-left: 4px solid #06b6d4;
}

.track-synth .track-header {
    background: linear-gradient(135deg, #cffafe, #cffafe);
}

.track-synth .track-title h3 {
    color: #0e7490;
}

/* Synth Controls in Instrument Panel */
#synthControls {
    display: none;
}

.synth-osc-group {
    background: #f0fdff;
    border: 1px solid #67e8f9;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.synth-osc-label {
    display: block;
    font-weight: 700;
    font-size: 0.9em;
    color: #0e7490;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-group-compact {
    margin-bottom: 8px;
}

.param-group-compact:last-child {
    margin-bottom: 0;
}

.param-group-compact label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.param-group-compact .param-value {
    color: #06b6d4;
    font-weight: 700;
    font-size: 0.95em;
}

.panel-select-compact {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1.5px solid #d1d5db;
    background: white;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.panel-select-compact:hover {
    border-color: #06b6d4;
}

.panel-select-compact:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.param-slider-compact {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.param-slider-compact:hover {
    opacity: 1;
}

.param-slider-compact::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #06b6d4;
    cursor: pointer;
    transition: all 0.15s ease;
}

.param-slider-compact::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.15);
}

.param-slider-compact::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #06b6d4;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.param-slider-compact::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.15);
}

/* Mobile Responsive Synth Track */
@media (max-width: 768px) {
    .track-synth .track-header {
        padding: 8px 12px;
    }

    .synth-osc-group {
        padding: 10px;
        margin-bottom: 10px;
    }

    .synth-osc-label {
        font-size: 0.8em;
    }

    .param-group-compact label {
        font-size: 0.8em;
    }
}

/* ========================================
   User Authentication & Menu Styles
   ======================================== */

/* Header Actions Container */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-family);
}

.user-menu-button:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--gray-800);
}

.user-credits {
    font-size: 0.75em;
    color: var(--primary);
    font-weight: 600;
}

.dropdown-arrow {
    font-size: 0.7em;
    color: var(--gray-500);
    transition: transform var(--transition-fast);
}

.user-menu-button:hover .dropdown-arrow {
    transform: translateY(2px);
}

/* User Menu Dropdown */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 300px;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1000;
}

.user-menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 2px solid var(--gray-200);
}

.user-menu-avatar img,
.user-menu-avatar .avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-avatar .avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
    font-size: 1.5em;
}

.user-menu-details {
    flex: 1;
}

.user-menu-name {
    font-weight: 700;
    font-size: 1em;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.user-menu-email {
    font-size: 0.8em;
    color: var(--gray-600);
}

/* Credits Section */
.user-menu-credits-section {
    padding: var(--space-lg);
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.credits-breakdown {
    margin-bottom: var(--space-md);
}

.credit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    font-size: 0.9em;
}

.credit-item.total {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 2px solid var(--gray-300);
    font-weight: 700;
}

.credit-label {
    color: var(--gray-700);
}

.credit-value {
    font-weight: 600;
    color: var(--gray-900);
}

.credit-value.bonus {
    color: var(--accent);
}

.credit-value.premium {
    color: var(--primary);
}

.premium-badge {
    text-align: center;
    padding: var(--space-sm);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
}

/* Menu Items */
.user-menu-section {
    padding: var(--space-sm);
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    font-size: 0.95em;
    text-align: left;
}

.menu-item:hover {
    background: var(--gray-100);
}

.menu-item.admin {
    color: var(--primary);
    font-weight: 600;
}

.menu-item.admin:hover {
    background: rgba(139, 92, 246, 0.1);
}

.menu-icon {
    font-size: 1.2em;
}

.menu-text {
    flex: 1;
    color: var(--gray-800);
}

/* ========================================
   Subscription Modal Styles
   ======================================== */

.subscription-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.subscription-hero {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
}

.hero-text {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
}

.hero-subtext {
    font-size: 1.1em;
    color: var(--gray-700);
}

/* Pricing Cards */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.pricing-card {
    position: relative;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    background: white;
    transition: all var(--transition-normal);
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.pricing-card.featured {
    border-color: var(--primary);
    border-width: 3px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.featured-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: var(--space-xs) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 0.5px;
}

.plan-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.plan-header h3 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-md);
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-xs);
}

.price {
    font-size: 3em;
    font-weight: 700;
    color: var(--primary);
}

.period {
    font-size: 1em;
    color: var(--gray-600);
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-xl) 0;
}

.plan-features li {
    padding: var(--space-sm) 0;
    font-size: 0.95em;
    color: var(--gray-800);
    line-height: 1.6;
}

.plan-features li strong {
    color: var(--primary);
}

/* FAQ Section */
.subscription-faq {
    margin-bottom: var(--space-xl);
}

.subscription-faq h4 {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-lg);
}

.faq-item {
    margin-bottom: var(--space-lg);
}

.faq-item strong {
    display: block;
    font-size: 1em;
    color: var(--gray-900);
    margin-bottom: var(--space-xs);
}

.faq-item p {
    font-size: 0.9em;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
}

.subscription-footer {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 2px solid var(--gray-200);
}

.small-text {
    font-size: 0.85em;
    color: var(--gray-600);
}

.small-text a {
    color: var(--primary);
    text-decoration: none;
}

.small-text a:hover {
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .user-menu-button {
        padding: var(--space-xs) var(--space-sm);
    }

    .user-info {
        display: none;
    }

    .dropdown-arrow {
        display: none;
    }

    .user-menu-dropdown {
        right: -10px;
        min-width: calc(100vw - 40px);
    }

    .pricing-cards {
        grid-template-columns: 1fr;
    }

    .subscription-hero {
        padding: var(--space-lg);
    }

    .hero-text {
        font-size: 1.2em;
    }

    .hero-subtext {
        font-size: 1em;
    }
}

/* ========================================
   Help Modal Styles
   ======================================== */

.help-modal {
    display: none;
}

.help-modal.open .help-modal-backdrop {
    opacity: 1;
}

.help-modal.open .help-modal-content {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.help-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.help-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Header */
.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.help-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-icon {
    font-size: 2em;
}

.help-modal-title h2 {
    margin: 0;
    font-size: 1.5em;
}

.help-close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.help-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Tabs */
.help-tabs {
    display: flex;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.help-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    position: relative;
}

.help-tab:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.help-tab.active {
    background: white;
    color: var(--primary);
}

.help-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.tab-icon {
    font-size: 1.2em;
}

.tab-text {
    font-size: 0.95em;
}

/* Tab Content */
.help-tab-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.help-pane {
    display: none;
}

.help-pane.active {
    display: block;
}

/* Shortcut Sections */
.shortcut-section {
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--gray-800);
    font-size: 1.2em;
    font-weight: 700;
}

.section-icon {
    font-size: 1.3em;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.shortcut-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.2s;
}

.shortcut-card:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 4px;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    background: linear-gradient(180deg, #ffffff, #f3f4f6);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    box-shadow:
        0 2px 0 var(--gray-300),
        0 3px 2px rgba(0, 0, 0, 0.1);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-700);
}

.key-plus {
    font-size: 0.8em;
    color: var(--gray-400);
    margin: 0 2px;
}

.shortcut-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shortcut-name {
    font-weight: 600;
    color: var(--gray-900);
}

.shortcut-desc {
    font-size: 0.85em;
    color: var(--gray-600);
}

/* Guide Steps */
.guide-steps {
    max-width: 700px;
    margin: 0 auto;
}

.guide-step {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--gray-50);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
}

.step-number {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 1.5em;
    font-weight: 700;
    border-radius: 50%;
}

.step-content h4 {
    margin: 0 0 8px 0;
    color: var(--gray-900);
    font-size: 1.1em;
}

.step-content p {
    margin: 0;
    color: var(--gray-700);
    line-height: 1.6;
}

.step-content kbd {
    font-size: 0.9em;
}

/* Tips Carousel */
.tips-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tip-card {
    padding: 24px;
    background: linear-gradient(135deg, var(--gray-50), #ffffff);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s;
}

.tip-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
    transform: translateY(-4px);
}

.tip-icon {
    font-size: 3em;
    margin-bottom: 12px;
    display: block;
}

.tip-card h4 {
    margin: 0 0 8px 0;
    color: var(--gray-900);
    font-size: 1.1em;
}

.tip-card p {
    margin: 0;
    color: var(--gray-700);
    line-height: 1.6;
    font-size: 0.9em;
}

/* About Content */
.about-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.about-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 16px;
}

.about-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    color: var(--gray-900);
}

.about-tagline {
    font-size: 1.1em;
    color: var(--gray-600);
    margin-bottom: 32px;
}

.about-section {
    margin-bottom: 32px;
    text-align: left;
}

.about-section h4 {
    margin: 0 0 12px 0;
    font-size: 1.2em;
    color: var(--gray-900);
}

.about-section p {
    margin: 0;
    color: var(--gray-700);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    padding: 8px 0;
    color: var(--gray-700);
}

.about-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--gray-200);
}

.about-footer p {
    margin: 4px 0;
    color: var(--gray-600);
}

.about-version {
    font-size: 0.85em;
    color: var(--gray-500);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .help-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .help-modal-header {
        padding: 16px 20px;
    }

    .help-icon {
        font-size: 1.5em;
    }

    .help-modal-title h2 {
        font-size: 1.2em;
    }

    .help-tabs {
        overflow-x: auto;
    }

    .help-tab {
        flex: 0 0 auto;
        min-width: 100px;
        padding: 12px 8px;
    }

    .tab-text {
        display: none;
    }

    .tab-icon {
        font-size: 1.5em;
    }

    .help-tab-content {
        padding: 16px;
    }

    .shortcut-grid {
        grid-template-columns: 1fr;
    }

    .guide-step {
        flex-direction: column;
        padding: 16px;
    }

    .tips-carousel {
        grid-template-columns: 1fr;
    }
}

