:root {
    --background-color: #fafafa;
}

body {
    background: var(--background-color);
}

#controls {
    position: sticky;
    top: 0;
    background: var(--background-color);
    z-index: 60; /* Above season labels */
    padding-bottom: 10px;
}

#subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: bold;
    font-size: 15px;
    color: #666;
    line-height: 1.5;
}

.bar {
    stroke-width: 3;
    stroke: var(--background-color);
}

.tooltip-donut {
    position: fixed;  /* Changed from absolute - fixed is better for transforms */
    padding: 12px 14px;  /* Reduced from 14px 16px */
    background: #fcfcfc;  /* Softer white instead of pure white */
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.4;  /* Tighter line-height */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    opacity: 0;
    min-width: 280px;
    max-width: 360px;
    box-sizing: border-box;
    pointer-events: none;  /* Prevent tooltip from interfering with mouse events */
    left: 0;
    top: 0;
    will-change: transform;  /* Hint to browser for GPU acceleration */
    z-index: 1000;  /* Ensure tooltip is above all other elements */
}

.tooltip-donut.pinned {
    pointer-events: auto;  /* Re-enable when pinned so links are clickable */
}

.tooltip-song-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;  /* Slightly darker for contrast */
    margin: 0 0 4px 0;  /* Reduced from 6px */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.tooltip-info {
    color: #666;
    font-size: 12px;
    margin: 3px 0;  /* Reduced from 2px for tighter spacing */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-date-venue {
    color: #846075;
    font-size: 13px;
    font-weight: 600;
    margin: 4px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-info strong {
    color: #1a1a1a;
    font-weight: 500;
}

.tooltip-album-cover {
    float: right;
    width: 48px;  /* Slightly smaller */
    height: 48px;
    border-radius: 2px;
    margin-left: 10px;
    margin-bottom: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.tooltip-links {
    margin-top: 6px;  /* Reduced spacing */
    padding-top: 6px;
    border-top: 1px solid #e9ecef;
}

.tooltip-links a {
    display: inline-block;
    color: #4281A4;
/*    text-decoration: none;*/
    font-size: 12px;
}

.tooltip-links a:hover {
/*    text-decoration: underline;*/
}


.year-label {
    font-family: sans-serif;
    font-size: 12px;
    font-weight: bold;
    margin-left: 20px;
}

.set-label {
    font-family: sans-serif;
    font-size: 10px;
    font-weight: bold;
    margin-left: 20px;
}

#selectButton {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    padding: 6px 32px 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: var(--background-color);
    color: #333;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"%3E%3Cpath fill="%23666" d="M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* Style the label */
label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

h1 {
    font-family: Georgia, 'Times New Roman', serif;  // Serif for main title
    font-size: 32px;
    font-weight: bold;
    color: #333;  // Dark gray instead of blue
    margin-top: 0;
    margin-bottom: 8px;
}

#help-icon {
    position: fixed;
    top: 15px;
    right: 10px;
    width: 37px;
    height: 37px;
    cursor: pointer;
    z-index: 70;
}

#search-container {
    position: fixed;
    top: 21px;
    right: 60px;
    z-index: 70;
}

#song-search {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: var(--background-color);
    color: #333;
    width: 200px;
    outline: none;
}

#song-search:focus {
    border-color: #999;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 80;
}

#search-results.active {
    display: block;
}

.search-result-item {
    padding: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f4f4f4;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 4px;
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 80px);
    border-radius: 4px 4px 0 0;
}

#modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 32px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

#modal-close:hover {
    color: #333;
}

.modal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-radius: 0 0 4px 4px;
}

.modal-nav button {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-nav button:hover {
    background: var(--background-color);
    border-color: #999;
    color: #333;
}

.modal-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#slide-counter {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #666;
}

#sticky-season-labels {
    position: sticky;
    top: 80px; /* Below controls - reduced gap */
    height: 30px;
    background: var(--background-color);
    z-index: 50;
    overflow-x: auto;
    overflow-y: hidden;
    margin-left: 90px; /* align with chart data */
    will-change: transform;
    max-width: calc(100vw - 90px); /* match svg-container width */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    border-bottom: 1px solid rgba(224, 224, 224, 0.5); /* Match year divider: #e0e0e0 with 0.5 opacity */
}

#sticky-season-labels::-webkit-scrollbar {
    display: none; /* Hide scrollbar but keep scrolling functionality */
    width: 0;
    height: 0;
}

.sticky-season-label {
    position: absolute;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #999;
    top: 10px;
    transition: left 0.2s ease-out;
}

#chart-wrapper {
    position: relative;
    display: flex;
    margin-top: -55px; /* Pull up to eliminate MARGINS.top whitespace */
}

#labels-container {
    position: sticky;
    left: 0;
    width: 90px; /* matches MARGINS.left */
    background: var(--background-color);
    z-index: 10;
    flex-shrink: 0;
    padding-top: 55px; /* Match MARGINS.top to align content */
}

#labels-container::after {
    content: '';
    position: absolute;
    right: 0;
    top: 55px; /* Start border at MARGINS.top */
    bottom: 0;
    width: 1px;
    background: rgba(224, 224, 224, 0.5); /* Match year divider style */
}

#svg-container {
    overflow-x: auto;
    overflow-y: hidden;
}

#svg-container svg {
    margin-left: -80px; /* Pull SVG left to reduce gap, adjust as needed */
}

#fixed-scrollbar {
    position: fixed;
    bottom: 30px;
    left: 90px; /* offset by labels width */
    right: 0;
    height: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--background-color);
    border-top: 1px solid #e0e0e0;
    z-index: 100;
}

#scrollbar-content {
    height: 1px;
    width: 3600px; /* matches CHART_WIDTH */
}

.fixed-year-label {
    position: absolute;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 600;
    fill: #666;
    color: #666;
    text-align: right;
    width: 75px;
    right: 15px;
}

.fixed-set-label {
    position: absolute;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 500;
    fill: #999;
    color: #999;
    text-align: right;
    width: 75px;
    right: 15px;
}

select,
text,
h2,
h3,
h4,
h5,
h6 {
    color: #333;
    font-weight: 700;
    line-height: 1.15;
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-family: sans-serif;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--background-color);
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 11px;
    color: #999;
    line-height: 30px;
    z-index: 99;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#footer a {
    color: #666;
    text-decoration: none;
}

#footer a:hover {
    color: #333;
    text-decoration: underline;
}

#mobile-bottom-message {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 30px 20px;
    line-height: 1.4;
}

#info-icon {
    display: none;
    position: fixed;
    bottom: 15px;
    right: 10px;
    width: 37px;
    height: 37px;
    cursor: pointer;
    z-index: 150;
}

#controls-fab {
    display: none;
    position: fixed;
    bottom: 15px;
    left: 15px;
    width: 37px;
    height: 37px;
    cursor: pointer;
    z-index: 150;
}

#controls-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
}

#controls-panel-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--background-color);
    border-radius: 12px;
    padding: 24px;
    width: calc(100vw - 80px);
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#controls-panel.active {
    display: block;
}

#controls-panel label {
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    letter-spacing: 0.02em;
}

#controls-panel label:first-of-type {
    margin-top: 0;
}

#controls-panel select,
#controls-panel input {
    width: 100%;
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 400;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    box-sizing: border-box;
}

#controls-panel select {
    padding-right: 36px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"%3E%3Cpath fill="%23666" d="M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

#controls-panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 22px;
    font-weight: 200;
    color: #333;
    cursor: pointer;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#mobile-search-results {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 8px;
    display: none;
    box-sizing: border-box;
    width: 100%;
}

#mobile-search-results.active {
    display: block;
}

#mobile-search-results .search-result-item {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    background: white;
}

#mobile-search-results .search-result-item:first-child {
    border-radius: 6px 6px 0 0;
}

#mobile-search-results .search-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

#mobile-search-results .search-result-item:active {
    background: #f8f8f8;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    h1 {
        font-size: 16px;
        margin-bottom: 0;
        padding: 5px 8px;
        line-height: 1.3;
    }

    #controls {
        padding: 0;
        padding-bottom: 0;
    }

    #chart-wrapper {
        margin-top: -55px;
    }

    #subtitle {
        display: none;
    }

    #selectButton {
        display: none;
    }

    #search-container {
        display: none;
    }

    #song-search {
        width: 100%;
        font-size: 16px; /* Prevent iOS zoom on focus */
        padding: 10px 12px;
    }

    #sticky-season-labels {
        font-size: 10px;
        top: 27px;
        margin-left: 50px;
        height: 20px;
        max-width: none;
        width: calc(100vw - 50px);
    }

    .sticky-season-label {
        font-size: 10px;
        top: 5px;
    }

    .fixed-year-label {
        font-size: 13px;
        width: 40px;
        right: 5px;
    }

    .fixed-set-label {
        font-size: 10px;
        width: 40px;
        right: 5px;
    }

    #labels-container {
        width: 50px;
        padding-top: 30px;
    }

    #fixed-scrollbar {
        display: none !important;
    }

    #scrollbar-content {
        display: none;
    }

    .tooltip-donut {
        position: fixed !important;
        bottom: 35px !important;
        top: auto !important;
        left: 10px !important;
        right: auto !important;
        transform: none !important;
        max-width: calc(100vw - 20px);
        min-width: 0;
        width: auto;
        height: auto;
        padding: 6px 8px;
        line-height: 1.2;
    }

    .tooltip-song-name {
        font-size: 12px;
        margin: 0 0 2px 0;
        line-height: 1.2;
    }

    .tooltip-date-venue {
        font-size: 11px;
        margin: 2px 0;
        line-height: 1.2;
    }

    .tooltip-info {
        font-size: 10px;
        margin: 1px 0;
        line-height: 1.2;
    }

    .tooltip-album-cover {
        display: none;
    }

    .tooltip-links {
        margin-top: 3px;
        padding-top: 3px;
    }

    .tooltip-links a {
        font-size: 11px;
    }

    #footer {
        font-size: 10px;
        display: none;
        z-index: 200;
    }

    #footer.active {
        display: block;
    }

    #info-icon {
        display: block;
    }

    #controls-fab {
        display: block;
        bottom: 10px;
        left: 10px;
        width: 32px;
        height: 32px;
    }

    #info-icon {
        bottom: 10px;
        right: 5px;
        width: 32px;
        height: 32px;
    }

    #help-icon {
        top: 10px;
        right: 5px;
        width: 32px;
        height: 32px;
    }

    #footer {
        font-size: 9px;
        height: 24px;
        line-height: 24px;
    }

    /* Increase touch target size */
    .search-result-item {
        padding: 12px;
        font-size: 14px;
    }

    #mobile-bottom-message {
        display: block;
    }
}