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

:root {
    /* Colors - Voice Parts */
    --color-soprano: #E74C3C;
    --color-alto: #3498DB;
    --color-tenor: #2ECC71;
    --color-bass: #9B59B6;

    /* Colors - UI */
    --color-highlight: #F39C12;
    --color-text-dark: #2C3E50;
    --color-text-medium: #7F8C8D;
    --color-text-light: #95A5A6;
    --color-border: #E8E8E8;
    --color-background: #FFFFFF;
    --color-background-alt: #F5F7FA;

    /* Legacy compatibility - map old vars to new */
    --primary-color: var(--color-alto);
    --primary-hover: #2980B9;
    --secondary-color: var(--color-bass);
    --background: var(--color-background-alt);
    --surface: var(--color-background);
    --text-primary: var(--color-text-dark);
    --text-secondary: var(--color-text-medium);
    --border: var(--color-border);
    --success: var(--color-tenor);
    --danger: var(--color-soprano);
    --shadow: rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
    --font-size-h1: 32px;
    --font-size-h2: 24px;
    --font-size-h3: 20px;
    --font-size-base: 16px;
    --font-size-small: 14px;
    --font-size-tiny: 12px;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.7;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    line-height: var(--line-height-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Global focus styles for accessibility */
*:focus {
    outline: 2px solid var(--color-alto);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-alto);
    outline-offset: 2px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 20px 20px; /* No top padding, 20px on sides and bottom */
}

/* Header */
header {
    padding: 16px 20px;
    background: #dce3ee;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Add a pseudo-element for the gap that stays with the header */
header::after {
    content: '';
    display: block;
    height: 5px;
    background: var(--background);
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

header .header-logo {
    height: 120px;
    width: auto;
}

header .header-center {
    flex: 1;
    text-align: center;
}

header .header-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text-dark);
    margin: 0;
}

header .header-tagline {
    font-size: var(--font-size-small);
    color: var(--color-text-medium);
    margin: 4px 0 0 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.home-link,
.help-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-tenor);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.home-link:hover,
.help-link:hover {
    background: #27ae60;
    transform: scale(1.1);
}

.help-link {
    background: var(--color-alto);
}

.help-link:hover {
    background: #2980b9;
}

header .tagline {
    font-size: var(--font-size-small);
    color: var(--color-text-medium);
    margin: 0;
    font-weight: var(--font-weight-normal);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: var(--primary-color);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--surface);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 91px; /* Stick right below header */
    z-index: 99;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-button:hover {
    background: var(--background);
    color: var(--text-primary);
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Work Info Section */
.work-info-section {
    background: var(--surface);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* On wider screens, arrange work title and share section horizontally */
@media (min-width: 769px) {
    .work-info-section {
        flex-direction: row;
        align-items: flex-start;
        gap: 16px;
    }

    .work-title {
        flex: 1;
    }

    .shareable-url-section {
        flex: 0 0 auto;
        min-width: 300px;
        margin-top: 0;
    }
}

.work-title h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin: 0;
}

.shareable-url-section {
    margin-top: 0;
    display: flex;
    align-items: center;
}

.url-copy-container {
    display: flex;
    gap: 8px;
}

.url-copy-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--background);
    color: var(--text-primary);
}

.url-copy-container button {
    white-space: nowrap;
}

/* Selection Controls */
.selection-controls {
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 5px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.control-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: fit-content;
}

.control-group select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.control-group select:hover {
    border-color: var(--primary-color);
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Content */
main {
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

section {
    margin-bottom: 16px;
}

section:last-child {
    margin-bottom: 0;
}

/* MIDI Input Section */
.midi-input-section {
    margin-bottom: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

#midi-url {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    width: 100%;
}

#midi-url:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Voice Part Section */
.voice-part-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    flex-wrap: wrap;
}

.voice-part-section label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
}

#voice-part,
#channel-selector {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.3s;
}

#voice-part:focus,
#channel-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

#channel-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn .icon {
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-control {
    background: var(--success);
    color: white;
    flex: 1;
}

.btn-control:hover:not(:disabled) {
    background: #229954;
}

.btn-seek {
    background: var(--secondary-color);
    color: white;
    flex: 1;
}

.btn-seek:hover:not(:disabled) {
    background: #6854d6;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 8px 12px;
    min-width: auto;
}

.icon {
    font-size: 1.2rem;
}

/* Status Messages */
.status-message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.error {
    background: #fee;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.status-message.success {
    background: #efe;
    color: var(--success);
    border: 1px solid var(--success);
}

.status-message.info {
    background: #eef;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.status-message.warning {
    background: #fff8e1;
    color: #f57c00;
    border: 1px solid #ffb74d;
    display: block; /* Always show warnings */
}

/* Playback Info */
.playback-info {
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 5px;
    text-align: center;
}

.movement-select-main {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1.3rem;
    font-weight: 600;
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.3s;
}

.movement-select-main:hover {
    border-color: var(--primary-color);
}

.movement-select-main:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.midi-title-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Transport Controls Toolbar */
.transport-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.btn-transport {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: white;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-transport:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

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

.btn-transport:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-transport.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-transport-primary {
    background: var(--success);
    color: white;
    border-color: var(--success);
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.btn-transport-primary:hover:not(:disabled) {
    background: #229954;
    border-color: #229954;
}

.btn-transport i {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 0;
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
    overflow: visible;
}

.progress-header {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    gap: 10px;
}

.progress-info {
    display: flex;
    align-items: center;
}

.bar-jump-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: normal;
}

.bar-jump-inline label {
    margin: 0;
    white-space: nowrap;
}

.bar-jump-inline .bar-jump-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 0.8rem;
}

.bar-jump-inline .btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.progress-time-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.progress-container .slider-container {
    margin-top: 0;
    padding-bottom: 25px;
}

/* Loop Range Display */
.loop-range-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

#loop-range-display {
    color: var(--primary-color);
    font-weight: 600;
}

/* Loop Highlight on Progress Bar */
.loop-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--secondary-color);
    opacity: 0.1;
    pointer-events: none;
    z-index: 1;
    transition: left 0.1s, width 0.1s;
}

/* Loop Markers */
.loop-marker {
    position: absolute;
    bottom: -18px;
    width: 20px;
    height: 20px;
    cursor: grab;
    z-index: 4;
    user-select: none;
    transform: translateX(-50%);
    display: block;
    visibility: visible;
}

.loop-marker:active {
    cursor: grabbing;
}

.loop-marker-triangle {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    display: block;
}

.loop-marker-start .loop-marker-triangle {
    border-bottom: 15px solid #7b68ee;  /* Medium slate blue - matches slider controls */
}

.loop-marker-end .loop-marker-triangle {
    border-bottom: 15px solid #7b68ee;  /* Medium slate blue - matches slider controls */
}

/* Debug: Make start marker more visible */
.loop-marker-start {
    /* Start marker at left edge */
}

.loop-marker-end {
    /* End marker at right edge */
}

.loop-marker-label {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.loop-marker:hover .loop-marker-label,
.loop-marker.dragging .loop-marker-label {
    opacity: 1;
}


/* Tempo Control */
.tempo-control {
    margin-bottom: 5px;
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
}

.tempo-control > label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

#tempo-value {
    color: var(--primary-color);
}

/* Balance Control */
.balance-control {
    margin-bottom: 5px;
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
}

.balance-control > label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

#balance-value {
    color: var(--primary-color);
}

.balance-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Common Slider Container (for tempo, balance, and progress) */
.slider-container {
    position: relative;
    height: 40px;
    margin-top: 0;
    overflow: visible;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.styled-slider {
    position: absolute;
    width: 100%;
    height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: auto;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 2;
    outline: none;
    cursor: pointer;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.styled-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Center marker for sliders (100% for tempo, 0 for balance) */
.slider-center-marker {
    position: absolute;
    width: 2px;
    height: 16px;
    background: var(--color-text-medium);
    top: 50%;
    transform: translate(-50%, -150%);
    pointer-events: none;
    z-index: 3;
    border-radius: 1px;
}

/* Bar Markers */
.bar-markers {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
}

.bar-marker {
    position: absolute;
    width: 1px;
    height: 14px;
    background: rgba(123, 104, 238, 0.3);
    top: 50%;
    transform: translate(-50%, -50%);
}

.bar-marker.major {
    height: 18px;
    background: rgba(123, 104, 238, 0.5);
    width: 2px;
}

.bar-marker-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-bottom: 2px;
}

/* Bar Jump Control */
.bar-jump-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    padding: 6px 8px;
    background: var(--background);
    border-radius: 6px;
}

.bar-jump-control label {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin: 0;
}

.bar-jump-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: center;
}

.bar-jump-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Responsive Design */
/* Medium screens - 2x2 button grid */
@media (max-width: 768px) and (min-width: 481px) {
    .main-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* Small screens - 1x4 button stack */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header {
        padding: 12px 16px;
    }

    header .header-logo {
        height: 70px;
    }

    header .header-title {
        font-size: 1.1rem;
    }

    header .header-tagline {
        font-size: 0.7rem;
    }

    .home-link,
    .help-link {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .header-right {
        gap: 6px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    header p {
        font-size: 0.9rem;
    }

    main {
        padding: 16px;
    }

    .main-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 0.95rem;
    }
}

/* MIDI Selection Section */
.midi-selection-section {
    margin-bottom: 16px;
}

/* Search Section */
.search-section {
    margin-bottom: 16px;
}

.search-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 12px;
}

.search-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-weight: 500;
}

.checkbox-label:hover {
    color: var(--primary-color);
}

.search-results {
    display: none;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 8px;
    background: var(--surface);
}

.result-category {
    padding: 8px 12px;
    background-color: var(--background);
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.result-category strong {
    color: var(--primary-color);
}

.composer-item,
.result-item,
.work-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.composer-item:last-child,
.result-item:last-child,
.work-item:last-child {
    border-bottom: none;
}

.composer-item:hover,
.result-item:hover,
.work-item:hover {
    background-color: var(--background);
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-main {
    font-weight: 600;
    color: var(--text-primary);
}

.result-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.work-item.selected {
    background-color: var(--primary-color);
    color: white;
}

.work-item.selected .result-main,
.work-item.selected .result-sub {
    color: white;
}

.no-results {
    padding: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.works-container,
.movements-container {
    margin-top: 16px;
}

.works-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.movement-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    margin-top: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.3s;
}

.movement-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.recent-works {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
}

.recent-works label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 8px;
}

.recent-works-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-work-item {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.recent-work-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#composer-search {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    width: 100%;
}

#composer-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Settings Tab Styles */
.settings-section {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.settings-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.copyright-section {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
}

.copyright-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.copyright-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.copyright-section a:hover {
    text-decoration: underline;
}

/* Movement Channels Section */
.movement-channels-section {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.movement-channels-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Channels Table */
.channels-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.channels-table thead {
    background: var(--background);
}

.channels-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.channels-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.channels-table tr:hover {
    background: var(--background);
}

.channels-table input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Time Signature Table */
.time-sig-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.time-sig-table thead {
    background: var(--background);
}

.time-sig-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.time-sig-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.time-sig-table tr:hover {
    background: var(--background);
}

.time-sig-table select {
    font-size: 1rem;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card-background);
    color: var(--text-primary);
}

.time-sig-table .ambiguous-warning {
    color: #e67e22;
    font-size: 0.85em;
    font-style: italic;
}

/* Voice Part Dropdown Styling */
#voice-part-settings {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    width: 100%;
    background: var(--surface);
    cursor: pointer;
}

#voice-part-settings:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.help-modal-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: help-modal-slide-in 0.2s ease-out;
}

@keyframes help-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.help-modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.help-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.help-modal-close:hover {
    background: var(--background);
}

.help-modal-body {
    padding: 20px;
}

.help-modal-body p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 1rem;
}

/* Touch tooltip for long-press on mobile */
.touch-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    max-width: 250px;
    text-align: center;
    z-index: 10001;
    pointer-events: none;
    animation: tooltip-fade-in 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
