css html {
    background-color: #000000;
    width: 100%;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    /* Clean sans-serif */
    background-color: #000000;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    width: 100%;
    /* Force full width */
    overflow-x: hidden;
    /* Prevent horizontal scroll from tooltip */
}

.container {
    background: #000000;
    padding: 40px;
    border: none;
    max-width: 1000px;
    width: 100%;
    text-align: left;
}

/* Header & Info Button */
.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fallback */
    margin-bottom: 40px;
    width: 100%;
}

h1 {
    margin-bottom: 0;
    font-weight: 300;
    font-size: 24px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
}

.icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    /* Blur effect */
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* Above tooltip */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #111;
    border: 1px solid #333;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    margin-top: 0;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 15px;
}

.modal-content strong {
    color: #fff;
    font-weight: 600;
}

.credits {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.social-links a {
    color: #888;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: #fff;
}

#ticker-date {
    position: absolute;
    bottom: 40px;
    right: 40px;
    /* More padding from edge */
    font-size: clamp(40px, 12vw, 80px);
    /* Slightly bigger responsive base */
    font-weight: 700;
    color: #333333;
    z-index: 0;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ======================================== */

/* Intermediate sizing for Tablets (iPad) / Small Laptops */
@media screen and (max-width: 1200px) {
    #ticker-date {
        font-size: 60px !important;
        right: 285px !important;
        bottom: 20px !important;
    }
}

/* Tablet (768px and below) */
@media screen and (max-width: 768px) {
    .container {
        padding: 20px 15px;
        max-width: 100%;
    }

    h1 {
        font-size: 18px;
        letter-spacing: 0.5px;
    }

    .header-controls {
        padding-left: 10px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    #chart-container {
        width: 100% !important;
        height: auto !important;
        margin: 0;
    }

    #ticker-date {
        font-size: 60px;
    }

    .label {
        font-size: 11px;
    }

    .rank-label {
        font-size: 11px;
    }

    .value {
        font-size: 11px;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    #play-pause-btn {
        width: 100%;
        padding: 12px 24px;
    }

    #date-slider {
        width: 100%;
    }

    #speed-selector {
        width: 100%;
        padding: 10px;
    }

    .modal-content {
        padding: 30px 25px;
        max-width: 90%;
    }

    .modal-content h2 {
        font-size: 18px;
    }

    .modal-content p {
        font-size: 14px;
    }
}

/* Mobile (480px and below) */
@media screen and (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }

    body {
        align-items: flex-start;
        /* Align content to top */
        padding-top: 25px;
        /* Small buffer */
    }

    h1 {
        font-size: 18px;
        letter-spacing: 0.3px;
        white-space: normal;
        line-height: 1.3;
    }

    .header-row {
        margin-bottom: 20px;
    }

    .header-controls {
        padding-left: 8px;
    }

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

    .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    #ticker-date {
        font-size: 25px !important;
        opacity: 0.6 !important;
        color: #555 !important;
        bottom: 10px !important;
        right: 10px !important;
    }

    .label {
        font-size: 9px;
    }

    .rank-label {
        font-size: 9px;
    }

    .value {
        font-size: 9px;
    }

    .controls {
        margin-top: 0px;
        /* Pull up to overlap chart gap */
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 10px;
        justify-content: space-between;
    }

    #date-slider {
        order: 1;
        width: 90%;
        margin-bottom: 10px;
    }

    #play-pause-btn {
        order: 2;
        width: 48%;
        /* Slightly less than 50% to account for gap if any, but space-between handles it */
        flex: 1 0 45%;
        padding: 12px 0;
        font-size: 14px;
    }

    #speed-selector {
        order: 3;
        width: 48%;
        flex: 1 0 45%;
        font-size: 14px;
        padding: 10px 0;
    }

    .modal-content {
        padding: 25px 20px;
        border-radius: 15px;
        width: 80%;
        /* Reduced to be clearly not 100% */
    }

    .modal-content h2 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .modal-content p {
        font-size: 13px;
        line-height: 1.5;
    }

    .close-btn {
        font-size: 11px;
        top: 15px;
        right: 15px;
    }

    .social-links {
        gap: 15px;
    }

    .social-links svg {
        width: 20px;
        height: 20px;
    }
}

#chart-container {
    position: relative;
    height: 600px;
    width: 1000px;
    margin: 0 auto;
}

.close-btn {
    position: static;
    display: block;
    margin: 25px auto 0;
    background: transparent;
    border: 1px solid #444;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    padding: 10px 30px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: #fff;
    border-color: #fff;
}

#chart {
    position: relative;
    z-index: 1;
}

.bar {
    opacity: 0.9;
}

.label {
    font-size: 14px;
    font-weight: 400;
    fill: #ffffff;
}

.value {
    font-size: 14px;
    font-weight: 300;
    fill: #888888;
    /* Grey for values to de-emphasize */
}

.controls {
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center controls */
    gap: 20px;
}

button {
    padding: 10px 24px;
    font-size: 14px;
    cursor: pointer;
    background-color: #ffffff;
    color: #000000;
    border: none;
    border-radius: 20px;
    /* Rounded pill button */
    font-weight: 600;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.8;
}

/* Tooltip */
.tooltip {
    position: fixed;
    /* Fixed to viewport to prevent scrollbars */
    text-align: center;
    padding: 8px 12px;
    font: 14px 'Inter', sans-serif;
    background: #333;
    color: #fff;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    /* High z-index */
    transform: translate(-50%, -100%);
    /* Center horizontally, place above cursor by default */
    margin-top: -10px;
    /* Spacing */
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 400px;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 32px;
    /* Bigger touch target */
    width: 32px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -14px;
    /* Center on track */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #333;
    border-radius: 2px;
}

select {
    padding: 10px 20px;
    background-color: #000;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 20px;
    /* Match button */
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    text-align: center;
    text-align-last: center;
    /* Force center for some browsers */
    display: flex;
    justify-content: center;
    align-items: center;
}

select:hover {
    background-color: #111;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}