.timeline-container {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000000 !important;
    opacity: 1 !important;
}

.timeline-container.readonly-mode .timeline-scroll-area {
    opacity: 0.9;
    cursor: default;
}
.timeline-container.readonly-mode .timeline-content * {
    pointer-events: none;
}

.timeline-header {
    width: 150px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    background-color: var(--bg-primary);
    cursor: grab;
    z-index: 20;
    /* Keep header above content */
}

.timeline-scroll-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.timeline-scroller {
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    width: 100%;
}

.timeline-scroll-area:active {
    cursor: grabbing;
}

.timeline-content {
    position: relative;
    /* Width is set by JS based on song length */
    background-color: transparent;
    z-index: 10;
    pointer-events: auto;
}

/* Tab Track */
.tab-track {
    height: 100px;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    background-color: transparent;
    /* Fix: Remove gray */
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.tab-track:hover {
    background-color: rgba(30, 30, 30, 0.7);
}

.tab-track[data-type="chord"] {
    height: 50px;
    cursor: pointer;
    overflow: visible;
}

/* ... (unchanged lines) ... */

/* Cursor Line (Playhead) - Dynamic positioning */
.cursor-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background-color: #ef4444; /* Red-500 */
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    display: none; /* Only show when needed */
}

.cursor-line.visible {
    display: block;
}


.tab-track[data-type="chord"]:hover {
    background-color: rgba(255, 183, 77, 0.1);
}

/* Track Labels - matching view-tab button style */
.track-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    width: 150px;
}

.track-label[data-track="section"] {
    height: 40px;
}

.track-label[data-track="chord"] {
    height: 50px;
}

.track-label[data-track="tab"] {
    height: 100px;
}

.track-label[data-track="lyrics"] {
    height: 50px;
}

.tab-track[data-type="lyrics"] {
    height: 50px;
    cursor: pointer;
    position: relative;
}

.tab-track[data-type="lyrics"]::before {
    content: 'クリックして歌詞を入力';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    opacity: 0.65;
    letter-spacing: 0.05em;
}

.tab-track[data-type="lyrics"]:has(.lyric-item)::before {
    display: none;
}

.tab-track[data-type="lyrics"]:hover {
    background-color: rgba(255, 183, 77, 0.1);
}

.tab-track[data-type="section"] {
    height: 40px;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
    /* Keep above other tracks */
}

.section-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    padding: 0 8px;
    background-color: var(--accent-color);
    color: var(--bg-primary);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    white-space: nowrap;
    border-left: 2px solid #fff;
    opacity: 0.9;
    z-index: 5;
    transition: opacity 0.2s;
}

.section-marker:hover {
    opacity: 1;
    z-index: 100;
}

.tab-track[data-type="tab"] {
    padding: 10px 0;
}

/* String Lines - Highly Visible */
.string-line {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 1;
    /* Below grid cells */
}

/* String visual - centered in the row */
.string-line::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    /* Default thickness */
    background-color: rgba(200, 200, 200, 0.7);
    pointer-events: none;
    transition: background-color 0.2s ease, height 0.2s ease;
    z-index: 2;
    /* Below grid cells */
}

/* String thickness: thicker for lower strings (4 = thickest, 1 = thinnest for bass) */
.string-line[data-string="4"]::before {
    height: 4px;
    background-color: rgba(170, 170, 170, 0.8);
    /* Wound string color */
}

.string-line[data-string="3"]::before {
    height: 3px;
    background-color: rgba(180, 180, 180, 0.8);
}

.string-line[data-string="2"]::before {
    height: 2px;
    background-color: rgba(200, 200, 200, 0.7);
}

.string-line[data-string="1"]::before {
    height: 1.5px;
    background-color: rgba(220, 220, 220, 0.7);
}

/* Guitar 6-string support */
.string-line[data-string="6"]::before {
    height: 5px;
    background-color: rgba(150, 150, 150, 0.8);
}

.string-line[data-string="5"]::before {
    height: 4px;
    background-color: rgba(160, 160, 160, 0.8);
}

.string-line:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.string-line:hover::before {
    height: 3px;
    background-color: var(--accent-color);
}

/* Grid Cell Placeholder (Step Sequencer Interaction) */
.grid-cell-placeholder {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: transparent;
    border: 1px solid transparent;
    transform: translate(-50%, -50%);
    /* Centered on string/beat intersection */
    z-index: 10;
    cursor: crosshair;
    border-radius: 4px;
    /* Phase 2: スムーズなカーソル移動 */
    transition: all 0.15s ease-out;
}

.grid-cell-placeholder:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.grid-cell-placeholder.cursor-active {
    background-color: rgba(255, 183, 77, 0.3);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
    /* Phase 2: 呼吸アニメーション */
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Phase 2: カーソル移動時のパルスエフェクト */
.grid-cell-placeholder.pulse {
    animation: pulse-scale 0.3s ease-out;
}

/* Phase 2: 呼吸アニメーション */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 8px var(--accent-color);
    }

    50% {
        box-shadow: 0 0 15px var(--accent-color);
    }
}

/* Phase 2: パルスアニメーション */
@keyframes pulse-scale {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.15);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Notes */
.note {
    position: absolute;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background-color: var(--bg-secondary);
    color: var(--accent-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 5;
    transform: translate(-50%, -50%);
    cursor: pointer;
    border: 1px solid var(--accent-color);
    white-space: nowrap;
    /* Phase 2: フェードインアニメーション */
    animation: fadeIn 0.2s ease-out;
}

/* Phase 2: フェードインアニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.note:hover {
    background-color: var(--accent-color);
    color: var(--accent-text);
    z-index: 100;
}

.note.warning {
    background-color: #ff5252;
    /* Red */
    color: white;
    border-color: #d32f2f;
    box-shadow: 0 0 5px red;
}

/* Note Connection Lines */
.note-connection-line {
    position: absolute;
    height: 1px;
    background-color: var(--accent-color);
    z-index: 3;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.6;
}

/* Chord Items */
.chord-item {
    position: absolute;
    white-space: nowrap;
    color: var(--accent-color);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    z-index: 6;
}

/* Lyrics Items */
.lyric-item {
    position: absolute;
    transform: translateY(-50%);
    white-space: nowrap;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.lyric-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Inline Chord Diagrams */
.inline-chord-diagram {
    position: absolute;
    pointer-events: auto;
    z-index: 15;
}

.inline-chord-diagram svg {
    width: 60px !important;
    height: 75px !important;
    display: block;
}

/* Chord Chart Container (keep for backward compatibility) */
.chord-chart-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    opacity: 0;
}

/* Cursor Line (Now in scroll-area, fixed center) */
.cursor-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: transparent;
    border-left: 2px solid #ff5252;
    z-index: 50;
    pointer-events: none;
    transform: translateX(-50%);
    display: block;
    /* Ensure it's visible initially */
}

/* Loop Markers & Region */
.loop-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: var(--accent-color);
    z-index: 15;
    pointer-events: auto;
    /* Enable dragging */
    cursor: ew-resize;
    /* Indicate horizontal resize */
}

.loop-marker:hover {
    box-shadow: 0 0 5px var(--accent-color);
    width: 4px;
    /* Slightly wider on hover */
}

.loop-marker::after {
    content: attr(data-label);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color);
    color: var(--bg-primary);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 2px;
}

.loop-region {
    position: absolute;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 229, 255, 0.1);
    /* Accent with low opacity */
    z-index: 5;
    pointer-events: none;
    border-left: 1px dashed var(--accent-color);
    border-right: 1px dashed var(--accent-color);
}