/* ...existing styles... */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a1a;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

#loopstation-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

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

.time-date {
    font-size: 14px;
    opacity: 0.8;
}

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

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    transition: background 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.06s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.icon-btn:hover {
    background: rgba(255,255,255,0.09);
    box-shadow: 0 4px 10px rgba(0,0,0,0.45);
    transform: none;
}

.icon-btn:focus { outline: 2px solid rgba(0,122,255,0.18); outline-offset: 2px; }

.icon-btn.import-audio-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.05));
    border-color: rgba(255,255,255,0.08);
}

.icon-btn.import-audio-btn:hover {
    background: rgba(255,255,255,0.09);
}

.icon-btn.effect-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.04));
    border-color: rgba(255,255,255,0.06);
}

.icon-btn.effect-btn:hover {
    background: rgba(255,255,255,0.08);
}

.transport-controls {
    display: flex;
    gap: 10px;
}

.play-btn, .record-btn, .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.play-btn { background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.05)); }

.play-btn.playing { background: linear-gradient(180deg, #4caf50, #3fa047); border-color: rgba(0,0,0,0.25); box-shadow: 0 6px 18px rgba(76,175,80,0.18); }

.record-btn { background: linear-gradient(180deg, #ff4b46, #e63935); border-color: rgba(0,0,0,0.18); }

.record-btn.recording { box-shadow: 0 6px 18px rgba(255,59,48,0.18); }

/* New class to match the play button green appearance */
.green-btn {
    background: linear-gradient(180deg, #4caf50, #3fa047);
    border-color: rgba(0,0,0,0.25);
    box-shadow: 0 6px 18px rgba(76,175,80,0.18);
}
.green-btn:hover {
    background: linear-gradient(180deg, #56c05a, #47a052);
    box-shadow: 0 8px 22px rgba(76,175,80,0.20);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.timeline {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-left: 60px;
}

.timeline-numbers {
    display: flex;
    flex: 1;
    justify-content: space-between;
    padding: 0 10px;
}

.timeline-number {
    font-size: 12px;
    opacity: 0.6;
    width: calc(100% / 8);
    text-align: center;
}

.timeline-number.current {
    opacity: 1;
    color: #4caf50;
    font-weight: bold;
}

.tracks-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

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

.track-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.track-icon:hover {
    background: rgba(0, 0, 0, 0.5);
}

.track-icon.muted {
    opacity: 0.3;
}

.track-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.step {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid rgba(0, 0, 0, 0.3);
    position: relative;
    background: rgba(255,255,255,0.02);
}

.step.active {
    filter: brightness(1.3);
    transform: scale(0.95);
}

.step.playing {
    filter: brightness(1.5);
    box-shadow: 0 0 15px currentColor;
}

.step.in-loop {
    border: 2px solid #4caf50;
}

.footer-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
    padding: 10px 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transition: background 0.12s ease, border-color 0.12s ease;
}

.control-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
}

.control-btn.active {
    background: linear-gradient(180deg,#007aff,#0066d6);
    border-color: rgba(0,102,214,0.2);
    box-shadow: 0 8px 18px rgba(0,122,255,0.12);
}

.power-btn {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.06));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.45);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.power-btn.powered-off {
    border-color: rgba(255,59,48,0.9);
    box-shadow: 0 6px 18px rgba(255,59,48,0.12);
}

.power-btn:focus { outline: 2px solid rgba(255,255,255,0.06); outline-offset: 2px; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
}

.modal-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #fff;
}

.slider-container {
    margin: 20px 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007aff;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007aff;
    cursor: pointer;
    border: none;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.modal-btn.primary {
    background: linear-gradient(180deg,#007aff,#0066d6);
    color: #fff;
    border: 1px solid rgba(0,102,214,0.18);
}

.modal-btn.secondary {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
}

.track-selection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.track-selection-btn {
    padding: 15px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.track-selection-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
}

.track-icon-small {
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-name {
    font-size: 12px;
    text-align: center;
}

.track-icon.has-audio {
    position: relative;
}

.track-icon.has-audio::after {
    content: '♪';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.preview-btn, #previewEffectBtn {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.06));
    border: 1px solid rgba(255,255,255,0.06);
}

.preview-btn:hover, #previewEffectBtn:hover {
    background: rgba(255,255,255,0.08);
}

/* ensure modal form elements are spaced */
#effectsControls select, #effectsControls .slider {
    margin-top: 6px;
}

/* Make the effects dropdown a neutral grey with readable text */
#effectsTypeSelect {
    background: #3a3a3a;
    color: #e5e5e5;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 8px;
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

/* Ensure the dropdown shows a subtle border on focus for accessibility */
#effectsTypeSelect:focus {
    border-color: rgba(0,122,255,0.18);
    box-shadow: 0 0 0 4px rgba(0,122,255,0.06);
}

/* Make the option list inherit the same grey background and readable text */
#effectsTypeSelect option {
    background: #3a3a3a;
    color: #e5e5e5;
}

@media (max-width: 768px) {
    .header-controls {
        gap: 8px;
    }

    .icon-btn {
        width: 28px;
        height: 28px;
    }

    .footer-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .control-btn {
        padding: 8px 12px;
        font-size: 10px;
    }

    .track-selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}