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

body {
    background: #0f0f0f;
    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: 12px 14px;
    padding-top: max(env(safe-area-inset-top, 12px), 12px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.yt-logo-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.yt-text {
    font-size: 18px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    opacity: 0.9;
}

.header-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #555, #888);
}

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

.thumbnail-blur {
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, #1a1a1a 0%, #0f0f0f 50%, #1c0a0a 100%);
    animation: ytShift 4s ease-in-out infinite;
}

@keyframes ytShift {

    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 1;
    }
}

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

.yt-shorts-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.shorts-badge {
    background: #ff0000;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff0000;
    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: 220px;
    margin: 0 auto;
}

/* ===== Video UI ===== */
.video-ui {
    position: absolute;
    bottom: 56px;
    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: 65px;
}

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

.author-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border-radius: 50%;
    flex-shrink: 0;
}

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

.subscribe-btn {
    background: #cc0000;
    border: none;
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    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.7);
}

.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);
}

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

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

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

    100% {
        width: 100%;
    }
}

/* ===== Bottom Bar ===== */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #212121;
    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: 3px;
}

.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: -2px;
}

.create-btn {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 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.45;
    animation: orbFloat 8s ease-in-out infinite;
}

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

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

@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;
    color: #ff0000;
    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(255, 0, 0, 0.4);
    box-shadow:
        0 0 0 6px rgba(255, 0, 0, 0.06),
        0 8px 40px rgba(255, 0, 0, 0.2),
        0 2px 80px rgba(255, 102, 0, 0.08);
    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: #cc0000;
    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(204, 0, 0, 0.4);
    animation: fadeInUp 0.5s ease 0.7s both;
    letter-spacing: 0.3px;
}

.prank-btn:hover {
    background: #ff0000;
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 10px 40px rgba(255, 0, 0, 0.55);
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
    body {
        background: #0f0f0f;
        align-items: stretch;
        flex-direction: column;
    }

    .desktop-layout {
        display: contents;
    }

    /* YouTube Top Bar */
    .yt-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #0f0f0f;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 20;
    }

    .yt-topbar-left {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .yt-hamburger {
        opacity: 0.8;
        cursor: pointer;
    }

    .yt-topbar-logo {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .yt-topbar-text {
        font-size: 20px;
        font-weight: 700;
        letter-spacing: -0.5px;
    }

    .yt-topbar-center {
        flex: 1;
        max-width: 500px;
        margin: 0 40px;
    }

    .yt-search-bar {
        display: flex;
        align-items: center;
        background: #121212;
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 40px;
        overflow: hidden;
    }

    .yt-search-bar input {
        flex: 1;
        background: transparent;
        border: none;
        color: #fff;
        padding: 8px 16px;
        font-size: 14px;
        outline: none;
    }

    .yt-search-bar input::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

    .yt-search-btn {
        background: rgba(255, 255, 255, 0.08);
        border: none;
        border-left: 1px solid rgba(255, 255, 255, 0.15);
        padding: 8px 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .yt-topbar-right {
        display: flex;
        align-items: center;
        gap: 18px;
    }

    .yt-topbar-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(135deg, #555, #888);
    }

    /* Side Nav */
    .yt-sidenav {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 72px;
        background: #0f0f0f;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 8px;
        gap: 4px;
        z-index: 15;
    }

    .yt-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 12px 4px;
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.6);
        text-decoration: none;
        font-size: 10px;
        width: 64px;
        text-align: center;
        cursor: pointer;
        transition: background 0.2s;
    }

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

    .yt-nav-item.active {
        color: #fff;
    }

    .yt-nav-divider {
        width: 40px;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 8px 0;
    }

    /* Phone frame */
    .phone-frame {
        position: relative;
        z-index: 2;
        max-width: 420px;
        height: calc(100vh - 56px);
        margin: 56px auto 0;
        margin-left: calc(72px + ((100% - 72px - 420px) / 2));
    }

    .top-header {
        display: none;
    }

    .bottom-bar {
        display: none;
    }

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

    .video-progress {
        bottom: 0;
    }
}

@media (min-width: 1200px) {
    .yt-sidenav {
        width: 200px;
        align-items: flex-start;
    }

    .yt-nav-item {
        flex-direction: row;
        gap: 16px;
        font-size: 14px;
        width: auto;
        padding: 10px 12px;
    }

    .phone-frame {
        margin-left: calc(200px + ((100% - 200px - 420px) / 2));
    }
}