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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0;
}

.loading-content small {
    font-size: 14px;
    opacity: 0.8;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Header Professionale */
.app-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo-icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0;
}

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

.btn-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-icon span:first-child {
    font-size: 18px;
}

.btn-text {
    font-weight: 500;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.1);
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toolbar-divider {
    width: 1px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
}

.section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-bottom: 2px;
}

.control-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.input-field {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(0, 0, 0, 0.3);
}

.input-text {
    width: 180px;
}

.input-number {
    width: 70px;
    text-align: center;
}

.input-small {
    width: 50px;
    text-align: center;
}

.select-field {
    width: 110px;
    cursor: pointer;
}

.btn-small {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-small:active {
    transform: scale(0.95);
}

.unit-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Transport Controls */
.transport-section {
    flex-direction: row;
    margin-left: auto;
}

.btn-transport {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-transport:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

.btn-play:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65408b 100%);
}

.btn-transport.locked {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: transparent;
    animation: pulse-lock 2s ease-in-out infinite;
}

.btn-transport.locked:hover {
    background: linear-gradient(135deg, #d68910 0%, #ca6f1e 100%);
}

@keyframes pulse-lock {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(243, 156, 18, 0);
    }
}

/* Rimosse regole duplicate - ora gestite in .input-field */

/* Preset Slots */
.preset-slots {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 25px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preset-slots .section-label {
    flex-shrink: 0;
}

.slots-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.slot-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
}

.slot-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.slot-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slot-btn.filled {
    color: white;
}

/* Sequencer Wrapper */
.sequencer-wrapper {
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: #f0f0f0;
    color: #333;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65408b 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #d97ee3 0%, #dc4a5e 100%);
}

.sequencer {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Bar Numbers Row */
.bar-numbers-row {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.bar-number {
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    padding: 6px 8px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.bar-number::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.3), transparent);
}

.bar-copy-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.bar-copy-btn:hover {
    background: #5568d3;
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.bar-copy-btn:active {
    transform: scale(0.95);
}

.bar-number-text {
    flex: 1;
    text-align: center;
}

.sequencer-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sequencer-grid-wrapper {
    display: flex;
    position: relative;
}

.sequencer-instruments {
    flex-shrink: 0;
    z-index: 10;
    background: #f8f9fa;
}

.sequencer-steps {
    overflow-x: auto;
    overflow-y: hidden;
}

.sequencer-steps::-webkit-scrollbar {
    height: 8px;
}

.sequencer-steps::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.sequencer-steps::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.sequencer-steps::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.sequencer-row {
    display: flex;
    align-items: center;
    cursor: move;
    transition: opacity 0.3s;
    min-height: 44px;
}

.sequencer-instruments .sequencer-row {
    margin-bottom: 2px;
}

.sequencer-steps .sequencer-row {
    gap: 2px;
    margin-bottom: 2px;
}

.sequencer-row.dragging {
    opacity: 0.4;
}

.sequencer-row.drag-over {
    border-top: 3px solid #667eea;
}

.sequencer-row.muted-row .step {
    opacity: 0.5;
}

.sequencer-row.muted-row .step.active {
    opacity: 0.4;
    background: #999;
    border-color: #999;
}

.instrument-label {
    padding: 0;
    font-weight: 600;
    background: #667eea;
    color: white;
    border-radius: 8px;
    width: 140px;
    flex-shrink: 0;
    height: 40px;
    cursor: move;
    position: relative;
    transition: all 0.3s;
}

.instrument-label > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 8px 10px;
    height: 100%;
}

.instrument-label:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.instrument-label.muted {
    opacity: 0.4;
    background: #999;
}

.drag-icon {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: -2px;
    flex-shrink: 0;
}

.instrument-name {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.sample-select {
    width: 100%;
    min-width: 0;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.sample-select:focus {
    outline: 2px solid white;
    outline-offset: 1px;
}

.sample-select option {
    color: #333;
    background: white;
    padding: 4px 8px;
}

/* Volume button (replaces mute-btn) */
.volume-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
}

.volume-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.volume-btn:active {
    transform: scale(0.95);
}

/* Volume button states */
.volume-btn.custom {
    color: #4facfe;
    border-color: #4facfe;
    background: rgba(79, 172, 254, 0.2);
}

.volume-btn.muted {
    color: #e74c3c;
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
}

/* Volume popover */
.volume-popover {
    background: #2c3e50;
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    min-width: 200px;
}

.volume-popover-header {
    font-weight: bold;
    font-size: 14px;
    color: white;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.volume-popover-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.volume-slider-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.volume-slider-container label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: space-between;
}

.volume-slider-container #volume-value-display {
    color: #4facfe;
    font-weight: bold;
}

.volume-slider-container input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.volume-slider-container input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.volume-mute-container label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.volume-mute-container input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Keep old mute-btn class for backward compatibility if needed */
.mute-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.mute-btn:active {
    transform: scale(0.95);
}

.muted-row .step.active {
    opacity: 0.4;
    background: #999;
    border-color: #999;
}

.step {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: white;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
    position: relative;
}

.step.bar-start {
    /* Nessun margine extra - rimosso per allineamento */
}

.step:hover {
    background: #e0e0e0;
    transform: scale(1.1);
    border-color: #999;
}

.step.active {
    background: #667eea;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.step.accent {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.step.playing {
    background: #f5576c;
    border-color: #f5576c;
    animation: pulse 0.1s ease-in-out;
}

.step.beat-marker {
    border-color: #764ba2;
    border-width: 3px;
}

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

.staff-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.staff-container {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.staff-container h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
}

#staff-canvas {
    display: block;
    margin: 0 auto 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.staff-container .btn {
    margin-right: 10px;
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.info-content {
    max-width: 900px;
    margin: 40px auto;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close-info-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.close-info-btn:hover {
    background: #5568d3;
    transform: rotate(90deg);
}

.info-content h2 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 32px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.info-content h3 {
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 22px;
}

.info-content h4 {
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.info-content p {
    line-height: 1.7;
    color: #333;
    margin-bottom: 15px;
}

.info-content ul, .info-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.8;
}

.info-content li {
    margin-bottom: 8px;
    color: #444;
}

.info-content strong {
    color: #667eea;
    font-weight: 600;
}

.info-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #e74c3c;
}

.info-content kbd {
    display: inline-block;
    padding: 3px 8px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 2px 0 #ddd;
    color: #333;
}

.info-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.info-footer p {
    color: #7f8c8d;
    font-style: italic;
    font-size: 16px;
    margin: 0;
}

.info-footer strong {
    color: #667eea;
    font-size: 18px;
}

/* Loop Sequencer Modal */
.loop-sequencer-content {
    max-width: 700px;
}

.loop-config {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.loop-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.loop-config-row:last-child {
    margin-bottom: 0;
}

.loop-config-row label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 200px;
}

.loop-shortcut-hint {
    margin-top: 15px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-size: 14px;
    color: #2c3e50;
}

.loop-shortcut-hint kbd {
    display: inline-block;
    padding: 3px 8px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    box-shadow: 0 2px 0 #ddd;
}

.loop-steps-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.loop-step {
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

.loop-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.loop-step-title {
    font-weight: 700;
    color: #667eea;
    font-size: 16px;
}

.loop-step-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loop-step-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.loop-step-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.loop-step-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loop-step-row label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 100px;
}

.loop-step-row select,
.loop-step-row input[type="number"] {
    flex: 1;
    background: white;
    color: #333;
    border: 2px solid #ddd;
    font-weight: 600;
}

.loop-step-row select:focus,
.loop-step-row input[type="number"]:focus {
    border-color: #667eea;
    background: white;
}

.loop-config-row input[type="number"] {
    background: white;
    color: #333;
    border: 2px solid #ddd;
    font-weight: 600;
}

.loop-config-row input[type="number"]:focus {
    border-color: #667eea;
    background: white;
}

.loop-add-step {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

.loop-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* Save Options Modal */
.save-options-content {
    max-width: 600px;
}

.save-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.save-option-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.save-option-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.save-option-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.save-option-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 18px;
}

.save-option-card p {
    color: #666;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .save-options-grid {
        grid-template-columns: 1fr;
    }
}

/* Countdown Overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.countdown-number {
    font-size: 120px;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 40px rgba(102, 126, 234, 0.8);
    animation: countdown-pulse 1s ease-in-out;
}

@keyframes countdown-pulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.countdown-label {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 600;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 1cm;
    }

    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .container {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }

    /* Nascondi tutto tranne il pentagramma */
    .app-header,
    .sequencer-wrapper,
    .staff-actions {
        display: none !important;
    }

    .staff-container {
        display: block !important;
        background: white;
        padding: 0;
        margin: 0;
    }

    .staff-container h2 {
        margin-top: 0;
        page-break-after: avoid;
    }

    #staff-canvas {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
    }
}

@media (max-width: 1024px) {
    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .toolbar-divider {
        display: none;
    }

    .transport-section {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

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

    .logo h1 {
        font-size: 18px;
    }

    .preset-slots {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .slots-container {
        width: 100%;
    }

    .slot-btn {
        min-width: 80px;
        font-size: 11px;
        padding: 6px 10px;
    }

    .logo-icon {
        font-size: 24px;
    }

    .btn-text {
        display: none;
    }

    .header-top {
        padding: 12px 15px;
    }

    .toolbar {
        padding: 12px 15px;
    }

    .toolbar-section {
        width: 100%;
    }

    .input-text {
        width: 100%;
    }

    .step {
        width: 30px;
        height: 30px;
    }

    .instrument-label {
        min-width: 100px;
        font-size: 11px;
    }

    .bar-numbers {
        padding-left: 122px;
    }

    .bar-number {
        font-size: 10px;
        padding: 4px 6px;
        gap: 4px;
    }

    .bar-copy-btn {
        width: 16px;
        height: 16px;
        font-size: 12px;
    }
}

/* ===== GROOVE LIBRARY ===== */
.groove-library-content {
    max-width: 850px;
    width: 90%;
}

.groove-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.groove-tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.groove-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px 8px 0 0;
}

.groove-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.groove-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.groove-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.groove-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
    transform: translateX(5px);
}

.groove-info {
    flex: 1;
}

.groove-number {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    margin-right: 15px;
}

.groove-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.groove-details {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.groove-actions {
    display: flex;
    gap: 10px;
}

.btn-groove {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-groove.preview {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-groove.preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.btn-groove.load {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-groove.load:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.groove-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

/* ===== CUSTOM SAMPLES ===== */
.custom-sample-content {
    max-width: 500px;
    width: 90%;
}

.custom-sample-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.file-input {
    width: 100%;
    padding: 10px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.file-info {
    margin-top: 5px;
}

.file-info small {
    color: #666;
    font-size: 12px;
}

.error-message {
    padding: 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c33;
    margin-bottom: 15px;
    font-size: 14px;
}

.info-message {
    padding: 12px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    color: #0066cc;
    margin-bottom: 15px;
    font-size: 14px;
}

.custom-sample-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== CONCERT MODE ===== */
.concert-mode-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 10000;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.exit-concert-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
}

.exit-concert-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.concert-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 40px;
    gap: 30px;
    box-sizing: border-box;
    visibility: visible;
    opacity: 1;
    position: relative;
    z-index: 10001;
}

/* Info Display */
.concert-info-display {
    text-align: center;
    color: white;
    width: 100%;
    display: block;
    visibility: visible;
    opacity: 1;
}

.concert-pattern-name {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    display: block;
    visibility: visible;
    opacity: 1;
    z-index: 1;
}

.concert-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    font-size: 28px;
    visibility: visible;
    opacity: 1;
}

.concert-stat {
    display: flex;
    gap: 10px;
    align-items: center;
}

.concert-stat-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.concert-stat-value {
    color: #4facfe;
    font-weight: bold;
    min-width: 80px;
    text-align: left;
}

/* BPM Control */
.concert-bpm-control {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    visibility: visible;
    opacity: 1;
}

.concert-bpm-label {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.concert-bpm-display {
    font-size: 56px;
    font-weight: bold;
    color: #4facfe;
    min-width: 150px;
    text-align: center;
}

.concert-bpm-buttons {
    display: flex;
    gap: 10px;
}

.concert-bpm-btn {
    width: 60px;
    height: 60px;
    font-size: 32px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.concert-bpm-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.6);
}

/* Transport Controls */
.concert-transport {
    display: flex;
    gap: 40px;
    visibility: visible;
    opacity: 1;
}

.concert-btn {
    width: 220px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.concert-btn:active {
    transform: scale(0.95);
}

.concert-btn-play {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.concert-btn-play:hover {
    box-shadow: 0 8px 24px rgba(56, 239, 125, 0.5);
}

.concert-btn-play.playing {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.concert-btn-stop {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.concert-btn-stop:hover {
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.5);
}

.concert-btn-icon {
    font-size: 48px;
    color: white;
}

.concert-btn-label {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

/* Preset Buttons */
.concert-presets {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 1200px;
    visibility: visible;
    opacity: 1;
}

.concert-preset-btn {
    height: 100px;
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.concert-preset-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.concert-preset-btn:active {
    transform: scale(0.95);
}

.concert-preset-btn.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: #4facfe;
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.concert-preset-btn.empty {
    opacity: 0.3;
    cursor: not-allowed;
}

.concert-preset-btn.empty:hover {
    transform: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

/* Responsive for smaller screens */
@media (max-width: 1024px) {
    .concert-pattern-name {
        font-size: 36px;
    }

    .concert-stats {
        font-size: 20px;
        gap: 20px;
    }

    .concert-bpm-display {
        font-size: 42px;
    }

    .concert-btn {
        width: 180px;
        height: 120px;
    }

    .concert-btn-icon {
        font-size: 40px;
    }

    .concert-btn-label {
        font-size: 20px;
    }

    .concert-preset-btn {
        height: 80px;
        font-size: 28px;
    }
}

/* Touch optimization */
@media (hover: none) {
    .concert-btn:hover,
    .concert-preset-btn:hover,
    .concert-bpm-btn:hover,
    .exit-concert-btn:hover {
        transform: none;
    }
}

/* ===== SUPPORT / DONATION SYSTEM ===== */

/* Support button in header */
.support-btn-header {
    background: linear-gradient(135deg, #fd9644 0%, #e67e22 100%) !important;
    border-color: #fd9644 !important;
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(253, 150, 68, 0.5); }
    50% { box-shadow: 0 0 15px rgba(253, 150, 68, 0.8); }
}

.support-btn-header:hover {
    background: linear-gradient(135deg, #e67e22 0%, #ca6f1e 100%) !important;
    transform: scale(1.05) !important;
}

/* Support Banner */
.support-banner {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.5s ease;
    position: relative;
    z-index: 1000;
}

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

.support-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.support-banner-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.support-banner-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.support-banner-btn {
    background: white;
    color: #4facfe;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.support-banner-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.support-banner-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    flex-shrink: 0;
}

.support-banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Support Pop-up Modal */
.support-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.support-popup-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    text-align: center;
}

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

.support-popup-content h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.support-popup-content p {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
}

.support-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.support-popup-btn {
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
    display: block;
}

.support-popup-btn-primary {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.support-popup-btn-primary:hover {
    background: linear-gradient(135deg, #ff5252 0%, #dd4a5f 100%);
    transform: scale(1.05);
}

.support-popup-btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
}

.support-popup-btn-success:hover {
    background: linear-gradient(135deg, #4a9628 0%, #95c955 100%);
    transform: scale(1.05);
}

.support-popup-btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.support-popup-btn-secondary:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

/* Support Section in Info Modal */
.support-section {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    border: 2px solid rgba(79, 172, 254, 0.3);
}

.support-section h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #333;
}

.support-section p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.support-section ul {
    margin: 15px 0;
    padding-left: 20px;
}

.support-section li {
    margin: 8px 0;
    line-height: 1.6;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .support-banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .support-banner-btn,
    .support-banner-close {
        align-self: stretch;
        text-align: center;
    }

    .support-popup-content {
        padding: 30px 20px;
    }

    .support-section {
        padding: 20px;
    }
}

