* {
    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 (hidden on mobile) ===== */
.desktop-layout {
    display: none;
}

/* ===== Phone Frame (shared) ===== */
.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: 12px 16px;
    padding-top: max(env(safe-area-inset-top, 12px), 12px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.header-icon {
    opacity: 0.9;
    flex-shrink: 0;
}

.header-tabs {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-tabs .tab {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    position: relative;
    padding-bottom: 4px;
}

.header-tabs .active-tab {
    color: #fff;
    font-weight: 700;
}

.header-tabs .active-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
}

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

.thumbnail-blur {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #1a1a2e 100%);
    animation: bgShift 4s ease-in-out infinite;
}

@keyframes bgShift {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

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

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

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fe2c55;
    border-right-color: #25f4ee;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

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

.loading-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    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.7));
    padding-bottom: 16px;
}

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

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

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
}

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

.follow-btn {
    background: #fe2c55;
    border: none;
    color: #fff;
    padding: 5px 14px;
    border-radius: 4px;
    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;
    overflow: hidden;
}

.music-icon {
    font-size: 14px;
}

.music-marquee {
    overflow: hidden;
    white-space: nowrap;
}

.music-marquee span {
    display: inline-block;
    animation: marquee 8s linear infinite;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ===== Right Actions ===== */
.right-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    position: absolute;
    right: 12px;
    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);
}

.action-btn svg {
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.avatar-action {
    position: relative;
    margin-bottom: 6px;
}

.small-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    border: 2px solid #fff;
}

.plus-badge {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #fe2c55;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.music-disc {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #333, #555);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: discSpin 3s linear infinite;
    border: 3px solid #444;
}

.disc-inner {
    width: 16px;
    height: 16px;
    background: #222;
    border-radius: 50%;
    border: 2px solid #555;
}

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

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

.progress-bar {
    height: 100%;
    width: 35%;
    background: #fff;
    border-radius: 0 2px 2px 0;
    animation: progressMove 12s linear infinite;
}

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

    100% {
        width: 100%;
    }
}

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

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

.tab-item span {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.active-tab-item span {
    color: #fff;
}

.create-tab {
    margin-top: -4px;
}

.create-btn {
    width: 44px;
    height: 28px;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.create-btn::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: calc(100% + 6px);
    border-radius: 8px;
    background: linear-gradient(90deg, #25f4ee, #fe2c55);
    z-index: -1;
}

.create-btn span {
    font-size: 22px;
    font-weight: 300;
    color: #000;
    line-height: 1;
}

/* ===== 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: #fe2c55;
    top: -100px;
    right: -80px;
    animation-delay: 0s;
}

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

.orb3 {
    width: 250px;
    height: 250px;
    background: #a855f7;
    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 */
.camera-flash {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

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

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

    100% {
        opacity: 0;
    }
}

/* Confetti */
.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, #fe2c55, #ff6b81, #25f4ee);
    -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(254, 44, 85, 0.5);
    box-shadow:
        0 0 0 6px rgba(37, 244, 238, 0.08),
        0 8px 40px rgba(254, 44, 85, 0.25),
        0 2px 80px rgba(37, 244, 238, 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%, transparent 100%);
    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, #fe2c55, #ff4070);
    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(254, 44, 85, 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(254, 44, 85, 0.55);
}

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

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

    /* Sidebar */
    .desktop-sidebar {
        width: 240px;
        background: #121212;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        padding: 20px 12px;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
    }

    .sidebar-logo {
        padding: 0 8px;
        margin-bottom: 24px;
    }

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

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

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

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

    .sidebar-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.08);
        margin: 16px 0;
    }

    .sidebar-section-title {
        font-size: 12px;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.4);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        padding: 0 12px;
        margin-bottom: 12px;
    }

    .sidebar-accounts {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar-account {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.2s;
    }

    .sidebar-account:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .account-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .account-info {
        display: flex;
        flex-direction: column;
    }

    .account-name {
        font-size: 14px;
        font-weight: 600;
    }

    .account-followers {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.4);
    }

    .desktop-content {
        flex: 1;
    }

    /* Phone frame adjustments */
    .phone-frame {
        position: relative;
        z-index: 2;
        max-width: 480px;
        height: 100vh;
        margin: 0 auto;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    /* Hide mobile-only elements on desktop */
    .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: 280px;
    }
}