:root {
    --bg-color: #f9f9f9;
    --text-color: #333333;
    --accent-color: #ff3e00;
    --ad-border: #e0e0e0;
    --font-main: 'Outfit', sans-serif;
    --ad-width: 300px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}

.loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 32px;
    height: 32px;
    border: 2px solid #ccc;
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Article Layout */
.article-container {
    max-width: 650px;
    margin: 0 auto;
    padding: 40px 20px;
    /* background: #fff; */
}

.article-header {
    margin-bottom: 40px;
}

.article-header h1 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 10px;
}

.byline {
    color: #888;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.content-block p {
    margin-bottom: 24px;
    font-size: 1.1rem;
}

/* Inline Ad Unit (300x250) */
.ad-spacer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 60px 0;
    position: relative;
    user-select: none;
}

.scroll-ad {
    width: 370px;
    height: 320px;
    /* background: #F7F7F7; */
    /* border: 1px solid var(--ad-border); */
    position: relative;
    overflow: hidden;
    /* box-shadow: 0 5px 15px rgba(182, 182, 182, 0.05); */
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-label {
    font-size: 10px;
    color: #999;
    letter-spacing: 2px;
    margin-top: 8px;
    text-align: center;
}

/* Video Overlay (300x600) */
.video-overlay {
    position: fixed;
    width: 300px;
    height: 250px;
    /* Initial height matching ad */

    z-index: 1510;
    opacity: 0;
    visibility: hidden;
    /* overflow: hidden; */
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    background-color: transparent !important;
    -webkit-background-color: transparent !important;

    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.video-overlay.active {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    height: 600px !important;
    opacity: 1;
    visibility: visible;
    background-color: transparent !important;
}

.video-overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1499;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.video-overlay-bg.active {
    opacity: 1;
    visibility: visible;
}

video {
    width: 90%;
    height: 100%;
    object-fit: cover;
    background: transparent !important;
    background-color: transparent !important;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;
}

.mute-btn {
    position: absolute;
    top: 554px;
    left: 304px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
    z-index: 1510;
}

.mute-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.8);
}

.mute-btn svg {
    width: 18px;
    height: 18px;
}

.close-overlay {
    position: absolute;
    top: -40px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
    z-index: 1510;
}

.close-overlay:hover {
    transform: scale(1.1);
}

.article-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #aaa;
    font-size: 0.8rem;
    text-align: center;
}