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

body {
    background: #000;
    font-family: 'Inter', -apple-system, sans-serif;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.desktop-layout {
    display: none;
}

.phone-frame {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.state {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.state.active {
    display: flex;
    flex-direction: column;
}

/* ===== Top Header ===== */
.top-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    padding-top: max(env(safe-area-inset-top, 14px), 14px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-icon {
    opacity: 0.9;
}

/* ===== Loading ===== */
.video-placeholder {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-blur {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, #833ab4 0%, #fd1d1d 40%, #fcb045 100%);
    opacity: 0.15;
    animation: igShift 5s ease-in-out infinite;
}

@keyframes igShift {

    0%,
    100% {
        opacity: 0.12;
    }

    50% {
        opacity: 0.2;
    }
}

.loading-overlay {
    position: relative;
    z-index: 2;
    text-align: center;
}

.ig-logo {
    margin-bottom: 20px;
    opacity: 0.9;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #e1306c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.loading-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    max-width: 200px;
    margin: 0 auto;
}

/* ===== Video UI ===== */
.video-ui {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    z-index: 3;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    padding-bottom: 16px;
}

.left-info {
    flex: 1;
    padding-right: 65px;
}

.author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    position: relative;
    flex-shrink: 0;
}

.avatar-ring {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border: 2px solid #000;
}

.author-name {
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.follow-btn {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.description {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.music-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.right-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: absolute;
    right: 14px;
    bottom: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.action-btn span {
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.music-album {
    width: 32px;
    height: 32px;
    background: linear-gradient(45deg, #f09433, #dc2743);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: albumPulse 2s ease-in-out infinite;
}

.album-inner {
    width: 12px;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

@keyframes albumPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ===== Progress Bar ===== */
.video-progress {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 5;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #fff;
    animation: progressMove 15s linear infinite;
}

@keyframes progressMove {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

/* ===== Bottom Bar ===== */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 10;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px;
}

.profile-tab-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #555, #888);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== Result State — Full-Screen Redesign ===== */
#result-state {
    background: #000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.result-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb1 {
    width: 350px;
    height: 350px;
    background: #e1306c;
    top: -100px;
    right: -80px;
}

.orb2 {
    width: 300px;
    height: 300px;
    background: #833ab4;
    bottom: -80px;
    left: -60px;
    animation-delay: 2s;
}

.orb3 {
    width: 250px;
    height: 250px;
    background: #f77737;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.15);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.result-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.result-card {
    position: relative;
    text-align: center;
    padding: 28px 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardAppear 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 380px;
    width: 100%;
    overflow: hidden;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.75) translateY(50px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.camera-flash {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

.camera-flash.active {
    animation: flashAnim 0.4s ease-out forwards;
}

@keyframes flashAnim {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 50;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    border-radius: 2px;
    animation: confettiFall linear forwards;
    opacity: 0.9;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.gotcha-emoji {
    font-size: 64px;
    margin-bottom: 6px;
    animation: emojiPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

@keyframes emojiPop {
    from {
        transform: scale(0) rotate(-20deg);
    }

    to {
        transform: scale(1) rotate(0deg);
    }
}

.gotcha-title {
    font-size: 38px;
    font-weight: 900;
    background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
    letter-spacing: -1px;
    animation: fadeInUp 0.5s ease 0.3s both;
}

.gotcha-sub {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
    animation: fadeInUp 0.5s ease 0.4s both;
    letter-spacing: 0.3px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.photo-frame {
    width: 90%;
    max-width: 320px;
    aspect-ratio: 1;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 3px solid rgba(225, 48, 108, 0.5);
    box-shadow:
        0 0 0 6px rgba(131, 58, 180, 0.08),
        0 8px 40px rgba(225, 48, 108, 0.25),
        0 2px 80px rgba(131, 58, 180, 0.1);
    animation: frameAppear 0.6s ease 0.5s both;
}

@keyframes frameAppear {
    from {
        opacity: 0;
        transform: scale(0.6) rotate(-2deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-glare {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, transparent 40%);
    pointer-events: none;
}

.prank-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 18px;
    line-height: 1.5;
    animation: fadeInUp 0.5s ease 0.6s both;
}

.prank-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #833ab4, #e1306c, #f77737);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 6px 24px rgba(225, 48, 108, 0.4);
    animation: fadeInUp 0.5s ease 0.7s both;
    letter-spacing: 0.3px;
}

.prank-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 10px 40px rgba(225, 48, 108, 0.55);
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
    body {
        background: #000;
        align-items: stretch;
    }

    .desktop-layout {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 1;
    }

    .desktop-sidebar {
        width: 220px;
        background: #000;
        border-right: 1px solid rgba(255, 255, 255, 0.12);
        padding: 20px 12px;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
    }

    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        margin-bottom: 24px;
    }

    .logo-text {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: -0.5px;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
    }

    .nav-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 12px 14px;
        border-radius: 8px;
        color: rgba(255, 255, 255, 0.65);
        text-decoration: none;
        font-size: 15px;
        font-weight: 400;
        transition: background 0.2s;
        cursor: pointer;
    }

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .nav-item.active {
        color: #fff;
        font-weight: 700;
    }

    .sidebar-bottom {
        margin-top: auto;
    }

    .sidebar-profile-avatar {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: linear-gradient(45deg, #f09433, #dc2743);
    }

    .phone-frame {
        position: relative;
        z-index: 2;
        max-width: 480px;
        height: 100vh;
        margin: 0 auto;
    }

    .top-header {
        display: none;
    }

    .bottom-bar {
        display: none;
    }

    .video-ui {
        bottom: 0;
        padding-bottom: 24px;
    }

    .video-progress {
        bottom: 0;
    }
}

@media (min-width: 1200px) {
    .desktop-sidebar {
        width: 260px;
    }
}