:root {
    --ticker-padding: unset; /* Dynamically set by JavaScript */
    --ticker-text-color-light: #000; /* Configurable text color for light mode */
    --ticker-text-color-dark: #fff; /* Configurable text color for dark mode */
    --ticker-height: unset; /* Dynamically set by JavaScript */
    --ticker-item-margin: unset; /* Dynamically set by JavaScript */
    --focus-outline-color: unset; /* Dynamically set by JavaScript */
    --ticker-error-padding: 10px; /* Configurable padding for error messages */
    --ticker-error-color: #ffbdbd; /* Configurable error text color */
    --ticker-error-font-size: 1rem; /* Configurable error font size */
    --ticker-popup-width: 300px; /* Configurable popup width */
    --ticker-popup-height: 180px; /* Configurable popup height */
    --ticker-popup-border-radius: 30px; /* Configurable popup border radius */
    --ticker-popup-box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2); /* Configurable popup shadow */
    --bubble-title-font-size: unset; /* Dynamically set by JavaScript */
    --bubble-content-font-size: unset; /* Dynamically set by JavaScript */
    --bubble-background-color: unset; /* Dynamically set by JavaScript */
    --ticker-background-color: unset; /* Dynamically set by JavaScript */
    --ticker-text-color: unset; /* Dynamically set by JavaScript */
}

body {
    margin: 0;
    font-family: sans-serif;
    background-color: #111;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

body.light-mode {
    background-color: #f9f9f9; /* Light mode background */
    color: #222; /* Light mode text color */
}

body.dark-mode {
    background-color: #111; /* Dark mode background */
    color: #fff; /* Dark mode text color */
}

body.ticker-top .ticker-container,
body.ticker-bottom .ticker-container {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 1000;
}

body.ticker-top .ticker-container {
    top: 0;
}

body.ticker-bottom .ticker-container {
    bottom: 0;
}

body.light-mode.ticker-bottom .ticker-container {
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.08); /* Reduced shadow thickness at the top in light mode */
}

.ticker-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    overflow: hidden;
    background-color: var(--ticker-background-color, #222); /* Configurable background color */
    color: var(--ticker-text-color, #fff); /* Configurable text color */
    white-space: nowrap;
    position: relative;
    padding: var(--ticker-padding); /* Use configurable padding */
    min-height: var(--ticker-height); /* Use configurable height */
    z-index: 9999; /* Ensure the ticker stays above other content */
    position: fixed; /* Ensure the ticker is independent of page content */
    left: 0;
    width: 100%;
    z-index: 1000;
}

.centered-text {
    text-align: center;
    margin-bottom: 20px; /* Add spacing below the text */
    margin-top: -180px; /* Adjust text position upwards */
}

.ticker-wrapper {
    overflow: hidden;
}

.ticker {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: scrollTicker linear infinite;
    animation-fill-mode: forwards;
    animation-play-state: running;
    will-change: transform; /* Optimize animation performance */
}

.ticker.paused {
    animation-play-state: paused;
}

.ticker-item {
    display: inline-block;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    font-weight: 500;
    margin: 0 var(--ticker-item-margin); /* Use configurable margin */
}

.ticker-item strong {
    font-weight: 900; /* Increased font weight for the title */
    margin-right: 5px;
}

.ticker-item a {
    color: #000; /* Set link color to black */
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.ticker-item a:hover {
    color: #555; /* Slightly darker color on hover */
}

body.dark-mode .ticker-container {
    background-color: #000; /* Dark mode background */
    color: var(--ticker-text-color-dark); /* Use configurable text color for dark mode */
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1); /* Reduced shadow thickness in dark mode */
}

body.light-mode .ticker-container {
    background-color: #fff; /* Light mode background */
    color: var(--ticker-text-color-light); /* Use configurable text color for light mode */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); /* Reduced shadow thickness in light mode */
}

/* Accessibility: Ensure sufficient contrast ratios for text and background colors */
body.light-mode .ticker a {
    color: #007bff;
}

body.dark-mode .ticker a {
    color: #5daeff; /* Slightly more saturated blue for better visibility */
}

body.dark-mode .ticker a:hover {
    color: #82caff; /* Brighter blue on hover for better contrast */
}

@keyframes scrollTicker {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Animation: Smooth scrolling effect for the ticker */
.ticker-error {
    display: none; /* Hide the error message by default */
    text-align: center;
    padding: var(--ticker-error-padding); /* Use configurable padding */
    color: var(--ticker-error-color); /* Use configurable error text color */
    font-size: var(--ticker-error-font-size); /* Use configurable font size */
    font-weight: 500;
}

.ticker-popup {
    position: absolute;
    padding: 20px; /* Equal padding all around */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align content at the top */
    align-items: flex-start; /* Align content to the left */
    font-family: 'Roboto', sans-serif;
    font-size: var(--bubble-content-font-size, 14px);
    width: var(--ticker-popup-width); /* Use configurable width */
    height: var(--ticker-popup-height); /* Use configurable height */
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    background-color: var(--bubble-background-color, #f9f9f9); /* Unified background color */
    color: #222; /* Unified text color */
    border: none; /* Remove borders */
    border-radius: var(--ticker-popup-border-radius); /* Use configurable border radius */
    font-weight: 500;
    box-shadow: var(--ticker-popup-box-shadow); /* Default shadow */
    cursor: pointer;
}

body.light-mode .ticker-popup {
    box-shadow: none; /* Remove box shadow in light mode */
}

.ticker-popup-title {
    margin: 0 0 8px 0;
    font-size: var(--bubble-title-font-size, 16px);
    width: 100%;
    text-align: left; /* Align title to the left */
    font-weight: 900; /* Increased font weight for the title in the popup */
}

.ticker-popup-content {
    margin: 0; /* Remove extra margin */
    width: 100%;
    text-align: left; /* Align content to the left */
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis; /* Truncate text with ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 6; /* Limit to 6 lines */
    -webkit-box-orient: vertical;
    line-clamp: 6; /* Add standard property for compatibility */
}

.ticker-popup-link {
    margin-top: 10px; /* Add spacing below the content */
    font-size: 12px; /* Slightly smaller font size */
    font-weight: bold; /* Make the URL bold */
    color: inherit; /* Match the text color of the bubble */
    text-align: left; /* Align URL to the left */
    word-wrap: break-word; /* Ensure long URLs wrap properly */
    opacity: 0.8; /* Slightly shade the link */
    text-decoration: none; /* Remove underline */
    transition: opacity 0.2s ease-in-out;
}

.ticker-popup-link:hover {
    opacity: 1; /* Fully visible on hover */
}

.ticker-popup.show {
    opacity: 1;
    transform: translateY(0);
}

.ticker-controls {
    position: absolute;
    right: 10px;
    z-index: 100;
}

.ticker-top .ticker-controls {
    top: 5px;
}

.ticker-bottom .ticker-controls {
    bottom: 5px;
}

.ticker-item a:focus {
    outline: 2px solid var(--focus-outline-color); /* Use configurable focus outline color */
    outline-offset: 2px;
}

/* Responsive Design: Adjustments for different screen sizes */
@media (max-width: 768px) {
    /* Responsive adjustments for smaller screens */
    .ticker-item {
        font-size: clamp(0.75rem, 1.5vw, 1rem); /* Adjust font size */
        margin: 0 20px; /* Reduce margin between items */
    }

    .ticker-container {
        padding: 2px 0; /* Reduce padding for smaller screens */
    }
}

.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0 0 0; /* Ensure 20px spacing above the dashboard */
    padding: 10px;
    background-color: #333;
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.dashboard label {
    margin: 10px 0 5px;
    font-size: 14px;
}

.dashboard select,
.dashboard input[type="range"] {
    margin: 5px 0 15px;
    padding: 5px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #444;
    color: #fff;
    font-size: 14px;
    width: 200px;
}

.dashboard select {
    margin-bottom: 15px; /* Add spacing for new dropdowns */
}

.dashboard input[type="range"] {
    width: 220px;
    cursor: pointer;
}

.dashboard input[type="checkbox"] {
    margin-left: 10px;
    cursor: pointer;
}

#theme-label {
    margin-left: 5px;
    font-size: 14px;
}

.theme-switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.theme-switch {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.theme-switch:checked + .slider {
    background-color: #4d90fe;
}

.theme-switch:checked + .slider::before {
    transform: translateX(20px);
}

.octocat-link {
    position: absolute;
    z-index: 1000;
    display: inline-block;
    width: 40px;
    height: 40px;
    transition: transform 0.2s ease-in-out;
}

body.ticker-top .octocat-link {
    bottom: 10px; /* Move to the lower right corner */
    right: 10px;
}

body.ticker-bottom .octocat-link {
    top: 10px; /* Default position in the upper right corner */
    right: 10px;
}

.octocat-link:hover .octocat-tooltip {
    opacity: 1;
    transform: translateX(-10px);
}

.octocat-logo {
    width: 100%;
    height: 100%;
    filter: invert(1); /* Invert colors for dark mode */
}

body.light-mode .octocat-logo {
    filter: invert(0); /* Restore original colors for light mode */
}

.octocat-tooltip {
    position: absolute;
    top: 50%; /* Center vertically relative to the Octocat image */
    right: 50px;
    transform: translateY(-50%) translateX(0); /* Adjust for centering */
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1001;
}

body.light-mode .octocat-tooltip {
    background-color: #f9f9f9;
    color: #222;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: none !important;
}