.player {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    font-family: system-ui, sans-serif;
}

/* Fullscreen styles */
.player:fullscreen,
.player:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: auto !important; /* ignore previous 16/9 */
}

.player:fullscreen #yt-player,
.player:-webkit-full-screen #yt-player {
    width: 100% !important;
    height: 100% !important;
}

/* === VIDEO === */
.player video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* === TOOLBOX AREA === */
.toolbox {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(20px);
    padding: 10px 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.toolbox {
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.toolbox.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* === PROGRESS + TIMER === */
.progress-container {
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.progress {
    position: relative;
    width: 100%;
    height: 4px; /* match your current progress height */
    background: rgba(255, 255, 255, 0.25); /* optional fallback bg */
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.buffered-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%; /* match progress height exactly */
    width: 0%;
    background: rgba(255, 255, 255, 0.15); /* slightly lighter than progress */
    pointer-events: none;
    z-index: 1; /* behind progress bar */
    border-radius: 2px;
    transition: width 0.25s linear;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #fff; /* your played color */
    border-radius: 2px;
    z-index: 2; /* above buffered-bar */
    transition: width 0.1s linear;
}

.timer {
    color: #fff;
    font-size: 13px;
    margin-top: 6px;
    text-align: center;
    opacity: 0.9;
}

/* === CONTROLS === */
.controls {
    width: 95%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left,
.right {
    display: flex;
    align-items: center;
    gap: 12px;
}

button {
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

button:hover {
    transform: scale(1.1);
}

.speed-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px; /* smaller than play/pause */
    cursor: pointer;
    transition: transform 0.15s ease;
}

.speed-btn:hover {
    transform: scale(1.1);
}

.volume-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.volume-btn:hover {
    transform: scale(1.1);
}

.volume-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 8px; /* track height */
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px; /* half of track height for full rounding */
    cursor: pointer;
    outline: none;
}

/* WebKit */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;

    /* Center thumb exactly on the track */
    margin-top: calc((8px - 16px) / 2); /* (trackHeight - thumbHeight)/2 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Firefox */
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.volume-slider::-moz-range-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

/* IE / Edge Legacy */
.volume-slider::-ms-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.volume-slider::-ms-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    border-color: transparent;
    color: transparent;
}

.context-menu {
    position: absolute;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 160px;
    color: #fff;
    font-family: system-ui, sans-serif;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    z-index: 15;
}

.context-menu.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.context-menu .menu-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.context-menu .menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

#yt-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none; /* optional if overlay controls handle clicks */
}

.yt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* above the iframe */
    background: transparent;
    pointer-events: auto; /* needed to capture events */
}

#yt-player {
    z-index: 1;
} /* YouTube iframe */
.yt-overlay {
    z-index: 10;
} /* Overlay for right-click */
.toolbox {
    z-index: 20;
} /* Controls */
.context-menu {
    z-index: 30;
} /* Menu above everything */
