
        /* =========================================
           1. DESIGN TOKENS & THEME ENGINE
           ========================================= */
        :root {
        
            --accent-gold: #fbbf24;   
            --red: #f43f5e;           
            --green: #10b981;         
            --orange: #f97316;
            --blue: #3b82f6;
            --font-ui: 'Outfit', sans-serif;
            --font-read: 'Merriweather', serif;
            --header-h: 64px;
            --card-radius: 24px;
            --max-width: 1200px;
            --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-spring: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        /* DARK THEME */
        :root[data-theme="dark"] {
            --bg-body: #09090b;       
            --bg-card: #18181b;       
            --bg-modal: #18181b;
            --bg-overlay: #09090b;
            --text-main: #f4f4f5;     
            --text-muted: #c5c5d1; 
            --primary: #fbbf24;       
            --primary-dim: rgba(251, 191, 36, 0.15);
            --highlight-bg: rgba(251, 191, 36, 0.15);
            --chip-active: #fbbf24;   
            --border-glass: rgba(255, 255, 255, 0.08);
            --bg-glass: rgba(9, 9, 11, 0.85);
            --shadow-soft: 0 4px 20px rgba(0,0,0,0.5);
            --shadow-hover: 0 10px 30px rgba(0,0,0,0.6);
            --highlight-bg: rgba(45, 212, 191, 0.15);
            --cloze-bg: rgba(255, 255, 255, 0.1);
            --cloze-border: #52525b;
            --quiz-bg: #121214;
            --quiz-mask: #27272a;
            --gradient-text-card: radial-gradient(circle at 0% 100%, #1e1b4b 0%, #18181b 50%), 
                                  radial-gradient(circle at 100% 0%, #0f766e 0%, #18181b 50%);
            --scroll-track: #27272a;
            --scroll-thumb: #52525b;
            --chip-bg: #27272a;
            --chip-active-text: #000;
            --toolbar-bg: rgba(24, 24, 27, 0.75);
            --toolbar-border: rgba(255, 255, 255, 0.1);
            --toolbar-text: rgba(255, 255, 255, 0.8);
            --toolbar-shadow: 0 10px 30px rgba(0,0,0,0.3);
        }

        /* LIGHT THEME */
        :root[data-theme="light"] {
            --bg-body: #f0fdfa;       
            --bg-card: #ffffff;
            --bg-modal: #ffffff;
            --bg-overlay: #f0fdfa;
            --text-main: #1e293b;     
            --text-muted: #64748b; 
            
            --primary: #1bc4b6;       
            --primary-dim: rgba(13, 148, 136, 0.15);
            --highlight-bg: rgba(13, 148, 136, 0.15);

            --border-glass: rgba(0, 0, 0, 0.06);
            --bg-glass: rgba(255, 255, 255, 0.9);
            --shadow-soft: 0 10px 30px rgba(0,0,0,0.05);
            --shadow-hover: 0 15px 40px rgba(0,0,0,0.1);
            --highlight-bg: rgba(45, 212, 191, 0.25);
            --cloze-bg: rgba(0, 0, 0, 0.05);
            --cloze-border: #cbd5e1;
            --quiz-bg: #f8fafc;
            --quiz-mask: #e2e8f0;
            --gradient-text-card: radial-gradient(circle at 0% 100%, #e0f2fe 0%, #ffffff 60%), 
                                  radial-gradient(circle at 100% 0%, #f0fdfa 0%, #ffffff 60%);
            --scroll-track: #e2e8f0;
            --scroll-thumb: #94a3b8;
            --chip-bg: #e2e8f0;
            --chip-active: #24e3ca;
            --chip-active-text: #000;
            --toolbar-bg: rgba(255, 255, 255, 0.75); /* Frosted White */
            --toolbar-border: rgba(0, 0, 0, 0.1);
            --toolbar-text: #334155; /* Dark Grey Icons */
            --toolbar-shadow: 0 10px 30px rgba(0,0,0,0.1);

        }
        :root[data-theme="sepia"] {
            --bg-body: #f2e9d0;       
            --bg-card: #fbf6e6;
            --bg-modal: #fbf6e6;
            --bg-overlay: #f2e9d0;
            --text-main: #433422;     /* Dark Coffee */
            --text-muted: #857258;    /* Light Leather */
            --primary: #d97706;       /* Amber */
            --primary-dim: rgba(217, 119, 6, 0.15);
            --border-glass: rgba(67, 52, 34, 0.1);
            --bg-glass: rgba(251, 246, 230, 0.9);
            --shadow-soft: 0 4px 20px rgba(67, 52, 34, 0.05);
            --highlight-bg: rgba(217, 119, 6, 0.15);
            --cloze-bg: rgba(67, 52, 34, 0.05);
            --cloze-border: #d4c5a9;
            --gradient-text-card: linear-gradient(to bottom, #fbf6e6, #f2e9d0);
            --chip-bg: #e6dac0;
            --chip-active: #d97706;
            --chip-active-text: #fff;
            --scroll-thumb: #d4c5a9;
            
            --toolbar-bg: rgba(251, 246, 230, 0.85); /* Warm Paper */
            --toolbar-border: rgba(67, 52, 34, 0.15);
            --toolbar-text: #433422; /* Coffee color */
            --toolbar-shadow: 0 10px 20px rgba(67, 52, 34, 0.1);
        }


        /* =========================================
           2. BASE & UTILITY
           ========================================= */
        * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; outline: none; }
        
        body { 
            font-family: var(--font-ui); 
            background: var(--bg-body); 
            color: var(--text-main); 
            height: 100vh; 
            overflow: hidden; 
            transition: background var(--transition-smooth), color var(--transition-smooth); 
        }

        /* Smooth Scrollbar */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { 
            background: var(--scroll-thumb); 
            border-radius: 10px; border: 2px solid transparent; background-clip: content-box; 
        }
        ::-webkit-scrollbar-thumb:hover { background: var(--primary); }
        
        /* Noise Texture for that "Premium" feel */
        body::before {
            content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
            pointer-events: none; z-index: 9999; opacity: 0.5; mix-blend-mode: overlay;
        }

        /* =========================================
           3. LOADER & ERROR SCREEN (The Safety Net)
           ========================================= */
        #startup-loader {
            position: fixed; inset: 0; background: var(--bg-body); z-index: 10000;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: opacity 0.5s ease;
        }
        .loader-spinner {
            width: 50px; height: 50px; border: 4px solid var(--border-glass);
            border-top: 4px solid var(--primary); border-radius: 50%;
            animation: spin 1s linear infinite; margin-bottom: 20px;
        }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        
        #debug-console {
            display: none; width: 90%; max-width: 600px; max-height: 300px; overflow-y: auto;
            background: rgba(255, 0, 0, 0.1); border: 1px solid var(--red); color: var(--red);
            padding: 15px; border-radius: 12px; font-family: monospace; font-size: 0.8rem;
            margin-top: 20px; text-align: left;
        }

        /* =========================================
           4. HEADER
           ========================================= */
        header {
            position: fixed; top: 0; left: 0; width: 100%; height: 55px; z-index: 100;
            background: var(--bg-glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border-glass); 
            display: flex; justify-content: space-between; align-items: center; padding: 0 24px;
        }

        .brand { 
            font-weight: 800; 
            font-size: 1.8rem; /* Increased size */
            letter-spacing: -0.5px; cursor: pointer;
            background: linear-gradient(135deg, var(--text-main) 0%, var(--text-muted) 100%);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            display: flex; align-items: center; 
        }

        .brand span { color: var(--primary); -webkit-text-fill-color: var(--primary); }

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

        .icon-btn {
            background: transparent; border: none; cursor: pointer; padding: 10px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center; 
            color: var(--text-muted); transition: var(--transition-smooth); position: relative;
        }
        .icon-btn:hover { background: var(--border-glass); color: var(--text-main); transform: scale(1.05); }
        .icon-btn:active { transform: scale(0.95); }
        .icon-btn.active-state { color: var(--primary); background: var(--highlight-bg); }
        .icon-btn.liked svg { fill: var(--red); stroke: var(--red); }
        .icon-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
        
        .badge-dot {
            position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; 
            background: var(--primary); border-radius: 50%; display: none;
        }
        /* Info about note export */
        .info-icon-btn {
            color: var(--primary); 
            opacity: 0.8; 
            transition: all 0.2s ease;
        }
        .info-icon-btn:hover {
            opacity: 1;
            transform: scale(1.1);
        }
        .tutorial-list li {
            margin-bottom: 8px;
            line-height: 1.5;
            color: var(--text-muted);
        }
        .tutorial-highlight {
            color: var(--primary);
            font-weight: 700;
        }
        #modal-notekash-tutorial {
            z-index: 300 !important; /* Higher than settings (200) */
        }

        /* =========================================
        5. MAIN FEED & CARDS
        ========================================= */
        #app-container { height: 100%; width: 100%; overflow-y: auto; scroll-behavior: smooth; padding-top: var(--header-h); overscroll-behavior-y: contain; will-change: scroll-position; }

        @media (min-width: 769px) {
            #feed-list { 
                display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); 
                gap: 40px; padding: 40px; max-width: var(--max-width); margin: 0 auto; 
            }
            .news-card { 
                height: 650px; 
                border-radius: var(--card-radius); border: 1px solid var(--border-glass); 
                box-shadow: var(--shadow-soft); overflow: hidden;
            }
        }

        .action-toolbar-container {
            padding: 15px 20px 30px 20px; 
            display: flex; justify-content: center; width: 100%;
        }

        .action-toolbar {
            display: flex; align-items: center; justify-content: space-evenly; gap: 15px;
            background: var(--toolbar-bg); 
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--toolbar-border);
            box-shadow: 0 8px 32px -4px rgba(0,0,0,0.1), inset 0 1px 1px rgba(255, 255, 255, 0.5);
            padding: 4px 20px; border-radius: 50px; min-width: 180px;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        .action-toolbar .icon-btn svg {
            width: 28px; height: 28px; stroke-width: 1.8;
            transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        .action-toolbar .icon-btn:hover svg { transform: scale(1.2); }
        .action-toolbar .icon-btn { padding: 8px; color: var(--toolbar-text); }
        .action-toolbar .icon-btn:hover { color: var(--primary); transform: scale(1.15); background: transparent; }
        .action-toolbar .icon-btn.liked { color: var(--red) !important; }

        @media (max-width: 768px) {
            #app-container { scroll-snap-type: y mandatory; padding-top: 0; height: 100dvh; }
            header { 
                background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
                backdrop-filter: none; border: none; pointer-events: none;
                height: 50px; padding: 0 10px; align-items: center; display: flex;
            }
            header > * { pointer-events: auto; }
            .header-actions { gap: 2px; }
            .brand { -webkit-text-fill-color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.5); font-size: 1.5rem; }
            .icon-btn { color: rgba(255,255,255,0.95); }
            .news-card { 
                height: 100dvh; width: 100%; scroll-snap-align: start; scroll-snap-stop: normal; 
                border-radius: 0; border: none; display: flex; flex-direction: column; 
            }
            .scroll-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: block; padding-bottom: 20px; }
            .card-footer { display: none !important; } 
            .card-img { height: 40vh; background-position: center top !important; }
        }

        .news-card { background: var(--bg-card); position: relative; display: flex; flex-direction: column; transition: transform 0.3s ease; }
        .scroll-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; position: relative; }
        .card-img { height: 45vh; min-height: 250px; flex-shrink: 0; background-size: cover; background-position: center; position: relative; }
        .spin-active { animation: spin 1s linear infinite; color: var(--primary) !important; }
        .card-body { padding: 24px 24px 4px 24px; position: relative; z-index: 2; }

        /* --- TEXT ONLY CARD (LIVE APP) --- */
        .news-card.text-only .scroll-content { 
            background: var(--bg-card);
            background-image: linear-gradient(to bottom right, var(--bg-card), var(--bg-body));
        }
        .news-card.text-only .card-body { 
            padding: 80px 30px 40px 30px; min-height: 100%; 
            display: block; position: relative; overflow: hidden;
        }
        .news-card.text-only .card-body::before {
            content: '“'; position: absolute; top: -20px; left: 20px;
            font-family: var(--font-read); font-size: 10rem; line-height: 1;
            color: var(--primary); opacity: 0.1; pointer-events: none; z-index: -1;
        }
        .news-card.text-only h2 { 
            font-size: 2rem; margin-bottom: 24px; text-align: center; position: relative; z-index: 2;
        }
        .news-card.text-only .summary-box { text-align: left; font-size: 1.25rem; line-height: 1.8; position: relative; z-index: 2; }
        /* Uncluttered Header for Text Cards */
        .news-card.text-only .meta-row {
            justify-content: center !important; gap: 25px !important; 
            margin-bottom: 30px !important; position: relative; z-index: 5;
        }
        .news-card.text-only .date::before {
            content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
            width: 1px; height: 12px; background: var(--text-muted); opacity: 0.4;
        }

        /* --- EXPORT CARD (MAGAZINE STYLE) --- */
        .news-card.export-mode {
            height: auto !important; min-height: auto !important; width: 600px !important;
            background: var(--bg-card) !important; color: var(--text-main) !important;
            border: none !important; border-radius: 0 !important;
            display: flex !important; flex-direction: column !important; position: relative !important;
            z-index: -9999; padding: 0 !important; overflow: hidden !important;
        }
        /* Hide UI in Export */
        .news-card.export-mode .card-img,
        .news-card.export-mode .action-toolbar-container, 
        .news-card.export-mode .card-footer,
        .news-card.export-mode .watermark-overlay,
        .news-card.export-mode .ad-label-corner,
        .news-card.export-mode .export-logo-top { display: none !important; }

        /* 16:11 Aspect Ratio Image */
        .export-image-16x11 {
            width: 100% !important; aspect-ratio: 16 / 11 !important; 
            background-size: cover !important; background-position: center center !important;
            background-repeat: no-repeat !important; border-bottom: 1px solid var(--border-glass);
            z-index: 1; background-color: var(--bg-body); margin: 0 !important;
        }

        /* Export Typography (Tight & Optimized) */
        .news-card.export-mode .card-body {
            padding: 15px 20px 40px 20px !important; /* Optimized Padding */
            background: var(--bg-card) !important; flex: 1;
        }
        /* Quote Mark for Text-Only Export */
        .news-card.export-mode .card-body::before {
            content: '“'; position: absolute; top: -15px; left: 20px;
            font-family: var(--font-read); font-size: 8rem; line-height: 1;
            color: var(--primary); opacity: 0.07; pointer-events: none; z-index: 0;
        }
        .news-card.export-mode h2 {
            font-size: 2.4rem !important; line-height: 1.2 !important;
            margin-bottom: 12px !important; color: var(--text-main) !important;
            letter-spacing: -0.03em !important; position: relative; z-index: 2;
        }
        .news-card.export-mode .summary-box {
            font-family: var(--font-read) !important; font-size: 1.35rem !important;
            line-height: 1.6 !important; color: var(--text-muted) !important;
            opacity: 0.95 !important; position: relative; z-index: 2;
        }

        /* Export Header Fix (Uncluttered) */
        .news-card.export-mode .meta-row {
            margin-bottom: 25px !important; 
            justify-content: space-between !important; /* Left/Right Split */
            align-items: center !important; 
            gap: 0 !important;
            position: relative; z-index: 5;
        }

        .news-card.export-mode .badge {
            font-size: 0.95rem !important; /* Larger */
            padding: 6px 14px !important;   /* Beefier pill */
            letter-spacing: 1px !important;
        }

        .news-card.export-mode .date {
            font-size: 1.1rem !important; /* Larger */
            font-weight: 700 !important;
            opacity: 0.9 !important;
        }
        .news-card.export-mode .date::before { display: none !important; }


        /* --- 1. EXPORT MODE: CLOZE, FOOTER & CLEAN BADGES --- */
        .news-card.export-mode .keyword {
            background: transparent !important; border: none !important; box-shadow: none !important;
            padding: 0 4px !important; margin: 0 !important; color: var(--primary) !important;
            font-family: var(--font-ui) !important; font-size: 1.25rem !important; font-weight: 900 !important;
            letter-spacing: 1.5px !important; opacity: 1 !important; display: inline-block !important; vertical-align: baseline !important;
        }
        .news-card.export-mode .keyword::after { content: none !important; }
        .export-footer { display: none !important; }
        .news-card.export-mode .badge {
            box-shadow: none !important;
            border: none !important;
        }

        /* --- 2. WATERMARK ENGINE (3D & THEME AWARE) --- */
        .export-watermark-top {
            position: absolute !important; top: 20px !important; right: 20px !important; z-index: 100 !important;
            display: flex !important; align-items: center !important; gap: 8px !important;
            filter: drop-shadow(0 8px 15px rgba(0,0,0,0.3)) !important; /* 3D Pop */
            padding: 8px 16px !important; border-radius: 50px !important;
            backdrop-filter: blur(8px) !important; border: 1px solid rgba(255, 255, 255, 0.2) !important;
        }
        .watermark-text {
            font-family: var(--font-ui) !important; font-weight: 900 !important; font-size: 1.25rem !important;
            line-height: 1 !important; letter-spacing: -0.5px !important; 
            text-shadow: 0 -1px 0 rgba(0,0,0,0.2) !important; /* Carved Depth */
        }
        .watermark-badge {
            font-size: 0.75rem !important; font-weight: 800 !important; letter-spacing: 0.5px !important;
            padding: 3px 8px !important; border-radius: 6px !important;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
        }

        /* Watermark Themes */
        [data-theme="dark"] .export-watermark-top { background: rgba(0, 0, 0, 0.6) !important; }
        [data-theme="dark"] .watermark-text { color: #ffffff !important; }
        [data-theme="dark"] .watermark-text span { color: var(--primary) !important; }
        [data-theme="dark"] .watermark-badge { background: var(--primary) !important; color: #000000 !important; }

        [data-theme="sepia"] .export-watermark-top { background: rgba(67, 52, 34, 0.85) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; }
        [data-theme="sepia"] .watermark-text { color: #fbf6e6 !important; } 
        [data-theme="sepia"] .watermark-text span { color: #f3dba5 !important; } 
        [data-theme="sepia"] .watermark-badge { background: #f3dba5 !important; color: #433422 !important; }

        [data-theme="light"] .export-watermark-top { background: rgba(255, 255, 255, 0.9) !important; border: 1px solid rgba(0, 0, 0, 0.05) !important; }
        [data-theme="light"] .watermark-text { color: #1e293b !important; } 
        [data-theme="light"] .watermark-text span { color: #14b8a6 !important; } 
        [data-theme="light"] .watermark-badge { background: #14b8a6 !important; color: #ffffff !important; }


        /* --- 3. METADATA & CARVED EFFECTS (Main App) --- */
        .meta-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; opacity: 0.9; }

        .badge { 
            padding: 5px 12px; border-radius: 8px; font-weight: 800; font-size: 0.75rem; 
            text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; border: 1px solid transparent; 
            transition: transform 0.2s ease;
            background: var(--badge-bg, var(--primary)); color: var(--badge-text, #000);
            box-shadow: var(--badge-shadow, none); border-color: var(--badge-border, transparent);
        }
        .badge:active { transform: scale(0.95); }

        .date { 
            font-size: 0.85rem; font-weight: 600; color: var(--date-text, var(--text-muted)); 
            text-shadow: var(--text-carve, none); /* Carved Effect */
        }

        /* Metadata Theme Variables */
        :root[data-theme="dark"] {
            --badge-bg: var(--primary); --badge-text: #000000;
            --badge-shadow: 0 2px 10px rgba(251, 191, 36, 0.2);
            --date-text: var(--text-muted); --text-carve: 0 1px 2px rgba(0,0,0,0.8);
        }
        :root[data-theme="sepia"] {
            --badge-bg: rgba(67, 52, 34, 0.08); --badge-text: #856404; --badge-border: rgba(133, 100, 4, 0.2);
            --badge-shadow: inset 0 1px 2px rgba(0,0,0,0.05), 0 1px 0 rgba(255,255,255,0.8);
            --date-text: #857258; --text-carve: 1px 1px 0 rgba(255,255,255,1); /* Letterpress Look */
        }
        :root[data-theme="light"] {
            --badge-bg: #f1f5f9; --badge-text: #0f766e; --badge-border: #e2e8f0;
            --badge-shadow: 0 1px 2px rgba(0,0,0,0.05);
            --date-text: #64748b; --text-carve: 0 1px 0 rgba(255,255,255,1);
        }

        /* --- 4. TYPOGRAPHY & FOOTER --- */
        h2 { font-size: 1.6rem; font-weight: 800; line-height: 1.3; margin-bottom: 16px; font-family: var(--font-ui); letter-spacing: -0.02em; }
        .summary-box { font-family: var(--font-read); font-size: 1.15rem; line-height: 1.75; color: var(--text-muted); margin-bottom: 4px; }

        .keyword {
            background: var(--highlight-bg); color: var(--primary); padding: 2px 5px; border-radius: 4px;
            font-weight: 600; cursor: pointer; border-bottom: 1px dashed var(--primary);
            transition: all 0.3s ease; user-select: none;
        }
        .keyword.is-hidden { background: var(--cloze-bg); color: transparent; border-bottom: 2px solid var(--cloze-border); }
        .keyword.is-hidden:hover { border-color: var(--primary); }

        .card-footer { 
            padding: 16px 24px; display: flex; justify-content: flex-end; gap: 12px; align-items: center; 
            border-top: 1px solid var(--border-glass); background: var(--bg-card); z-index: 10;
        }

        /* =========================================
           6. 3D QUIZ SYSTEM (PREMIUM & FLIP RESTORED)
           ========================================= */
        #quiz-fullscreen-layer {
            position: fixed; inset: 0; z-index: 2000;
            background: var(--bg-overlay);
            display: flex; flex-direction: column;
            opacity: 0; pointer-events: none;
            transition: opacity 0.4s ease;
            padding-top: 10px;
        }
        #quiz-fullscreen-layer.active { opacity: 1; pointer-events: auto; }

        .quiz-navbar {
            padding: 10px 24px;
            display: flex; justify-content: space-between; align-items: center;
            max-width: 800px; width: 100%; margin: 0 auto;
            flex-shrink: 0;
        }

        .quiz-progress-track {
            flex: 1; height: 6px; background: var(--border-glass);
            border-radius: 10px; margin: 0 20px; overflow: hidden;
        }
        .quiz-progress-fill {
            height: 100%; background: var(--primary); width: 0%;
            transition: width 0.5s ease;
        }

        /* THE STAGE: Sets the 3D environment */
        .quiz-stage {
            flex: 1; display: flex; align-items: center; justify-content: center;
            padding: 20px; 
            perspective: 2000px; /* Deep perspective for premium 3D feel */
            overflow: hidden; 
        }

        /* THE CARD OBJECT */
        .quiz-card-wrapper {
            width: 100%; max-width: 600px; 
            height: 100%; max-height: 75vh; min-height: 400px;
            position: relative;
            transform-style: preserve-3d; /* Crucial for Flip */
            transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1); 
            transform: translateX(0) rotateY(0deg) scale(1);
            margin-bottom: 20px;
        }
        
        /* STATE: FLIPPED (The rotation) */
        .quiz-card-wrapper.is-flipped {
            transform: translateX(0) rotateY(180deg);
        }

        /* ANIMATION: SWIPE LEFT (Exit to Next) */
        .card-exit-left {
            animation: swipeOut 0.4s forwards cubic-bezier(0.55, 0.085, 0.68, 0.53);
        }
        @keyframes swipeOut {
            0% { transform: translateX(0) rotateY(0deg) scale(1); opacity: 1; }
            100% { transform: translateX(-120%) rotateY(-20deg) scale(0.9); opacity: 0; }
        }

        /* ANIMATION: STACK REVEAL (Enter from bottom/back) */
        .card-enter-stack {
            animation: stackIn 0.5s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        @keyframes stackIn {
            0% { transform: translateY(40px) scale(0.9); opacity: 0; }
            100% { transform: translateY(0) scale(1); opacity: 1; }
        }

        /* DEFAULT STATE (Reset) */
        .card-center-active {
            transform: translateX(0) rotateY(0deg);
            opacity: 1;
        }

        /* THE VISUAL FACES (Front & Back) */
        .quiz-face {
            position: absolute; inset: 0;
            -webkit-backface-visibility: hidden; backface-visibility: hidden;
            background: linear-gradient(145deg, var(--bg-card), var(--bg-body));
            border-radius: 32px;
            border-top: 1px solid rgba(255,255,255,0.1);
            border-left: 1px solid rgba(255,255,255,0.05);
            border-right: 1px solid rgba(0,0,0,0.1);
            border-bottom: 1px solid rgba(0,0,0,0.1);
            box-shadow: 
                0 20px 50px -10px rgba(0,0,0,0.5),
                0 10px 20px -10px rgba(0,0,0,0.3);
                
            display: flex; flex-direction: column;
            overflow: hidden;
        }

        .quiz-back { transform: rotateY(180deg); }

        .quiz-scroll-area {
            flex: 1; overflow-y: auto; padding: 40px;
            display: flex; flex-direction: column;
            scrollbar-width: none; 
        }
        .quiz-scroll-area::-webkit-scrollbar { display: none; }
        
        .quiz-question-text {
            font-family: var(--font-read); 
            font-size: 1.15rem; /* Matches Summary Box size */
            line-height: 1.75;
            color: var(--text-main); text-align: left;
            margin-top: 0; /* Removed auto to let text fill from top */
            padding-top: 0;
            transition: font-size 0.2s ease;
        }
        .quiz-question-text.enlarged {
            font-size: 1.6rem;
            line-height: 1.5;
        }
        @media (max-width: 768px) {
           
            #quiz-fullscreen-layer { padding-top: 0 !important; }
            .quiz-navbar { 
                padding: 4px 12px; /* Very tight padding */
                height: 45px; 
                min-height: 45px;
            }
            .quiz-navbar .quiz-header-label { font-size: 0.8rem; }
            .quiz-actions-area { 
                padding: 10px 12px !important; /* Reduced from 24px */
                padding-bottom: 20px !important; /* iOS Safe Area consideration */
            }

            .quiz-stage { padding: 5px 10px; } 
            
            .quiz-card-wrapper { 
                margin-bottom: 5px; 
                height: 100%; /* Fill available space */
            }
            
            .quiz-scroll-area { 
                padding: 20px 15px; /* Wider text area */
            }
            .srs-btn { padding: 8px 4px; border-radius: 12px; }
            .srs-btn span:first-child { font-size: 0.8rem; }
            .srs-btn span:last-child { font-size: 0.55rem; }
            .btn-large { padding: 10px; } /* Smaller Nav Buttons */
        }
        .quiz-navbar .icon-btn {
            color: var(--text-main) !important; 
            background: rgba(125, 125, 125, 0.15); /* Slight pill background */
            width: 32px; height: 32px; /* Fixed touch target */
            border: 1px solid var(--border-glass);
            z-index: 2002;
        }
        .quiz-navbar .icon-btn:hover {
            background: var(--red);
            color: white !important;
            border-color: var(--red);
        }
        [data-theme="light"] .quiz-navbar .icon-btn,
        [data-theme="light"] #modal-quiz-menu .icon-btn {
            color: #000000 !important;             /* Jet Black Icon */
            background: rgba(0, 0, 0, 0.08) !important; /* Light Grey Background Pill */
            border: 1px solid rgba(0,0,0,0.15) !important;
            opacity: 1 !important;                 /* Ensure it's not transparent */
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        }
        [data-theme="light"] .quiz-navbar .icon-btn:hover,
        [data-theme="light"] #modal-quiz-menu .icon-btn:hover {
            background: #ef4444 !important;        /* Red Background */
            color: #ffffff !important;             /* White Icon */
            border-color: #ef4444 !important;
        }
        .quiz-navbar .icon-btn svg {
            stroke: currentColor;
            stroke-width: 2.5; /* Make it slightly bolder */
        }
        .quiz-actions-area {
            padding: 24px; 
            border-top: 1px solid var(--border-glass);
            background: var(--bg-card); 
            flex-shrink: 0;
            border-bottom-left-radius: 32px;
            border-bottom-right-radius: 32px;
        }

        /* CLOZE STYLING */
        .quiz-mask {
            background: var(--quiz-mask); color: transparent;
            border-radius: 6px; padding: 2px 12px; margin: 0 4px;
            display: inline-block; border: 1px dashed var(--text-muted);
            vertical-align: middle; min-width: 60px; position: relative;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }
        .quiz-mask::after {
            content: '?'; color: var(--text-muted);
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            font-weight: 700;
        }
        .quiz-revealed {
            color: var(--primary); font-weight: 800;
            background: var(--highlight-bg); padding: 4px 10px; border-radius: 6px;
            animation: highlightPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: inline-block;
        }
        @keyframes highlightPop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

        /* BUTTONS */
        .srs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
        .srs-btn {
            padding: 14px 10px; border-radius: 16px; border: none; cursor: pointer;
            display: flex; flex-direction: column; align-items: center; gap: 6px;
            transition: all 0.2s; 
            background: var(--bg-body); 
            border: 1px solid var(--border-glass);
            color: var(--text-main);
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        }
        .srs-btn:hover { 
            transform: translateY(-4px); 
            background: var(--bg-card); 
            box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
        }
        .srs-btn:active { transform: scale(0.95); }
        .srs-btn span:first-child { font-weight: 800; font-size: 0.95rem; letter-spacing: 0.5px; }
        .srs-btn span:last-child { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; }
        
        .srs-again { border-bottom: 4px solid var(--red); }
        .srs-hard { border-bottom: 4px solid var(--orange); }
        .srs-good { border-bottom: 4px solid var(--blue); }
        .srs-easy { border-bottom: 4px solid var(--green); }

        #quiz-summary {
            position: absolute; inset: 0; background: var(--bg-overlay); z-index: 5;
            display: none; flex-direction: column; align-items: center; justify-content: center;
            animation: fadeIn 0.5s;
        }
        #quiz-summary.visible { display: flex; }

        /* 1. STREAK FIRE ENGINE */
        .streak-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-bottom: 25px;
            position: relative;
        }

        .fire-wrapper {
            position: relative;
            width: 60px;
            height: 60px;
            margin-bottom: 5px;
        }

        .fire-icon {
            font-size: 3.5rem;
            filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.5));
            animation: breatheFire 2s infinite ease-in-out;
            transform-origin: center bottom;
            display: block;
        }

        .streak-count {
            position: absolute;
            bottom: -5px;
            right: -5px;
            background: var(--bg-card);
            border: 2px solid var(--border-glass);
            color: var(--text-main);
            font-weight: 800;
            font-size: 0.9rem;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        }

        .streak-label {
            font-size: 1.2rem;
            font-weight: 800;
            background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 2px;
        }

        .streak-sub {
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        @keyframes breatheFire {
            0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(255, 69, 0, 0.4)); }
            50% { transform: scale(1.1); filter: drop-shadow(0 0 15px rgba(255, 69, 0, 0.8)); }
            100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(255, 69, 0, 0.4)); }
        }
        /* DAILY MASTERY BUTTON (Gold Theme) */
        .btn-mastery {
            background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%); /* Amber to Dark Gold */
            color: white;
            border: none;
            box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4); /* Golden Glow */
            transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        .btn-mastery:hover {
            box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
            transform: translateY(-2px);
            filter: brightness(1.1);
        }
        /* 2. CRAM MODE BUTTON STYLING */
        .btn-cram {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
            border: none;
        }
        .btn-cram:hover {
            box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
            transform: translateY(-2px);
        }

        /* 3. STATUS CAPSULE (On Flashcards) */
        .status-header {
            display: flex;
            align-items: center;
            gap: 10px;         
            margin-bottom: 25px; 
            width: 100%;
            position: relative;
        }
        .clean-capsule { padding: 5px 14px; border-radius: 50px; font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; border: 1px solid transparent; display: inline-block; backdrop-filter: blur(6px); transition: transform 0.2s ease; }
        .clean-capsule:hover { transform: scale(1.05); }
        .status-new { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); box-shadow: 0 0 15px rgba(59, 130, 246, 0.35); }
        .status-again { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border-color: rgba(244, 63, 94, 0.3); box-shadow: 0 0 15px rgba(244, 63, 94, 0.35); }
        .status-hard { background: rgba(249, 115, 22, 0.15); color: #f97316; border-color: rgba(249, 115, 22, 0.3); box-shadow: 0 0 15px rgba(249, 115, 22, 0.35); }
        .status-good { background: rgba(16, 185, 129, 0.15); color: #10b981; border-color: rgba(16, 185, 129, 0.3); box-shadow: 0 0 15px rgba(16, 185, 129, 0.35); }
        .status-easy { background: rgba(20, 184, 166, 0.15); color: #14b8a6; border-color: rgba(20, 184, 166, 0.3); box-shadow: 0 0 15px rgba(20, 184, 166, 0.35); }
        
        /* The Reset Button (FIX B: Outside & Aesthetic) */
        .capsule-reset-btn {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 4px;
            border-radius: 50%;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0.5;
        }

        .capsule-reset-btn:hover {
            background: rgba(255,255,255,0.05);
            color: var(--primary);
            transform: rotate(-180deg); /* Playful interaction */
            opacity: 1;
        }

        .card-status-capsule { display: none !important; }

        /* =========================================
           7. MODALS, CHIPS & SETTINGS
           ========================================= */
        .modal-backdrop { 
            position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200; 
            display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px);
            opacity: 0; transition: opacity 0.3s ease;
        }
        .modal-backdrop.visible { opacity: 1; }
        
        .modal-card { 
            background: var(--bg-modal); width: 90%; max-width: 450px; border-radius: 24px; 
            padding: 30px; border: 1px solid var(--border-glass); box-shadow: var(--shadow-hover); 
            transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            max-height: 85vh; overflow-y: auto;
        }
        .modal-backdrop.visible .modal-card { transform: translateY(0); }

        .setting-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 16px 0; border-bottom: 1px solid var(--border-glass);
        }
        .setting-row:last-child { border-bottom: none; }
        .setting-label { font-weight: 600; font-size: 1rem; }
        .setting-sub { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 4px; }
        
        select {
            background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border-glass);
            padding: 8px 12px; border-radius: 8px; font-family: var(--font-ui); outline: none;
        }

        /* Chips / Categories */
        .chip-container {
            display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px;
        }
        .chip {
            padding: 8px 16px; border-radius: 20px; background: var(--chip-bg);
            color: var(--text-muted); font-size: 0.9rem; font-weight: 600; cursor: pointer;
            border: 1px solid transparent; transition: var(--transition-smooth);
        }
        .chip:hover { background: var(--border-glass); color: var(--text-main); }
        .chip.active {
            background: var(--chip-active); color: var(--chip-active-text);
            box-shadow: 0 4px 12px rgba(45, 212, 191, 0.3);
        }

        /* Buttons */
        .btn-large {
            width: 100%; padding: 16px; border-radius: 16px; border: none;
            font-weight: 700; cursor: pointer; font-size: 1rem;
            transition: var(--transition-spring);
            display: flex; justify-content: center; align-items: center; gap: 8px;
        }
        .btn-primary { background: var(--primary); color: #000; box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3); }
        .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(45, 212, 191, 0.4); }
        .btn-outline { background: transparent; border: 1px solid var(--border-glass); color: var(--text-main); }
        .btn-outline:hover { background: var(--bg-glass); border-color: var(--primary); }
        .btn-small { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; cursor: pointer; }

        /* Toast */
        #toast { 
            position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px); 
            background: var(--text-main); color: var(--bg-body); padding: 12px 24px; 
            border-radius: 50px; font-weight: 700; opacity: 0; pointer-events: none; 
            transition: var(--transition-spring); z-index: 20000 !important; 
            box-shadow: var(--shadow-soft); white-space: nowrap;
        }
        #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

        /* Micro-Interactions */
        .loading-spinner {
            width: 20px; height: 20px; border: 3px solid var(--border-glass);
            border-top: 3px solid var(--primary); border-radius: 50%;
            animation: spin 1s linear infinite; display: none;
        }
        /* HEART POP ANIMATION */
        .heart-pop {
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0);
            font-size: 6rem; color: var(--red);
            pointer-events: none; z-index: 50;
            opacity: 0;
        }
        .heart-pop.animate {
            animation: popFade 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }
        @keyframes popFade {
            0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
            50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
        }

        /* SNAPSHOT STYLES */
        .watermark-overlay {
            position: absolute; top: 20px; right: 20px;
            font-family: var(--font-ui); font-weight: 800; font-size: 1.5rem;
            color: rgba(255,255,255,0.8); text-shadow: 0 2px 4px rgba(0,0,0,0.5);
            z-index: 999; display: none; /* Hidden normally */
        }
        
        /* When capturing, hide the toolbar and show watermark */
        .news-card.capturing .action-toolbar-container { display: none !important; }
        .news-card.capturing .watermark-overlay {
            top: 20px;
            right: 20px;
            display: block !important;
            text-shadow: 0 2px 8px rgba(0,0,0,0.8); /* Stronger shadow for readability */
        }
        .news-card.capturing .card-img {
            margin-top: 0 !important;
            border-radius: 0 !important;
        }
        .news-card.capturing {
            border-radius: 0 !important;
            box-shadow: none !important;
            margin: 0 !important;       
            padding-top: 0 !important;  
            padding-bottom: 40px !important; /* Breathing room at bottom */
            transform: none !important;
            border: none !important; /* Remove any border that might look weird */
        }
        .news-card.capturing .scroll-content {
            overflow: visible !important;
            height: auto !important;
        }

        /* DESKTOP LAYOUT ENGINE (NEW)*/
        @media (min-width: 1024px) {
            /* 1. Main Container */
            #feed-list.layout-paper {
                display: block;
                max-width: 100%;
                margin: 0;
                padding: 40px;
                background: var(--bg-body);
            }

            /* 2. The Card (Viewport Window) */
            #feed-list.layout-paper .news-card {
                width: 100%;
                max-width: 1150px;
                height: 80vh; /* Fixed height relative to screen */
                margin: 0 auto 80px auto;
                
                background: var(--bg-card);
                border: 1px solid var(--border-glass);
                border-radius: 20px;
                box-shadow: 0 20px 40px rgba(0,0,0,0.3);
                
                /* Reset any transforms */
                transform: none !important;
                /* Do NOT hide overflow here, let the child handle it */
                overflow: hidden; 
            }

            /* 3. The Layout Engine (Grid) */
            #feed-list.layout-paper .scroll-content {
                display: grid;
                width: 100%;
                height: 100%;
                
                /* 40% Image | 60% Content (Requested Split) */
                grid-template-columns: 40% 60%;
                
                /* Allow rows to form naturally */
                grid-auto-rows: min-content;
                
                /* THIS IS THE SCROLLER */
                overflow-y: auto; 
                scroll-behavior: smooth;
            }

            /* 4. LEFT PANE: Sticky Image */
            #feed-list.layout-paper .card-img {
                /* Place in Column 1, Span ALL Rows to cover full height */
                grid-column: 1;
                grid-row: 1 / span 10; 
                
                /* STICKY MAGIC: Pinned to the visual top of the scroller */
                position: sticky;
                top: 0;
                left: 0;
                
                /* Force dimensions */
                width: 100%;
                height: 80vh; /* Match the card height exactly */
                
                /* Visuals */
                object-fit: cover;
                border-radius: 0;
                border-right: 1px solid var(--border-glass);
                margin: 0;
                z-index: 2;
            }

            /* 5. RIGHT PANE: Content Flow */
            #feed-list.layout-paper .card-body {
                grid-column: 2;
                /* Natural flow: Text comes first */
                
                padding: 60px 60px 20px 60px;
                width: 100%;
                
                display: flex;
                flex-direction: column;
                justify-content: flex-start; /* Ensure top align */
            }

            /* 6. RIGHT PANE: Toolbar (Flows naturally after text) */
            #feed-list.layout-paper .action-toolbar-container {
                grid-column: 2;
                padding: 20px 60px 60px 60px; 
                width: 100%;
                display: flex; 
                justify-content: flex-end; 
                background: transparent;
                border: none;
            }

            /* --- Styling Polish --- */
            #feed-list.layout-paper .action-toolbar {
                margin: 0; /* Align Left */
                width: fit-content;
                background: var(--bg-body);
                border: 1px solid var(--border-glass);
            }

            #feed-list.layout-paper h2 {
                font-family: var(--font-read);
                font-size: 2.6rem;
                line-height: 1.2;
                margin-bottom: 25px;
                color: var(--text-main);
            }

            #feed-list.layout-paper .summary-box {
                font-family: var(--font-read);
                font-size: 1.15rem;
                line-height: 1.8;
                color: var(--text-muted);
                -webkit-line-clamp: unset; /* Show Full Text */
                display: block;
            }

            #feed-list.layout-paper .meta-row {
                margin-bottom: 20px;
                display: flex;
                align-items: center;
                gap: 15px;
            }

            /* Scrollbar Polish */
            #feed-list.layout-paper .scroll-content::-webkit-scrollbar { width: 8px; }
            #feed-list.layout-paper .scroll-content::-webkit-scrollbar-track { background: var(--bg-card); }
            #feed-list.layout-paper .scroll-content::-webkit-scrollbar-thumb {
                background: var(--border-glass);
                border-radius: 4px;
            }

            /* --- Text Only Card Fix --- */
            #feed-list.layout-paper .news-card.text-only .scroll-content {
                grid-template-columns: 100%; /* Full width */
            }
            #feed-list.layout-paper .news-card.text-only .card-img { display: none; }
            #feed-list.layout-paper .news-card.text-only .card-body,
            #feed-list.layout-paper .news-card.text-only .action-toolbar-container {
                grid-column: 1;
                max-width: 800px; /* Constrain reading width */
                margin: 0 auto;
            }
        }

        /* Search Input Styling inside Modal */
        .search-input-container {
            position: relative;
            margin-bottom: 20px;
        }
        .search-input {
            width: 100%;
            padding: 14px 16px 14px 45px; /* Space for icon */
            background: var(--bg-body);
            border: 1px solid var(--border-glass);
            border-radius: 12px;
            color: var(--text-main);
            font-size: 1rem;
            font-family: var(--font-ui);
            transition: all 0.3s ease;
        }
        .search-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-dim);
        }
        .search-icon-overlay {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            pointer-events: none;
        }

        /* Highlight Styling for Search Matches */
        .search-highlight {
            background-color: rgba(244, 63, 94, 0.25); /* Transparent Red */
            color: var(--red);
            font-weight: 800;
            border-radius: 2px;
            padding: 0 2px;
        }
        .search-clear-btn {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-weight: bold;
            font-size: 1rem;
            cursor: pointer;
            padding: 5px; /* Larger clickable area */
            display: none; /* Hidden by default */
            transition: color 0.2s;
        }
        .search-clear-btn:hover {
            color: var(--primary);
        }

        /* --- NATIVE AD STYLING --- */
        .news-card.ad-unit {
            border: 1px solid var(--primary-dim); /* Subtle border to distinguish */
        }

        .news-card.ad-unit .badge {
            background: transparent;
            border: 1px solid var(--text-muted);
            color: var(--text-muted);
            font-size: 0.65rem;
            letter-spacing: 1px;
        }

        .ad-cta-container {
            padding: 15px 24px 30px 24px;
            display: flex;
            justify-content: center;
            width: 100%;
        }

        .ad-cta-btn {
            width: 100%;
            background: var(--text-main);
            color: var(--bg-card);
            padding: 14px;
            border-radius: 50px;
            font-weight: 800;
            text-transform: uppercase;
            font-size: 0.9rem;
            letter-spacing: 1px;
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .ad-cta-btn:hover {
            transform: scale(1.02);
            opacity: 0.95;
        }

        .ad-cta-btn svg {
            width: 18px; 
            height: 18px; 
            stroke-width: 2.5;
        }
        /* --- ADVERTISING CONTAINERS --- */
        .news-card.google-ad-unit {
            justify-content: center;
            align-items: center;
            background: var(--bg-card);
            position: relative;
            overflow: hidden;
        }

        .google-ad-wrapper {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            background: rgba(0,0,0,0.02); /* Slight contrast */
        }

        .ad-label-corner {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 0.6rem;
            color: var(--text-muted);
            border: 1px solid var(--border-glass);
            padding: 2px 6px;
            border-radius: 4px;
            z-index: 10;
            pointer-events: none;
        }
        .google-ad-unit {
            min-height: 280px; /* Force height so it doesn't collapse */
            background: radial-gradient(circle, var(--bg-card) 0%, var(--bg-body) 100%);
            border: 1px dashed var(--border-glass);
        }

        .google-ad-unit:empty::before {
            content: 'Advertisement Loading...';
            color: var(--text-muted);
            font-size: 0.8rem;
        }
        /* PULL TO REFRESH (PTR) - NEW */
        #ptr-zone {
            height: 0;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            background: transparent;
            transition: height 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Spring feel */
            will-change: height;
        }

        .ptr-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            opacity: 0;
            transform: translateY(-10px);
            transition: opacity 0.2s, transform 0.2s;
        }

        #ptr-zone.visible .ptr-content {
            opacity: 1;
            transform: translateY(0);
        }

        .ptr-icon-arrow {
            width: 24px;
            height: 24px;
            stroke: var(--primary);
            stroke-width: 2.5;
            fill: none;
            transition: transform 0.3s ease;
        }

        .ptr-icon-arrow.rotate {
            transform: rotate(180deg); /* Visual cue to release */
        }

        .ptr-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid var(--border-glass);
            border-top: 3px solid var(--primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            display: none;
        }

        /* Prevent browser native refresh on Android to avoid conflict */
        body {
            overscroll-behavior-y: contain; 
        }
