:root {
    --bg-main: #060911;
    --bg-secondary: #0b1120;
    --bg-card: rgba(13, 19, 33, 0.85);
    --bg-card-hover: rgba(19, 27, 46, 0.92);
    --bg-input: rgba(8, 13, 23, 0.95);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.45);
    --border-highlight: rgba(255, 255, 255, 0.16);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --yt-red: #ff0033;
    --yt-red-glow: rgba(255, 0, 51, 0.4);
    
    --secondary: #10b981;
    --accent: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-full: 9999px;
    
    --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-glass: 0 10px 35px 0 rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, .brand-info h1 {
    font-family: 'Outfit', sans-serif;
}

html, body {
    width: 100%;
    min-height: 100%;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    padding: 14px 10px 40px 10px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 600px) {
    body {
        padding: 28px 16px 60px 16px;
    }
}

/* Background Ambient Grid & Glows */
.ambient-grid-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: 28px 28px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    z-index: 0;
    pointer-events: none;
}

.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
    animation: floatOrb 14s ease-in-out infinite alternate;
}

.glow-1 {
    top: -10%;
    left: 10%;
    width: clamp(260px, 45vw, 500px);
    height: clamp(260px, 45vw, 500px);
    background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
}

.glow-2 {
    bottom: 5%;
    right: 5%;
    width: clamp(240px, 40vw, 450px);
    height: clamp(240px, 40vw, 450px);
    background: radial-gradient(circle, #e11d48 0%, transparent 70%);
    animation-delay: -6s;
}

@keyframes floatOrb {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(30px) scale(1.08); }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 820px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 600px) {
    .app-container {
        gap: 24px;
    }
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

.luxury-border {
    position: relative;
}

.luxury-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(99, 102, 241, 0.2), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 2px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.brand-logo-wrapper {
    position: relative;
    flex-shrink: 0;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #4f46e5 0%, #312e81 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #fff;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
}

@media (min-width: 600px) {
    .brand-logo {
        width: 50px;
        height: 50px;
        font-size: 24px;
        border-radius: var(--radius-md);
    }
}

.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 6px #10b981;
}

.brand-info {
    min-width: 0;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-info h1 {
    font-size: clamp(17px, 4.2vw, 24px);
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.15;
    white-space: nowrap;
}

.version-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #c4b5fd;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.gradient-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 40%, #f43f5e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: clamp(10.5px, 2.4vw, 12.5px);
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Compact Icon-Only Buttons */
.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
}

@media (min-width: 600px) {
    .btn-icon-only {
        width: 42px;
        height: 42px;
        font-size: 16px;
        border-radius: var(--radius-md);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    font-size: clamp(13px, 2.5vw, 14px);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    min-height: 44px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    min-height: 34px;
    border-radius: var(--radius-sm);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
}

.btn-youtube {
    background: linear-gradient(135deg, #ff0033 0%, #cc0000 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px var(--yt-red-glow);
}

.btn-music {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Platform Tabs (Mobile-Grid 3 Columns) */
.platform-tabs-wrapper {
    width: 100%;
    margin-bottom: 12px;
}

.platform-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 3px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-muted);
    font-size: clamp(11.5px, 2.7vw, 13px);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

.tab-btn[data-platform="youtube"].active {
    background: rgba(255, 0, 51, 0.22);
    border-color: rgba(255, 0, 51, 0.5);
    color: #fca5a5;
}

/* Search Card */
.input-card {
    padding: 14px 14px;
}

@media (min-width: 600px) {
    .input-card {
        padding: 22px 22px;
    }
}

.search-form {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

@media (min-width: 680px) {
    .search-form {
        flex-direction: row;
    }
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.input-glow-bg {
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(236, 72, 153, 0.2), transparent);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    z-index: 0;
}

.input-wrapper:focus-within .input-glow-bg {
    opacity: 1;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-dim);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 11px 78px 11px 38px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: clamp(13px, 2.7vw, 14.5px);
    outline: none;
    transition: var(--transition);
    min-height: 46px;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input::placeholder {
    color: var(--text-dim);
    font-size: clamp(11.5px, 2.4vw, 13.5px);
}

.input-actions {
    position: absolute;
    right: 6px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-paste-glow {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
    border-color: rgba(99, 102, 241, 0.45);
    color: #c7d2fe;
}

.btn-clear {
    padding: 6px 7px;
}

/* Feature Pills Bar */
.feature-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pill {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 3px 9px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.pill i {
    color: var(--primary);
    font-size: 11px;
}

.pill i.fa-music { color: var(--secondary); }
.pill i.fa-film { color: var(--accent-pink); }

/* Skeleton Loading */
.skeleton-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skeleton-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-line {
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.w-25 { width: 25%; }
.w-40 { width: 40%; }
.w-75 { width: 75%; }
.w-90 { width: 90%; }

.skeleton-media {
    width: 100%;
    height: clamp(180px, 40vw, 300px);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.skeleton-avatar::after,
.skeleton-line::after,
.skeleton-media::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Result Card */
.result-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
    .result-card {
        padding: 24px;
        gap: 18px;
    }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Author / Channel Header */
.tweet-author-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.author-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.channel-avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 0, 51, 0.15);
    border: 1px solid rgba(255, 0, 51, 0.35);
    color: #ff0033;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.author-meta {
    min-width: 0;
}

.author-meta h4 {
    font-size: clamp(13.5px, 2.8vw, 15.5px);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verified-icon {
    color: #1d9bf0;
    font-size: 13px;
    flex-shrink: 0;
}

.author-handle {
    font-size: 11.5px;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tweet-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.yt-badge {
    background: rgba(255, 0, 51, 0.15);
    border: 1px solid rgba(255, 0, 51, 0.35);
    color: #fca5a5;
}

.mp3-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.tweet-text {
    font-size: clamp(13px, 2.5vw, 14.5px);
    line-height: 1.55;
    color: #f1f5f9;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Media Containers */
.media-container {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
}

.image-grid {
    display: grid;
    gap: 6px;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr; }
.grid-3 .media-item:first-child { grid-column: span 2; }
.grid-4 { grid-template-columns: 1fr 1fr; }

@media (max-width: 480px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .grid-3 .media-item:first-child {
        grid-column: span 1;
    }
}

.media-item {
    position: relative;
    overflow: hidden;
    background: #0f172a;
    cursor: pointer;
    min-height: clamp(160px, 35vw, 240px);
    max-height: clamp(260px, 60vh, 480px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.media-item:hover img {
    transform: scale(1.03);
}

.media-badge-orig {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #38bdf8;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    z-index: 2;
}

.media-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 3;
}

.media-item:hover .media-overlay {
    opacity: 1;
}

.btn-preview-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* Video Player */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
}

.video-wrapper video {
    width: 100%;
    max-height: clamp(240px, 60vh, 480px);
    outline: none;
}

/* YouTube Preview Card */
.yt-media-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
}

.yt-thumbnail-img {
    width: 100%;
    max-height: clamp(200px, 45vw, 380px);
    object-fit: cover;
    display: block;
}

.yt-duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Format Switcher Tabs */
.format-switch-container {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.format-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: clamp(12px, 2.6vw, 13.5px);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.format-tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.format-tab-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.55);
    color: #818cf8;
}

.format-tab-btn[data-mode="mp3"].active {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.55);
    color: #34d399;
}

/* Actions Card */
.download-actions-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.actions-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.quality-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.quality-select-wrapper label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.select-quality, .custom-select {
    flex: 1;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    min-height: 40px;
    transition: var(--transition);
}

.select-quality:focus, .custom-select:focus {
    border-color: var(--primary);
}

.actions-buttons {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

@media (min-width: 540px) {
    .actions-buttons {
        flex-direction: row;
    }
}

.actions-buttons .btn {
    width: 100%;
}

/* ==================== MODALS ==================== */
.modal-backdrop,
.lightbox-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(3, 7, 18, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-icon-badge {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #818cf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.modal-title h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.modal-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Settings Items */
.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.setting-info {
    flex: 1;
    min-width: 180px;
}

.setting-info label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.setting-desc {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

.text-accent { color: #a78bfa; }
.text-danger { color: #f87171; }
.text-success { color: #34d399; }
.text-warning { color: #fbbf24; }

.vertical-group {
    flex-direction: column;
    align-items: stretch;
}

.cookies-textarea {
    width: 100%;
    min-height: 90px;
    padding: 10px;
    background: rgba(8, 12, 22, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    outline: none;
    resize: vertical;
}

/* iOS Style Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Progress Active Modal */
.progress-card {
    padding: 20px;
    gap: 16px;
    max-width: 480px;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.progress-icon-pulse {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.25));
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.progress-title-meta {
    min-width: 0;
    flex: 1;
}

.progress-title-meta h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.progress-percent-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.progress-live-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.progress-live-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-track-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.35);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.progress-bar-animated {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #10b981, #38bdf8);
    border-radius: 4px;
    transition: width 0.3s ease-out;
}


.progress-steps-row {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.p-step {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.p-step.active {
    color: #38bdf8;
    font-weight: 700;
}

.progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    flex: 1;
    min-width: 200px;
    line-height: 1.35;
}

/* History Item */

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history-meta h5 {
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
    word-break: break-all;
}

.history-meta p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    max-width: 94vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 16px;
    left: 12px;
    right: 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 600px) {
    .toast-container {
        left: auto;
        right: 20px;
        bottom: 20px;
        align-items: flex-end;
    }
}

.toast {
    pointer-events: auto;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: rgba(18, 24, 38, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success { border-left: 4px solid var(--secondary); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(14px) scale(0.95); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

/* ===== X Result Card - Download Actions ===== */
.download-actions-card {
    padding: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dl-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tweet-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tweet-badge.badge-green {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
    color: #86efac;
}

.btn-full {
    width: 100%;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-lg);
}

.btn-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.8);
}

.quality-select-wrapper.compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 13px;
}

.quality-select-wrapper.compact .select-quality {
    padding: 5px 10px;
    font-size: 12px;
    max-width: 180px;
}
