:root {
    --news-primary: #0066cc;
    --news-accent: #ff4757;
    --news-bg: #f0f2f5;
    --news-card-bg: #ffffff;
    --news-text: #2f3542;
    --news-text-dim: #57606f;
    --news-border: #dfe4ea;
    --news-header-bg: #ffffff;
    --news-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --news-bg: #0a0b10;
    --news-card-bg: #161a23;
    --news-text: #f1f2f6;
    --news-text-dim: #a4b0be;
    --news-border: #2f3542;
    --news-header-bg: #161a23;
    --news-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

body.news-portal {
    background: var(--news-bg);
    color: var(--news-text);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.news-header {
    background: var(--news-header-bg);
    border-bottom: 1px solid var(--news-border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--news-shadow);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--news-primary);
    text-decoration: none;
    letter-spacing: -1px;
}

.logo-text span {
    color: var(--news-accent);
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #444;
    font-weight: 700;
    font-size: 0.95rem;
    transition: 0.2s;
    text-transform: uppercase;
}

.nav-link:hover,
.nav-link.active {
    color: var(--news-accent);
}

.portal-container {
    max-width: 1200px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 0 20px;
}

/* Feature Slider (The Tilo Game Call to Action) */
.game-portal-hero {
    grid-column: 1 / -1;
    height: 450px;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.unsplash.com/photo-1550745165-9bc0b252726f?auto=format&fit=crop&q=80&w=2070');
    /* Placeholder, will be premium */
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.game-portal-hero:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.game-portal-hero h1 {
    font-size: 4rem;
    font-weight: 900;
    margin: 0;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.game-portal-hero p {
    font-size: 1.5rem;
    margin: 20px 0;
    opacity: 0.9;
}

.hero-btn {
    background: var(--news-accent);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 0, 0, 0.4);
    transition: 0.3s;
}

.hero-btn:hover {
    transform: scale(1.1);
    background: #cc0000;
}

/* News List */
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.news-card {
    background: var(--news-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--news-shadow);
    transition: var(--transition);
    border: 1px solid var(--news-border);
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-body {
    padding: 15px;
}

.news-meta {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.news-title {
    font-size: 1.4rem;
    font-weight: 900;
    margin: 0 0 12px 0;
    color: var(--news-text);
    line-height: 1.3;
    font-family: 'Outfit', sans-serif;
}

.news-excerpt {
    font-size: 0.95rem;
    color: var(--news-text-dim);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar */
.sidebar-title {
    background: var(--news-primary);
    color: #fff;
    padding: 10px 15px;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 15px;
}

.sidebar-list {
    background: var(--news-card-bg);
    border: 1px solid var(--news-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--news-shadow);
}

.sidebar-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

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

.sidebar-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

body.dark-mode .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 12px;
}

.sidebar-item-info {
    flex: 1;
}

.sidebar-item-time {
    font-size: 0.7rem;
    color: var(--news-accent);
    font-weight: 700;
}

.sidebar-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Profile Dropdown */
.auth-nav {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background: var(--news-card-bg);
    border: 1px solid var(--news-border);
    border-radius: 20px;
    box-shadow: var(--news-shadow);
    width: 240px;
    z-index: 2000;
    overflow: hidden;
    display: none;
    transform-origin: top right;
    animation: dropdownAnim 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    backdrop-filter: blur(15px);
}

.profile-dropdown.active {
    display: block;
}

@keyframes dropdownAnim {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--news-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--news-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--news-border);
}

/* Footer Section */
.news-footer {
    background: var(--news-header-bg);
    border-top: 1px solid var(--news-border);
    padding: 40px 20px;
    margin-top: 50px;
    text-align: center;
    color: var(--news-text);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-counters {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: var(--news-bg);
    border-radius: 12px;
    display: inline-flex;
    border: 1px solid var(--news-border);
}

/* News Detail Container */
#news-detail {
    background: var(--news-card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--news-shadow);
    border: 1px solid var(--news-border);
    margin-bottom: 30px;
}

/* Floating Game Button */
.floating-game-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #ff8c00);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 140, 0, 0.5);
    z-index: 2000;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: floating 3s ease-in-out infinite;
    text-decoration: none;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
    }

    50% {
        transform: translateY(-60%) scale(1.1);
    }
}

.floating-game-btn:hover {
    transform: translateY(-50%) scale(1.2) rotate(15deg);
}

.floating-game-btn::after {
    content: 'PLAY GAME';
    position: absolute;
    bottom: -30px;
    background: #000;
    color: #fff;
    font-size: 0.6rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: 0.3s;
}

.floating-game-btn:hover::after {
    opacity: 1;
}

/* Auth Profile Header */
.auth-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-circle {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--news-primary), #0055aa);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    cursor: pointer;
    border: 2px solid var(--news-card-bg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
}

#user-profile-header:hover .profile-circle {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

#user-profile-header:hover #header-nickname {
    color: var(--news-accent);
}

#header-nickname {
    transition: 0.3s;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--news-border);
    transition: .4s;
    border-radius: 20px;
}

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

input:checked+.slider {
    background-color: var(--news-primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Transitions for Dark Mode */
body,
.news-header,
.news-card,
.sidebar-list,
.comment-section,
.profile-dropdown,
.news-footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Comment Section UI */
.comment-section {
    margin-top: 40px;
    background: var(--news-card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--news-shadow);
    border: 1px solid var(--news-border);
}

.comment-input {
    width: 100%;
    padding: 18px;
    background: var(--news-bg);
    border: 1px solid var(--news-border);
    border-radius: 12px;
    margin-bottom: 12px;
    font-family: inherit;
    color: var(--news-text);
    transition: var(--transition);
    resize: none;
}

.comment-input:focus {
    outline: none;
    border-color: var(--news-primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.comment-user {
    font-weight: 800;
    color: var(--news-primary);
    font-size: 1rem;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--news-text-dim);
}

.comment-text {
    color: var(--news-text);
    line-height: 1.6;
    margin: 10px 0;
}

.sidebar-list {
    background: var(--news-card-bg);
    border: 1px solid var(--news-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--news-shadow);
}

.sidebar-item {
    border-bottom: 1px solid var(--news-border);
    padding: 15px;
    transition: var(--transition);
}

.sidebar-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.news-footer {
    background: var(--news-header-bg);
    border-top: 1px solid var(--news-border);
    color: var(--news-text);
    padding: 60px 20px;
}

.comment-list {
    margin-top: 20px;
}

.comment-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--news-border);
}

.comment-user {
    font-weight: 800;
    color: var(--news-primary);
    margin-right: 10px;
}

.comment-date {
    font-size: 0.75rem;
    color: var(--news-text-dim);
}

.comment-text {
    margin-top: 5px;
    color: var(--news-text);
}

/* Auth Modal Design Enhancements */
.modal-content.glass {
    background: var(--news-card-bg) !important;
    border: 1px solid var(--news-border) !important;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--news-shadow);
    color: var(--news-text);
    animation: dropdownAnim 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.auth-field input {
    width: 100%;
    padding: 12px 18px;
    background: var(--news-bg);
    border: 1px solid var(--news-border);
    border-radius: 12px;
    margin-bottom: 15px;
    color: var(--news-text);
    font-family: inherit;
    transition: var(--transition);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--news-primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.action-btn {
    background: var(--news-primary);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.action-btn.second-btn {
    background: var(--news-bg);
    color: var(--news-text);
    border: 1px solid var(--news-border);
}

.close-modal {
    color: var(--news-text-dim);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

/* Interactive Background Elements */
.bg-interactive-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-watermark {
    position: absolute;
    font-size: 8rem;
    font-weight: 900;
    opacity: 0.03;
    color: var(--news-primary);
    user-select: none;
    pointer-events: none;
    transform: rotate(-15deg);
}

body.dark-mode .bg-watermark {
    opacity: 0.05;
}

.bg-stain {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.5s, transform 0.2s;
    filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: stainAppear 0.5s ease-out;
}

body.dark-mode .bg-stain {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

@keyframes stainAppear {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.bg-stain.cleaning {
    transform: scale(1.5);
    opacity: 0 !important;
}

/* Tilo Sponge (Global Cleaner) */
#tilo-sponge {
    position: fixed;
    width: 80px;
    height: 80px;
    bottom: 30px;
    right: 120px;
    z-index: 3000;
    cursor: grab;
    transition: transform 0.1s;
    user-select: none;
    touch-action: none;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
    background-size: cover;
    background-position: center;
}

#tilo-sponge.dragging {
    cursor: grabbing;
    transition: none;
}

/* Syncing Skins with Game */
.cloth-skin-default {
    background-image: url("img/tilo_default.png");
}

.cloth-skin-fire {
    background-image: url("img/tilo_fire.png");
}

.cloth-skin-ice {
    background-image: url("img/tilo_ice.png");
}

.cloth-skin-electric {
    background-image: url("img/tilo_electric.png");
}

.cloth-skin-rainbow {
    background-image: url("img/tilo_rainbow.png");
}

/* Default fallback if images missing */
#tilo-sponge:not([style*="background-image"]) {
    background-color: #ffd700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

#tilo-sponge:not([style*="background-image"])::after {
    content: "🧽";
}

/* Stains Layering */
.bg-stain {
    z-index: 5;
    /* Above background, below main content */
}

/* Tilo Sponge Design Overhaul (Game Sync) */
#tilo-sponge {
    width: 140px;
    height: 140px;
    background-image: url("tilo.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

#tilo-sponge:active {
    transform: scale(1.1) rotate(2deg);
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
}

/* Sync Filters from Game */
.cloth-skin-fire {
    filter: drop-shadow(0 0 35px #ff4500) grayscale(1) sepia(1) hue-rotate(-45deg) saturate(15) brightness(1.0) contrast(1.1) !important;
}

.cloth-skin-ice {
    filter: drop-shadow(0 0 35px #00f2fe) grayscale(1) sepia(1) hue-rotate(175deg) saturate(30) brightness(1.2) contrast(1.1) !important;
}

.cloth-skin-electric {
    filter: drop-shadow(0 0 35px #ffff00) grayscale(1) sepia(1) hue-rotate(5deg) saturate(35) brightness(1.4) contrast(1.2) !important;
}

.cloth-skin-rainbow {
    animation: skin-rainbow-anim 3s linear infinite !important;
}

@keyframes skin-rainbow-anim {
    0% {
        filter: drop-shadow(0 0 15px red) hue-rotate(0deg);
    }

    100% {
        filter: drop-shadow(0 0 15px red) hue-rotate(360deg);
    }
}

/* --- Video Notification & Player Styles --- */
#video-notification.slide-in {
    transform: translateX(0) !important;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px cyan, 0 0 10px cyan;
    }

    to {
        text-shadow: 0 0 10px cyan, 0 0 20px cyan, 0 0 30px #00ffff;
    }
}

#video-player-modal .hidden {
    display: none !important;
}


.chat-msg {
    font-size: 0.85rem;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    word-break: break-word;
}

body.dark-mode .chat-msg {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Mobile Responsiveness (Refined for Phone) --- */
@media (max-width: 768px) {
    .portal-container {
        grid-template-columns: 1fr;
        padding: 0 15px;
        gap: 20px;
    }

    /* Hide Sidebar (YouTube Abuse Slots) to match Game Page mobile style */
    .sidebar-list,
    .sidebar-title {
        display: none !important;
    }

    /* Hide Tilo Sponge (Requested removal on mobile) */
    #tilo-sponge {
        display: none !important;
    }

    /* Hide Mini Video Player (YouTube style match) */
    #video-player-modal {
        display: none !important;
    }

    /* Hide Hero/TILO WORLD banner on mobile */
    .game-portal-hero {
        display: none !important;
    }

    /* Single Column News */
    .news-grid {
        grid-template-columns: 1fr;
        margin-top: 10px !important;
    }

    /* Ensure Header looks good */
    .header-container {
        padding: 0 15px;
    }

    .logo-text {
        font-size: 1.8rem;
    }

    .nav-link {
        font-size: 0.85rem;
    }

    /* Show floating game button on mobile */
    .floating-game-btn {
        display: flex !important;
    }
}