body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #000;
    height: 100vh;
    overflow-y: auto;
}
h1 { text-align: center; color: #333; margin-bottom: 4px; }
.subtitle { text-align: center; color: #888; margin-top: 0; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.logout-btn { background: #333; color: #fff; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.logout-btn:hover { background: #444; }
.auth-message { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.video-gallery { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-bottom: 20px; }
.video-item { cursor: pointer; width: 200px; background: #333; padding: 10px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,.1); transition: transform .2s; text-decoration: none; color: #fff; }
.video-item:hover { transform: scale(1.03); }
.video-thumb { width: 100%; height: 120px; border-radius: 5px; display: flex; align-items: center; justify-content: center; background: #111; color: #fff; font-size: 42px; }
.video-item p { text-align: center; margin: 8px 0 0; font-size: 14px; }
.video-page-body { background: #000; margin: 0; padding: 0; height: 100vh; overflow: hidden; }
.video-page { display: flex; justify-content: center; align-items: center; height: 100vh; }
.video-container { position: relative; background: #000; width: 90vw; max-width: 1200px; border-radius: 8px; overflow: hidden; cursor: pointer; }
#video-element { width: 100%; height: auto; max-height: 90vh; display: block; object-fit: contain; background: #000; }
.video-controls { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; padding: 8px 12px; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: white; gap: 10px; box-sizing: border-box; opacity: 0; transition: opacity .3s; }
.video-container:hover .video-controls, .video-container.show-controls .video-controls { opacity: 1; }
.video-controls button, .video-controls a { background: transparent; color: white; border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 16px; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.video-controls button:hover, .video-controls a:hover { background: rgba(255,255,255,.15); }
.volume-control { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.progress-container { flex-grow: 1; min-width: 0; }
#progress-bar { width: 100%; height: 5px; cursor: pointer; accent-color: red; }
#volume-slider { width: 80px; cursor: pointer; }
.video-container:fullscreen, .video-container:-webkit-full-screen { width: 100vw; height: 100vh; max-width: none; border-radius: 0; }
.video-container:fullscreen #video-element, .video-container:-webkit-full-screen #video-element { width: 100%; height: 100%; max-height: 100vh; object-fit: contain; }
.video-container:fullscreen .video-controls, .video-container:-webkit-full-screen .video-controls { position: absolute; bottom: 0; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Ensure HTML hidden attributes always win over page styles. */
.auth-message[hidden], #site-content[hidden] { display: none !important; }
.video-thumb { height: 120px; object-fit: cover; object-position: center; display: block; background: #111; }
.video-item img { width: 100%; }

/* --- Mobile video player improvements --- */
@media (pointer: coarse), (max-width: 768px) {
    .video-page { padding: 0; }
    .video-container { width: 100vw; max-width: none; border-radius: 0; }
    #video-element { max-height: 100vh; }

    /* Bigger, thumb-friendly controls and always-visible bar on touch devices */
    .video-controls {
        opacity: 1;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
    }
    .video-controls button, .video-controls a {
        font-size: 20px;
        padding: 10px 12px;
    }
    #time-display { font-size: 12px; }
}

/* Fullscreen: fill the whole screen on any orientation */
.video-container:fullscreen,
.video-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}
.video-container:fullscreen #video-element,
.video-container:-webkit-full-screen #video-element {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    object-fit: contain;
}
.video-container:fullscreen .video-controls,
.video-container:-webkit-full-screen .video-controls {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
}

/* Landscape phones: reclaim vertical space, keep controls compact */
@media (max-width: 900px) and (orientation: landscape) {
    .video-controls button, .video-controls a { font-size: 16px; padding: 6px 8px; }
}
