* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    overscroll-behavior: none;
}

html {
    height: -webkit-fill-available;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #00d4ff, #7b2ff7, #ff2d95);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: #888;
    font-size: 1rem;
}

section {
    background: #14141f;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #1e1e2e;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #00d4ff;
}

h3 {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 6px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    touch-action: manipulation;
}

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

.btn-record {
    background: #ff2d55;
    color: white;
}

.btn-record:hover:not(:disabled) {
    background: #ff4d6f;
    box-shadow: 0 0 20px rgba(255, 45, 85, 0.4);
}

.btn-record.recording {
    animation: pulse-record 1s ease-in-out infinite;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 45, 85, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 45, 85, 0.8); }
}

.btn-stop {
    background: #555;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: #777;
}

.btn-play, .btn-synth, .btn-compare, .btn-play-seq {
    background: #00d4ff;
    color: #0a0a0f;
}

.btn-play:hover:not(:disabled),
.btn-synth:hover:not(:disabled),
.btn-compare:hover:not(:disabled),
.btn-play-seq:hover:not(:disabled) {
    background: #33ddff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-stop-seq {
    background: #ff6b35;
    color: white;
}

.btn-clear-seq {
    background: #333;
    color: #ccc;
}

.btn-clear-seq:hover {
    background: #444;
}

.record-icon {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    display: inline-block;
}

.stop-icon {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 2px;
    display: inline-block;
}

/* Quick Actions - Top buttons */
.quick-actions-section {
    padding: 16px !important;
    background: linear-gradient(135deg, #14141f, #1a1a2e) !important;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-quick-upload {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #7b2ff7, #5500cc);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    text-align: center;
}

.btn-quick-upload:hover:not(:disabled) {
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(123, 47, 247, 0.4);
}

.btn-quick-record {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ff2d55, #cc0033);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    text-align: center;
}

.btn-quick-record:hover:not(:disabled) {
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(255, 45, 85, 0.4);
}

/* Beat Pad hint */
.pad-hint {
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
    margin-left: 8px;
}

/* Record hint */
.record-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

/* Sequencer hint */
.seq-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

/* Export controls */
.export-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Record Section */
.record-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.recording-status {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 12px;
}

.recording-status.active {
    color: #ff2d55;
    font-weight: 600;
}

canvas {
    width: 100%;
    height: auto;
    background: #0d0d15;
    border-radius: 8px;
    border: 1px solid #1e1e2e;
}

/* Analysis */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.analysis-card {
    background: #1a1a2a;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.analysis-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #7b2ff7;
}

.analysis-unit {
    font-size: 0.8rem;
    color: #666;
}

/* Suggestions */
.suggestion-hint {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-card {
    background: #1a1a2a;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid #2a2a3a;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-card:hover {
    border-color: #7b2ff7;
    background: #1e1e30;
}

.suggestion-card.selected {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.suggestion-info {
    flex: 1;
}

.suggestion-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.suggestion-description {
    font-size: 0.85rem;
    color: #888;
}

.suggestion-match {
    font-size: 1.3rem;
    font-weight: 700;
    color: #00d4ff;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.suggestion-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}

.suggestion-play-btn {
    background: #7b2ff7;
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    flex: 1;
    min-width: 70px;
    text-align: center;
}

.suggestion-play-btn:hover {
    background: #9b4fff;
}

/* Synth Controls */
.synth-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 0.85rem;
    color: #aaa;
}

.control-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #2a2a3a;
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #7b2ff7;
    border-radius: 50%;
    cursor: pointer;
}

.control-group span {
    font-size: 0.8rem;
    color: #666;
    text-align: right;
}

.synth-play-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Beat Pad */
.beat-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.pad {
    aspect-ratio: 1;
    border: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    text-transform: uppercase;
    letter-spacing: 1px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.pad:nth-child(1) { background: linear-gradient(135deg, #ff2d55, #cc0033); color: white; }
.pad:nth-child(2) { background: linear-gradient(135deg, #ff6b35, #cc4400); color: white; }
.pad:nth-child(3) { background: linear-gradient(135deg, #ffd60a, #ccaa00); color: #333; }
.pad:nth-child(4) { background: linear-gradient(135deg, #30d158, #22a244); color: white; }
.pad:nth-child(5) { background: linear-gradient(135deg, #00d4ff, #0099cc); color: #0a0a0f; }
.pad:nth-child(6) { background: linear-gradient(135deg, #7b2ff7, #5500cc); color: white; }
.pad:nth-child(7) { background: linear-gradient(135deg, #bf5af2, #9933cc); color: white; }
.pad:nth-child(8) { background: linear-gradient(135deg, #ff2d95, #cc0066); color: white; }

.pad:active {
    transform: scale(0.92);
    filter: brightness(1.3);
}

.pad.active {
    animation: pad-flash 0.15s ease-out;
}

@keyframes pad-flash {
    0% { transform: scale(0.92); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Sequencer */
.sequencer-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sequencer-controls label {
    color: #aaa;
    font-size: 0.9rem;
}

.sequencer-controls input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1a2a;
    color: #e0e0e0;
    font-size: 0.9rem;
    text-align: center;
}

.sequencer-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-x: auto;
}

.seq-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.seq-label {
    width: 70px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    flex-shrink: 0;
}

.seq-step {
    width: 36px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #2a2a3a;
    background: #1a1a2a;
    cursor: pointer;
    transition: all 0.1s;
    flex-shrink: 0;
    touch-action: manipulation;
}

.seq-step:hover {
    border-color: #444;
}

.seq-step.active {
    border-color: transparent;
}

.seq-step.playing {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.seq-step:nth-child(4n+2) { /* every 4th beat marker */
    margin-left: 4px;
}

.seq-row:nth-child(1) .seq-step.active { background: #ff2d55; }
.seq-row:nth-child(2) .seq-step.active { background: #ff6b35; }
.seq-row:nth-child(3) .seq-step.active { background: #ffd60a; }
.seq-row:nth-child(4) .seq-step.active { background: #30d158; }
.seq-row:nth-child(5) .seq-step.active { background: #00d4ff; }
.seq-row:nth-child(6) .seq-step.active { background: #7b2ff7; }
.seq-row:nth-child(7) .seq-step.active { background: #bf5af2; }
.seq-row:nth-child(8) .seq-step.active { background: #ff2d95; }

/* ML Classification */
.ml-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #2a2a3a;
}

.ml-section h3 {
    color: #ff2d95;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.ml-results {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ml-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #2a2a3a;
}

.ml-tag.top {
    background: rgba(123, 47, 247, 0.2);
    border-color: #7b2ff7;
    color: #bf9aff;
}

.ml-tag .ml-confidence {
    font-size: 0.75rem;
    opacity: 0.7;
}

.ml-correction {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ml-correction span {
    font-size: 0.8rem;
    color: #888;
}

.ml-correction select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1a2a;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.btn-small {
    padding: 4px 12px;
    font-size: 0.8rem;
    background: #333;
    color: #ccc;
    border-radius: 6px;
}

.btn-small:hover {
    background: #444;
}

.ml-stats {
    font-size: 0.75rem;
    color: #555;
    margin-top: 8px;
}

/* Freesound Section */
.freesound-api-toggle {
    margin-bottom: 12px;
}

.freesound-api-toggle summary {
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
    margin-bottom: 8px;
}

.freesound-api-toggle summary:hover {
    color: #00d4ff;
}

.freesound-config {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.input-api-key {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1a1a2a;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.input-api-key:focus {
    border-color: #7b2ff7;
    outline: none;
}

.api-link {
    font-size: 0.8rem;
    color: #00d4ff;
    text-decoration: none;
}

.api-link:hover {
    text-decoration: underline;
}

.freesound-hint {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 12px;
}

.freesound-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.freesound-card {
    background: #1a1a2a;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #2a2a3a;
    transition: all 0.2s;
}

.freesound-card:hover {
    border-color: #7b2ff7;
}

.freesound-card-info {
    flex: 1;
    min-width: 0;
}

.freesound-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.freesound-card-meta {
    font-size: 0.75rem;
    color: #666;
}

.freesound-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.freesound-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #2a2a3a;
    border-radius: 4px;
    color: #aaa;
}

.freesound-play-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: #30d158;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.freesound-play-btn:hover {
    background: #40e168;
}

.freesound-play-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.freesound-rating {
    font-size: 0.8rem;
    color: #ffd60a;
    white-space: nowrap;
}

/* Export buttons */
.btn-export {
    background: #30d158;
    color: white;
    font-size: 0.85rem;
    padding: 8px 16px;
}

.btn-export:hover:not(:disabled) {
    background: #40e168;
    box-shadow: 0 0 15px rgba(48, 209, 88, 0.3);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #444;
    font-size: 0.8rem;
}

/* Panel toggles (collapsible sections) */
.panel-toggle {
    font-size: 1rem;
    font-weight: 600;
    color: #00d4ff;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
}

.panel-toggle::-webkit-details-marker {
    display: none;
}

.panel-toggle::before {
    content: '+ ';
    color: #666;
}

details[open] > .panel-toggle::before {
    content: '- ';
}

.panel-content {
    margin-top: 16px;
}

/* Timeline */
.timeline-section {
    padding: 16px !important;
}

.timeline-container {
    position: relative;
}

.tl-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.tl-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tl-btn-play {
    background: #30d158 !important;
    color: white !important;
    padding: 8px 18px !important;
    font-size: 0.85rem !important;
}

.tl-btn-stop {
    background: #ff6b35 !important;
    color: white !important;
    padding: 8px 18px !important;
    font-size: 0.85rem !important;
}

.tl-btn-upload {
    background: #7b2ff7 !important;
    color: white !important;
    padding: 8px 14px !important;
    font-size: 0.8rem !important;
}

.tl-btn-zoom {
    background: #2a2a3a !important;
    color: #ccc !important;
    padding: 6px 12px !important;
    font-size: 1rem !important;
    min-width: 32px;
}

.tl-btn-stems {
    background: #00d4ff !important;
    color: #0a0a0f !important;
    padding: 8px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
}

.tl-btn-record {
    background: #ff2d55 !important;
    color: white !important;
    padding: 8px 14px !important;
    font-size: 0.8rem !important;
}

.tl-btn-clear {
    background: #333 !important;
    color: #aaa !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.tl-time {
    font-family: monospace;
    font-size: 1.1rem;
    color: #00d4ff;
    min-width: 65px;
}

.tl-bpm-label {
    color: #aaa;
    font-size: 0.85rem;
}

.tl-bpm-input {
    width: 55px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1a2a;
    color: #e0e0e0;
    font-size: 0.85rem;
    text-align: center;
}

.tl-scroll-area {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    background: #0d0d15;
}

.tl-ruler {
    height: 24px;
    position: relative;
    border-bottom: 1px solid #2a2a3a;
    background: #111;
    min-width: 100%;
}

.tl-ruler-mark {
    position: absolute;
    top: 4px;
    font-size: 0.65rem;
    color: #666;
    transform: translateX(-50%);
}

.tl-tracks-area {
    display: flex;
    min-width: 100%;
}

.tl-labels {
    width: 70px;
    flex-shrink: 0;
    border-right: 1px solid #2a2a3a;
    background: #111;
    position: sticky;
    left: 0;
    z-index: 2;
}

.tl-label {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    border-bottom: 1px solid #1a1a2a;
    gap: 2px;
}

.tl-label-name {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.tl-label-btns {
    display: flex;
    gap: 2px;
}

.tl-mute-btn {
    width: 18px;
    height: 18px;
    border: 1px solid #444;
    border-radius: 3px;
    background: transparent;
    color: #666;
    font-size: 0.55rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tl-mute-btn.active {
    background: #ff2d55;
    color: white;
    border-color: #ff2d55;
}

.tl-grid {
    position: relative;
    flex: 1;
    min-width: 0;
}

.tl-track-lane {
    height: 44px;
    position: relative;
    border-bottom: 1px solid #1a1a2a;
}

.tl-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #1a1a2a;
    pointer-events: none;
}

.tl-grid-line.tl-grid-measure {
    background: #2a2a3a;
}

.tl-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff2d55;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(255, 45, 85, 0.5);
}

.tl-clip {
    position: absolute;
    top: 3px;
    height: 38px;
    border-radius: 4px;
    border: 1px solid;
    cursor: grab;
    overflow: hidden;
    display: flex;
    align-items: center;
    min-width: 8px;
    z-index: 1;
}

.tl-clip:active {
    cursor: grabbing;
    z-index: 3;
    filter: brightness(1.2);
}

.tl-clip-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    position: absolute;
    top: 2px;
    left: 2px;
    z-index: 1;
}

.tl-clip-waveform {
    position: absolute;
    top: 7px;
    left: 0;
    width: 100%;
    height: 30px;
    opacity: 0.7;
}

.tl-clip-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #ccc;
    font-size: 0.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.tl-clip:hover .tl-clip-del {
    opacity: 1;
}

/* Suggestion timeline button */
.suggestion-timeline-btn {
    background: #2a2a3a;
    border: 1px solid #444;
    color: #aaa;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    flex: 1;
    min-width: 70px;
    text-align: center;
}

.suggestion-timeline-btn:hover {
    background: #7b2ff7;
    color: white;
    border-color: #7b2ff7;
}

/* Freesound timeline button */
.freesound-timeline-btn {
    padding: 6px 10px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #2a2a3a;
    color: #aaa;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.freesound-timeline-btn:hover {
    background: #7b2ff7;
    color: white;
    border-color: #7b2ff7;
}

/* Stem assignment modal */
.tl-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tl-modal-content {
    background: #14141f;
    border: 1px solid #2a2a3a;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.tl-modal-content h3 {
    color: #00d4ff;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.tl-modal-hint {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.tl-stem-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.tl-stem-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a1a2a;
    border-radius: 8px;
    padding: 10px 12px;
}

.tl-stem-filename {
    flex: 1;
    font-size: 0.85rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tl-stem-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #0d0d15;
    color: #e0e0e0;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.tl-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.tl-btn-confirm {
    background: #30d158 !important;
    color: white !important;
    padding: 10px 24px !important;
    font-size: 0.9rem !important;
}

.tl-btn-cancel {
    background: #333 !important;
    color: #aaa !important;
    padding: 10px 24px !important;
    font-size: 0.9rem !important;
}

/* Generated clips (pattern) - dashed border + slight glow */
.tl-clip-generated {
    border-style: dashed !important;
    animation: gen-clip-glow 2s ease-in-out infinite alternate;
}

@keyframes gen-clip-glow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.15); }
}

/* Pattern generator modal */
.pattern-modal-content {
    max-width: 520px;
}

.pattern-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.pattern-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pattern-field label {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 600;
}

.pattern-select,
.pattern-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1a1a2a;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.pattern-select:focus,
.pattern-input:focus {
    border-color: #7b2ff7;
    outline: none;
}

.pattern-smart-hint {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

.pattern-range-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pattern-range {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #2a2a3a;
    border-radius: 3px;
    outline: none;
}

.pattern-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
}

.pattern-preview {
    background: #0d0d15;
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid #2a2a3a;
}

.pattern-preview-label {
    font-size: 0.75rem;
    color: #666;
    display: block;
    margin-bottom: 6px;
}

.pattern-preview-bar {
    position: relative;
    height: 20px;
    background: #1a1a2a;
    border-radius: 4px;
    margin-bottom: 4px;
    overflow: hidden;
}

.pattern-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 14px;
    background: #00d4ff;
    border-radius: 2px;
    opacity: 0.8;
}

.pattern-preview-count {
    font-size: 0.75rem;
    color: #888;
}

.pattern-btn-preview {
    background: #7b2ff7 !important;
    color: white !important;
    padding: 10px 18px !important;
    font-size: 0.9rem !important;
}

/* Suggestion pattern button */
.suggestion-pattern-btn {
    background: linear-gradient(135deg, #00d4ff, #7b2ff7);
    border: none;
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: all 0.2s;
    flex: 1;
    min-width: 70px;
    text-align: center;
}

.suggestion-pattern-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .app-container { padding: 12px; }
    header h1 { font-size: 1.6rem; }
    .beat-pad { grid-template-columns: repeat(2, 1fr); }
    .seq-step { width: 24px; height: 22px; }
    .seq-label { width: 50px; font-size: 0.65rem; }
    .tl-toolbar { gap: 6px; }
    .tl-label { width: 55px; }
    .tl-labels { width: 55px; }
    .tl-label-name { font-size: 0.55rem; }
    .tl-track-lane { height: 38px; }
    .tl-label { height: 38px; }
    .tl-clip { height: 32px; top: 2px; }
    .tl-actions { gap: 6px; }
    .tl-actions .btn { padding: 6px 10px !important; font-size: 0.75rem !important; }
    .tl-modal-content { padding: 16px; }
}
