* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background: #000;
}

.reels-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 55px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
}

.reels-header h2 {
    font-size: 19px;
}

.back-button,
.create-reel {
    color: #fff;
    text-decoration: none;
    font-size: 30px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
}

.reels-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    overscroll-behavior-y: contain;
}

.reels-container::-webkit-scrollbar {
    display: none;
}

.reel-card {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: #111;
}

.reel-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.reel-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,.25),
        transparent 25%,
        transparent 55%,
        rgba(0,0,0,.75)
    );
}

.reel-play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: white;
    font-size: 30px;
    display: none;
    place-items: center;
    pointer-events: none;
}

.reel-card.paused .reel-play-indicator {
    display: grid;
}

.reel-actions {
    position: absolute;
    right: 12px;
    bottom: 125px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 5;
}

.reel-action {
    border: none;
    background: transparent;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    text-shadow: 0 2px 5px #000;
    min-width: 44px;
}

.reel-action .icon {
    font-size: 27px;
}

.reel-action small {
    font-size: 11px;
    font-weight: bold;
}

.reel-action.liked .icon {
    color: #ff405c;
}

.reel-action.saved .icon {
    color: #62b5ff;
}

.reel-info {
    position: absolute;
    left: 15px;
    right: 78px;
    bottom: 25px;
    color: white;
    z-index: 5;
    text-shadow: 0 2px 5px #000;
}

.reel-creator {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.reel-creator img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid white;
}

.reel-creator strong {
    font-size: 14px;
}

.reel-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 7px;
}

.reel-caption {
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.reel-time {
    font-size: 11px;
    margin-top: 8px;
    opacity: .8;
}

.reels-loading,
.reels-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 25px;
    gap: 15px;
}

.reels-empty a {
    color: white;
    background: #168bfa;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
}

.spinner {
    width: 35px;
    height: 35px;
    border: 3px solid #555;
    border-top-color: #168bfa;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* COMMENTS */

.reel-comment-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,.7);
    align-items: flex-end;
    justify-content: center;
}

.reel-comment-modal.active {
    display: flex;
}

.comment-box {
    width: 100%;
    max-width: 550px;
    height: 70%;
    background: white;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.comment-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.comment-heading button {
    border: none;
    background: none;
    font-size: 27px;
    cursor: pointer;
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    color: #172b4d;
}

.reel-comment {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.reel-comment strong {
    font-size: 13px;
}

.reel-comment p {
    margin-top: 5px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

#commentForm {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
}

#commentInput {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
}

#commentForm button {
    background: #168bfa;
    color: white;
    border: none;
    padding: 0 18px;
    border-radius: 25px;
}

.reel-message {
    position: fixed;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    background: white;
    color: #172b4d;
    padding: 12px 18px;
    border-radius: 25px;
    display: none;
    font-size: 13px;
}

@media (min-width: 700px) {
    .reels-container {
        background: #111;
    }

    .reel-card {
        max-width: 480px;
        margin: auto;
        border-left: 1px solid #222;
        border-right: 1px solid #222;
    }
}

.stripe-bottom-nav {
    display: none !important;
}