/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: min(20px, 2vh);
    padding-left: min(200px, 15vw);
}

/* Mobile-first responsive design */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
        padding-left: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
}

/* Main container - fully responsive */
.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: min(40px, 4vh);
    width: min(500px, 40vw);
    max-width: min(500px, 40vw);
    height: min(600px, 75vh);
    max-height: 75vh;
    overflow-y: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media screen and (max-width: 768px) {
    .container {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
        min-height: calc(100vh - 40px);
        padding: 20px;
        border-radius: 12px;
        margin: 0;
    }
}

/* Header styles */
header h1 {
    font-size: min(2.5rem, 5vh);
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: min(10px, 1vh);
}

@media screen and (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    header h2 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
}

header p {
    color: #666;
    font-size: min(1.1rem, 2.5vh);
    margin-bottom: min(40px, 4vh);
}

@media screen and (max-width: 768px) {
    header p {
        font-size: 1rem;
        margin-bottom: 20px;
    }
}

/* Input section - hidden by default */
.input-section {
    margin-bottom: 30px;
    display: none;
}

#textInput {
    width: 100%;
    padding: min(16px, 2vh) min(20px, 3vw);
    font-size: min(1.1rem, 2.5vh);
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s ease;
    margin-bottom: min(20px, 2vh);
    flex-shrink: 0;
}

#textInput:focus {
    border-color: #667eea;
}

/* Button styles */
#nextBtn, #createBtn, .primary-btn {
    width: 100%;
    padding: min(16px, 2vh) min(20px, 3vw);
    font-size: min(1.1rem, 2.5vh);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

#nextBtn:hover, #createBtn:hover, .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

#nextBtn:active, #createBtn:active, .primary-btn:active {
    transform: translateY(0);
}

/* Loading container */
.loading-container {
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-container p {
    color: #666;
    font-size: 1.1rem;
}

.detection-info {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 10px;
}

/* Results container */
.results-container {
    padding: 20px 0;
}

.qr-code {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.qr-code img {
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
}

.download-btn {
    display: inline-block;
    padding: 14px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(40, 167, 69, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

/* Responsive design for both containers */
@media (max-width: 1400px) {
    .container {
        width: min(450px, 42vw);
        max-width: min(450px, 42vw);
    }
    
    body {
        padding-left: min(180px, 13vw);
    }
}

@media (max-width: 1200px) {
    .container {
        width: min(400px, 45vw);
        max-width: min(400px, 45vw);
    }
    
    .side-ad-container {
        right: min(50px, 3vw);
        width: min(600px, 40vw);
    }
    
    body {
        padding-left: min(120px, 10vw);
    }
}

@media (max-width: 1000px) {
    .container {
        width: min(350px, 48vw);
        max-width: min(350px, 48vw);
    }
    
    .side-ad-container {
        width: min(500px, 38vw);
    }
    
    body {
        padding-left: min(100px, 8vw);
    }
}

@media (max-width: 800px) {
    .container {
        width: min(320px, 50vw);
        max-width: min(320px, 50vw);
    }
    
    .side-ad-container {
        width: min(400px, 35vw);
    }
    
    body {
        padding-left: min(80px, 6vw);
    }
}

@media (max-width: 768px) {
    .container {
        width: 90vw;
        max-width: 90vw;
        height: min(500px, 60vh);
        margin-bottom: 20px;
    }
    
    .side-ad-container {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 90vw;
        max-width: 90vw;
        height: min(400px, 50vh);
        margin: 20px auto;
        display: block !important;
    }
    
    body {
        flex-direction: column;
        padding: min(20px, 2vh);
        padding-left: min(20px, 2vh);
    }
}

@media (max-width: 480px) {
    .container {
        width: 95vw;
        max-width: 95vw;
        height: min(450px, 55vh);
        padding: min(20px, 3vh) min(15px, 2vw);
        margin: min(10px, 1vh);
    }
    
    header h1 {
        font-size: min(2rem, 6vw);
    }
    
    header p {
        font-size: min(1rem, 3.5vw);
        margin-bottom: min(20px, 3vh);
    }
    
    #textInput, #createBtn, #nextBtn, .primary-btn, .secondary-btn {
        font-size: min(1rem, 3.5vw);
        padding: min(12px, 2vh) min(14px, 3vw);
    }
    
    .results-content h3 {
        font-size: min(1.2rem, 4vw);
    }
    
    .side-ad-container {
        width: 95vw;
        max-width: 95vw;
        height: min(350px, 45vh);
        margin: min(15px, 2vh) auto;
        padding: min(15px, 2vh);
    }
    
    body {
        padding: min(15px, 2vh);
    }
}

/* Logo upload section */
.logo-upload-container {
    margin-bottom: min(30px, 3vh);
    text-align: center;
}

.logo-upload-container h3 {
    font-size: min(1.5rem, 4vh);
    color: #333;
    margin-bottom: min(8px, 1vh);
}

.logo-upload-container p {
    color: #666;
    font-size: min(1rem, 2.5vh);
    margin-bottom: min(30px, 3vh);
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: min(30px, 4vh) min(20px, 3vw);
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: min(20px, 2vh);
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e0e7ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: min(3rem, 6vh);
    margin-bottom: min(15px, 2vh);
}

.browse-link {
    color: #667eea;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.logo-preview {
    position: relative;
    display: inline-block;
    margin-bottom: min(20px, 2vh);
}

.logo-preview img {
    max-width: min(120px, 15vw);
    max-height: min(120px, 15vh);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.remove-logo {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-buttons {
    display: flex;
    gap: min(10px, 1vw);
    flex-wrap: wrap;
}

.secondary-btn {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    padding: min(12px, 1.5vh) min(20px, 2.5vw);
    font-size: min(1rem, 2.5vh);
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    min-width: 80px;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.skip-btn {
    background: transparent;
    color: #6b7280;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    padding: min(12px, 1.5vh) min(20px, 2.5vw);
    font-size: min(1rem, 2.5vh);
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    min-width: 100px;
    transition: all 0.2s ease;
}

.skip-btn:hover {
    border-color: #9ca3af;
    color: #4b5563;
}

.primary-btn {
    flex: 2;
    min-width: 140px;
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .logo-preview img {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Current logo display in input section */
.current-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.current-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
}

.change-logo-btn {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.change-logo-btn:hover {
    border-color: #9ca3af;
    color: #374151;
    background: white;
}

/* Screen transitions */
.container {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.container.slide-left {
    transform: translateX(-100%);
}

.container.slide-right {
    transform: translateX(100%);
}

/* Generation container */
.generation-container {
    margin-bottom: 30px;
    text-align: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.generation-container.active {
    opacity: 1;
    transform: translateX(0);
}

/* Hide main header when generation or results screens are active */
.container.hide-header header {
    display: none;
}

.generation-content h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

/* QR Generation Area */
.qr-generation-area {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.qr-progress {
    position: relative;
    width: 256px;
    height: 256px;
    margin: 0 auto 30px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    border: 2px solid #e5e7eb;
}

.qr-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(25, 1fr);
    grid-template-rows: repeat(25, 1fr);
    opacity: 0;
}

.qr-pixel {
    background: #000;
    opacity: 0;
    animation: pixelReveal 0.1s ease-in-out forwards;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.generation-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Progress section */
.progress-section {
    margin-top: 20px;
}

.progress-bar-container {
    background: #f3f3f3;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

.progress-text {
    color: #667eea;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 5px;
}

.ad-message {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* Results container - back to normal */
.results-container {
    padding: 20px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.results-container.active {
    opacity: 1;
    transform: translateY(0);
}

.results-content {
    text-align: center;
}

.results-content h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Side ad container - positioned to the right of main container */

.side-ad-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: min(800px, 45vw);
    height: min(600px, 75vh);
    max-height: 75vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: min(15px, 2vh);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 100;
    opacity: 0;
    transition: all 0.6s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.side-ad-container.active {
    opacity: 1;
}

#container-40c53785c982ab911aea1e688f3e55e5 {
    width: 100% !important;
    min-width: 400px !important;
    min-height: min(450px, 55vh) !important;
    max-height: min(600px, 70vh) !important;
    max-width: 100% !important;
    overflow: hidden !important;
    flex: 1;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.side-ad-container::before {
    content: "Our sponsor for this session, they help us keep this tool free for you";
    color: rgba(255, 255, 255, 0.7);
    font-size: min(11px, 1.8vh);
    margin-bottom: min(15px, 2vh);
    text-transform: none;
    letter-spacing: 0.5px;
    display: block;
}

/* Ad script container and actual ad styling */
#adscript-container {
    width: 100%;
    min-height: 400px;
}

/* Back to Basics - Simple Ad Container */
#adscript-container {
    width: 100%;
    min-height: 300px;
}

#container-40c53785c982ab911aea1e688f3e55e5 {
    width: 100% !important;
    min-width: 300px !important;
    min-height: 250px !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Subtle loading indicator */
.ad-clean-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
    pointer-events: none;
}

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

/* Ad content styling */
.ad-clean-container > * {
    position: relative;
    z-index: 2;
}

/* Responsive ad sizing within clean container */
.ad-clean-container iframe,
.ad-clean-container img,
.ad-clean-container div {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
}

/* Primary ad container - keep original for compatibility */
#container-40c53785c982ab911aea1e688f3e55e5 {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Additional ad containers for grid */
#container-skyscraper,
#container-medium-rect {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Scale up ad content responsively based on viewport height and width */
#container-40c53785c982ab911aea1e688f3e55e5 > * {
    transform: scale(1.5) !important;
    transform-origin: center !important;
    max-width: 90% !important;
    max-height: 90% !important;
}

/* Vertical responsiveness - scaling for reduced viewport heights */
@media (max-height: 700px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.3) !important;
        max-width: 85% !important;
        max-height: 85% !important;
    }
}

@media (max-height: 600px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.2) !important;
        max-width: 80% !important;
        max-height: 80% !important;
    }
}

@media (max-height: 500px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.0) !important;
        max-width: 75% !important;
        max-height: 75% !important;
    }
}

@media (max-height: 400px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(0.9) !important;
        max-width: 70% !important;
        max-height: 70% !important;
    }
}

/* Horizontal responsiveness - scaling for reduced viewport widths */
@media (max-width: 1400px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.3) !important;
        max-width: 85% !important;
        max-height: 85% !important;
    }
}

@media (max-width: 1200px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.2) !important;
        max-width: 80% !important;
        max-height: 80% !important;
    }
}

@media (max-width: 1000px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.0) !important;
        max-width: 75% !important;
        max-height: 75% !important;
    }
}

@media (max-width: 800px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(0.9) !important;
        max-width: 70% !important;
        max-height: 70% !important;
    }
}

/* Combined height and width constraints for optimal scaling */
@media (max-height: 600px) and (max-width: 1200px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(1.0) !important;
        max-width: 75% !important;
        max-height: 75% !important;
    }
}

@media (max-height: 500px) and (max-width: 1000px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(0.9) !important;
        max-width: 70% !important;
        max-height: 70% !important;
    }
}

/* Mobile Layout Overrides */
@media screen and (max-width: 768px) {
    /* Side ad container will be repositioned, not hidden */
    
    /* Make main container full width */
    .container {
        width: calc(100% - 20px) !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        padding: 20px !important;
        margin: 10px auto !important;
        justify-content: flex-start !important;
        display: block !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    /* Logo upload section mobile optimization */
    .logo-upload-container h3 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    .upload-area {
        min-height: 120px;
        padding: 20px;
        margin: 15px 0;
    }
    
    .upload-area .upload-icon {
        font-size: 2.5rem;
    }
    
    .logo-preview img {
        max-width: 100px;
        max-height: 100px;
    }
    
    /* Input section mobile optimization */
    #textInput {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Buttons mobile optimization */
    .primary-btn,
    .skip-btn,
    .change-logo-btn,
    .download-btn {
        padding: 15px 20px;
        font-size: 1rem;
        min-height: 50px;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Generation container mobile optimization */
    .generation-container {
        padding: 20px 15px;
    }
    
    .qr-generation-area {
        flex-direction: column;
    }
    
    #qrGenerationProgress {
        margin-bottom: 20px;
        margin-right: 0;
    }
    
    .progress-section {
        text-align: center;
    }
    
    /* Results container mobile optimization */
    .results-container {
        padding: 20px 15px;
        width: 100%;
        position: relative;
        display: block !important;
        transform: none !important;
        opacity: 1 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
    }
    
    .results-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        text-align: center;
    }
    
    .results-content h3 {
        margin-bottom: 20px;
        text-align: center;
    }
    
    #qrcode {
        margin: 0 auto 20px auto;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 200px;
        position: relative;
    }
    
    #qrcode img,
    #qrcode canvas {
        max-width: 90%;
        max-height: 300px;
        width: auto;
        height: auto;
        margin: 0 auto;
        display: block;
    }
    
    .download-btn {
        margin: 20px auto;
        display: block;
        text-align: center;
        width: 90%;
        max-width: 300px;
    }
    
    /* Override any desktop positioning that might interfere */
    .results-container.active {
        transform: none !important;
        opacity: 1 !important;
    }
    
    /* Ensure QR code container doesn't get pushed to the left */
    .qr-code {
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    /* Show side ad container on mobile as bottom section */
    .side-ad-container,
    #mobile-ad-container {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        top: auto !important;
        right: auto !important;
        background: #f8fafc !important;
        border-radius: 12px !important;
        margin: 20px 0 !important;
        padding: 20px 15px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        opacity: 1 !important;
        display: block !important;
    }
    
    .side-ad-container::before,
    #mobile-ad-container::before {
        content: "Supported by our sponsors - keeping this tool free for everyone" !important;
        color: #6b7280 !important;
        font-size: 0.8rem !important;
        margin-bottom: 15px !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Mobile ad container sizing */
    #mobile-ad-container #container-40c53785c982ab911aea1e688f3e55e5,
    #container-40c53785c982ab911aea1e688f3e55e5 {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        height: auto !important;
        min-height: 200px !important;
        max-height: 300px !important;
        transform: none !important;
        overflow: hidden !important;
        border-radius: 8px !important;
        background: #ffffff !important;
    }
    
    #mobile-ad-container #container-40c53785c982ab911aea1e688f3e55e5 > *,
    .side-ad-container #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: none !important;
        max-width: 100% !important;
        max-height: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
    
    /* FAQ and content sections mobile optimization */
    .benefits-section,
    .use-cases-section,
    .faq-section {
        margin: 15px;
        padding: 20px 15px;
    }
    
    .benefits-grid,
    .use-cases-grid,
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section-header h2 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }
    
    /* Touch targets */
    button,
    input[type="file"],
    .upload-area {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    /* Scroll behavior */
    .container {
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Form validation styling */
    input:invalid {
        border-color: #e53e3e;
    }
    
    input:valid {
        border-color: #48bb78;
    }
}

/* Additional mobile improvements */
@media screen and (max-width: 480px) {
    /* Very small mobile screens */
    body {
        padding: 5px;
        padding-top: 10px;
    }
    
    .container {
        width: calc(100% - 10px) !important;
        margin: 5px !important;
        padding: 15px !important;
        border-radius: 8px !important;
    }
    
    header h1 {
        font-size: 1.8rem !important;
    }
    
    header h2 {
        font-size: 1rem !important;
    }
    
    header p {
        font-size: 0.9rem !important;
    }
    
    /* Make upload area smaller on very small screens */
    .upload-area {
        min-height: 100px;
        padding: 15px;
    }
    
    .upload-area .upload-icon {
        font-size: 2rem;
    }
}

/* Landscape mobile orientation */
@media screen and (max-width: 768px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 10px;
    }
    
    .container {
        min-height: auto !important;
        max-height: calc(100vh - 20px) !important;
        overflow-y: auto !important;
    }
    
    header h1 {
        font-size: 1.8rem !important;
        margin-bottom: 5px !important;
    }
    
    header h2 {
        font-size: 1rem !important;
        margin-bottom: 5px !important;
    }
    
    header p {
        font-size: 0.9rem !important;
        margin-bottom: 15px !important;
    }
}

@media (max-height: 400px) and (max-width: 800px) {
    #container-40c53785c982ab911aea1e688f3e55e5 > * {
        transform: scale(0.8) !important;
        max-width: 65% !important;
        max-height: 65% !important;
    }
}

/* Ensure ad iframes and content scale properly */
#container-40c53785c982ab911aea1e688f3e55e5 iframe,
#container-40c53785c982ab911aea1e688f3e55e5 img,
#container-40c53785c982ab911aea1e688f3e55e5 div,
#container-skyscraper iframe,
#container-skyscraper img,
#container-skyscraper div,
#container-medium-rect iframe,
#container-medium-rect img,
#container-medium-rect div {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 8px !important;
}

/* Real QR morph styles */
.real-qr-morph {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.real-qr-morph img {
    border-radius: 12px;
}

/* Smooth transitions for progress elements */
.progress-section {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.generation-content h3 {
    transition: opacity 0.3s ease;
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pixelReveal {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

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

.countdown-timer-pulse {
    animation: pulse 1s ease-in-out;
}