*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background-color: black;
    font-family: sans-serif;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes zoom-out {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(2);
    }
}

@keyframes zoom-out-big {
    to {
        transform: scale(3);
        opacity: 0;
    }
}

@keyframes feedback-scale-fade {
    0% {
        transform: scale(0.33);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

#curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    cursor: pointer;
    z-index: 10;
    transition: opacity 1s ease-in-out;
}

#curtain.hidden {
    opacity: 0;
}

#curtain img {
    width: 600px;
    margin-bottom: 20px;
    animation: blink 1.5s infinite;
}

#curtain p {
    display: none;
}

#curtain.zooming-out img {
    animation: zoom-out-big 1s forwards;
}

#video-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#video-wrapper::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 220px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.hide-ui::after {
    opacity: 0;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

#logo-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: transform 0.2s ease-in-out;
}

#logo-container:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

#logo {
    width: 600px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.7));
}

#video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 0;
    object-fit: cover;
}

#controls-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    transition: background-color 0.2s ease-out, width 0.25s ease, opacity 0.3s ease-in-out;
}

#controls-container:hover {
    background-color: transparent;
}

#channel-info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 22px;
    transition: background-color 0.25s ease, opacity 0.3s ease-in-out;
    pointer-events: all;
    gap: 10px;
}

#channel-info a {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
}

#channel-info img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

#channel-info span {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

#time-display {
    color: white;
    font-size: 14px;
    font-weight: 500;
    transition: margin-left 0.2s ease-out;
}

.volume-area:hover ~ #time-display {
    margin-left: 0;
}

.volume-area {
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 30px;
    transition: background-color 0.25s ease, width 0.25s ease;
    padding-left: 0;
}

.volume-area:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.volume-area .control-btn {
    background: transparent;
}

.volume-area:hover .volume-panel {
    width: 100px;
    padding: 0 15px;
}

.volume-panel {
    position: relative;
    width: 0;
    height: 44px;
    border-radius: 0;
    overflow: hidden;
    transition: width 0.25s ease;
    display: flex;
    align-items: center;
    background-color: transparent;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    width: 70px;
    height: 4px;
    cursor: pointer;
    --volume-progress: 100%;
}

#volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, white var(--volume-progress), rgba(255, 255, 255, 0.4) var(--volume-progress));
    border-radius: 2px;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    margin-top: -4px;
}

#volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, white var(--volume-progress), rgba(255, 255, 255, 0.4) var(--volume-progress));
    border-radius: 2px;
}

#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    margin-top: -4px;
}

.control-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease;
    box-shadow: none;
}

.control-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.control-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.hidden {
    display: none;
}

#progress-bar-container {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    height: 5px;
    cursor: pointer;
    z-index: 3;
    transition: height 0.1s ease-in-out, opacity 0.3s ease-in-out;
}

#progress-bar-container:hover {
    height: 8px;
}

#progress-bar {
    position: relative;
    height: 100%;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.4);
}

#loaded-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    width: 0;
}

#play-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #ff0000;
    width: 0;
}

#progress-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 16px;
    height: 16px;
    background-color: #ff0000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.1s ease-in-out;
}

#progress-bar-container:hover #progress-thumb {
    opacity: 1;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-active #video {
    filter: none;
}

.fullscreen-active .video-overlay,
.fullscreen-active #logo-container {
    display: none;
}

.fullscreen-active.hide-ui {
    cursor: none;
}

.controls-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#channel-info:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    margin-top: -75px;
    margin-left: -75px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    animation: feedback-scale-fade 1s forwards;
}

.feedback-overlay svg {
    width: 100px;
    height: 100px;
    fill: white;
}

/* ---------- FULLSCREEN ICON ANIMATIONS ----------- */
@keyframes corner-out-ur { 0%,100% {transform: translate(0,0);} 50% {transform: translate(2px,-2px);} }
@keyframes corner-out-ul { 0%,100% {transform: translate(0,0);} 50% {transform: translate(-2px,-2px);} }
@keyframes corner-out-dr { 0%,100% {transform: translate(0,0);} 50% {transform: translate(2px,2px);} }
@keyframes corner-out_dl { 0%,100% {transform: translate(0,0);} 50% {transform: translate(-2px,2px);} }

@keyframes corner-in-ur { 0%,100% {transform: translate(0,0);} 50% {transform: translate(-2px,2px);} }
@keyframes corner-in-ul { 0%,100% {transform: translate(0,0);} 50% {transform: translate(2px,2px);} }
@keyframes corner-in-dr { 0%,100% {transform: translate(0,0);} 50% {transform: translate(-2px,-2px);} }
@keyframes corner-in_dl { 0%,100% {transform: translate(0,0);} 50% {transform: translate(2px,-2px);} }

/* ENTER FULLSCREEN hover */
#fullscreen-btn:hover #enter-fullscreen-icon .ytp-fullscreen-button-corner-3 { animation: corner-out-ur 0.5s forwards; }
#fullscreen-btn:hover #enter-fullscreen-icon .ytp-fullscreen-button-corner-2 { animation: corner-out-ul 0.5s forwards; }
#fullscreen-btn:hover #enter-fullscreen-icon .ytp-fullscreen-button-corner-0 { animation: corner-out-dr 0.5s forwards; }
#fullscreen-btn:hover #enter-fullscreen-icon .ytp-fullscreen-button-corner-1 { animation: corner-out_dl 0.5s forwards; }

/* EXIT FULLSCREEN hover */
#fullscreen-btn:hover #exit-fullscreen-icon .ytp-fullscreen-button-corner-3 { animation: corner-in-ur 0.5s forwards; }
#fullscreen-btn:hover #exit-fullscreen-icon .ytp-fullscreen-button-corner-2 { animation: corner-in-ul 0.5s forwards; }
#fullscreen-btn:hover #exit-fullscreen-icon .ytp-fullscreen-button-corner-0 { animation: corner-in-dr 0.5s forwards; }
#fullscreen-btn:hover #exit-fullscreen-icon .ytp-fullscreen-button-corner-1 { animation: corner-in_dl 0.5s forwards; }

/* ---- mobile адаптация ---- */
@media (max-width: 640px) {
    .control-btn {
        padding: 8px; /* чуть больше для тапов */
    }
    .control-btn svg {
        width: 26px;
        height: 26px;
    }
    #time-display {
        font-size: 12px;
    }
    #channel-info {
        font-size: 12px;
        padding: 8px;
    }
    #progress-bar-container {
        bottom: 70px;
    }
    /* уменьшаем ширину панели громкости на мобильных */
    .volume-area:hover .volume-panel {
        width: 80px;
    }

    /* hide controls */
    #controls-container,
    #progress-bar-container,
    #channel-info {
        display: none !important;
    }

    /* video should not crop */
    #video {
        object-fit: contain;
    }

    /* darken screen when paused */
    #video-wrapper.dim::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 4;
    }

    /* larger pause icon overlay */
    .feedback-overlay {
        background-color: rgba(0,0,0,0.7);
    }
} 