/* --- 1. CORE & RESET --- */
        * { -webkit-tap-highlight-color: transparent; box-sizing: border-box; user-select: none; }
        
        body {
            font-family: 'Inter', sans-serif;
            background-color: #020617;
            color: #e2e8f0;
            overflow: hidden;
            width: 100vw;
            height: 100dvh;
            display: flex;
            align-items: center;
            justify-content: center;
            background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #020617 70%);
            overscroll-behavior: none;
            touch-action: none;
            position: fixed;
            top: 0; left: 0;
            transition: background 0.5s ease;
        }

        .demo-layout {
            display: flex;
            gap: 40px;
            align-items: center;
            height: 100%;
            width: 100%;
            padding: 20px;
            justify-content: center;
            position: relative;
        }

        /* --- 2. UTILITIES --- */
        .brand-text {
            background: linear-gradient(90deg, #ffffff 0%, #94a3b8 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        /* Shimmer effect for slider text */
        @keyframes shimmer { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
        .animate-shimmer { animation: shimmer 2s infinite ease-in-out; }

        @keyframes slideInLeft { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
        @keyframes fadeIn { to { opacity: 1; } }
        
        /* --- 3. COMPONENTS: PHONE CONTAINER --- */
        .mobile-container {
            width: 390px;
            height: 800px;
            max-height: 100dvh;
            background-color: #0f172a;
            position: relative;
            box-shadow: 0 0 80px rgba(0,0,0,0.6), 0 0 0 10px #1e293b;
            border-radius: 50px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            z-index: 20;
            flex-shrink: 0;
        }
        
        .mobile-bottom-hint {
            position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
            width: 100px; height: 4px; background: rgba(255,255,255,0.15);
            border-radius: 2px; z-index: 50; pointer-events: none;
            padding-bottom: env(safe-area-inset-bottom, 0px);
        }

        /* --- 4. COMPONENTS: LANDING SCREEN --- */
        #landing-screen { 
            position: absolute; inset: 0; z-index: 100; 
            background: #020617; 
            display: flex; flex-direction: column; align-items: center; justify-content: center; 
            padding: 40px; text-align: center; overflow: hidden; 
            transition: opacity 0.5s ease-in-out; 
        }
        #landing-screen.fade-out { opacity: 0; pointer-events: none; }
        
        #security-status { animation: pulse-text 2s; }
        
        /* Slider */
        #slider-track {
            background-color: #0f172a; border-color: #334155;
        }

        /* --- 5. COMPONENTS: APP SCREEN & CARDS --- */
        #app-screen { 
            display: flex; flex-direction: column; height: 100%; 
            opacity: 0; transition: opacity 0.5s ease; pointer-events: none; 
            background: #0f172a; 
        }
        #app-screen.active { opacity: 1; pointer-events: all; }

        .card-stack { 
            position: relative; flex-grow: 1; 
            display: flex; justify-content: center; align-items: center; 
            perspective: 1200px; 
            padding-top: 5px; padding-bottom: 50px; 
        }

        .pax-card { 
            position: absolute; width: 92%; height: 55vh; 
            background: linear-gradient(160deg, #1e293b 0%, #111827 100%); 
            border-radius: 28px; 
            box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.1); 
            transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease; 
            display: flex; flex-direction: column; overflow: hidden; 
            z-index: 10; transform-origin: bottom center; will-change: transform; 
        }
        
        .card-accent-bar { height: 4px; width: 100%; position: absolute; top: 0; left: 0; }
        .card-scroll-area { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; -webkit-overflow-scrolling: touch; }

        /* Card States */
        .pax-card.next { z-index: 5; transform: scale(0.94) translateY(15px); opacity: 0.6; filter: brightness(0.7); }
        .pax-card.next-2 { z-index: 4; transform: scale(0.88) translateY(30px); opacity: 0.3; filter: brightness(0.5); }
        .swiped-right { transform: translateX(150%) rotate(15deg) !important; opacity: 0; }
        .swiped-left { transform: translateX(-150%) rotate(-15deg) !important; opacity: 0; }
        .swiped-down { transform: translateY(150%) !important; opacity: 0; }
        .tilt-left { transform: rotate(-5deg) translateX(-15px) !important; }
        .tilt-right { transform: rotate(5deg) translateX(15px) !important; }

        /* Match Gauge */
        .match-gauge circle { transition: stroke-dashoffset 1s ease-out; }
        
        /* Flagged Badge */
        .flagged-badge {
            position: absolute; top: 10px; right: 10px;
            background: #ef4444; color: white;
            padding: 4px 8px; border-radius: 6px;
            font-size: 10px; font-weight: bold;
            display: flex; align-items: center; gap: 4px;
            animation: bounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            z-index: 50; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
        }
        @keyframes bounceIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

        /* --- 6. COMPONENTS: MODALS & OVERLAYS --- */
        .source-overlay { 
            position: absolute; inset: 0; background: #f8fafc; color: #0f172a; 
            z-index: 60; transform: translateY(100%); 
            transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1); 
            padding: 0; display: flex; flex-direction: column; 
        }
        .source-overlay.active { transform: translateY(0); }
        
        .modal-overlay { 
            position: absolute; inset: 0; 
            background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); 
            z-index: 70; 
            display: flex; align-items: center; justify-content: center; 
            opacity: 0; pointer-events: none; transition: opacity 0.2s; 
        }
        .modal-overlay.active { opacity: 1; pointer-events: all; }
        
        .modal-content { 
            background: #1e293b; width: 88%; border-radius: 24px; padding: 24px; 
            border: 1px solid #334155; box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
        }

        .preview-box { 
            background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 16px; 
            font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #e2e8f0; 
            margin-bottom: 20px; white-space: pre-wrap; 
            box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); 
            position: relative; outline: none; transition: all 0.2s; 
        }
        .preview-box:focus { border-color: #3b82f6; background: #1e293b; }
        .preview-box.fade-in-text { animation: fadeInText 0.3s ease-out; }
        @keyframes fadeInText { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

        .tone-btn.active { background-color: #2563eb; color: white; border-color: #3b82f6; box-shadow: 0 0 10px rgba(37, 99, 235, 0.3); }

        .slot-btn { 
            background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 12px; 
            display: flex; justify-content: space-between; items-center; width: 100%; transition: all 0.2s; 
        }
        .slot-btn:hover { background: #1e293b; }
        .slot-btn.conflict { border-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
        .slot-btn.free { border-color: #10b981; background: rgba(16, 185, 129, 0.1); }

        /* --- 7. COMPONENTS: CONSOLE (KERNEL) --- */
        .console-panel {
            width: 340px; height: 700px; max-height: 90vh;
            background: rgba(10, 15, 30, 0.95); backdrop-filter: blur(12px);
            border: 1px solid #334155; border-radius: 16px;
            font-family: 'JetBrains Mono', monospace;
            padding: 20px;
            display: flex; flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 10; opacity: 1 !important; visibility: visible !important;
        }

        .console-header { font-size: 10px; text-transform: uppercase; color: #64748b; margin-bottom: 15px; border-bottom: 1px solid #333; padding-bottom: 10px; display: flex; justify-content: space-between; letter-spacing: 1px; }
        .console-logs { flex-grow: 1; overflow-y: auto; font-size: 11px; display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; padding-top: 10px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
        
        .log-entry { opacity: 0; animation: slideInLeft 0.2s forwards; display: flex; gap: 8px; align-items: flex-start; }
        .log-timestamp { color: #475569; min-width: 55px; flex-shrink: 0; }
        .log-content { color: #94a3b8; word-break: break-word; }
        .log-highlight { color: #38bdf8; font-weight: 600; }
        .log-success { color: #4ade80; }
        .log-warn { color: #fbbf24; }
        .log-error { color: #f87171; }
        .log-separator { border-top: 1px dashed #475569; margin: 12px 0; opacity: 0.5; width: 100%; }

        /* --- 8. MOBILE ADAPTATIONS --- */
        @media (max-width: 768px) {
            body { background-image: none; background-color: #020617; }
            .demo-layout { padding: 0; gap: 0; width: 100%; height: 100dvh; display: block; }
            .mobile-container { width: 100%; height: 100dvh; border-radius: 0; border: none; box-shadow: none; z-index: 20; }
            
            .console-panel {
                position: fixed; bottom: 0; left: 0; width: 100%; height: 70dvh;
                border-radius: 24px 24px 0 0; background: rgba(10, 10, 15, 0.98); backdrop-filter: blur(20px);
                border: none; border-top: 1px solid #334155; transform: translateY(100%);
                padding-top: 15px; padding-bottom: env(safe-area-inset-bottom, 20px);
                box-shadow: 0 -10px 40px rgba(0,0,0,0.8); z-index: 50;
            }
            .console-panel.open { transform: translateY(0); }
            .console-handle { width: 40px; height: 4px; background: #475569; border-radius: 2px; margin: 0 auto 15px auto; flex-shrink: 0; }
        }
        @media (min-width: 769px) {
            .console-handle { display: none; }
            .mobile-bottom-hint { display: none; }
        }


/* --- File protocol overlay (when opened via file://) --- */
.file-protocol-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
}
.file-protocol-overlay.hidden { display: none; }

.file-protocol-card{
  width: min(520px, 92vw);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(30,41,59,0.92) 0%, rgba(15,23,42,0.92) 100%);
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  padding: 20px;
  color: #e2e8f0;
}
.file-protocol-title{ font-weight: 800; font-size: 16px; margin-bottom: 10px; letter-spacing: -0.01em; }
.file-protocol-text{ color: rgba(226,232,240,0.8); font-size: 12px; line-height: 1.4; margin-bottom: 14px; }
.file-protocol-steps{ display:flex; flex-direction:column; gap:10px; margin: 12px 0 16px; }
.file-protocol-steps .step{ display:flex; gap:10px; align-items:flex-start; color: rgba(226,232,240,0.85); font-size: 12px; }
.file-protocol-steps .step-n{ width: 18px; height: 18px; border-radius: 8px; display:flex; align-items:center; justify-content:center;
  background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color:#93c5fd; font-weight: 800; font-size: 11px; flex-shrink:0; margin-top: 1px;}
.file-protocol-actions{ display:flex; gap:10px; }
.file-protocol-actions .btn-copy, .file-protocol-actions .btn-open{
  flex:1;
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.file-protocol-actions .btn-copy{
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.22);
  color: #e2e8f0;
}
.file-protocol-actions .btn-open{
  background: rgba(16,185,129,0.9);
  border: 1px solid rgba(16,185,129,0.4);
  color: #04130e;
  text-align:center;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration: none;
}
.file-protocol-foot{ margin-top: 12px; font-size: 10px; color: rgba(148,163,184,0.7); }
.mono{ font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }
