:root {
    --bg-light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --accent-cyan: #0891b2;
    --accent-purple: #7c3aed;
    --accent-pink: #db2777;
    --text-main: #000000;
    --text-muted: #475569;
    --glass-border: rgba(0, 0, 0, 0.08);
    --soft-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

@keyframes animate-grid {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    height: 100vh; width: 100vw; overflow: hidden; display: flex;
}

/* Background Layers */
.app-bg-layers { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.bg-grid {
    position: absolute; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 50px 50px; mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
    animation: animate-grid 25s linear infinite;
}
.bg-aurora {
    position: absolute; top: -20%; left: -20%; width: 140%; height: 140%;
    background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 70% 80%, rgba(8, 145, 178, 0.04) 0%, transparent 40%);
}

/* Sidebar */
.sidebar {
    width: 280px; flex-shrink: 0; background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(50px); border-right: 1px solid var(--glass-border); padding: 3rem 1.5rem; display: flex; flex-direction: column;
}
.logo-box { display: flex; flex-direction: column; align-items: center; margin-bottom: 3.5rem; width: 100%; }
.logo-box img { max-width: 140px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1)); }
.logo-subtitle { font-size: 0.6rem; letter-spacing: 5px; color: var(--text-muted); font-weight: 800; text-transform: uppercase; margin-top: 15px; margin-right: -5px; text-align: center; }

.nav-link {
    display: flex; align-items: center; gap: 14px; padding: 14px 20px; text-decoration: none;
    color: var(--text-muted); border-radius: 16px; margin-bottom: 8px; transition: 0.3s; font-weight: 600; font-size: 0.9rem;
}
.nav-link:hover { background: rgba(0, 0, 0, 0.02); color: var(--text-main); }
.nav-link.active { background: rgba(124, 58, 237, 0.08); color: var(--accent-purple); box-shadow: 0 4px 15px rgba(124, 58, 237, 0.05); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.viewport { flex: 1; padding: 3.5rem; overflow-y: auto; }
.h1-title { font-size: 3rem; font-weight: 800; margin-bottom: 2.5rem; color: #000; letter-spacing: -2px; }

/* Cards & Bento */
.card {
    background: var(--card-bg); backdrop-filter: blur(30px); border: 1px solid var(--glass-border);
    border-radius: 32px; padding: 2.5rem; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--soft-shadow);
}
.span-12 { grid-column: span 12; }

/* NEWS FEED */
.news-feed-list { display: flex; flex-direction: column; gap: 20px; }
.news-item { padding: 30px; border-radius: 28px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--glass-border); cursor: pointer; transition: 0.3s; }
.news-item:hover { background: #fff; border-color: var(--accent-purple); transform: scale(1.01); box-shadow: 0 15px 40px rgba(0,0,0,0.03); }
.news-author { font-weight: 900; color: #000; font-size: 1.5rem; display: block; margin-bottom: 15px; letter-spacing: -0.5px; }
.news-body { line-height: 1.7; color: #334155; font-weight: 400; font-size: 1rem; }

/* --- GAUSS REDESIGN --- */
.gauss-cluster { display: flex; justify-content: center; gap: 30px; margin-bottom: 40px; }
.node-val { width: 80px; height: 80px; background: #fff; border: 1px solid var(--glass-border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0.5; transition: 0.5s; }
.node-val.active { opacity: 1; border-color: var(--accent-purple); box-shadow: 0 5px 20px rgba(124, 58, 237, 0.1); color: var(--accent-purple); }
.node-val span { font-size: 0.6rem; font-weight: 800; margin-top: 5px; color: var(--text-muted); }

.engine-morph-container { position: relative; height: 100px; display: flex; align-items: center; justify-content: center; margin-bottom: 40px; }
.engine-core-box { 
    width: 140px; height: 60px; background: #000; color: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; 
    font-weight: 900; font-family: 'JetBrains Mono'; letter-spacing: 2px; z-index: 5; transition: 0.8s cubic-bezier(0.17, 0.67, 0.3, 1.3);
}
.engine-core-box.swapped { background: var(--accent-purple); transform: scale(1.1); box-shadow: 0 0 30px rgba(124, 58, 237, 0.4); }

/* --- REX PIPELINE --- */
.rex-pipeline { display: flex; align-items: center; justify-content: center; gap: 50px; min-height: 200px; }
.rex-entry, .rex-output { width: 120px; height: 100px; background: #fff; border: 1px solid var(--glass-border); border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.rex-entry.active, .rex-output.active { border-color: var(--accent-purple); color: var(--accent-purple); }
.rex-entry span, .rex-output span { font-size: 0.65rem; font-weight: 800; margin-top: 8px; }

.rex-enclave { 
    width: 180px; height: 180px; border: 2px dashed var(--glass-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative;
}
.rex-enclave.active { border-color: var(--accent-purple); animation: spin 4s linear infinite; }
.enclave-inner { 
    width: 110px; height: 110px; background: #000; color: #fff; border-radius: 20px; display: flex; align-items: center; justify-content: center; 
    font-size: 0.65rem; font-weight: 900; text-align: center; padding: 10px; transition: 0.5s;
}
.rex-enclave.active .enclave-inner { box-shadow: 0 0 40px var(--accent-purple); animation: spinRev 4s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spinRev { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

/* --- DKG QUORUM --- */
.quorum-circle { position: relative; width: 300px; height: 300px; margin: 0 auto; }
.q-node { 
    position: absolute; width: 50px; height: 50px; background: #fff; border: 1px solid var(--glass-border); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; transform: translate(-50%, -50%); transition: 0.5s;
}
.q-node.active { border-color: var(--accent-purple); background: rgba(124, 58, 237, 0.05); color: var(--accent-purple); box-shadow: 0 0 15px var(--accent-purple); }
.q-center { 
    position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; background: #f1f5f9; border-radius: 50%; 
    transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; color: #cbd5e1; transition: 0.8s;
}
.q-center.solid { background: #000; color: var(--accent-purple); box-shadow: 0 0 40px rgba(124, 58, 237, 0.3); transform: translate(-50%, -50%) scale(1.2); }

/* --- RWA FLOW --- */
.rwa-verification-flow { display: flex; align-items: center; justify-content: center; gap: 40px; }
.rwa-source, .rwa-attestation { width: 180px; height: 120px; background: #fff; border: 1px solid var(--glass-border); border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.rwa-source span, .rwa-attestation span { font-size: 0.7rem; font-weight: 800; margin-top: 10px; }
.rwa-source.active, .rwa-attestation.active { border-color: var(--accent-purple); color: var(--accent-purple); box-shadow: 0 5px 20px rgba(124, 58, 237, 0.1); }
.rwa-bridge { flex: 1; height: 2px; background: var(--glass-border); position: relative; max-width: 100px; }
.rwa-pulse-check { position: absolute; top: -4px; left: 0%; width: 10px; height: 10px; background: var(--accent-purple); border-radius: 50%; display: none; }
@keyframes rwaPulseAnim { from { left: 0%; } to { left: 100%; } }

/* --- ZK PRIVACY --- */
.zk-transaction-card { background: #fff; border: 1px solid var(--glass-border); border-radius: 20px; padding: 25px; transition: 0.8s; }
.zk-transaction-card.shielded { filter: blur(6px); opacity: 0.5; transform: scale(0.98); border-color: var(--accent-purple); }
.status-box { background: #f1f5f9; padding: 15px; border-radius: 12px; font-weight: 800; font-size: 0.75rem; color: var(--accent-purple); text-align: center; margin-bottom: 15px; }
.zk-progress-bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 10px; overflow: hidden; }
#zk-p-fill { width: 0%; height: 100%; background: var(--accent-purple); transition: width 0.3s; }
.proof-box { margin-top: 30px; background: rgba(124, 58, 237, 0.05); border: 2px dashed var(--accent-purple); border-radius: 20px; padding: 25px; animation: slideUp 0.6s ease; }

/* --- REACTIVE LOGIC --- */
.reactive-node { width: 220px; height: 180px; background: #fff; border: 1px solid var(--glass-border); border-radius: 24px; padding: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; transition: 0.5s; position: relative; }
.node-label { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); position: absolute; top: 15px; letter-spacing: 1px; }
.price-display { font-family: 'JetBrains Mono'; font-size: 2.2rem; font-weight: 800; color: #000; margin: 10px 0; }
.trend-down { color: #ef4444; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.circuit-container { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 0 40px; }
.circuit-line { width: 4px; height: 120px; background: #e2e8f0; border-radius: 100px; position: relative; }
.data-pulse { position: absolute; top: 0; left: 0; width: 100%; height: 20px; background: var(--accent-purple); border-radius: 100px; box-shadow: 0 0 15px var(--accent-purple); animation: flowPulse 2s linear infinite; display: none; }
@keyframes flowPulse { from { top: 0%; } to { top: 100%; } }
.trigger-gate { padding: 15px 25px; border-radius: 16px; border: 2px solid var(--glass-border); background: #f8fafc; text-align: center; transition: 0.5s; }
.trigger-gate.active { border-color: var(--accent-purple); background: rgba(124, 58, 237, 0.05); transform: scale(1.1); box-shadow: 0 0 30px rgba(124, 58, 237, 0.2); }
.vault-icon { font-size: 2.5rem; color: #cbd5e1; transition: 0.5s; }
.executor-node.active .vault-icon { color: var(--accent-purple); transform: scale(1.2); }

/* --- IDENTITY BRIDGE --- */
.id-source-item { display: flex; align-items: center; gap: 15px; padding: 18px 20px; border: 1px solid var(--glass-border); border-radius: 16px; margin-bottom: 12px; cursor: pointer; transition: 0.3s; background: #fff; }
.id-source-item.active { border-color: var(--accent-purple); background: rgba(124, 58, 237, 0.04); }
.bridge-core { width: 340px; height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.bridge-spinner { width: 60px; height: 60px; border: 3px solid var(--glass-border); border-top-color: var(--accent-purple); border-radius: 50%; animation: spin 1s linear infinite; display: none; }
.rialo-passport { width: 320px; height: 200px; background: #1a1a1a; border-radius: 20px; position: relative; padding: 25px; box-shadow: 0 30px 60px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); overflow: hidden; animation: cardFloat 4s ease-in-out infinite; }
@keyframes cardFloat { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
.passport-glow { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.2) 0%, transparent 50%); pointer-events: none; }
.passport-chip { width: 45px; height: 35px; background: linear-gradient(135deg, #d4af37 0%, #f9e29c 50%, #d4af37 100%); border-radius: 6px; }
.passport-content { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; }

/* --- ASYNC FLOW --- */
.flow-container { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 200px; }
.flow-node { width: 90px; height: 90px; background: #fff; border: 2px solid var(--glass-border); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.75rem; color: #000; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: 0.5s; }
.flow-node.active { border-color: var(--accent-purple); background: rgba(124, 58, 237, 0.05); color: var(--accent-purple); box-shadow: 0 0 35px rgba(124, 58, 237, 0.2); }
.flow-arrow { flex: 1; height: 2px; background: var(--glass-border); position: relative; max-width: 80px; }
.flow-arrow .progress { position: absolute; top: 0; left: 0; height: 100%; width: 0%; background: var(--accent-purple); transition: width 1s linear; }

/* --- MAP --- */
.map-container { position: relative; width: 100%; height: 420px; background: #f1f5f9; border-radius: 28px; overflow: hidden; border: 1px solid var(--glass-border); }
.svg-map { width: 100%; height: 100%; opacity: 0.4; background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ec/World_map_blank_without_borders.svg'); background-size: contain; background-repeat: no-repeat; background-position: center; }
.map-ping { position: absolute; width: 10px; height: 10px; background: var(--accent-purple); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 15px var(--accent-purple); z-index: 5; }

/* --- CREDIT ORCHESTRATION --- */
#credit-signals { display: flex; flex-direction: column; gap: 15px; }
.signal-item { 
    padding: 15px 25px; background: #fff; border: 1px solid var(--glass-border); border-radius: 12px; 
    font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; gap: 12px; transition: 0.5s;
}
.signal-item.active { border-color: var(--accent-purple); color: var(--accent-purple); transform: translateX(10px); box-shadow: 0 5px 20px rgba(124, 58, 237, 0.1); }

.credit-engine-core { 
    width: 220px; height: 220px; border: 4px solid var(--glass-border); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; position: relative;
}
.credit-engine-core::after { 
    content: ""; position: absolute; width: 100%; height: 100%; border-radius: 50%; 
    border: 4px solid transparent; border-top-color: var(--accent-purple);
}
.credit-engine-core.active::after { animation: spin 2s linear infinite; }
.engine-display { text-align: center; }

.vintage-box { 
    width: 100px; height: 140px; background: #f8fafc; border: 2px dashed var(--glass-border); 
    border-radius: 16px; display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: 0.6rem; font-weight: 800; color: var(--text-muted); transition: 0.8s;
}
.vintage-box.tokenized { 
    background: #000; color: var(--accent-purple); border: 1px solid var(--accent-purple);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3); transform: translateY(-10px);
}

/* Finalizing Utilities */
.action-btn { background: #000; color: #fff; border: none; padding: 16px 40px; border-radius: 100px; font-weight: 700; cursor: pointer; transition: 0.3s; }
.action-btn:hover { transform: scale(1.05); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.terminal-panel { background: #fff; border-top: 1px solid var(--glass-border); padding: 2.5rem; height: 200px; overflow-y: auto; font-family: 'JetBrains Mono'; }
.log-entry { margin-bottom: 10px; font-size: 0.9rem; color: #000; }
.log-entry .tag { background: #f1f5f9; color: #7c3aed; padding: 3px 10px; border-radius: 8px; margin: 0 15px; font-weight: 800; font-size: 0.75rem; }
.indicator { display: inline-block; padding: 6px 18px; background: rgba(124, 58, 237, 0.08); color: #7c3aed; border-radius: 100px; font-size: 0.75rem; font-weight: 800; margin-bottom: 20px; }
