/* Ensure ticker fits within GeneratePress container and viewport */
.rumorpress-ticker {
    width: 100%;
    max-width: 100%; /* Respect parent container (e.g., .site or .inside-top-bar) */
    background: #000000; /* Black background */
    color: #fff000; /* Yellow text */
    padding: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    border-bottom: 1px solid #000000; /* Black border */
    display: flex;
    align-items: center;
    box-sizing: border-box; /* Include padding in width */
}

/* Static prefix */
.ticker-prefix {
    flex: 0 0 auto;
    padding: 0 15px 0 10px; /* Consistent padding */
    font-size: 17px;
    font-weight: 600;
    color: #ffffff; /* White prefix */
    white-space: nowrap;
    max-width: 30%; /* Limit prefix width */
    overflow: hidden;
    text-overflow: ellipsis; /* Truncate if too long */
}

/* Wrapper for sequential content */
.ticker-content-wrapper {
    flex: 1;
    overflow: hidden; /* Prevent overflow */
    position: relative;
    max-width: calc(100% - 15px); /* Account for prefix padding */
}

/* Container for ticker items */
.ticker-content {
    display: block; /* Stack items for sequential display */
}

/* Individual ticker items */
.ticker-item {
    display: none; /* Hidden by default */
    opacity: 0; /* Start invisible for fade effect */
    transition: opacity 7s ease-in-out; /* Slightly longer transition for smoothness */
    max-width: 100%; /* Prevent item overflow */
    position: absolute; /* Stack items to prevent layout shifts */
    width: 100%; /* Ensure full width */
}

.ticker-item.active {
    display: block; /* Show active item */
    opacity: 1; /* Fully visible */
    position: relative; /* Ensure active item is visible */
}

/* Ensure consistent text color */
.ticker-item a,
.ticker-item.active a {
    color: #ffffff !important; /* white text, override any conflicting styles */
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: color 0.1s ease;
    display: block; /* Full width for static display */
    overflow: hidden;
    text-overflow: ellipsis; /* Truncate long headlines */
}

/* Hover effect */
.ticker-item a:hover,
.ticker-item.active a:hover {
    color: #003bff !important; /* Blue on hover */
    font-weight: 600; /* Bold on hover */
}

/* Desktop adjustments (GeneratePress container width) */
@media (min-width: 769px) {
    .rumorpress-ticker {
        max-width: 1200px; /* Match GeneratePress default container width */
        margin: 0 auto; /* Center within .site */
    }
    .ticker-content-wrapper {
        max-width: calc(100% - 15px); /* Adjust for prefix */
    }
    .ticker-item a {
        max-width: 1000px; /* Limit headline width */
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .rumorpress-ticker {
        max-width: 100vw; /* Full viewport width */
        padding: 8px 5px;
    }
    .ticker-prefix {
        font-size: 16px;
        padding-right: 10px;
        max-width: 25%; /* Tighter limit for mobile */
    }
    .ticker-content-wrapper {
        max-width: calc(100vw - 15px); /* Account for padding */
    }
    .ticker-item a {
        font-size: 16px;
        max-width: calc(85vw - 15px); /* Prevent overflow */
    }
}

/* Extra small screens (e.g., iPhone SE, ~320px) */
@media (max-width: 576px) {
    .rumorpress-ticker {
        padding: 6px 3px;
    }
    .ticker-prefix {
        font-size: 16px;
        max-width: 20%;
    }
    .ticker-item a {
        font-size: 16px;
        max-width: calc(80vw - 15px);
    }
}

/* Sticky Top Bar */
.inside-top-bar,
.top-bar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0;
    z-index: 1000;
    background: #000000;
    width: 100%;
    max-width: 100%; /* Respect parent container */
    overflow: hidden; /* Prevent overflow */
    box-sizing: border-box;
}

/* Remove extra margins */
.rumorpress-ticker {
    margin: 0;
}

/* Adjust for navigation */
.sticky-enabled .main-navigation.is_stuck,
.sticky-enabled #mobile-header.is_stuck {
    top: 40px !important;
}

/* Admin bar adjustments */
.admin-bar .inside-top-bar,
.admin-bar .top-bar {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .inside-top-bar,
    .admin-bar .top-bar {
        top: 46px;
    }
    .sticky-enabled .main-navigation.is_stuck,
    .sticky-enabled #mobile-header.is_stuck {
        top: 64px !important;
    }
}

@media (max-width: 529px) {
    .sticky-enabled .main-navigation.is_stuck,
    .sticky-enabled #mobile-header.is_stuck {
        top: 60px !important;
    }
}

/* Support dynamic viewport units for mobile */
@supports (width: 100svw) {
    .rumorpress-ticker {
        max-width: 100svw; /* Small viewport width */
    }
    .ticker-content-wrapper {
        max-width: calc(100svw - 15px);
    }
    .ticker-item a {
        max-width: calc(80sv鉄 - 15px);
    }
}