:root {
    --bg-body: #f5f5f5; 
    --bg-container: white;
    --bg-card: white;
    --color-text: #0f172a;
    --color-muted: #64748b;      /* <--- Use this one */
    --color-text-muted: #64748b; /* <--- Add this as a backup/alias */
    --border-color: #e2e8f0;
    --brand-red: #991b1b; 
}

/* Night Mode Overrides */
body.night-mode {
    --bg-body: #0f172a;
    --bg-container: #1e293b;
    --bg-card: #1e293b;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --border-color: #334155;
    --brand-red: #ef4444;
}

body { 
    background: var(--bg-body); 
    color: var(--color-text); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    min-height: 100vh; 
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* --- HEADER --- */
.header { background: var(--bg-container); height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); z-index: 100; flex-shrink: 0; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 800; cursor: pointer; color: var(--color-text); user-select: none; }
.brand img { height: 40px; border-radius: 4px; }

/* 1. HIDE THE HAMBURGER ON DESKTOP */
.hamburger { display: none; font-size: 28px; background: none; border: none; cursor: pointer; color: var(--color-text); padding: 0; margin: 0; }

/* 2. SPREAD THE LINKS AND BUTTONS ON DESKTOP */
.nav-right { display: flex; flex: 1; align-items: center; justify-content: space-between; margin-left: 30px; }
.nav-links { display: flex; gap: 30px; margin: 0; padding: 0; align-items: center; }
.nav-link { color: var(--color-muted); text-decoration: none; font-weight: 600; font-size: 15px; transition: 0.2s; }
.nav-link:hover { color: var(--color-text); }

.auth-section { display: flex; align-items: center; gap: 15px; }
.auth-btn { padding: 8px 16px; font-size: 14px; font-weight: 600; border-radius: 6px; cursor: pointer; transition: 0.2s; border: none; background: var(--brand-red); color: white; }
.auth-btn:hover { background: #7f1d1d; }

.credit-display { font-size: 14px; font-weight: 600; color: black; background: #f8fafc; padding: 6px 12px; border-radius: 20px; border: 1px solid black; display: none; align-items: center; }

#initial-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    padding-top: 220px; 
    padding-left: 20px;
    padding-right: 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    /* THE FIX: Automatically flips based on theme */
    color: var(--color-text); 
    line-height: 1.2;
    text-align: center;
}
.drop-zone {
    background: var(--bg-container); 
    border: 2px dashed #cbd5e1; 
    border-radius: 16px;
    padding: 60px 20px; 
    width: 100%;
    max-width: 700px; 
    text-align: center;
    box-shadow: var(--shadow);
    transition: 0.2s;
}
.drop-zone:hover { border-color: #94a3b8; background: #f8fafc; }
.upload-icon { font-size: 48px; margin-bottom: 15px; }

input[type="file"] { display: none; }

.custom-file-upload {
    display: inline-block;
    padding: 12px 24px;
    cursor: pointer;
    background: #0f172a;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    transition: 0.2s;
}
.custom-file-upload:hover { background: #334155; }
.drop-zone-text {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-top: 15px;
    margin-bottom: 0;
}

/* 3. STATE 2: Workspace View */
/* --- NEW LANDING PAGE STYLING --- */
.landing-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
    gap: 60px;
}

.hero-content { flex: 1; }
.hero-visual { flex: 1.4; display: flex; justify-content: center; }

.hero-headline { font-size: 4rem; font-weight: 800; line-height: 1.1; margin-bottom: 20px; color: var(--color-text); }
.text-accent { color: var(--brand-red); } 
.hero-subtext { font-size: 1.2rem; color: var(--color-muted); line-height: 1.6; margin-bottom: 40px; max-width: 90%; }

.hero-stats { display: flex; gap: 30px; margin-bottom: 40px; }
.stat-box h2 { font-size: 2rem; font-weight: 800; margin: 0 0 5px 0; color: var(--color-text); }
.stat-box p { font-size: 0.9rem; color: var(--color-muted); margin: 0; font-weight: 600; text-transform: uppercase; }

.hero-buttons { display: flex; gap: 15px; }
.hero-btn { padding: 16px 32px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; transition: 0.2s; border: none; }
.btn-primary { background: #3b82f6; color: white; box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4); }
.btn-primary:hover { background: #2563eb; transform: translateY(-2px); }
.btn-secondary { background: var(--bg-card); color: var(--color-text); border: 2px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }

/* --- INTERACTIVE SLIDER CSS --- */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 900px; /* <--- Increased from 500px */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* Sleeker, softer shadow */
    cursor: ew-resize; 
    touch-action: pan-y; 
}

.comparison-slider img { width: 100%; display: block; pointer-events: none; user-select: none; }

.img-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); 
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--brand-red);
    transform: translateX(-50%);
    pointer-events: none; 
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--brand-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#workspace-view {
    display: none; 
    flex-grow: 1;
    height: calc(100vh - 60px);
    flex-direction: row; 
    overflow: hidden;
    position: relative; /* Added for the floating settings menu */
}

/* The Left Sidebar Controls */
.sidebar {
    width: 280px;
    background: var(--bg-container); 
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.sidebar-controls {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

button.action-btn { 
    padding: 12px; 
    font-size: 15px; 
    font-weight: 600;
    cursor: pointer; 
    border: none; 
    border-radius: 8px; 
    width: 100%;
    transition: 0.2s; 
}
#translateBtn { background: var(--brand-red); color: white; } 
#translateBtn:hover { background: #7f1d1d; }
#downloadBtn { background: #1e293b; color: white; } 
#downloadBtn:hover { background: #0f172a; }
#resetBtn { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
#resetBtn:hover { background: #e2e8f0; }

/* Thumbnail List */
.thumbnail-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.thumbnail-list::-webkit-scrollbar { width: 6px; }
.thumbnail-list::-webkit-scrollbar-track { background: transparent; }
.thumbnail-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
    border: transparent;
}

.thumbnail-item {
    position: relative;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    height: 140px; 
    flex-shrink: 0; 
    background: var(--bg-container); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.thumbnail-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.thumbnail-item.active {
    border-color: var(--color-primary); 
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}
.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.thumb-status {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}
.thumb-number {
        position: absolute;
        bottom: 5px;
        left: 5px;
        background: rgba(255,255,255,0.9);
        color: #333;
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 11px;
        font-weight: bold;
}

/* NEW: Torii-Style "Add Images" Card */
.add-image-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #cbd5e1;
    background: transparent;
    box-shadow: none;
    border-radius: 12px;
}
.add-image-card:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
    box-shadow: none;
}
.add-image-card.active {
    border-color: #cbd5e1; /* Override active state for this specific card */
    box-shadow: none;
}
.add-circle {
    width: 50px;
    height: 50px;
    background-color: #7f1d1d; /* Light blue */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff; /* Bright blue */
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 5px;
    
    box-sizing: border-box;
    padding-bottom: 10px;
    line-height: 0; 
}
.add-text {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

/* Manga Reader Bottom Controls */
.reader-controls {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-container); 
    flex-shrink: 0;
    display: flex;
    gap: 10px;
}
button.reader-btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    font-weight: bold;
    background: #0f172a; 
    color: white;       
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}
button.reader-btn:hover { 
    background: #1e293b; 
}

/* The Main Image Viewer */
.main-viewer {
    flex-grow: 1;
    overflow-y: auto; 
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; 
    background: var(--bg-body); /* Restored to user's choice */
}

#active-image-display {
    width: 100%;
    max-width: 900px;
    height: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-radius: 4px;
    display: none; 
    transition: all 0.2s ease;
}

#active-image-display.fit-screen {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: calc(100vh - 100px); 
    object-fit: contain;
}

.main-viewer:fullscreen { background: #000; padding: 0; align-items: center; }
.main-viewer:fullscreen #active-image-display { max-height: 100vh; border-radius: 0; }

/* --- ADDED: SETTINGS WIDGET CSS --- */
.settings-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background: #0f172a;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    transition: 0.2s;
    z-index: 1000;
}
.settings-fab:hover {
    transform: scale(1.05);
    background: #1e293b;
}

.settings-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: 260px;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    border: 1px solid #e2e8f0;
}
.settings-panel.open {
    display: flex; /* Shown when toggled */
}
.settings-panel h3 { 
    margin: 0; font-size: 16px; color: #0f172a; display: flex; align-items: center; gap: 8px;
    padding-bottom: 10px; border-bottom: 1px solid #e2e8f0;
}
.setting-group { display: flex; flex-direction: column; gap: 6px; }
.setting-group label { font-size: 12px; font-weight: 600; color: #64748b; }
.setting-group select, .setting-group input {
    padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; color: #333; outline: none; background: #f8fafc;
}
.setting-group select:focus, .setting-group input:focus { border-color: #0f172a; background: white;}

.thumb-delete {
    position: absolute; bottom: 5px; right: 5px; 
    /* Match the exact red from #translateBtn (--brand-red) */
    background: #991b1b; 
    color: white; border: none; 
    padding: 4px; border-radius: 4px; font-size: 12px; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; 
    transition: 0.2s; line-height: 1; z-index: 10;
}
/* Hover effect to make it slightly darker red */
.thumb-delete:hover { background: #7f1d1d; transform: scale(1.1); }

.restore-btn {
    margin-top: 5px; padding: 10px; font-size: 13px; font-weight: bold; 
    background: #1e293b; border: none; border-radius: 6px; color: white; 
    cursor: pointer; width: 100%; transition: 0.2s; 
}
.restore-btn:hover { background: #0f172a; }

/* --- FOOTER STYLING --- */
footer {
    background: var(--bg-container);
    border-top: 1px solid var(--border-color);
    padding: 50px 20px 30px 20px;
    margin-top: auto; /* Pushes footer to bottom of short pages */
    color: var(--color-text);
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
}

.footer-brand .footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 15px;
}

.footer-brand .footer-logo img {
    height: 30px;
    border-radius: 4px;
}

.footer-brand p {
    font-size: 14px;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0;
}

.footer-column h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul li a {
    text-decoration: none;
    color: var(--color-muted);
    font-size: 14px;
    transition: color 0.2s;
}

.footer-column ul li a:hover {
    color: var(--brand-red);
}

.footer-bottom {
    max-width: 1100px;
    margin: 40px auto 0 auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 13px;
    color: var(--color-muted);
}

/* Responsive Fix for Mobile */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }
    .footer-brand {
        grid-column: span 2;
    }

    .landing-container { flex-direction: column; text-align: center; padding: 40px 20px; }
    .hero-subtext { margin: 0 auto 30px auto; }
    .hero-stats { justify-content: center; }
    .hero-buttons { justify-content: center; }
}

/* --- LEGAL PAGES (Privacy, Terms, Cookies, FAQ) --- */
.content-wrapper { flex-grow: 1; padding: 60px 20px; display: flex; justify-content: center; }
.legal-document { max-width: 800px; width: 100%; background: var(--bg-card); padding: 50px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.legal-document h1 { font-size: 36px; font-weight: 800; margin: 0 0 10px 0; }
.legal-document .last-updated { color: var(--color-muted); font-size: 14px; margin-bottom: 40px; font-weight: 600; }
.legal-document h2 { font-size: 20px; font-weight: 700; margin: 35px 0 15px 0; color: var(--color-text); border-bottom: 2px solid var(--border-color); padding-bottom: 8px; }
.legal-document p, .legal-document li { color: var(--color-text-muted); line-height: 1.7; font-size: 15px; margin-bottom: 15px; }
.legal-document ul { margin-bottom: 20px; padding-left: 20px; }

/* --- FAQ CONTENT --- */
.faq-container { max-width: 800px; margin: 60px auto; padding: 0 20px; flex-grow: 1; }
.faq-container h1 { font-size: 42px; font-weight: 800; text-align: center; margin-bottom: 40px; }
.faq-item { background: var(--bg-container); border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 15px; overflow: hidden; }
.faq-question { padding: 20px; width: 100%; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; font-size: 18px; border: none; background: none; color: var(--color-text); text-align: left; }
.faq-answer { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; color: var(--color-muted); line-height: 1.6; }
.faq-item.active .faq-answer { max-height: 200px; padding: 0 20px 20px 20px; }
.faq-item.active .arrow { transform: rotate(180deg); }
.arrow { transition: transform 0.3s; font-size: 12px; }

/* --- LOGIN AREA --- */
.main-content { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 20vh; }
.header-title { display: flex; flex-direction: column; align-items: center; gap: 20px; font-size: 32px; font-weight: 800; color: var(--color-text); margin-bottom: 30px; text-align: center; }
.header-title img { height: 200px; border-radius: 8px; }
.login-card { background: var(--bg-card); padding: 40px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); width: 100%; max-width: 340px; text-align: center; }
.btn { width: 100%; padding: 12px; border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google { background: white; color: var(--color-text); border: 1px solid var(--border-color); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-google:hover { background: #f8fafc; }
.divider { display: flex; align-items: center; text-align: center; margin: 24px 0; color: var(--color-muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.divider:not(:empty)::before { margin-right: .5em; }
.divider:not(:empty)::after { margin-left: .5em; }
.input-group { position: relative; margin-bottom: 16px; }
.input-group input { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 14px; box-sizing: border-box; background: white; text-align: center; }
.input-group input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.input-group .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-muted); }
.btn-primary { background: var(--brand-red); color: white; border-radius: 8px; }
.btn-primary:hover { background: #7f1d1d; }
.terms { margin-top: 24px; font-size: 12px; color: var(--color-muted); line-height: 1.5; }
.terms a { color: #3b82f6; text-decoration: none; }
.terms a:hover { text-decoration: underline; }

/* --- PRICING PAGE STYLING --- */
.pricing-content { flex-grow: 1; display: flex; flex-direction: column; align-items: center; padding: 60px 20px; }
.pricing-header { text-align: center; margin-bottom: 50px; }
.pricing-header h1 { font-size: 48px; font-weight: 800; margin: 0 0 10px 0; }
.pricing-header p { font-size: 18px; color: var(--color-muted); margin: 0; }

.pricing-grid { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; max-width: 1000px; }
.card { background: var(--bg-card); border: 2px solid var(--brand-red); border-radius: 12px; width: 300px; display: flex; flex-direction: column; position: relative; transition: transform 0.3s ease, box-shadow 0.3s ease; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); overflow: hidden; }
.card:hover { transform: translateY(-10px); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

.card::after { content: ''; position: absolute; top: 0; left: -150%; width: 60%; height: 100%; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%); transform: skewX(-25deg); z-index: 10; pointer-events: none; animation: sweep-shine 7s infinite; }
.card:nth-child(1)::after { animation-delay: 0s; }
.card:nth-child(2)::after { animation-delay: 2s; }
.card:nth-child(3)::after { animation-delay: 4s; }

@keyframes sweep-shine { 0% { left: -150%; } 20% { left: 250%; } 100% { left: 250%; } }

.card-top-bar { height: 30px; border-radius: 10px 10px 0 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: bold; text-transform: uppercase; background: var(--brand-red); }
.card-body { padding: 30px; display: flex; flex-direction: column; flex-grow: 1; text-align: center; }
.card-icon { height: 85px; margin-bottom: 20px; align-self: center; border-radius: 8px; }
.credit-amount { font-size: 32px; font-weight: 800; margin: 0 0 5px 0; display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.credit-amount b { font-weight: 800; color: var(--color-text); }
.credit-amount span { font-size: 16px; color: var(--color-muted); font-weight: 600; }
.motto { font-size: 13px; color: var(--color-muted); margin: 0; line-height: 1.4; text-align: center;}
.price { font-size: 42px; font-weight: 800; margin: 15px 0 5px 0; text-align: center; }
.price-sub { font-size: 13px; color: var(--color-muted); margin-bottom: 20px; font-weight: 500; text-align: center;}
.buy-btn { width: 100%; padding: 14px; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; border: none; background: var(--brand-red); color: white; margin-bottom: 25px; transition: 0.2s; }
.buy-btn:hover { background: #7f1d1d; } 
.features-title { font-size: 14px; font-weight: 600; margin-bottom: 15px; text-align: left; }
.feature-list { list-style: none; padding: 0; margin: 0; font-size: 14px; color: var(--color-muted); display: flex; flex-direction: column; gap: 10px; }
.feature-list li { display: flex; align-items: center; gap: 8px; text-align: left; }
.feature-list li::before { content: '✔'; color: #10b981; font-size: 12px; }
.highlight-red { color: #ef4444; font-weight: bold; }

/* =========================================
   MOBILE & TABLET OPTIMIZATION
   ========================================= */
@media (max-width: 768px) {
    /* 1. Sandwich Menu */
    .hamburger { display: block; }
    .nav-right {
        display: none; /* Hidden until clicked */
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--bg-container);
        flex-direction: column;
        padding: 20px 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-color);
        z-index: 999;
    }
    .nav-right.active { display: flex; }
    .nav-links { flex-direction: column; align-items: center; gap: 20px; width: 100%; margin: 0 0 20px 0; }
    .auth-section { flex-direction: column; width: 100%; justify-content: center; }

    /* 2. Global Text & Spacing */
    .hero-title { font-size: 2.2rem; }
    .drop-zone { padding: 40px 15px; }
    .content-wrapper { padding: 30px 15px; }
    .legal-document { padding: 30px; }
    .legal-document h1, .pricing-header h1 { font-size: 32px; }

    /* 3. Translation Workspace */
    #workspace-view { flex-direction: column; height: auto; min-height: calc(100vh - 60px); }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); height: auto; max-height: none; }
    
    /* Make image thumbnails scroll left/right instead of up/down */
    .thumbnail-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 15px; }
    .thumbnail-item { width: 100px; height: 100px; flex-shrink: 0; }
    .add-image-card { width: 100px; height: 100px; }
    .add-circle { width: 35px; height: 35px; font-size: 24px; padding-bottom: 5px; }
    
    /* Center the floating settings gear menu */
    .settings-panel { right: 50%; transform: translateX(50%); width: 90%; max-width: 300px; bottom: 90px; }
}

/* --- MIDDLE SECTION: COUNTER & MARQUEE --- */
.middle-section {
    padding: 60px 0;
    text-align: center;
    overflow: hidden; 
}

/* The Odometer Counter */
.translation-counter {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 80px;
    flex-wrap: wrap;
}

.counter-box-container {
    display: flex;
    gap: 6px;
}

.digit-box {
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 2.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.digit-comma {
    font-size: 2.5rem;
    color: var(--color-text);
    align-self: flex-end;
    line-height: 1;
    padding-bottom: 5px;
}

/* The Infinite Marquee */
.marquee-wrapper {
    position: relative;
    width: 100vw;
    max-width: 100%;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: #f8fafc; 
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

body.night-mode .marquee-wrapper {
    background: #0f172a; /* Blends into night mode beautifully */
}

.marquee-track {
    display: flex;
    gap: 30px;
    width: max-content;
    /* Move left continuously for 20 seconds, then instantly reset */
    animation: scroll-marquee 25s linear infinite;
}

.marquee-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-text);
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

@keyframes scroll-marquee {
    0% { transform: translateX(0); }
    /* Shifts exactly 50% (one full set of cards) to create a perfect loop */
    100% { transform: translateX(calc(-50% - 15px)); } 
}

/* --- FEATURES GRID SECTION --- */
.features-section {
    max-width: 1200px;
    margin: 0 auto 100px auto; /* 100px bottom margin gives it breathing room before the footer */
    padding: 0 20px;
}

.features-header {
    text-align: center;
    margin-bottom: 60px;
}

.features-header h2 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--color-text);
    margin: 0 0 15px 0;
}

.features-header p {
    font-size: 1.1rem;
    color: var(--color-muted);
    max-width: 600px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    /* This automatically creates columns that fit the screen! */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    border-color: var(--brand-red); /* Uses your custom red on hover! */
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 15px 0;
}

.feature-desc {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0;
}

/* =========================================
   MOBILE & TABLET OPTIMIZATION
   ========================================= */
@media (max-width: 768px) {
    /* --- Nav & Global --- */
    .hamburger { display: block; }
    .nav-right {
        display: none; 
        position: absolute; top: 60px; left: 0;
        width: 100%; background: var(--bg-container);
        flex-direction: column; padding: 20px 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-color); z-index: 999;
    }
    .nav-right.active { display: flex; }
    .nav-links { flex-direction: column; align-items: center; gap: 20px; width: 100%; margin: 0 0 20px 0; }
    .auth-section { flex-direction: column; width: 100%; justify-content: center; }

    /* --- Landing Page Hero --- */
    .landing-container { 
        flex-direction: column; 
        text-align: center; 
        padding: 40px 15px; 
        gap: 40px; 
    }
    
    .hero-headline { 
        font-size: 2.2rem; /* Shrunk down from 4rem so it fits! */
        margin-bottom: 15px; 
    }
    
    .hero-subtext { 
        font-size: 1rem;
        margin: 0 auto 25px auto; 
        max-width: 100%; 
    }

    .hero-stats { 
        flex-direction: column; /* Stacks the stats vertically instead of squishing them */
        gap: 15px; 
        margin-bottom: 30px; 
    }
    
    .stat-box h2 { font-size: 1.6rem; }
    
    .hero-buttons { 
        flex-direction: column; /* Makes buttons stack cleanly */
        width: 100%; 
        gap: 12px; 
    }
    
    .hero-btn { width: 100%; }

    /* --- The Interactive Slider --- */
    .hero-visual { width: 100%; padding: 0; }
    .comparison-slider { border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15); }
    .slider-button { width: 30px; height: 30px; font-size: 14px; } /* Smaller drag handle */

    /* --- The Middle Section (Odometer & Marquee) --- */
    .middle-section { padding: 40px 0; }
    
    .translation-counter { 
        font-size: 1.2rem; 
        margin-bottom: 40px; 
        gap: 8px; 
    }
    
    .digit-box { 
        font-size: 1.5rem; /* Shrinks the black number boxes so they don't break the line */
        padding: 5px 8px; 
    }
    
    .digit-comma { font-size: 1.5rem; }

    /* --- Footer --- */
    .footer-container {
        grid-template-columns: 1fr; /* Stacks all footer columns */
        text-align: center;
        gap: 30px;
    }
    .footer-brand .footer-logo { justify-content: center; }
}