/* ===== ZXH Instagram Reel Downloader - Complete Styles ===== */
:root {
    --bg: #05050f;
    --card-bg: rgba(16, 16, 32, 0.78);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #eaeaef;
    --text-secondary: #9898b0;
    --accent-orange: #f97316;
    --accent-pink: #ec4899;
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --gradient-4: linear-gradient(135deg, #f97316, #ec4899, #a855f7, #3b82f6);
    --glass-blur: 40px;
    --transition-fast: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-xl: 28px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 11px;
    --shadow-glow-pink: 0 0 60px rgba(236, 72, 153, 0.35);
    --shadow-glow-purple: 0 0 50px rgba(168, 85, 247, 0.3);
    --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 48px 48px;
}

/* Splash */
#splashScreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #05050f;
    transition: opacity 0.55s ease, visibility 0.55s ease;
    pointer-events: all;
}
#splashScreen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.splash-logo-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 22px;
}
.splash-logo-square {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: var(--gradient-4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 80px rgba(236, 72, 153, 0.55), 0 0 140px rgba(168, 85, 247, 0.4);
    animation: splashPulse 2s ease-in-out infinite;
    overflow: hidden;
}
.splash-logo-square img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
    display: block;
}
@keyframes splashPulse {
    0%, 100% {
        box-shadow: 0 0 80px rgba(236, 72, 153, 0.55), 0 0 140px rgba(168, 85, 247, 0.4);
    }
    50% {
        box-shadow: 0 0 110px rgba(236, 72, 153, 0.7), 0 0 180px rgba(168, 85, 247, 0.55);
    }
}
.ring-pulse {
    position: absolute;
    inset: -16px;
    border-radius: 32px;
    border: 3px solid rgba(236, 72, 153, 0.55);
    animation: ringPulse 1.6s ease-out infinite;
    z-index: 1;
}
.ring-pulse:nth-child(2) {
    animation-delay: 0.55s;
    border-color: rgba(168, 85, 247, 0.45);
}
.ring-pulse:nth-child(3) {
    animation-delay: 1.1s;
    border-color: rgba(249, 115, 22, 0.35);
}
@keyframes ringPulse {
    0% { transform: scale(1); opacity: 0.85; }
    100% { transform: scale(1.8); opacity: 0; }
}
.splash-title {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient-4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.2;
}
.splash-subtitle {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 26px;
}
.loading-bar-wrap {
    width: 190px;
    height: 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--gradient-4);
    background-size: 200% 100%;
    animation: gradientShift 1.5s ease infinite, loadBar 2.4s ease forwards;
    width: 0%;
}
@keyframes loadBar {
    0% { width: 0%; }
    100% { width: 100%; }
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* App Container */
#appContainer {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    pointer-events: none;
    gap: 18px;
}
#appContainer.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    padding: 8px 0;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.mini-logo {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: var(--gradient-4);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}
.mini-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}
.mini-logo:hover {
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.6);
    transform: scale(1.05);
}
.header-text {
    display: flex;
    flex-direction: column;
}
.header-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient-4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}
.header-subtitle {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}
.menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 1.2rem;
}
.menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.menu-btn:active {
    transform: scale(0.92);
}

/* Glass Card */
.glass-card {
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 26px 24px 20px;
    position: relative;
    max-height: 78vh;
    overflow-y: auto;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.glass-card::-webkit-scrollbar {
    width: 4px;
}
.glass-card::-webkit-scrollbar-track {
    background: transparent;
}
.glass-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

/* Pages */
.pages-container {
    flex: 1;
    min-height: 0;
}
.page {
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    will-change: transform, opacity;
}
.page.hidden {
    display: none;
    opacity: 0;
    transform: translateY(16px);
}
.page.active {
    display: block;
    animation: slideUpIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes slideUpIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(5, 5, 15, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    pointer-events: all;
}
.menu-overlay.open {
    opacity: 1;
    visibility: visible;
}
.menu-panel {
    width: 90%;
    max-width: 360px;
    background: rgba(22, 22, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 30px 20px 20px;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.menu-overlay.open .menu-panel {
    transform: scale(1);
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: #ddd;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.02em;
    text-decoration: none;
}
.menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.menu-item:active {
    transform: scale(0.97);
}
.menu-close {
    align-self: flex-end;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    margin-bottom: 6px;
}
.menu-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* Input */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.input-group input {
    width: 100%;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 0.94rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}
.input-group input:focus {
    border-color: rgba(236, 72, 153, 0.65);
    box-shadow: 0 0 28px rgba(236, 72, 153, 0.2), 0 0 0 5px rgba(236, 72, 153, 0.06);
    background: rgba(255, 255, 255, 0.07);
}
.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}
.paste-btn-wrap {
    display: flex;
    justify-content: flex-end;
}
.paste-btn {
    padding: 9px 18px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: #ccc;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.paste-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}
.paste-btn:active {
    transform: scale(0.93);
    background: rgba(236, 72, 153, 0.22);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.94rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    letter-spacing: 0.02em;
    transition: all var(--transition-fast);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    overflow: hidden;
    will-change: transform;
}
.btn:active {
    transform: scale(0.94);
}
.btn-gradient {
    background: var(--gradient-4);
    background-size: 200% 200%;
    color: #fff;
    width: 100%;
    font-weight: 700;
    animation: shimmerBg 5s ease infinite;
    box-shadow: 0 8px 30px rgba(236, 72, 153, 0.35);
    margin-top: 4px;
    letter-spacing: 0.03em;
}
.btn-gradient:hover {
    box-shadow: 0 12px 36px rgba(236, 72, 153, 0.5);
    transform: translateY(-2px);
}
.btn-gradient:disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(30%);
}
@keyframes shimmerBg {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}
.btn-outline {
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    color: #d0d0d8;
    flex: 1;
    font-weight: 500;
}
.btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.btn-sm {
    padding: 10px 16px;
    font-size: 0.83rem;
    border-radius: 10px;
}
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: #bbb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}
.btn-icon:active {
    transform: scale(0.9);
}
.btn-success-flash {
    border: 2px solid #22c55e !important;
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.45) !important;
    color: #22c55e !important;
    transition: all 0.3s ease;
}

/* Video */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 45vh;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    margin-bottom: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}
.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    color: #888;
    font-size: 0.85rem;
    pointer-events: none;
    border-radius: var(--radius-md);
    transition: opacity 0.35s;
    font-weight: 500;
}
.video-placeholder.hidden {
    opacity: 0;
}
.video-info-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #ddd;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Info */
.info-block {
    margin-bottom: 8px;
}
.info-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.83rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.info-row strong {
    color: #fff;
    font-weight: 600;
}
.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 500;
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.caption-edit {
    width: 100%;
    min-height: 48px;
    max-height: 100px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ddd;
    padding: 12px 14px;
    font-size: 0.84rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    outline: none;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}
.caption-edit:focus {
    border-color: rgba(236, 72, 153, 0.55);
    box-shadow: 0 0 16px rgba(236, 72, 153, 0.12);
}
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Download Progress */
.download-progress-wrap {
    width: 100%;
    height: 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin-top: 10px;
    display: none;
}
.download-progress-wrap.active {
    display: block;
}
.download-progress-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--gradient-4);
    background-size: 200% 100%;
    width: 0%;
    transition: width 0.15s ease;
    animation: shimmerBg 3s ease infinite;
}
.download-progress-text {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 5px;
    font-weight: 500;
    letter-spacing: 0.03em;
    display: none;
}
.download-progress-text.active {
    display: block;
}

/* History Section */
.history-section {
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
}
.history-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}
.history-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}
.history-item:active {
    transform: scale(0.98);
}
.history-thumb {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    overflow: hidden;
}
.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.history-info {
    flex: 1;
    min-width: 0;
}
.history-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-url {
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-delete {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.history-delete:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}
.history-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 16px 0;
    opacity: 0.7;
}
.history-clear-all {
    font-size: 0.7rem;
    color: #f87171;
    cursor: pointer;
    text-align: right;
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: all var(--transition-fast);
}
.history-clear-all:hover {
    color: #fca5a5;
}

/* Footer */
.app-footer {
    flex-shrink: 0;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    background: var(--gradient-4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.85;
    padding: 4px 16px;
    margin-top: 0;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    pointer-events: all;
    padding: 13px 18px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    max-width: 380px;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
}
.toast.removing {
    animation: toastOut 0.3s ease forwards;
}
.toast-success {
    background: rgba(22, 163, 74, 0.85);
    border-color: rgba(34, 197, 94, 0.5);
}
.toast-error {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(239, 68, 68, 0.5);
}
.toast-info {
    background: rgba(37, 99, 235, 0.8);
    border-color: rgba(59, 130, 246, 0.5);
}
.toast-warning {
    background: rgba(217, 119, 6, 0.85);
    border-color: rgba(245, 158, 11, 0.5);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* Loading Overlay */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(5, 5, 15, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: opacity 0.35s ease;
}
.overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}
.spinner-ring {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: #ec4899;
    border-right-color: #a855f7;
    animation: spin 0.75s linear infinite;
    margin-bottom: 18px;
    will-change: transform;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.overlay-text {
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
}
.overlay-progress-bar {
    width: 210px;
    height: 3px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.overlay-progress-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--gradient-4);
    width: 0%;
    transition: width 0.2s ease;
}

/* ===== PWA INSTALL POPUP ===== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    backdrop-filter: blur(5px);
}
.popup-content {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: #333;
    border-radius: 30px;
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 90%;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    animation: slideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.3s;
}
.popup-close-btn:hover { color: #333; }
.popup-content img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.popup-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.popup-content p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 25px;
}
.btn-premium {
    background: linear-gradient(135deg, #f97316, #ec4899);
    border: none;
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 1.1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.35);
}
.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(236, 72, 153, 0.5);
}
.not-now-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 20px;
    transition: color 0.3s;
}
.not-now-btn:hover { color: #555; }

/* Responsive */
@media (max-width: 480px) {
    .glass-card {
        max-width: 94%;
        max-height: 80vh;
        padding: 20px 14px 14px;
        border-radius: 22px;
    }
    #appContainer {
        padding: 12px;
        gap: 14px;
    }
    .header-title {
        font-size: 1.15rem;
    }
    .header-subtitle {
        font-size: 0.72rem;
    }
    .input-group input {
        padding: 14px;
        font-size: 0.88rem;
    }
    .paste-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
    }
    .btn {
        padding: 13px 20px;
        font-size: 0.88rem;
    }
    .video-container {
        max-height: 38vh;
        border-radius: 12px;
    }
    .video-container video {
        border-radius: 12px;
    }
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    .toast {
        max-width: 100%;
        font-size: 0.76rem;
        padding: 11px 14px;
    }
}