:root {
    color-scheme: dark;
    --short-header-height: 58px;
    --short-accent: #ef3fa8;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #050505; }
body { color: #fff; font-family: Arial, Helvetica, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }

.short-video-header {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 620px);
    height: calc(var(--short-header-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,0));
    pointer-events: none;
}
.short-video-header > * { pointer-events: auto; }
.short-video-header strong { text-align: center; font-size: 16px; text-shadow: 0 1px 5px #000; }
.short-video-back, .short-video-sound {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.38);
    color: #fff;
    font-size: 25px;
    text-decoration: none;
    cursor: pointer;
}
.short-video-sound { font-size: 19px; }
.short-video-sound .sound-on { display: none; }
.short-video-sound.is-on .sound-off { display: none; }
.short-video-sound.is-on .sound-on { display: inline; }

.short-video-feed {
    width: min(100%, 620px);
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    background: #000;
}
.short-video-feed::-webkit-scrollbar { display: none; }

.short-video-card {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 520px;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #090909;
}
.short-video-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background: #090909;
    cursor: pointer;
}
.short-video-shade { position: absolute; left: 0; right: 0; pointer-events: none; }
.short-video-shade-top { top: 0; height: 24%; background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent); }
.short-video-shade-bottom { bottom: 0; height: 47%; background: linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,.16), transparent); }
.short-video-play {
    position: absolute;
    z-index: 10;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    margin: -36px 0 0 -36px;
    display: grid;
    place-items: center;
    padding-left: 5px;
    border-radius: 50%;
    background: rgba(0,0,0,.42);
    font-size: 36px;
    opacity: 0;
    transform: scale(.84);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
}
.short-video-card.is-paused .short-video-play { opacity: 1; transform: scale(1); }
.short-video-progress { position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.2); }
.short-video-progress span { display: block; width: 0; height: 100%; background: var(--short-accent); }

.short-video-meta {
    position: absolute;
    z-index: 20;
    left: 16px;
    right: 86px;
    bottom: max(30px, calc(18px + env(safe-area-inset-bottom)));
    text-shadow: 0 1px 5px #000;
}
.short-video-author { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.short-video-author img { width: 44px; height: 44px; border: 2px solid #fff; border-radius: 50%; object-fit: cover; background: #222; }
.short-video-author strong { font-size: 16px; }
.short-video-location { margin: 9px 0 0 54px; font-size: 12px; color: rgba(255,255,255,.82); }
.short-video-description { margin: 9px 0 0; max-width: 540px; font-size: 14px; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.short-video-actions {
    position: absolute;
    z-index: 25;
    right: 14px;
    bottom: max(34px, calc(22px + env(safe-area-inset-bottom)));
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.short-video-action {
    width: 50px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.42);
    color: #fff;
    font-size: 27px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    text-shadow: 0 1px 5px #000;
}
.short-video-action small { min-height: 10px; margin-top: 2px; font-size: 10px; }
.short-video-favorite.is-active { color: var(--short-accent); }
.short-video-action:focus-visible, .short-video-back:focus-visible, .short-video-sound:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.short-video-loader { height: 1px; scroll-snap-align: none; }
.short-video-loader.is-loading::after {
    content: '';
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: 18px;
    width: 26px;
    height: 26px;
    margin-left: -13px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: short-spin .8s linear infinite;
}
.short-video-empty { height: 100vh; height: 100dvh; display: grid; place-content: center; gap: 16px; text-align: center; padding: 20px; }
.short-video-empty a { color: #fff; }
.short-video-empty.is-hidden { display: none; }
@keyframes short-spin { to { transform: rotate(360deg); } }

@media (min-width: 621px) {
    body { background: #151515; }
    .short-video-feed { box-shadow: 0 0 70px rgba(0,0,0,.75); }
}
@media (prefers-reduced-motion: reduce) {
    .short-video-feed { scroll-behavior: auto; }
    .short-video-play { transition: none; }
}
